Whitespace only (indentation fixes/cleanup).

This commit is contained in:
J.D. Purcell 2017-04-19 20:34:30 -04:00
parent 3f866f6d7f
commit 3d6b1da94d
13 changed files with 113 additions and 114 deletions

View File

@ -26,7 +26,7 @@ namespace BizHawk.Client.EmuHawk
/// <summary> /// <summary>
/// Quantize using an Octree /// Quantize using an Octree
/// </summary> /// </summary>
unsafe class OctreeQuantizer : Quantizer unsafe class OctreeQuantizer : Quantizer
{ {
/// <summary> /// <summary>
/// Stores the tree /// Stores the tree
@ -48,7 +48,7 @@ namespace BizHawk.Client.EmuHawk
/// <param name="maxColors">The maximum number of colors to return</param> /// <param name="maxColors">The maximum number of colors to return</param>
/// <param name="maxColorBits">The number of significant bits</param> /// <param name="maxColorBits">The number of significant bits</param>
public OctreeQuantizer(int maxColors, int maxColorBits) public OctreeQuantizer(int maxColors, int maxColorBits)
: base(false) : base(false)
{ {
if (maxColors > 255) if (maxColors > 255)
throw new ArgumentOutOfRangeException(nameof(maxColors), maxColors, "The number of colors should be less than 256"); throw new ArgumentOutOfRangeException(nameof(maxColors), maxColors, "The number of colors should be less than 256");
@ -78,12 +78,12 @@ namespace BizHawk.Client.EmuHawk
/// </summary> /// </summary>
/// <param name="pixel">The pixel to quantize</param> /// <param name="pixel">The pixel to quantize</param>
/// <returns>The quantized value</returns> /// <returns>The quantized value</returns>
protected override byte QuantizePixel(int pixel) protected override byte QuantizePixel(int pixel)
{ {
byte paletteIndex = (byte)_maxColors; // The color at [_maxColors] is set to transparent byte paletteIndex = (byte)_maxColors; // The color at [_maxColors] is set to transparent
// Get the palette index if this non-transparent // Get the palette index if this non-transparent
int a = (pixel>>24)&0xFF; int a = (pixel>>24)&0xFF;
#if HANDLE_TRANSPARENCY #if HANDLE_TRANSPARENCY
if (a > 0) if (a > 0)
@ -92,7 +92,7 @@ namespace BizHawk.Client.EmuHawk
paletteIndex = (byte)_octree.GetPaletteIndex(pixel); paletteIndex = (byte)_octree.GetPaletteIndex(pixel);
} }
return paletteIndex; return paletteIndex;
} }
/// <summary> /// <summary>
@ -100,7 +100,7 @@ namespace BizHawk.Client.EmuHawk
/// </summary> /// </summary>
/// <param name="original">Any old palette, this is overrwritten</param> /// <param name="original">Any old palette, this is overrwritten</param>
/// <returns>The new color palette</returns> /// <returns>The new color palette</returns>
protected override ColorPalette GetPalette(ColorPalette original) protected override ColorPalette GetPalette(ColorPalette original)
{ {
// First off convert the octree to _maxColors colors // First off convert the octree to _maxColors colors
List<Color> palette = _octree.Palletize(_maxColors - 1); List<Color> palette = _octree.Palletize(_maxColors - 1);
@ -170,7 +170,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
_previousColor = pixel; _previousColor = pixel;
_root.AddColor(pixel, _maxColorBits, 0, this); _root.AddColor(pixel, _maxColorBits, 0, this);
} }
} }
@ -282,7 +282,7 @@ namespace BizHawk.Client.EmuHawk
this.paletteTable = new PaletteTable(this._palette); this.paletteTable = new PaletteTable(this._palette);
} }
ret = this.paletteTable.FindClosestPaletteIndex(Color.FromArgb(pixel)); ret = this.paletteTable.FindClosestPaletteIndex(Color.FromArgb(pixel));
} }
return ret; return ret;
@ -381,9 +381,9 @@ namespace BizHawk.Client.EmuHawk
{ {
// Go to the next level down in the tree // Go to the next level down in the tree
int shift = 7 - level; int shift = 7 - level;
int b = pixel & 0xFF; int b = pixel & 0xFF;
int g = (pixel >> 8) & 0xFF; int g = (pixel >> 8) & 0xFF;
int r = (pixel >> 16) & 0xFF; int r = (pixel >> 16) & 0xFF;
int index = ((r & mask[level]) >> (shift - 2)) | int index = ((r & mask[level]) >> (shift - 2)) |
((g & mask[level]) >> (shift - 1)) | ((g & mask[level]) >> (shift - 1)) |
((b & mask[level]) >> (shift)); ((b & mask[level]) >> (shift));
@ -504,9 +504,9 @@ namespace BizHawk.Client.EmuHawk
if (!_leaf) if (!_leaf)
{ {
int shift = 7 - level; int shift = 7 - level;
int b = pixel & 0xFF; int b = pixel & 0xFF;
int g = (pixel >> 8) & 0xFF; int g = (pixel >> 8) & 0xFF;
int r = (pixel >> 16) & 0xFF; int r = (pixel >> 16) & 0xFF;
int index = ((r & mask[level]) >> (shift - 2)) | int index = ((r & mask[level]) >> (shift - 2)) |
((g & mask[level]) >> (shift - 1)) | ((g & mask[level]) >> (shift - 1)) |
((b & mask[level]) >> (shift)); ((b & mask[level]) >> (shift));
@ -530,12 +530,12 @@ namespace BizHawk.Client.EmuHawk
public void Increment(int pixel) public void Increment(int pixel)
{ {
++_pixelCount; ++_pixelCount;
int b = pixel&0xFF; int b = pixel&0xFF;
int g = (pixel>>8) & 0xFF; int g = (pixel>>8) & 0xFF;
int r = (pixel >> 16) & 0xFF; int r = (pixel >> 16) & 0xFF;
_red += r; _red += r;
_green += g; _green += g;
_blue += b; _blue += b;
} }
/// <summary> /// <summary>

View File

@ -183,12 +183,12 @@ namespace BizHawk.Client.EmuHawk
} }
} }
int ClampToByte(int val) int ClampToByte(int val)
{ {
if (val < 0) return 0; if (val < 0) return 0;
else if (val > 255) return 255; else if (val > 255) return 255;
else return val; else return val;
} }
/// <summary> /// <summary>
/// Execute a second pass through the bitmap /// Execute a second pass through the bitmap
@ -249,26 +249,26 @@ namespace BizHawk.Client.EmuHawk
// Quantize the pixel // Quantize the pixel
int srcPixel = *pSourcePixel; int srcPixel = *pSourcePixel;
int srcR = srcPixel & 0xFF; //not int srcR = srcPixel & 0xFF; //not
int srcG = (srcPixel>>8) & 0xFF; //a int srcG = (srcPixel>>8) & 0xFF; //a
int srcB = (srcPixel>>16) & 0xFF; //mistake int srcB = (srcPixel>>16) & 0xFF; //mistake
int srcA = (srcPixel >> 24) & 0xFF; int srcA = (srcPixel >> 24) & 0xFF;
int targetB = ClampToByte(srcB - ((errorThisRowB[col] * weight) / 8)); int targetB = ClampToByte(srcB - ((errorThisRowB[col] * weight) / 8));
int targetG = ClampToByte(srcG - ((errorThisRowG[col] * weight) / 8)); int targetG = ClampToByte(srcG - ((errorThisRowG[col] * weight) / 8));
int targetR = ClampToByte(srcR - ((errorThisRowR[col] * weight) / 8)); int targetR = ClampToByte(srcR - ((errorThisRowR[col] * weight) / 8));
int targetA = srcA; int targetA = srcA;
int target = (targetA<<24)|(targetB<<16)|(targetG<<8)|targetR; int target = (targetA<<24)|(targetB<<16)|(targetG<<8)|targetR;
byte pixelValue = QuantizePixel(target); byte pixelValue = QuantizePixel(target);
*pDestinationPixel = pixelValue; *pDestinationPixel = pixelValue;
int actual = pallete[pixelValue].ToArgb(); int actual = pallete[pixelValue].ToArgb();
int actualR = actual & 0xFF; int actualR = actual & 0xFF;
int actualG = (actual >> 8) & 0xFF; int actualG = (actual >> 8) & 0xFF;
int actualB = (actual >> 16) & 0xFF; int actualB = (actual >> 16) & 0xFF;
int errorR = actualR - targetR; int errorR = actualR - targetR;
int errorG = actualG - targetG; int errorG = actualG - targetG;
int errorB = actualB - targetB; int errorB = actualB - targetB;

