use inline out
This commit is contained in:
parent
f873e7f9c3
commit
72d4b0ac46
|
@ -876,8 +876,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// (TODO - inefficient- build directly in a buffer)
|
||||
int bytes_written;
|
||||
AVIWriterImports.AVIStreamWrite(pAviRawAudioStream, outStatus.audio_samples, todo_realsamples, buf, todo_realsamples * 4, 0, IntPtr.Zero, out bytes_written);
|
||||
AVIWriterImports.AVIStreamWrite(pAviRawAudioStream, outStatus.audio_samples, todo_realsamples, buf, todo_realsamples * 4, 0, IntPtr.Zero, out var bytes_written);
|
||||
outStatus.audio_samples += todo_realsamples;
|
||||
outStatus.audio_bytes += bytes_written;
|
||||
outStatus.audio_buffered_shorts = 0;
|
||||
|
@ -925,8 +924,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
bp += pitch_add;
|
||||
}
|
||||
|
||||
int bytes_written;
|
||||
int ret = AVIWriterImports.AVIStreamWrite(pAviCompressedVideoStream, outStatus.video_frames, 1, new IntPtr(bytes_ptr), todo, AVIIF_KEYFRAME, IntPtr.Zero, out bytes_written);
|
||||
int ret = AVIWriterImports.AVIStreamWrite(pAviCompressedVideoStream, outStatus.video_frames, 1, new IntPtr(bytes_ptr), todo, AVIIF_KEYFRAME, IntPtr.Zero, out var bytes_written);
|
||||
outStatus.video_bytes += bytes_written;
|
||||
outStatus.video_frames++;
|
||||
}
|
||||
|
@ -957,8 +955,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
idx -= w * 2;
|
||||
}
|
||||
|
||||
int bytes_written;
|
||||
int ret = AVIWriterImports.AVIStreamWrite(pAviCompressedVideoStream, outStatus.video_frames, 1, new IntPtr(bytes_ptr), todo * 3, AVIIF_KEYFRAME, IntPtr.Zero, out bytes_written);
|
||||
int ret = AVIWriterImports.AVIStreamWrite(pAviCompressedVideoStream, outStatus.video_frames, 1, new IntPtr(bytes_ptr), todo * 3, AVIIF_KEYFRAME, IntPtr.Zero, out var bytes_written);
|
||||
outStatus.video_bytes += bytes_written;
|
||||
outStatus.video_frames++;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//NOTE: this throws EGL exceptions anyway. I'm going to ignore it and whine about it later
|
||||
}
|
||||
|
||||
public string API { get { return "OPENGL"; } }
|
||||
public string API => "OPENGL";
|
||||
|
||||
public int Version
|
||||
{
|
||||
|
@ -252,9 +252,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (required)
|
||||
throw new InvalidOperationException($"Error creating pipeline (error returned from glLinkProgram): {errcode}\r\n\r\n{resultLog}");
|
||||
else success = false;
|
||||
|
||||
int linkStatus;
|
||||
GL.GetProgram(pid, GetProgramParameterName.LinkStatus, out linkStatus);
|
||||
|
||||
GL.GetProgram(pid, GetProgramParameterName.LinkStatus, out var linkStatus);
|
||||
if (linkStatus == 0)
|
||||
if (required)
|
||||
throw new InvalidOperationException($"Error creating pipeline (link status false returned from glLinkProgram): \r\n\r\n{resultLog}");
|
||||
|
@ -286,8 +285,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
//get all the attributes (not needed)
|
||||
List<AttributeInfo> attributes = new List<AttributeInfo>();
|
||||
int nAttributes;
|
||||
GL.GetProgram(pid, GetProgramParameterName.ActiveAttributes, out nAttributes);
|
||||
GL.GetProgram(pid, GetProgramParameterName.ActiveAttributes, out var nAttributes);
|
||||
for (int i = 0; i < nAttributes; i++)
|
||||
{
|
||||
int size, length;
|
||||
|
@ -299,16 +297,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
//get all the uniforms
|
||||
List<UniformInfo> uniforms = new List<UniformInfo>();
|
||||
int nUniforms;
|
||||
GL.GetProgram(pid,GetProgramParameterName.ActiveUniforms,out nUniforms);
|
||||
GL.GetProgram(pid,GetProgramParameterName.ActiveUniforms,out var nUniforms);
|
||||
List<int> samplers = new List<int>();
|
||||
|
||||
for (int i = 0; i < nUniforms; i++)
|
||||
{
|
||||
int size, length;
|
||||
ActiveUniformType type;
|
||||
string name = new System.Text.StringBuilder(1024).ToString();
|
||||
GL.GetActiveUniform(pid, i, 1024, out length, out size, out type, out name);
|
||||
GL.GetActiveUniform(pid, i, 1024, out length, out size, out var type, out name);
|
||||
errcode = GL.GetError();
|
||||
int loc = GL.GetUniformLocation(pid, name);
|
||||
|
||||
|
@ -758,8 +754,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
int n;
|
||||
GL.GetShader(sid, ShaderParameter.CompileStatus, out n);
|
||||
GL.GetShader(sid, ShaderParameter.CompileStatus, out var n);
|
||||
|
||||
if (n == 0)
|
||||
if (required)
|
||||
|
|
|
@ -129,8 +129,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private int GetSource(ALGetSourcei param)
|
||||
{
|
||||
int value;
|
||||
AL.GetSource(_sourceID, param, out value);
|
||||
AL.GetSource(_sourceID, param, out var value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
|
@ -210,14 +210,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void GetSamplesFromBase(ref double scaleFactor)
|
||||
{
|
||||
short[] samples;
|
||||
int count;
|
||||
|
||||
if (BaseSoundProvider.SyncMode != SyncSoundMode.Sync)
|
||||
{
|
||||
throw new InvalidOperationException("Base sound provider must be in sync mode.");
|
||||
}
|
||||
BaseSoundProvider.GetSamplesSync(out samples, out count);
|
||||
BaseSoundProvider.GetSamplesSync(out var samples, out var count);
|
||||
|
||||
bool correctedEmptyFrame = false;
|
||||
if (count == 0)
|
||||
|
|
|
@ -113,8 +113,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
ulong version = 0;
|
||||
for (int i = 0; i < split.Length; i++)
|
||||
{
|
||||
ushort versionPart;
|
||||
if (!UInt16.TryParse(split[i], out versionPart)) return 0;
|
||||
if (!UInt16.TryParse(split[i], out var versionPart)) return 0;
|
||||
version |= (ulong)versionPart << (48 - (i * 16));
|
||||
}
|
||||
return version;
|
||||
|
|
|
@ -56,8 +56,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
uint a = _currentDisassemblerAddress;
|
||||
for (int i = 0; i <= lineCount; ++i)
|
||||
{
|
||||
int advance;
|
||||
string line = Disassembler.Disassemble(MemoryDomains.SystemBus, a, out advance);
|
||||
string line = Disassembler.Disassemble(MemoryDomains.SystemBus, a, out var advance);
|
||||
_disassemblyLines.Add(new DisasmOp(a, advance, line));
|
||||
a += (uint)advance;
|
||||
if (a > BusMaxValue)
|
||||
|
@ -107,8 +106,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
while (true)
|
||||
{
|
||||
int bytestoadvance;
|
||||
Disassembler.Disassemble(MemoryDomains.SystemBus, newaddress, out bytestoadvance);
|
||||
Disassembler.Disassemble(MemoryDomains.SystemBus, newaddress, out var bytestoadvance);
|
||||
if (newaddress + bytestoadvance == _currentDisassemblerAddress)
|
||||
{
|
||||
break;
|
||||
|
|
|
@ -2474,8 +2474,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
foreach (var t in code)
|
||||
{
|
||||
hexcode <<= 5;
|
||||
long y;
|
||||
_GENgameGenieTable.TryGetValue(t, out y);
|
||||
_GENgameGenieTable.TryGetValue(t, out var y);
|
||||
hexcode |= y;
|
||||
}
|
||||
long decoded = (hexcode & 0xFF00000000) >> 32;
|
||||
|
|
|
@ -1182,8 +1182,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void paletteViewer_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
Point pt;
|
||||
bool valid = TranslatePaletteCoord(e.Location, out pt);
|
||||
bool valid = TranslatePaletteCoord(e.Location, out var pt);
|
||||
if (!valid) return;
|
||||
lastColorNum = pt.Y * 16 + pt.X;
|
||||
UpdateColorDetails();
|
||||
|
|
|
@ -335,8 +335,7 @@ namespace BizHawk.Common
|
|||
return false;
|
||||
}
|
||||
var tkp = new TOKEN_PRIVILEGES { PrivilegeCount = 1, Privileges = new LUID_AND_ATTRIBUTES[1] };
|
||||
LUID luid;
|
||||
if (!LookupPrivilegeValue(null, PrivilegeName, out luid))
|
||||
if (!LookupPrivilegeValue(null, PrivilegeName, out var luid))
|
||||
{
|
||||
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
|
||||
return false;
|
||||
|
|
|
@ -128,8 +128,7 @@ namespace BizHawk.Common
|
|||
{
|
||||
il.Emit(OpCodes.Ldloc, target);
|
||||
il.Emit(OpCodes.Ldarg_1);
|
||||
MethodInfo m;
|
||||
if (!Readhandlers.TryGetValue(field.FieldType, out m))
|
||||
if (!Readhandlers.TryGetValue(field.FieldType, out var m))
|
||||
{
|
||||
throw new InvalidOperationException($"(R) Can't handle nested type {field.FieldType}");
|
||||
}
|
||||
|
@ -153,8 +152,7 @@ namespace BizHawk.Common
|
|||
il.Emit(OpCodes.Ldarg_1);
|
||||
il.Emit(OpCodes.Ldloc, target);
|
||||
il.Emit(OpCodes.Ldfld, field);
|
||||
MethodInfo m;
|
||||
if (!Writehandlers.TryGetValue(field.FieldType, out m))
|
||||
if (!Writehandlers.TryGetValue(field.FieldType, out var m))
|
||||
{
|
||||
throw new InvalidOperationException($"(W) Can't handle nested type {field.FieldType}");
|
||||
}
|
||||
|
@ -180,8 +178,7 @@ namespace BizHawk.Common
|
|||
|
||||
private static SerializationFactory GetFactory(Type t)
|
||||
{
|
||||
SerializationFactory f;
|
||||
if (!Serializers.TryGetValue(t, out f))
|
||||
if (!Serializers.TryGetValue(t, out var f))
|
||||
{
|
||||
f = CreateFactory(t);
|
||||
Serializers[t] = f;
|
||||
|
|
|
@ -26,8 +26,7 @@ namespace BizHawk.Common
|
|||
/// <param name="obj">the obj to act on</param>
|
||||
public static void SetDefaultValues<T>(T obj)
|
||||
{
|
||||
DefaultValueSetter f;
|
||||
if (!DefaultValueSetters.TryGetValue(typeof(T), out f))
|
||||
if (!DefaultValueSetters.TryGetValue(typeof(T), out var f))
|
||||
{
|
||||
f = CreateSetter(typeof(T));
|
||||
DefaultValueSetters[typeof(T)] = f;
|
||||
|
|
|
@ -37,10 +37,8 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
public void GetSamplesAsync(short[] samples)
|
||||
{
|
||||
short[] sampin;
|
||||
int numsamp;
|
||||
_input.GetSamplesSync(out sampin, out numsamp);
|
||||
_buffer.EnqueueSamples(sampin, numsamp);
|
||||
_input.GetSamplesSync(out var sampIn, out var numSamp);
|
||||
_buffer.EnqueueSamples(sampIn, numSamp);
|
||||
_buffer.OutputSamples(samples, samples.Length / 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -425,9 +425,7 @@ namespace BizHawk.Emulation.Common
|
|||
{
|
||||
if (_input != null)
|
||||
{
|
||||
short[] sampin;
|
||||
int nsampin;
|
||||
_input.GetSamplesSync(out sampin, out nsampin);
|
||||
_input.GetSamplesSync(out var sampin, out int nsampin);
|
||||
EnqueueSamples(sampin, nsampin);
|
||||
}
|
||||
|
||||
|
|
|
@ -171,8 +171,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// <exception cref="CCDParseException"><paramref name="key"/> not found in <see langword="this"/></exception>
|
||||
public int FetchOrFail(string key)
|
||||
{
|
||||
int ret;
|
||||
if(!TryGetValue(key, out ret))
|
||||
if(!TryGetValue(key, out var ret))
|
||||
throw new CCDParseException($"Malformed or unexpected CCD format: missing required [Entry] key: {key}");
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -250,8 +250,7 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
|||
break;
|
||||
}
|
||||
string strindexnum = clp.ReadToken();
|
||||
int indexnum;
|
||||
if (!int.TryParse(strindexnum, out indexnum) || indexnum < 0 || indexnum > 99)
|
||||
if (!int.TryParse(strindexnum, out var indexnum) || indexnum < 0 || indexnum > 99)
|
||||
{
|
||||
job.Error($"Invalid INDEX number: {strindexnum}");
|
||||
break;
|
||||
|
@ -331,15 +330,15 @@ namespace BizHawk.Emulation.DiscSystem.CUE
|
|||
job.Error("Incomplete TRACK command");
|
||||
break;
|
||||
}
|
||||
|
||||
string str_tracknum = clp.ReadToken();
|
||||
int tracknum;
|
||||
if (!int.TryParse(str_tracknum, out tracknum) || tracknum < 1 || tracknum > 99)
|
||||
if (!int.TryParse(str_tracknum, out int tracknum) || tracknum < 1 || tracknum > 99)
|
||||
{
|
||||
job.Error($"Invalid TRACK number: {str_tracknum}");
|
||||
break;
|
||||
}
|
||||
|
||||
//TODO - check sequentiality? maybe as a warning
|
||||
// TODO - check sequentiality? maybe as a warning
|
||||
|
||||
CueTrackType tt;
|
||||
var str_trackType = clp.ReadToken();
|
||||
|
|
|
@ -504,15 +504,13 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
foreach (var s in aSessions.Values)
|
||||
{
|
||||
Session session = new Session();
|
||||
ATrack startTrack;
|
||||
ATrack endTrack;
|
||||
|
||||
if (!aTracks.TryGetValue(s.FirstTrack, out startTrack))
|
||||
if (!aTracks.TryGetValue(s.FirstTrack, out var startTrack))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!aTracks.TryGetValue(s.LastTrack, out endTrack))
|
||||
if (!aTracks.TryGetValue(s.LastTrack, out var endTrack))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -341,8 +341,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
//read it if we dont have it cached
|
||||
//we wont be caching very much here, it's no big deal
|
||||
//identification is not something we want to take a long time
|
||||
byte[] data;
|
||||
if (!_sectorCache.TryGetValue(lba, out data))
|
||||
if (!_sectorCache.TryGetValue(lba, out var data))
|
||||
{
|
||||
data = new byte[2048];
|
||||
int read = _dsr.ReadLBA_2048(lba, data, 0);
|
||||
|
|
|
@ -63,15 +63,13 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
|
||||
public static int BCDToInt(byte n)
|
||||
{
|
||||
var bcd = new BCD2();
|
||||
bcd.BCDValue = n;
|
||||
var bcd = new BCD2 { BCDValue = n };
|
||||
return bcd.DecimalValue;
|
||||
}
|
||||
|
||||
public static byte IntToBCD(int n)
|
||||
{
|
||||
int ones;
|
||||
int tens = Math.DivRem(n, 10, out ones);
|
||||
int tens = Math.DivRem(n, 10, out var ones);
|
||||
return (byte)((tens << 4) | ones);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
{
|
||||
static byte IntToBCD(int n)
|
||||
{
|
||||
int ones;
|
||||
int tens = Math.DivRem(n, 10, out ones);
|
||||
int tens = Math.DivRem(n, 10, out var ones);
|
||||
return (byte)((tens << 4) | ones);
|
||||
}
|
||||
|
||||
|
@ -37,7 +36,5 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
{
|
||||
return f + (s * 75) + (m * 75 * 60) - 150;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using Cyotek.Drawing.BitmapFont;
|
||||
using sd=System.Drawing;
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
|
@ -61,8 +61,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
continue;
|
||||
}
|
||||
|
||||
Cyotek.Drawing.BitmapFont.Character bfc;
|
||||
if (!FontInfo.Characters.TryGetValue((char)c, out bfc))
|
||||
if (!FontInfo.Characters.TryGetValue((char)c, out var bfc))
|
||||
bfc = FontInfo.Characters[unchecked((char)-1)];
|
||||
|
||||
x += bfc.XAdvance;
|
||||
|
@ -98,8 +97,7 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
continue;
|
||||
}
|
||||
|
||||
Cyotek.Drawing.BitmapFont.Character bfc;
|
||||
if (!FontInfo.Characters.TryGetValue((char)c, out bfc))
|
||||
if (!FontInfo.Characters.TryGetValue((char)c, out var bfc))
|
||||
bfc = FontInfo.Characters[unchecked((char)-1)];
|
||||
|
||||
// calculate texcoords (we shouldve already had this cached, but im speedcoding now)
|
||||
|
|
Loading…
Reference in New Issue