Skip to content

Commit

Permalink
EXTERMINATE SPACES
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiRulz committed May 7, 2021
1 parent 8f7b01b commit 3ea71a2
Show file tree
Hide file tree
Showing 132 changed files with 262 additions and 259 deletions.
5 changes: 3 additions & 2 deletions src/BizHawk.BizInvoke/BizInvoker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,9 @@ private static Action<object, IImportResolver, ICallingConventionAdapter> Implem

il.Emit(OpCodes.Ldarg_0);
il.Emit(OpCodes.Ldfld, field);
il.EmitCalli(OpCodes.Calli,
nativeCall,
il.EmitCalli(
OpCodes.Calli,
nativeCall,
returnType == typeof(bool) ? typeof(byte) : returnType, // undo winapi style bool garbage
paramLoadInfos.Select(p => p.NativeType).ToArray());

Expand Down
17 changes: 12 additions & 5 deletions src/BizHawk.BizInvoke/MemoryBlockWindowsPal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ public static extern UIntPtr VirtualAlloc(UIntPtr lpAddress, UIntPtr dwSize,
AllocationType flAllocationType, MemoryProtection flProtect);

[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool VirtualProtect(UIntPtr lpAddress, UIntPtr dwSize,
MemoryProtection flNewProtect, out MemoryProtection lpflOldProtect);
public static extern bool VirtualProtect(
UIntPtr lpAddress,
UIntPtr dwSize,
MemoryProtection flNewProtect,
out MemoryProtection lpflOldProtect);

[Flags]
public enum AllocationType : uint
Expand Down Expand Up @@ -123,9 +126,13 @@ public enum FileMapProtection : uint
public static extern bool UnmapViewOfFile(IntPtr lpBaseAddress);

[DllImport("kernel32.dll")]
public static extern IntPtr MapViewOfFileEx(IntPtr hFileMappingObject,
FileMapAccessType dwDesiredAccess, uint dwFileOffsetHigh, uint dwFileOffsetLow,
UIntPtr dwNumberOfBytesToMap, IntPtr lpBaseAddress);
public static extern IntPtr MapViewOfFileEx(
IntPtr hFileMappingObject,
FileMapAccessType dwDesiredAccess,
uint dwFileOffsetHigh,
uint dwFileOffsetLow,
UIntPtr dwNumberOfBytesToMap,
IntPtr lpBaseAddress);

[Flags]
public enum FileMapAccessType : uint
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Bizware.BizwareGL/ArtManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private Art LoadArtInternal(BitmapBuffer tex)
/// <summary>
/// Closes this instance for for further resource loading. Will result in a texture atlasing operation.
/// If the close operation is forever, then internal backup copies of resources will be freed, but it can never be reopened.
/// This function may take some time to run, as it is
/// This function may take some time to run, as it is
/// </summary>
public void Close(bool forever = true)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Bizware.BizwareGL/AttribUsage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public enum AttribUsage
{
Unspecified,
Position,
Position,
Color0,
Texcoord0, Texcoord1,
}
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Bizware.BizwareGL/BitmapBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ public void ToSysdrawingBitmap(Bitmap bmp)
return;
}

//note: we lock it as 32bpp even if the bitmap is 24bpp so we can write to it more conveniently.
//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 Rectangle(0, 0, Width, Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);

if(bmpdata.Stride == bmpdata.Width*4)
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Bizware.BizwareGL/BitmapLoadOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class BitmapLoadOptions
public bool TransparentPalette0 = true;

/// <summary>
/// Specifies whether (r,g,b,0) pixels shall be turned into (0,0,0,0).
/// Specifies whether (r,g,b,0) pixels shall be turned into (0,0,0,0).
/// This is useful for cleaning up junk which you might not know you had littering purely transparent areas, which can mess up a lot of stuff during rendering.
/// </summary>
public bool CleanupAlpha0 = true;
Expand Down
11 changes: 5 additions & 6 deletions src/BizHawk.Bizware.BizwareGL/GDIPlusGuiRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@ public void SetModulateColor(sd.Color color)

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[] { 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 },
};