View File

@ -473,9 +473,9 @@ namespace BizHawk.Common
case 'f': // double case 'f': // double
o = GetDouble(n, fetcher()); o = GetDouble(n, fetcher());
w = FormatNumber( ( flagGroupThousands ? "n" : "f" ), flagAlternate, w = FormatNumber( ( flagGroupThousands ? "n" : "f" ), flagAlternate,
fieldLength, fieldPrecision, flagLeft2Right, fieldLength, fieldPrecision, flagLeft2Right,
flagPositiveSign, flagPositiveSpace, flagPositiveSign, flagPositiveSpace,
paddingCharacter, o ); paddingCharacter, o );
defaultParamIx++; defaultParamIx++;
break; break;
#endregion #endregion
@ -483,9 +483,9 @@ namespace BizHawk.Common
case 'e': // double / exponent case 'e': // double / exponent
o = GetDouble(n, fetcher()); o = GetDouble(n, fetcher());
w = FormatNumber( "e", flagAlternate, w = FormatNumber( "e", flagAlternate,
fieldLength, fieldPrecision, flagLeft2Right, fieldLength, fieldPrecision, flagLeft2Right,
flagPositiveSign, flagPositiveSpace, flagPositiveSign, flagPositiveSpace,
paddingCharacter, o ); paddingCharacter, o );
defaultParamIx++; defaultParamIx++;
break; break;
#endregion #endregion