var colorMatrix = new ColorMatrix(colorMatrixElements);
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Bizware.BizwareGL/IGL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace BizHawk.Bizware.BizwareGL
/// This is a wrapper over OpenGL and direct3d to give a uniform interface
/// TODO - This really needs to be split up into an internal and a user interface. so many of the functions are made to support the smart wrappers
/// Maybe make a method that returns an interface used for advanced methods (and IGL_TK could implement that as well and just "return this:")
///
///
/// NOTE: THIS SHOULD NOT BE ASSUMED TO BE THREAD SAFE! Make a new IGL if you want to use it in a new thread. I hope that will work...
/// </summary>
public interface IGL : IDisposable
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Bizware.BizwareGL/TexAtlas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static void AddAtlas(ICollection<(Size, List<RectItem>)> atlases, IReadOnlyColle
private class RectangleBinPack
{
/** A node of a binary tree. Each node represents a rectangular area of the texture
we surface. Internal nodes store rectangles of used data, whereas leaf nodes track
we surface. Internal nodes store rectangles of used data, whereas leaf nodes track
rectangles of free space. All the rectangles stored in the tree are disjoint. */
public class Node
{
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Bizware.DirectX/IGL_SlimDX9.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public Pipeline CreatePipeline(VertexLayout vertexLayout, Shader vertexShader, S
switch(item.Usage)
{
case AttribUsage.Position:
usage = DeclarationUsage.Position;
usage = DeclarationUsage.Position;
break;
case AttribUsage.Texcoord0:
usage = DeclarationUsage.TextureCoordinate;
Expand Down
10 changes: 5 additions & 5 deletions src/BizHawk.Bizware.OpenTK3/GuiRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace BizHawk.Bizware.OpenTK3
{
/// <summary>
/// A simple renderer useful for rendering GUI stuff.
/// A simple renderer useful for rendering GUI stuff.
/// When doing GUI rendering, run everything through here (if you need a GL feature not done through here, run it through here first)
/// Call Begin, then draw, then End, and don't use other Renderers or GL calls in the meantime, unless you know what you're doing.
/// This can perform batching (well.. maybe not yet), which is occasionally necessary for drawing large quantities of things.
Expand Down Expand Up @@ -241,10 +241,10 @@ private unsafe void DrawInternal(Art art, float x, float y, float w, float h, bo
else { v0 = art.v0; v1 = art.v1; }

float[] data = new float[32] {
x,y, u0,v0, CornerColors[0].X, CornerColors[0].Y, CornerColors[0].Z, CornerColors[0].W,
x+art.Width,y, u1,v0, CornerColors[1].X, CornerColors[1].Y, CornerColors[1].Z, CornerColors[1].W,
x,y+art.Height, u0,v1, CornerColors[2].X, CornerColors[2].Y, CornerColors[2].Z, CornerColors[2].W,
x+art.Width,y+art.Height, u1,v1, CornerColors[3].X, CornerColors[3].Y, CornerColors[3].Z, CornerColors[3].W,
x,y, u0,v0, CornerColors[0].X, CornerColors[0].Y, CornerColors[0].Z, CornerColors[0].W,
x+art.Width,y, u1,v0, CornerColors[1].X, CornerColors[1].Y, CornerColors[1].Z, CornerColors[1].W,
x,y+art.Height, u0,v1, CornerColors[2].X, CornerColors[2].Y, CornerColors[2].Z, CornerColors[2].W,
x+art.Width,y+art.Height, u1,v1, CornerColors[3].X, CornerColors[3].Y, CornerColors[3].Z, CornerColors[3].W,
};

Texture2d tex = art.BaseTexture;
Expand Down
10 changes: 5 additions & 5 deletions src/BizHawk.Bizware.OpenTK3/IGL_TK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
namespace BizHawk.Bizware.OpenTK3
{
/// <summary>
/// OpenTK implementation of the BizwareGL.IGL interface.
/// OpenTK implementation of the BizwareGL.IGL interface.
/// TODO - can we have more than one of these? could be dangerous. such dangerous things to be possibly reconsidered are marked with HAMNUTS
/// TODO - if we have any way of making contexts, we also need a way of freeing it, and then we can cleanup our dictionaries
/// </summary>
Expand Down Expand Up @@ -76,7 +76,7 @@ public IGL_TK(int majorVersion, int minorVersion, bool forwardCompatible)
MakeDefaultCurrent();

//this is important for reasons unknown
GraphicsContext.LoadAll();
GraphicsContext.LoadAll();

//misc initialization
CreateRenderStates();
Expand Down Expand Up @@ -395,7 +395,7 @@ public void DrawArrays(BizGL.PrimitiveType mode, int first, int count)

public void SetPipelineUniform(PipelineUniform uniform, bool value)
{
GL.Uniform1((int)uniform.Sole.Opaque, value ? 1 : 0);
GL.Uniform1((int) uniform.Sole.Opaque, value ? 1 : 0);
}

public unsafe void SetPipelineUniformMatrix(PipelineUniform uniform, Matrix4 mat, bool transpose)
Expand Down Expand Up @@ -826,12 +826,12 @@ internal void MakeContextCurrent(IGraphicsContext context, IWindowInfo windowInf
private void CreateRenderStates()
{
_rsBlendNoneVerbatim = new CacheBlendState(
false,
false,
BizGL.BlendingFactorSrc.One, BizGL.BlendEquationMode.FuncAdd, BizGL.BlendingFactorDest.Zero,
BizGL.BlendingFactorSrc.One, BizGL.BlendEquationMode.FuncAdd, BizGL.BlendingFactorDest.Zero);

_rsBlendNoneOpaque = new CacheBlendState(
false,
false,
BizGL.BlendingFactorSrc.One, BizGL.BlendEquationMode.FuncAdd, BizGL.BlendingFactorDest.Zero,
BizGL.BlendingFactorSrc.ConstantAlpha, BizGL.BlendEquationMode.FuncAdd, BizGL.BlendingFactorDest.Zero);

Expand Down
8 changes: 4 additions & 4 deletions src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ public void Set(string button, bool? state = null, int? controller = null)
if (state == null) _inputManager.ButtonOverrideAdapter.UnSet(buttonToSet);
else _inputManager.ButtonOverrideAdapter.SetButton(buttonToSet, state.Value);

//"Overrides" is a gross line of code in that flushes overrides into the current controller.
//That's not really the way it was meant to work which was that it should pull all its values through the filters before ever using them.
//Of course the code that does that is in the main loop and the lua API wouldnt know how to do it.
//I regret the whole hotkey filter chain OOP soup approach. Anyway, the code that
//"Overrides" is a gross line of code in that flushes overrides into the current controller.
//That's not really the way it was meant to work which was that it should pull all its values through the filters before ever using them.
//Of course the code that does that is in the main loop and the lua API wouldnt know how to do it.
//I regret the whole hotkey filter chain OOP soup approach. Anyway, the code that

//in a crude, CRUDE, *CRUDE* approximation of what the main loop does, we need to pull the physical input again before it's freshly overridded
//but really, everything the main loop does needs to be done here again.
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Client.Common/Api/Classes/MemoryApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private void WriteUnsigned(long addr, uint value, int size, string domain = null

public void SetBigEndian(bool enabled = true) => _isBigEndian = enabled;

public List<string> GetMemoryDomainList() =>
public List<string> GetMemoryDomainList() =>
DomainList
.Select(domain => domain.Name)
.ToList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using BizHawk.Bizware.BizwareGL;

// Here's how to make a filter:
// 1. Reset your state entirely in Initialize().
// The filter will be re-initialized several times while the chain is getting worked out, but not re-instantiated.
// 1. Reset your state entirely in Initialize().
// The filter will be re-initialized several times while the chain is getting worked out, but not re-instantiated.
// This is sort of annoying, but there's pretty good reasons for it (some external process has created the filters and set parameters needed to govern their chaining and surface properties)
// 2. In Initialize(), be sure to use DeclareInput
// (something about PresizeInput())
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Client.Common/DisplayManager/Filters/Gui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public LetterboxingLogic(bool maintainAspect, bool maintainInteger, int targetWi
float widthScale = (float)targetWidth / sourceWidth;
float heightScale = (float)targetHeight / sourceHeight;

if (maintainAspect
if (maintainAspect
// zero 20-jul-2014 - hacks upon hacks, this function needs rewriting
&& !maintainInteger
)
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Client.Common/DisplayManager/Filters/Retro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public override void Run()

// apply all parameters to this shader.. even if it was meant for other shaders. kind of lame.
if(Parameters != null)
{
{
foreach (var kvp in Parameters)
{
if (kvp.Value is float value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace BizHawk.Client.Common
{
/// <summary>
/// encapsulates thread-safe concept of pending/current display surfaces, reusing buffers where matching
/// encapsulates thread-safe concept of pending/current display surfaces, reusing buffers where matching
/// sizes are available and keeping them cleaned up when they don't seem like they'll need to be used anymore
/// </summary>
public class SwappableDisplaySurfaceSet<T>
Expand Down
4 changes: 2 additions & 2 deletions src/BizHawk.Client.Common/OpenAdvanced.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ public class OpenAdvanced_LibretroNoGame : IOpenAdvanced, IOpenAdvancedLibretro
// you might think ideally we'd fetch the libretro core name from the core info inside it
// but that would involve spinning up excess libretro core instances, which probably isn't good for stability, no matter how much we wish otherwise, not to mention slow.
// moreover it's kind of complicated here,
// and finally, I think the DisplayName should really be file-based in all cases, since the user is going to be loading cores by filename and
// this is related to the recent roms filename management.
// and finally, I think the DisplayName should really be file-based in all cases, since the user is going to be loading cores by filename and
// this is related to the recent roms filename management.
// so, leave it.
public OpenAdvanced_LibretroNoGame()
{
Expand Down
10 changes: 5 additions & 5 deletions src/BizHawk.Client.Common/RomGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public RomGame(HawkFile file, string patch)
// read the entire contents of the file into memory.
// unfortunate in the case of large files, but that's what we've got to work with for now.

// if we're offset exactly 512 bytes from a 1024-byte boundary,
// if we're offset exactly 512 bytes from a 1024-byte boundary,
// assume we have a header of that size. Otherwise, assume it's just all rom.
// Other 'recognized' header sizes may need to be added.
int headerOffset = fileLength % BankSize;
Expand All @@ -56,8 +56,8 @@ public RomGame(HawkFile file, string patch)
stream.Position = 0;
stream.Read(FileData, 0, fileLength);

// if there was no header offset, RomData is equivalent to FileData
// (except in cases where the original interleaved file data is necessary.. in that case we'll have problems..
// if there was no header offset, RomData is equivalent to FileData
// (except in cases where the original interleaved file data is necessary.. in that case we'll have problems..
// but this whole architecture is not going to withstand every peculiarity and be fast as well.
if (headerOffset == 0)
{
Expand All @@ -67,7 +67,7 @@ public RomGame(HawkFile file, string patch)
file.Extension == ".pzx" || file.Extension == ".csw" || file.Extension == ".wav" || file.Extension == ".cdt")
{
// these are not roms. unfortunately if treated as such there are certain edge-cases
// where a header offset is detected. This should mitigate this issue until a cleaner solution is found
// where a header offset is detected. This should mitigate this issue until a cleaner solution is found
// (-Asnivor)
RomData = FileData;
}
Expand Down Expand Up @@ -120,7 +120,7 @@ public RomGame(HawkFile file, string patch)

private static byte[] DeInterleaveSMD(byte[] source)
{
// SMD files are interleaved in pages of 16k, with the first 8k containing all
// SMD files are interleaved in pages of 16k, with the first 8k containing all
// odd bytes and the second 8k containing all even bytes.
int size = source.Length;
if (size > 0x400000)
Expand Down
10 changes: 5 additions & 5 deletions src/BizHawk.Client.Common/Sound/Utilities/BufferedAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ namespace BizHawk.Client.Common
{
// Generates SEMI-synchronous sound, or "buffered asynchronous" sound.

// This class will try as hard as it can to request the correct number of samples on each frame and then
// This class will try as hard as it can to request the correct number of samples on each frame and then
// send them out to the sound card as it needs them.

// However, it has minimum/maximum buffer targets and will request smaller or larger frames if it has to.
// The ultimate goal of this strategy is to make MOST frames 100% correct, and if errors must occur,
// The ultimate goal of this strategy is to make MOST frames 100% correct, and if errors must occur,
// concentrate it on a single frame, rather than distribute small errors across most frames, as
// distributing error to most frames tends to result in persistently distorted audio, especially when
// sample playback is involved.


/*
* Why use this, when each core has it's own Async sound output?
*
*
* It is true that each emulation core provides its own async sound output, either through directly
* rendering to arbitrary buffers (pce not TurboCD, sms), or using one of the metaspus (nes, TurboCD).
*
*
* Unfortunately, the vecna metaspu is not perfect, and for maintaining near-realtime playback (the usual
* situation which we want to optimize for), it simply sounds better with a BufferedAsync on top of it.
*
*
* TODO: BufferedAsync has some hard coded parameters that assume FPS = 60. make that more generalized.
* TODO: For systems that _really_ don't need BufferedAsync (pce not turbocd, sms), make a way to signal
* that and then bypass the BufferedAsync.
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Client.Common/cheats/GbaGameSharkDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace BizHawk.Client.Common.cheats
{
// TODO:
// TODO:
public static class GbaGameSharkDecoder
{
private static readonly uint[] GameSharkSeeds = { 0x09F4FBBDU, 0x9681884AU, 0x352027E9U, 0xF3DEE5A7U };
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Client.Common/config/Binding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// public string DisplayName;
// public string Bindings;
// }
// ...also. We should consider using something other than DisplayName for keying, maybe make a KEYNAME distinct from displayname.
// ...also. We should consider using something other than DisplayName for keying, maybe make a KEYNAME distinct from displayname.
// displayname is OK for now though.
namespace BizHawk.Client.Common
{
Expand Down
4 changes: 2 additions & 2 deletions src/BizHawk.Client.Common/config/ConfigEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public enum ESoundOutputMethod
public enum EDispManagerAR
{
None,
System,
System,

// actually, custom SIZE (fixme on major release)
Custom,
Custom,
CustomRatio
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static string GlobalBaseAbsolutePath(this PathEntryCollection collection)
/// </summary>
public static PathEntry EntryWithFallback(this PathEntryCollection collection, string pathType, string systemId)
{
return (collection[systemId, pathType]
return (collection[systemId, pathType]
?? collection[systemId, "Base"])
?? collection["Global", "Base"];
}
Expand Down
4 changes: 2 additions & 2 deletions src/BizHawk.Client.Common/config/SaveStateConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ public class SaveStateConfig
public const int DefaultCompressionLevelNormal = 1;
public SaveStateType Type { get; set; } = SaveStateType.Binary;
public int CompressionLevelNormal { get; set; } = DefaultCompressionLevelNormal;
public const int DefaultCompressionLevelRewind = 0; // this isn't actually used yet
public int CompressionLevelRewind { get; set; } = DefaultCompressionLevelRewind; // this isn't actually used yet
public const int DefaultCompressionLevelRewind = 0; // this isn't actually used yet
public int CompressionLevelRewind { get; set; } = DefaultCompressionLevelRewind; // this isn't actually used yet
public bool MakeBackups { get; set; } = true;
public bool SaveScreenshot { get; set; } = true;
public int BigScreenshotSize { get; set; } = 128 * 1024;
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Client.Common/inputAdapters/AutoPattern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public AutoPatternBool()
}

/// <summary>
/// Initializes a new instance of the <see cref="AutoPatternBool"/> class.
/// Initializes a new instance of the <see cref="AutoPatternBool"/> class.
/// A simple on/off pattern.
/// </summary>
public AutoPatternBool(int on, int off, bool skipLag = true, int offset = 0, int loop = 0)
Expand Down
Loading

0 comments on commit 3ea71a2

Please sign in to comment.