View File

@ -136,8 +136,7 @@ namespace BizHawk.Common
int IsDirty(); int IsDirty();
[PreserveSig] [PreserveSig]
void Load([In, MarshalAs(UnmanagedType.LPWStr)] void Load([In, MarshalAs(UnmanagedType.LPWStr)]string pszFileName, uint dwMode);
string pszFileName, uint dwMode);
[PreserveSig] [PreserveSig]
void Save([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName, void Save([In, MarshalAs(UnmanagedType.LPWStr)] string pszFileName,

View File

@ -98,7 +98,7 @@ namespace BizHawk.Emulation.Common
private readonly object[] _tmp1 = new object[1]; private readonly object[] _tmp1 = new object[1];
private readonly object[] _tmp0 = new object[0]; private readonly object[] _tmp0 = new object[0];
private readonly MethodInfo _gets; private readonly MethodInfo _gets;
private readonly MethodInfo _puts; private readonly MethodInfo _puts;
private readonly MethodInfo _getss; private readonly MethodInfo _getss;
private readonly MethodInfo _putss; private readonly MethodInfo _putss;

View File

@ -9,61 +9,61 @@ namespace BizHawk.Emulation.Cores.Components.H6280
{ {
public partial class HuC6280 public partial class HuC6280
{ {
public void DisassembleCDL(Stream s, ICodeDataLog cdl, IMemoryDomains mem) public void DisassembleCDL(Stream s, ICodeDataLog cdl, IMemoryDomains mem)
{ {
var w = new StreamWriter(s); var w = new StreamWriter(s);
w.WriteLine("; Bizhawk CDL Disassembly"); w.WriteLine("; Bizhawk CDL Disassembly");
w.WriteLine(); w.WriteLine();
foreach (var kvp in cdl) foreach (var kvp in cdl)
{ {
w.WriteLine(".\"{0}\" size=0x{1:x8}", kvp.Key, kvp.Value.Length); w.WriteLine(".\"{0}\" size=0x{1:x8}", kvp.Key, kvp.Value.Length);
byte[] cd = kvp.Value; byte[] cd = kvp.Value;
var md = mem[kvp.Key]; var md = mem[kvp.Key];
for (int i = 0; i < kvp.Value.Length; i++) for (int i = 0; i < kvp.Value.Length; i++)
{ {
if ((kvp.Value[i] & (byte)HuC6280.CDLUsage.Code) != 0) if ((kvp.Value[i] & (byte)HuC6280.CDLUsage.Code) != 0)
{ {
int unused; int unused;
string dis = HuC6280.DisassembleExt( string dis = HuC6280.DisassembleExt(
0, 0,
out unused, out unused,
delegate(ushort addr) delegate(ushort addr)
{ {
return md.PeekByte(addr + i); return md.PeekByte(addr + i);
}, },
delegate(ushort addr) delegate(ushort addr)
{ {
return md.PeekUshort(addr + i, false); return md.PeekUshort(addr + i, false);
} }
); );
w.WriteLine("0x{0:x8}: {1}", i, dis); w.WriteLine("0x{0:x8}: {1}", i, dis);
} }
} }
w.WriteLine(); w.WriteLine();
} }
w.WriteLine("; EOF"); w.WriteLine("; EOF");
w.Flush(); w.Flush();
} }
private static Dictionary<string, int> SizesFromHuMap(IEnumerable<HuC6280.MemMapping> mm) private static Dictionary<string, int> SizesFromHuMap(IEnumerable<HuC6280.MemMapping> mm)
{ {
Dictionary<string, int> sizes = new Dictionary<string, int>(); Dictionary<string, int> sizes = new Dictionary<string, int>();
foreach (var m in mm) foreach (var m in mm)
{ {
if (!sizes.ContainsKey(m.Name) || m.MaxOffs >= sizes[m.Name]) if (!sizes.ContainsKey(m.Name) || m.MaxOffs >= sizes[m.Name])
sizes[m.Name] = m.MaxOffs; sizes[m.Name] = m.MaxOffs;
} }
List<string> keys = new List<string>(sizes.Keys); List<string> keys = new List<string>(sizes.Keys);
foreach (var key in keys) foreach (var key in keys)
{ {
// becase we were looking at offsets, and each bank is 8192 big, we need to add that size // becase we were looking at offsets, and each bank is 8192 big, we need to add that size
sizes[key] += 8192; sizes[key] += 8192;
} }
return sizes; return sizes;
} }
} }
public partial class HuC6280 public partial class HuC6280

View File

@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition; public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
public IController Controller { get; set; } public IController Controller { get; set; }
public void FrameAdvance(bool render, bool rendersound) public void FrameAdvance(bool render, bool rendersound)
{ {

View File

@ -31,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
public LibsnesCore(GameInfo game, byte[] romData, bool deterministicEmulation, byte[] xmlData, CoreComm comm, object Settings, object SyncSettings) public LibsnesCore(GameInfo game, byte[] romData, bool deterministicEmulation, byte[] xmlData, CoreComm comm, object Settings, object SyncSettings)
{ {
var ser = new BasicServiceProvider(this); var ser = new BasicServiceProvider(this);
ServiceProvider = ser; ServiceProvider = ser;
_tracer = new TraceBuffer _tracer = new TraceBuffer
{ {

View File

@ -280,11 +280,11 @@ namespace GarboDev
this.arm7.Execute(cycleStep); this.arm7.Execute(cycleStep);
#if ARM_DEBUG #if ARM_DEBUG
if (this.arm7.BreakpointHit) if (this.arm7.BreakpointHit)
{ {
this.waitingToHalt = true; this.waitingToHalt = true;
Monitor.Wait(this); Monitor.Wait(this);
} }
#endif #endif
vramCycles -= cycleStep; vramCycles -= cycleStep;
this.arm7.FireIrq(); this.arm7.FireIrq();

View File

@ -99,7 +99,7 @@
public const uint HALTCNT = 0x300; public const uint HALTCNT = 0x300;
private const uint biosRamMask = 0x3FFF; private const uint biosRamMask = 0x3FFF;
private const uint ewRamMask = 0x3FFFF; private const uint ewRamMask = 0x3FFFF;
private const uint iwRamMask = 0x7FFF; private const uint iwRamMask = 0x7FFF;
private const uint ioRegMask = 0x4FF; private const uint ioRegMask = 0x4FF;

View File

@ -65,7 +65,7 @@
//Array.Copy(this.back, this.front, this.front.Length); //Array.Copy(this.back, this.front, this.front.Length);
//return this.front; //return this.front;
return this.back; return this.back;
} }
public void RenderLine(int line) public void RenderLine(int line)

View File

@ -104,14 +104,14 @@ namespace GarboDev
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="processor"></param> /// <param name="processor"></param>
/// <returns>true if end of frame</returns> /// <returns>true if end of frame</returns>
public bool LeaveHBlank(Arm7Processor processor) public bool LeaveHBlank(Arm7Processor processor)
{ {
bool ret = false; bool ret = false;
ushort dispstat = Memory.ReadU16(this.memory.IORam, Memory.DISPSTAT); ushort dispstat = Memory.ReadU16(this.memory.IORam, Memory.DISPSTAT);
dispstat &= 0xFFF9; dispstat &= 0xFFF9;
Memory.WriteU16(this.memory.IORam, Memory.DISPSTAT, dispstat); Memory.WriteU16(this.memory.IORam, Memory.DISPSTAT, dispstat);
@ -132,7 +132,7 @@ namespace GarboDev
if (this.curLine == 160) if (this.curLine == 160)
{ {
this.EnterVBlank(processor); this.EnterVBlank(processor);
ret = true; ret = true;
} }
else if (this.curLine == 0) else if (this.curLine == 0)
{ {
@ -150,7 +150,7 @@ namespace GarboDev
processor.RequestIrq(2); processor.RequestIrq(2);
} }
} }
return ret; return ret;
} }
public void RenderLine() public void RenderLine()

View File

@ -227,9 +227,9 @@ namespace BizHawk.Emulation.CPUs.M6502
//handle I flag differently. sort of a sloppy way to do the job, but it does finish it off. //handle I flag differently. sort of a sloppy way to do the job, but it does finish it off.
value8 = ReadMemory((ushort)(++S + 0x100)); value8 = ReadMemory((ushort)(++S + 0x100));
if ((value8 & 0x04) != 0 && !FlagI) if ((value8 & 0x04) != 0 && !FlagI)
SEI_Pending = true; SEI_Pending = true;
if ((value8 & 0x04) == 0 && FlagI) if ((value8 & 0x04) == 0 && FlagI)
CLI_Pending = true; CLI_Pending = true;
value8 &= unchecked((byte)~0x04); value8 &= unchecked((byte)~0x04);
P &= 0x04; P &= 0x04;
P |= value8; P |= value8;