misc cleanups, mostly IDE nags, in files I had open
This commit is contained in:
parent
bdf1838ac8
commit
e0eb572e74
|
@ -1,8 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
@ -30,12 +33,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
/// <summary>sets the codec token to be used for video compression</summary>
|
||||
/// <exception cref="ArgumentException"><paramref name="token"/> does not inherit <see cref="AviWriter.CodecToken"/></exception>
|
||||
/// <exception cref="ArgumentException"><paramref name="token"/> does not inherit <see cref="CodecToken"/></exception>
|
||||
public void SetVideoCodecToken(IDisposable token)
|
||||
{
|
||||
if (token is CodecToken)
|
||||
if (token is CodecToken cToken)
|
||||
{
|
||||
_currVideoCodecToken = (CodecToken)token;
|
||||
_currVideoCodecToken = cToken;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -69,23 +72,23 @@ namespace BizHawk.Client.EmuHawk
|
|||
// thread communication
|
||||
// synchronized queue with custom messages
|
||||
// it seems like there are 99999 ways to do everything in C#, so i'm sure this is not the best
|
||||
private System.Collections.Concurrent.BlockingCollection<object> threadQ;
|
||||
private System.Threading.Thread workerT;
|
||||
private BlockingCollection<object> _threadQ;
|
||||
private Thread _workerT;
|
||||
|
||||
private void threadproc()
|
||||
private void ThreadProc()
|
||||
{
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
object o = threadQ.Take();
|
||||
if (o is IVideoProvider)
|
||||
object o = _threadQ.Take();
|
||||
if (o is IVideoProvider provider)
|
||||
{
|
||||
AddFrameEx((IVideoProvider)o);
|
||||
AddFrameEx(provider);
|
||||
}
|
||||
else if (o is short[])
|
||||
else if (o is short[] arr)
|
||||
{
|
||||
AddSamplesEx((short[])o);
|
||||
AddSamplesEx(arr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -141,15 +144,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
throw new InvalidOperationException("Tried to start recording an AVI with no video codec token set");
|
||||
}
|
||||
|
||||
threadQ = new System.Collections.Concurrent.BlockingCollection<object>(30);
|
||||
workerT = new System.Threading.Thread(new System.Threading.ThreadStart(threadproc));
|
||||
workerT.Start();
|
||||
_threadQ = new System.Collections.Concurrent.BlockingCollection<object>(30);
|
||||
_workerT = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadProc));
|
||||
_workerT.Start();
|
||||
}
|
||||
|
||||
public void CloseFile()
|
||||
{
|
||||
threadQ.Add(new object()); // acts as stop message
|
||||
workerT.Join();
|
||||
_threadQ.Add(new object()); // acts as stop message
|
||||
_workerT.Join();
|
||||
_currSegment?.Dispose();
|
||||
_currSegment = null;
|
||||
}
|
||||
|
@ -157,9 +160,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <exception cref="Exception">worker thrread died</exception>
|
||||
public void AddFrame(IVideoProvider source)
|
||||
{
|
||||
while (!threadQ.TryAdd(new VideoCopy(source), 1000))
|
||||
while (!_threadQ.TryAdd(new VideoCopy(source), 1000))
|
||||
{
|
||||
if (!workerT.IsAlive)
|
||||
if (!_workerT.IsAlive)
|
||||
{
|
||||
throw new Exception("AVI Worker thread died!");
|
||||
}
|
||||
|
@ -183,9 +186,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// as MainForm.cs is written now, samples is all ours (nothing else will use it for anything)
|
||||
// but that's a bad assumption to make and could change in the future, so copy it since we're passing to another thread
|
||||
while (!threadQ.TryAdd((short[])samples.Clone(), 1000))
|
||||
while (!_threadQ.TryAdd((short[])samples.Clone(), 1000))
|
||||
{
|
||||
if (!workerT.IsAlive)
|
||||
if (!_workerT.IsAlive)
|
||||
{
|
||||
throw new Exception("AVI Worker thread died!");
|
||||
}
|
||||
|
@ -243,7 +246,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
_currSegment = new AviWriterSegment();
|
||||
_nameProvider.MoveNext();
|
||||
_currSegment.OpenFile(_nameProvider.Current, parameters, _currVideoCodecToken);
|
||||
_currSegment.OpenFile(_nameProvider.Current, _parameters, _currVideoCodecToken);
|
||||
try
|
||||
{
|
||||
_currSegment.OpenStreams();
|
||||
|
@ -340,7 +343,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public int fps, fps_scale;
|
||||
}
|
||||
|
||||
private readonly Parameters parameters = new Parameters();
|
||||
private readonly Parameters _parameters = new Parameters();
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@ -350,11 +353,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
bool change = false;
|
||||
|
||||
change |= fpsNum != parameters.fps;
|
||||
parameters.fps = fpsNum;
|
||||
change |= fpsNum != _parameters.fps;
|
||||
_parameters.fps = fpsNum;
|
||||
|
||||
change |= parameters.fps_scale != fpsDen;
|
||||
parameters.fps_scale = fpsDen;
|
||||
change |= _parameters.fps_scale != fpsDen;
|
||||
_parameters.fps_scale = fpsDen;
|
||||
|
||||
if (change)
|
||||
{
|
||||
|
@ -369,11 +372,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
bool change = false;
|
||||
|
||||
change |= parameters.width != width;
|
||||
parameters.width = width;
|
||||
change |= _parameters.width != width;
|
||||
_parameters.width = width;
|
||||
|
||||
change |= parameters.height != height;
|
||||
parameters.height = height;
|
||||
change |= _parameters.height != height;
|
||||
_parameters.height = height;
|
||||
|
||||
if (change)
|
||||
{
|
||||
|
@ -388,17 +391,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
bool change = false;
|
||||
|
||||
change |= parameters.a_samplerate != sampleRate;
|
||||
parameters.a_samplerate = sampleRate;
|
||||
change |= _parameters.a_samplerate != sampleRate;
|
||||
_parameters.a_samplerate = sampleRate;
|
||||
|
||||
change |= parameters.a_channels != channels;
|
||||
parameters.a_channels = channels;
|
||||
change |= _parameters.a_channels != channels;
|
||||
_parameters.a_channels = channels;
|
||||
|
||||
change |= parameters.a_bits != bits;
|
||||
parameters.a_bits = bits;
|
||||
change |= _parameters.a_bits != bits;
|
||||
_parameters.a_bits = bits;
|
||||
|
||||
change |= parameters.has_audio != true;
|
||||
parameters.has_audio = true;
|
||||
change |= _parameters.has_audio != true;
|
||||
_parameters.has_audio = true;
|
||||
|
||||
if (change)
|
||||
{
|
||||
|
@ -410,12 +413,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public void Dispose() { }
|
||||
private CodecToken() { }
|
||||
private AVIWriterImports.AVICOMPRESSOPTIONS comprOptions;
|
||||
private AVIWriterImports.AVICOMPRESSOPTIONS _comprOptions;
|
||||
public string codec;
|
||||
public byte[] Format = new byte[0];
|
||||
public byte[] Parms = new byte[0];
|
||||
|
||||
private static string decode_mmioFOURCC(int code)
|
||||
private static string Decode_mmioFOURCC(int code)
|
||||
{
|
||||
char[] chs = new char[4];
|
||||
|
||||
|
@ -432,8 +435,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var ret = new CodecToken
|
||||
{
|
||||
comprOptions = opts,
|
||||
codec = decode_mmioFOURCC(opts.fccHandler),
|
||||
_comprOptions = opts,
|
||||
codec = Decode_mmioFOURCC(opts.fccHandler),
|
||||
Format = new byte[opts.cbFormat],
|
||||
Parms = new byte[opts.cbParms]
|
||||
};
|
||||
|
@ -463,7 +466,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void AllocateToAVICOMPRESSOPTIONS(ref AVIWriterImports.AVICOMPRESSOPTIONS opts)
|
||||
{
|
||||
opts = comprOptions;
|
||||
opts = _comprOptions;
|
||||
if (opts.cbParms != 0)
|
||||
{
|
||||
opts.lpParms = Win32Imports.HeapAlloc(Win32Imports.GetProcessHeap(), 0, opts.cbParms);
|
||||
|
@ -481,17 +484,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
var m = new MemoryStream();
|
||||
var b = new BinaryWriter(m);
|
||||
|
||||
b.Write(comprOptions.fccType);
|
||||
b.Write(comprOptions.fccHandler);
|
||||
b.Write(comprOptions.dwKeyFrameEvery);
|
||||
b.Write(comprOptions.dwQuality);
|
||||
b.Write(comprOptions.dwBytesPerSecond);
|
||||
b.Write(comprOptions.dwFlags);
|
||||
b.Write(_comprOptions.fccType);
|
||||
b.Write(_comprOptions.fccHandler);
|
||||
b.Write(_comprOptions.dwKeyFrameEvery);
|
||||
b.Write(_comprOptions.dwQuality);
|
||||
b.Write(_comprOptions.dwBytesPerSecond);
|
||||
b.Write(_comprOptions.dwFlags);
|
||||
//b.Write(comprOptions.lpFormat);
|
||||
b.Write(comprOptions.cbFormat);
|
||||
b.Write(_comprOptions.cbFormat);
|
||||
//b.Write(comprOptions.lpParms);
|
||||
b.Write(comprOptions.cbParms);
|
||||
b.Write(comprOptions.dwInterleaveEvery);
|
||||
b.Write(_comprOptions.cbParms);
|
||||
b.Write(_comprOptions.dwInterleaveEvery);
|
||||
b.Write(Format);
|
||||
b.Write(Parms);
|
||||
b.Close();
|
||||
|
@ -538,10 +541,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
var ret = new CodecToken
|
||||
{
|
||||
comprOptions = comprOptions,
|
||||
_comprOptions = comprOptions,
|
||||
Format = Format,
|
||||
Parms = Parms,
|
||||
codec = decode_mmioFOURCC(comprOptions.fccHandler)
|
||||
codec = Decode_mmioFOURCC(comprOptions.fccHandler)
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
|
@ -581,35 +584,34 @@ namespace BizHawk.Client.EmuHawk
|
|||
CloseFile();
|
||||
}
|
||||
|
||||
private CodecToken currVideoCodecToken = null;
|
||||
private bool IsOpen;
|
||||
private IntPtr pAviFile, pAviRawVideoStream, pAviRawAudioStream, pAviCompressedVideoStream;
|
||||
private IntPtr pGlobalBuf;
|
||||
private int pGlobalBuf_size;
|
||||
private CodecToken _currVideoCodecToken;
|
||||
private bool _isOpen;
|
||||
private IntPtr _pAviFile, _pAviRawVideoStream, _pAviRawAudioStream, _pAviCompressedVideoStream;
|
||||
private IntPtr _pGlobalBuf;
|
||||
private int _pGlobalBuffSize;
|
||||
|
||||
// are we sending 32 bit RGB to avi or 24?
|
||||
private bool bit32 = false;
|
||||
private bool _bit32;
|
||||
|
||||
/// <summary>
|
||||
/// there is just ony global buf. this gets it and makes sure its big enough. don't get all re-entrant on it!
|
||||
/// </summary>
|
||||
private IntPtr GetStaticGlobalBuf(int amount)
|
||||
{
|
||||
if (amount > pGlobalBuf_size)
|
||||
if (amount > _pGlobalBuffSize)
|
||||
{
|
||||
if (pGlobalBuf != IntPtr.Zero)
|
||||
if (_pGlobalBuf != IntPtr.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(pGlobalBuf);
|
||||
Marshal.FreeHGlobal(_pGlobalBuf);
|
||||
}
|
||||
|
||||
pGlobalBuf_size = amount;
|
||||
pGlobalBuf = Marshal.AllocHGlobal(pGlobalBuf_size);
|
||||
_pGlobalBuffSize = amount;
|
||||
_pGlobalBuf = Marshal.AllocHGlobal(_pGlobalBuffSize);
|
||||
}
|
||||
|
||||
return pGlobalBuf;
|
||||
return _pGlobalBuf;
|
||||
}
|
||||
|
||||
|
||||
private class OutputStatus
|
||||
{
|
||||
public int video_frames;
|
||||
|
@ -618,14 +620,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
public int audio_samples;
|
||||
public int audio_buffered_shorts;
|
||||
public const int AUDIO_SEGMENT_SIZE = 44100 * 2;
|
||||
public short[] BufferedShorts = new short[AUDIO_SEGMENT_SIZE];
|
||||
public readonly short[] BufferedShorts = new short[AUDIO_SEGMENT_SIZE];
|
||||
}
|
||||
|
||||
private OutputStatus outStatus;
|
||||
private OutputStatus _outStatus;
|
||||
|
||||
public long GetLengthApproximation()
|
||||
{
|
||||
return outStatus.video_bytes + outStatus.audio_bytes;
|
||||
return _outStatus.video_bytes + _outStatus.audio_bytes;
|
||||
}
|
||||
|
||||
private static bool FAILED(int hr) => hr < 0;
|
||||
|
@ -641,7 +643,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private Parameters parameters;
|
||||
private Parameters _parameters;
|
||||
|
||||
/// <exception cref="InvalidOperationException">unmanaged call failed</exception>
|
||||
public void OpenFile(string destPath, Parameters parameters, CodecToken videoCodecToken)
|
||||
|
@ -653,8 +655,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
| ((int)(byte)(str[3]) << 24)
|
||||
);
|
||||
|
||||
this.parameters = parameters;
|
||||
this.currVideoCodecToken = videoCodecToken;
|
||||
this._parameters = parameters;
|
||||
this._currVideoCodecToken = videoCodecToken;
|
||||
|
||||
// TODO - try creating the file once first before we let vfw botch it up?
|
||||
|
||||
|
@ -664,7 +666,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
File.Delete(destPath);
|
||||
}
|
||||
|
||||
if (FAILED(AVIWriterImports.AVIFileOpenW(ref pAviFile, destPath, AVIWriterImports.OpenFileStyle.OF_CREATE | AVIWriterImports.OpenFileStyle.OF_WRITE, 0)))
|
||||
if (FAILED(AVIWriterImports.AVIFileOpenW(ref _pAviFile, destPath, AVIWriterImports.OpenFileStyle.OF_CREATE | AVIWriterImports.OpenFileStyle.OF_WRITE, 0)))
|
||||
{
|
||||
throw new InvalidOperationException($"Couldnt open dest path for avi file: {destPath}");
|
||||
}
|
||||
|
@ -677,7 +679,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
vidstream_header.dwRate = parameters.fps;
|
||||
vidstream_header.dwScale = parameters.fps_scale;
|
||||
vidstream_header.dwSuggestedBufferSize = (int)bmih.biSizeImage;
|
||||
if (FAILED(AVIWriterImports.AVIFileCreateStreamW(pAviFile, out pAviRawVideoStream, ref vidstream_header)))
|
||||
if (FAILED(AVIWriterImports.AVIFileCreateStreamW(_pAviFile, out _pAviRawVideoStream, ref vidstream_header)))
|
||||
{
|
||||
CloseFile();
|
||||
throw new InvalidOperationException("Failed opening raw video stream. Not sure how this could happen");
|
||||
|
@ -693,14 +695,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
audstream_header.dwRate = (int)wfex.nAvgBytesPerSec;
|
||||
audstream_header.dwSampleSize = wfex.nBlockAlign;
|
||||
audstream_header.dwInitialFrames = 1; // ??? optimal value?
|
||||
if (FAILED(AVIWriterImports.AVIFileCreateStreamW(pAviFile, out pAviRawAudioStream, ref audstream_header)))
|
||||
if (FAILED(AVIWriterImports.AVIFileCreateStreamW(_pAviFile, out _pAviRawAudioStream, ref audstream_header)))
|
||||
{
|
||||
CloseFile();
|
||||
throw new InvalidOperationException("Failed opening raw audio stream. Not sure how this could happen");
|
||||
}
|
||||
|
||||
outStatus = new OutputStatus();
|
||||
IsOpen = true;
|
||||
_outStatus = new OutputStatus();
|
||||
_isOpen = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -708,21 +710,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <exception cref="InvalidOperationException">no file open (need to call <see cref="OpenFile"/>)</exception>
|
||||
public IDisposable AcquireVideoCodecToken(IntPtr hwnd, CodecToken lastCodecToken)
|
||||
{
|
||||
if (!IsOpen)
|
||||
if (!_isOpen)
|
||||
{
|
||||
throw new InvalidOperationException("File must be opened before acquiring a codec token (or else the stream formats wouldnt be known)");
|
||||
}
|
||||
|
||||
if (lastCodecToken != null)
|
||||
{
|
||||
currVideoCodecToken = lastCodecToken;
|
||||
_currVideoCodecToken = lastCodecToken;
|
||||
}
|
||||
|
||||
// encoder params
|
||||
AVIWriterImports.AVICOMPRESSOPTIONS comprOptions = new AVIWriterImports.AVICOMPRESSOPTIONS();
|
||||
currVideoCodecToken?.AllocateToAVICOMPRESSOPTIONS(ref comprOptions);
|
||||
_currVideoCodecToken?.AllocateToAVICOMPRESSOPTIONS(ref comprOptions);
|
||||
|
||||
bool result = AVISaveOptions(pAviRawVideoStream, ref comprOptions, hwnd) != 0;
|
||||
bool result = AVISaveOptions(_pAviRawVideoStream, ref comprOptions, hwnd) != 0;
|
||||
CodecToken ret = CodecToken.CreateFromAVICOMPRESSOPTIONS(ref comprOptions);
|
||||
|
||||
// so, AVISaveOptions may have changed some of the pointers
|
||||
|
@ -746,15 +748,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <exception cref="InvalidOperationException">no video codec token set (need to call <see cref="OpenFile"/>), or unmanaged call failed</exception>
|
||||
public void OpenStreams()
|
||||
{
|
||||
if (currVideoCodecToken == null)
|
||||
if (_currVideoCodecToken == null)
|
||||
{
|
||||
throw new InvalidOperationException("set a video codec token before opening the streams!");
|
||||
}
|
||||
|
||||
// open compressed video stream
|
||||
AVIWriterImports.AVICOMPRESSOPTIONS opts = new AVIWriterImports.AVICOMPRESSOPTIONS();
|
||||
currVideoCodecToken.AllocateToAVICOMPRESSOPTIONS(ref opts);
|
||||
bool failed = FAILED(AVIWriterImports.AVIMakeCompressedStream(out pAviCompressedVideoStream, pAviRawVideoStream, ref opts, IntPtr.Zero));
|
||||
_currVideoCodecToken.AllocateToAVICOMPRESSOPTIONS(ref opts);
|
||||
bool failed = FAILED(AVIWriterImports.AVIMakeCompressedStream(out _pAviCompressedVideoStream, _pAviRawVideoStream, ref opts, IntPtr.Zero));
|
||||
CodecToken.DeallocateAVICOMPRESSOPTIONS(ref opts);
|
||||
|
||||
if (failed)
|
||||
|
@ -765,26 +767,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
// set the compressed video stream input format
|
||||
AVIWriterImports.BITMAPINFOHEADER bmih = new AVIWriterImports.BITMAPINFOHEADER();
|
||||
if (bit32)
|
||||
if (_bit32)
|
||||
{
|
||||
parameters.PopulateBITMAPINFOHEADER32(ref bmih);
|
||||
_parameters.PopulateBITMAPINFOHEADER32(ref bmih);
|
||||
}
|
||||
else
|
||||
{
|
||||
parameters.PopulateBITMAPINFOHEADER24(ref bmih);
|
||||
_parameters.PopulateBITMAPINFOHEADER24(ref bmih);
|
||||
}
|
||||
|
||||
if (FAILED(AVIWriterImports.AVIStreamSetFormat(pAviCompressedVideoStream, 0, ref bmih, Marshal.SizeOf(bmih))))
|
||||
if (FAILED(AVIWriterImports.AVIStreamSetFormat(_pAviCompressedVideoStream, 0, ref bmih, Marshal.SizeOf(bmih))))
|
||||
{
|
||||
bit32 = true; // we'll try again
|
||||
_bit32 = true; // we'll try again
|
||||
CloseStreams();
|
||||
throw new InvalidOperationException("Failed setting compressed video stream input format");
|
||||
}
|
||||
|
||||
// set audio stream input format
|
||||
AVIWriterImports.WAVEFORMATEX wfex = new AVIWriterImports.WAVEFORMATEX();
|
||||
parameters.PopulateWAVEFORMATEX(ref wfex);
|
||||
if (FAILED(AVIWriterImports.AVIStreamSetFormat(pAviRawAudioStream, 0, ref wfex, Marshal.SizeOf(wfex))))
|
||||
_parameters.PopulateWAVEFORMATEX(ref wfex);
|
||||
if (FAILED(AVIWriterImports.AVIStreamSetFormat(_pAviRawAudioStream, 0, ref wfex, Marshal.SizeOf(wfex))))
|
||||
{
|
||||
CloseStreams();
|
||||
throw new InvalidOperationException("Failed setting raw audio stream input format");
|
||||
|
@ -797,29 +799,29 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void CloseFile()
|
||||
{
|
||||
CloseStreams();
|
||||
if (pAviRawAudioStream != IntPtr.Zero)
|
||||
if (_pAviRawAudioStream != IntPtr.Zero)
|
||||
{
|
||||
AVIWriterImports.AVIStreamRelease(pAviRawAudioStream);
|
||||
pAviRawAudioStream = IntPtr.Zero;
|
||||
AVIWriterImports.AVIStreamRelease(_pAviRawAudioStream);
|
||||
_pAviRawAudioStream = IntPtr.Zero;
|
||||
}
|
||||
|
||||
if (pAviRawVideoStream != IntPtr.Zero)
|
||||
if (_pAviRawVideoStream != IntPtr.Zero)
|
||||
{
|
||||
AVIWriterImports.AVIStreamRelease(pAviRawVideoStream);
|
||||
pAviRawVideoStream = IntPtr.Zero;
|
||||
AVIWriterImports.AVIStreamRelease(_pAviRawVideoStream);
|
||||
_pAviRawVideoStream = IntPtr.Zero;
|
||||
}
|
||||
|
||||
if (pAviFile != IntPtr.Zero)
|
||||
if (_pAviFile != IntPtr.Zero)
|
||||
{
|
||||
AVIWriterImports.AVIFileRelease(pAviFile);
|
||||
pAviFile = IntPtr.Zero;
|
||||
AVIWriterImports.AVIFileRelease(_pAviFile);
|
||||
_pAviFile = IntPtr.Zero;
|
||||
}
|
||||
|
||||
if (pGlobalBuf != IntPtr.Zero)
|
||||
if (_pGlobalBuf != IntPtr.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(pGlobalBuf);
|
||||
pGlobalBuf = IntPtr.Zero;
|
||||
pGlobalBuf_size = 0;
|
||||
Marshal.FreeHGlobal(_pGlobalBuf);
|
||||
_pGlobalBuf = IntPtr.Zero;
|
||||
_pGlobalBuffSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -828,15 +830,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
public void CloseStreams()
|
||||
{
|
||||
if (pAviRawAudioStream != IntPtr.Zero)
|
||||
if (_pAviRawAudioStream != IntPtr.Zero)
|
||||
{
|
||||
FlushBufferedAudio();
|
||||
}
|
||||
|
||||
if (pAviCompressedVideoStream != IntPtr.Zero)
|
||||
if (_pAviCompressedVideoStream != IntPtr.Zero)
|
||||
{
|
||||
AVIWriterImports.AVIStreamRelease(pAviCompressedVideoStream);
|
||||
pAviCompressedVideoStream = IntPtr.Zero;
|
||||
AVIWriterImports.AVIStreamRelease(_pAviCompressedVideoStream);
|
||||
_pAviCompressedVideoStream = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -847,15 +849,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
int idx = 0;
|
||||
while (todo > 0)
|
||||
{
|
||||
int remain = OutputStatus.AUDIO_SEGMENT_SIZE - outStatus.audio_buffered_shorts;
|
||||
int remain = OutputStatus.AUDIO_SEGMENT_SIZE - _outStatus.audio_buffered_shorts;
|
||||
int chunk = Math.Min(remain, todo);
|
||||
for (int i = 0; i < chunk; i++)
|
||||
{
|
||||
outStatus.BufferedShorts[outStatus.audio_buffered_shorts++] = samples[idx++];
|
||||
_outStatus.BufferedShorts[_outStatus.audio_buffered_shorts++] = samples[idx++];
|
||||
}
|
||||
todo -= chunk;
|
||||
|
||||
if (outStatus.audio_buffered_shorts == OutputStatus.AUDIO_SEGMENT_SIZE)
|
||||
if (_outStatus.audio_buffered_shorts == OutputStatus.AUDIO_SEGMENT_SIZE)
|
||||
{
|
||||
FlushBufferedAudio();
|
||||
}
|
||||
|
@ -864,21 +866,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private unsafe void FlushBufferedAudio()
|
||||
{
|
||||
int todo = outStatus.audio_buffered_shorts;
|
||||
int todo = _outStatus.audio_buffered_shorts;
|
||||
int todo_realsamples = todo / 2;
|
||||
IntPtr buf = GetStaticGlobalBuf(todo * 2);
|
||||
|
||||
short* sptr = (short*)buf.ToPointer();
|
||||
for (int i = 0; i < todo; i++)
|
||||
{
|
||||
sptr[i] = outStatus.BufferedShorts[i];
|
||||
sptr[i] = _outStatus.BufferedShorts[i];
|
||||
}
|
||||
|
||||
// (TODO - inefficient- build directly in a buffer)
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
/// <exception cref="InvalidOperationException">attempted frame resize during encoding</exception>
|
||||
|
@ -886,17 +888,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
const int AVIIF_KEYFRAME = 0x00000010;
|
||||
|
||||
if (parameters.width != source.BufferWidth
|
||||
|| parameters.height != source.BufferHeight)
|
||||
if (_parameters.width != source.BufferWidth
|
||||
|| _parameters.height != source.BufferHeight)
|
||||
throw new InvalidOperationException("video buffer changed between start and now");
|
||||
|
||||
int pitch_add = parameters.pitch_add;
|
||||
int pitch_add = _parameters.pitch_add;
|
||||
|
||||
int todo = parameters.pitch * parameters.height;
|
||||
int todo = _parameters.pitch * _parameters.height;
|
||||
int w = source.BufferWidth;
|
||||
int h = source.BufferHeight;
|
||||
|
||||
if (!bit32)
|
||||
if (!_bit32)
|
||||
{
|
||||
IntPtr buf = GetStaticGlobalBuf(todo);
|
||||
|
||||
|
@ -923,9 +925,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
bp += pitch_add;
|
||||
}
|
||||
|
||||
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++;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -954,9 +956,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
idx -= w * 2;
|
||||
}
|
||||
|
||||
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++;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -975,7 +977,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return "avi";
|
||||
}
|
||||
|
||||
public bool UsesAudio => parameters.has_audio;
|
||||
public bool UsesAudio => _parameters.has_audio;
|
||||
|
||||
public bool UsesVideo => true;
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
_ffmpeg.BeginErrorReadLine();
|
||||
|
||||
_muxer = new NutMuxer(width, height, fpsnum, fpsden, sampleRate, channels, _ffmpeg.StandardInput.BaseStream);
|
||||
_muxer = new NutMuxer(_width, _height, _fpsnum, _fpsden, _sampleRate, _channels, _ffmpeg.StandardInput.BaseStream);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -160,7 +160,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <summary>
|
||||
/// returns a string containing the commandline sent to ffmpeg and recent console (stderr) output
|
||||
/// </summary>
|
||||
private string ffmpeg_geterror()
|
||||
private string FfmpegGetError()
|
||||
{
|
||||
if (_ffmpeg.StartInfo.RedirectStandardError)
|
||||
{
|
||||
|
@ -182,14 +182,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <exception cref="Exception">FFmpeg call failed</exception>
|
||||
public void AddFrame(IVideoProvider source)
|
||||
{
|
||||
if (source.BufferWidth != width || source.BufferHeight != height)
|
||||
if (source.BufferWidth != _width || source.BufferHeight != _height)
|
||||
{
|
||||
SetVideoParameters(source.BufferWidth, source.BufferHeight);
|
||||
}
|
||||
|
||||
if (_ffmpeg.HasExited)
|
||||
{
|
||||
throw new Exception($"unexpected ffmpeg death:\n{ffmpeg_geterror()}");
|
||||
throw new Exception($"unexpected ffmpeg death:\n{FfmpegGetError()}");
|
||||
}
|
||||
|
||||
var video = source.GetVideoBuffer();
|
||||
|
@ -199,7 +199,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show($"Exception! ffmpeg history:\n{ffmpeg_geterror()}");
|
||||
MessageBox.Show($"Exception! ffmpeg history:\n{FfmpegGetError()}");
|
||||
throw;
|
||||
}
|
||||
|
||||
|
@ -226,9 +226,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <exception cref="ArgumentException"><paramref name="token"/> does not inherit <see cref="FFmpegWriterForm.FormatPreset"/></exception>
|
||||
public void SetVideoCodecToken(IDisposable token)
|
||||
{
|
||||
if (token is FFmpegWriterForm.FormatPreset)
|
||||
if (token is FFmpegWriterForm.FormatPreset preset)
|
||||
{
|
||||
_token = (FFmpegWriterForm.FormatPreset)token;
|
||||
_token = preset;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -239,18 +239,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <summary>
|
||||
/// video params
|
||||
/// </summary>
|
||||
private int fpsnum, fpsden, width, height, sampleRate, channels;
|
||||
private int _fpsnum, _fpsden, _width, _height, _sampleRate, _channels;
|
||||
|
||||
public void SetMovieParameters(int fpsNum, int fpsDen)
|
||||
{
|
||||
this.fpsnum = fpsNum;
|
||||
this.fpsden = fpsDen;
|
||||
_fpsnum = fpsNum;
|
||||
_fpsden = fpsDen;
|
||||
}
|
||||
|
||||
public void SetVideoParameters(int width, int height)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
/* ffmpeg theoretically supports variable resolution videos, but in practice that's not handled very well.
|
||||
* so we start a new segment.
|
||||
|
@ -283,7 +283,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (_ffmpeg.HasExited)
|
||||
{
|
||||
throw new Exception($"unexpected ffmpeg death:\n{ffmpeg_geterror()}");
|
||||
throw new Exception($"unexpected ffmpeg death:\n{FfmpegGetError()}");
|
||||
}
|
||||
|
||||
if (samples.Length == 0)
|
||||
|
@ -298,7 +298,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show($"Exception! ffmpeg history:\n{ffmpeg_geterror()}");
|
||||
MessageBox.Show($"Exception! ffmpeg history:\n{FfmpegGetError()}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -311,8 +311,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
throw new ArgumentOutOfRangeException(nameof(bits), "Sampling depth must be 16 bits!");
|
||||
}
|
||||
|
||||
this.sampleRate = sampleRate;
|
||||
this.channels = channels;
|
||||
this._sampleRate = sampleRate;
|
||||
this._channels = channels;
|
||||
}
|
||||
|
||||
public string DesiredExtension()
|
||||
|
|
|
@ -106,24 +106,24 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <summary>
|
||||
/// true if the first frame has been written to the file; false otherwise
|
||||
/// </summary>
|
||||
private bool firstdone = false;
|
||||
private bool _firstDone;
|
||||
|
||||
/// <summary>
|
||||
/// the underlying stream we're writing to
|
||||
/// </summary>
|
||||
private Stream f;
|
||||
private Stream _f;
|
||||
|
||||
/// <summary>
|
||||
/// a final byte we must write before closing the stream
|
||||
/// </summary>
|
||||
private byte lastbyte;
|
||||
private byte _lastByte;
|
||||
|
||||
/// <summary>
|
||||
/// keep track of skippable frames
|
||||
/// </summary>
|
||||
private int skipindex = 0;
|
||||
private int _skipIndex = 0;
|
||||
|
||||
private int fpsnum = 1, fpsden = 1;
|
||||
private int _fpsNum = 1, _fpsDen = 1;
|
||||
|
||||
public void SetFrame(int frame)
|
||||
{
|
||||
|
@ -131,35 +131,35 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void OpenFile(string baseName)
|
||||
{
|
||||
f = new FileStream(baseName, FileMode.OpenOrCreate, FileAccess.Write);
|
||||
skipindex = _token.Frameskip;
|
||||
_f = new FileStream(baseName, FileMode.OpenOrCreate, FileAccess.Write);
|
||||
_skipIndex = _token.Frameskip;
|
||||
}
|
||||
|
||||
public void CloseFile()
|
||||
{
|
||||
f.WriteByte(lastbyte);
|
||||
f.Close();
|
||||
_f.WriteByte(_lastByte);
|
||||
_f.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// precooked gif header
|
||||
/// </summary>
|
||||
private static byte[] GifAnimation = { 33, 255, 11, 78, 69, 84, 83, 67, 65, 80, 69, 50, 46, 48, 3, 1, 0, 0, 0 };
|
||||
private static readonly byte[] GifAnimation = { 33, 255, 11, 78, 69, 84, 83, 67, 65, 80, 69, 50, 46, 48, 3, 1, 0, 0, 0 };
|
||||
|
||||
/// <summary>
|
||||
/// little endian frame length in 10ms units
|
||||
/// </summary>
|
||||
private byte[] Delay = {100, 0};
|
||||
private readonly byte[] _delay = { 100, 0 };
|
||||
|
||||
public void AddFrame(IVideoProvider source)
|
||||
{
|
||||
if (skipindex == _token.Frameskip)
|
||||
if (_skipIndex == _token.Frameskip)
|
||||
{
|
||||
skipindex = 0;
|
||||
_skipIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
skipindex++;
|
||||
_skipIndex++;
|
||||
return; // skip this frame
|
||||
}
|
||||
|
||||
|
@ -172,22 +172,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
MemoryStream ms = new MemoryStream();
|
||||
qBmp.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
|
||||
byte[] b = ms.GetBuffer();
|
||||
if (!firstdone)
|
||||
if (!_firstDone)
|
||||
{
|
||||
firstdone = true;
|
||||
_firstDone = true;
|
||||
b[10] = (byte)(b[10] & 0x78); // no global color table
|
||||
f.Write(b, 0, 13);
|
||||
f.Write(GifAnimation, 0, GifAnimation.Length);
|
||||
_f.Write(b, 0, 13);
|
||||
_f.Write(GifAnimation, 0, GifAnimation.Length);
|
||||
}
|
||||
|
||||
b[785] = Delay[0];
|
||||
b[786] = Delay[1];
|
||||
b[785] = _delay[0];
|
||||
b[786] = _delay[1];
|
||||
b[798] = (byte)(b[798] | 0x87);
|
||||
f.Write(b, 781, 18);
|
||||
f.Write(b, 13, 768);
|
||||
f.Write(b, 799, (int)(ms.Length - 800));
|
||||
_f.Write(b, 781, 18);
|
||||
_f.Write(b, 13, 768);
|
||||
_f.Write(b, 799, (int)(ms.Length - 800));
|
||||
|
||||
lastbyte = b[ms.Length - 1];
|
||||
_lastByte = b[ms.Length - 1];
|
||||
}
|
||||
|
||||
public void AddSamples(short[] samples)
|
||||
|
@ -210,21 +210,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
int delay;
|
||||
if (_token.FrameDelay == -1)
|
||||
{
|
||||
delay = (100 * fpsden * (_token.Frameskip + 1) + (fpsnum / 2)) / fpsnum;
|
||||
delay = (100 * _fpsDen * (_token.Frameskip + 1) + (_fpsNum / 2)) / _fpsNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
delay = _token.FrameDelay;
|
||||
}
|
||||
|
||||
Delay[0] = (byte)(delay & 0xff);
|
||||
Delay[1] = (byte)(delay >> 8 & 0xff);
|
||||
_delay[0] = (byte)(delay & 0xff);
|
||||
_delay[1] = (byte)(delay >> 8 & 0xff);
|
||||
}
|
||||
|
||||
public void SetMovieParameters(int fpsNum, int fpsDen)
|
||||
{
|
||||
this.fpsnum = fpsNum;
|
||||
this.fpsden = fpsDen;
|
||||
this._fpsNum = fpsNum;
|
||||
this._fpsDen = fpsDen;
|
||||
CalcDelay();
|
||||
}
|
||||
|
||||
|
@ -251,10 +251,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
if (f != null)
|
||||
if (_f != null)
|
||||
{
|
||||
f.Dispose();
|
||||
f = null;
|
||||
_f.Dispose();
|
||||
_f = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -591,7 +591,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
string ext = Path.GetExtension(baseName);
|
||||
if (ext == null || ext.ToLower() != ".jmd")
|
||||
{
|
||||
baseName = baseName + ".jmd";
|
||||
baseName += ".jmd";
|
||||
}
|
||||
|
||||
_jmdFile = new JmdFile(File.Open(baseName, FileMode.Create), _fpsNum, _fpsDen, _audioSampleRate, _audioChannels == 2);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
this.btnExport.TabIndex = 0;
|
||||
this.btnExport.Text = "Export";
|
||||
this.btnExport.UseVisualStyleBackColor = true;
|
||||
this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
|
||||
this.btnExport.Click += new System.EventHandler(this.BtnExport_Click);
|
||||
//
|
||||
// SynclessRecordingTools
|
||||
//
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public string PngPath { get; set; }
|
||||
}
|
||||
|
||||
private void btnExport_Click(object sender, EventArgs e)
|
||||
private void BtnExport_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_mFrameInfos.Count == 0)
|
||||
{
|
||||
|
|
|
@ -29,12 +29,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <summary>
|
||||
/// samplerate in HZ
|
||||
/// </summary>
|
||||
private int _sampleRate;
|
||||
private readonly int _sampleRate;
|
||||
|
||||
/// <summary>
|
||||
/// number of audio channels
|
||||
/// </summary>
|
||||
private int _numChannels;
|
||||
private readonly int _numChannels;
|
||||
|
||||
/// <summary>
|
||||
/// number of bytes of PCM data written to current file
|
||||
|
|
|
@ -58,33 +58,33 @@ namespace BizHawk.Client.EmuHawk
|
|||
public DisplayManager(IGL gl, PresentationPanel presentationPanel, Func<bool> getIsSecondaryThrottlingDisabled)
|
||||
{
|
||||
_getIsSecondaryThrottlingDisabled = getIsSecondaryThrottlingDisabled;
|
||||
GL = gl;
|
||||
_gl = gl;
|
||||
|
||||
// setup the GL context manager, needed for coping with multiple opengl cores vs opengl display method
|
||||
// but is it tho? --yoshi
|
||||
GLManager = GLManager.Instance;
|
||||
_glManager = GLManager.Instance;
|
||||
|
||||
this.presentationPanel = presentationPanel;
|
||||
GraphicsControl = this.presentationPanel.GraphicsControl;
|
||||
CR_GraphicsControl = GLManager.GetContextForGraphicsControl(GraphicsControl);
|
||||
this._presentationPanel = presentationPanel;
|
||||
_graphicsControl = this._presentationPanel.GraphicsControl;
|
||||
_crGraphicsControl = _glManager.GetContextForGraphicsControl(_graphicsControl);
|
||||
|
||||
// it's sort of important for these to be initialized to something nonzero
|
||||
currEmuWidth = currEmuHeight = 1;
|
||||
_currEmuWidth = _currEmuHeight = 1;
|
||||
|
||||
Renderer = GL.CreateRenderer();
|
||||
_renderer = _gl.CreateRenderer();
|
||||
|
||||
VideoTextureFrugalizer = new TextureFrugalizer(GL);
|
||||
_videoTextureFrugalizer = new TextureFrugalizer(_gl);
|
||||
|
||||
ShaderChainFrugalizers = new RenderTargetFrugalizer[16]; // hacky hardcoded limit.. need some other way to manage these
|
||||
_shaderChainFrugalizers = new RenderTargetFrugalizer[16]; // hacky hardcoded limit.. need some other way to manage these
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
ShaderChainFrugalizers[i] = new RenderTargetFrugalizer(GL);
|
||||
_shaderChainFrugalizers[i] = new RenderTargetFrugalizer(_gl);
|
||||
}
|
||||
|
||||
using (var xml = EmuHawk.ReflectionCache.EmbeddedResourceStream("Resources.courier16px.fnt"))
|
||||
{
|
||||
using var tex = EmuHawk.ReflectionCache.EmbeddedResourceStream("Resources.courier16px_0.png");
|
||||
TheOneFont = new StringRenderer(GL, xml, tex);
|
||||
_theOneFont = new StringRenderer(_gl, xml, tex);
|
||||
}
|
||||
|
||||
using (var gens =
|
||||
|
@ -99,23 +99,23 @@ namespace BizHawk.Client.EmuHawk
|
|||
LoadCustomFont(fceux);
|
||||
}
|
||||
|
||||
if (GL is IGL_TK || GL is IGL_SlimDX9)
|
||||
if (_gl is IGL_TK || _gl is IGL_SlimDX9)
|
||||
{
|
||||
var fiHq2x = new FileInfo(Path.Combine(PathUtils.ExeDirectoryPath, "Shaders/BizHawk/hq2x.cgp"));
|
||||
if (fiHq2x.Exists)
|
||||
{
|
||||
using var stream = fiHq2x.OpenRead();
|
||||
ShaderChain_hq2x = new RetroShaderChain(GL, new RetroShaderPreset(stream), Path.Combine(PathUtils.ExeDirectoryPath, "Shaders/BizHawk"));
|
||||
_shaderChainHq2X = new RetroShaderChain(_gl, new RetroShaderPreset(stream), Path.Combine(PathUtils.ExeDirectoryPath, "Shaders/BizHawk"));
|
||||
}
|
||||
var fiScanlines = new FileInfo(Path.Combine(PathUtils.ExeDirectoryPath, "Shaders/BizHawk/BizScanlines.cgp"));
|
||||
if (fiScanlines.Exists)
|
||||
{
|
||||
using var stream = fiScanlines.OpenRead();
|
||||
ShaderChain_scanlines = new RetroShaderChain(GL, new RetroShaderPreset(stream), Path.Combine(PathUtils.ExeDirectoryPath, "Shaders/BizHawk"));
|
||||
_shaderChainScanlines = new RetroShaderChain(_gl, new RetroShaderPreset(stream), Path.Combine(PathUtils.ExeDirectoryPath, "Shaders/BizHawk"));
|
||||
}
|
||||
|
||||
string bicubicPath = "Shaders/BizHawk/bicubic-fast.cgp";
|
||||
if (GL is IGL_SlimDX9)
|
||||
if (_gl is IGL_SlimDX9)
|
||||
{
|
||||
bicubicPath = "Shaders/BizHawk/bicubic-normal.cgp";
|
||||
}
|
||||
|
@ -123,14 +123,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (fiBicubic.Exists)
|
||||
{
|
||||
using var stream = fiBicubic.Open(FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
ShaderChain_bicubic = new RetroShaderChain(GL, new RetroShaderPreset(stream), Path.Combine(PathUtils.ExeDirectoryPath, "Shaders/BizHawk"));
|
||||
_shaderChainBicubic = new RetroShaderChain(_gl, new RetroShaderPreset(stream), Path.Combine(PathUtils.ExeDirectoryPath, "Shaders/BizHawk"));
|
||||
}
|
||||
}
|
||||
|
||||
LuaSurfaceSets["emu"] = new SwappableDisplaySurfaceSet();
|
||||
LuaSurfaceSets["native"] = new SwappableDisplaySurfaceSet();
|
||||
LuaSurfaceFrugalizers["emu"] = new TextureFrugalizer(GL);
|
||||
LuaSurfaceFrugalizers["native"] = new TextureFrugalizer(GL);
|
||||
_luaSurfaceSets["emu"] = new SwappableDisplaySurfaceSet();
|
||||
_luaSurfaceSets["native"] = new SwappableDisplaySurfaceSet();
|
||||
_luaSurfaceFrugalizers["emu"] = new TextureFrugalizer(_gl);
|
||||
_luaSurfaceFrugalizers["native"] = new TextureFrugalizer(_gl);
|
||||
|
||||
RefreshUserShader();
|
||||
}
|
||||
|
@ -141,43 +141,43 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Disposed) return;
|
||||
Disposed = true;
|
||||
VideoTextureFrugalizer.Dispose();
|
||||
foreach (var f in LuaSurfaceFrugalizers.Values)
|
||||
_videoTextureFrugalizer.Dispose();
|
||||
foreach (var f in _luaSurfaceFrugalizers.Values)
|
||||
{
|
||||
f.Dispose();
|
||||
}
|
||||
|
||||
foreach (var f in ShaderChainFrugalizers)
|
||||
foreach (var f in _shaderChainFrugalizers)
|
||||
{
|
||||
f?.Dispose();
|
||||
}
|
||||
|
||||
foreach (var s in new[] { ShaderChain_hq2x, ShaderChain_scanlines, ShaderChain_bicubic, ShaderChain_user })
|
||||
foreach (var s in new[] { _shaderChainHq2X, _shaderChainScanlines, _shaderChainBicubic, _shaderChainUser })
|
||||
{
|
||||
s?.Dispose();
|
||||
}
|
||||
|
||||
TheOneFont.Dispose();
|
||||
Renderer.Dispose();
|
||||
_theOneFont.Dispose();
|
||||
_renderer.Dispose();
|
||||
}
|
||||
|
||||
// rendering resources:
|
||||
private readonly IGL GL;
|
||||
private readonly GLManager GLManager;
|
||||
private readonly StringRenderer TheOneFont;
|
||||
private readonly IGuiRenderer Renderer;
|
||||
private readonly IGL _gl;
|
||||
private readonly GLManager _glManager;
|
||||
private readonly StringRenderer _theOneFont;
|
||||
private readonly IGuiRenderer _renderer;
|
||||
|
||||
// layer resources
|
||||
private readonly PresentationPanel presentationPanel; // well, its the final layer's target, at least
|
||||
private readonly GraphicsControl GraphicsControl; // well, its the final layer's target, at least
|
||||
private readonly GLManager.ContextRef CR_GraphicsControl;
|
||||
private readonly PresentationPanel _presentationPanel; // well, its the final layer's target, at least
|
||||
private readonly GraphicsControl _graphicsControl; // well, its the final layer's target, at least
|
||||
private readonly GLManager.ContextRef _crGraphicsControl;
|
||||
private FilterProgram _currentFilterProgram;
|
||||
|
||||
/// <summary>
|
||||
/// these variables will track the dimensions of the last frame's (or the next frame? this is confusing) emulator native output size
|
||||
/// THIS IS OLD JUNK. I should get rid of it, I think. complex results from the last filter ingestion should be saved instead.
|
||||
/// </summary>
|
||||
private int currEmuWidth, currEmuHeight;
|
||||
private int _currEmuWidth, _currEmuHeight;
|
||||
|
||||
/// <summary>
|
||||
/// additional pixels added at the unscaled level for the use of lua drawing. essentially increases the input video provider dimensions
|
||||
|
@ -194,20 +194,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
public PrivateFontCollection CustomFonts = new PrivateFontCollection();
|
||||
|
||||
private readonly TextureFrugalizer VideoTextureFrugalizer;
|
||||
private readonly Dictionary<string, TextureFrugalizer> LuaSurfaceFrugalizers = new Dictionary<string, TextureFrugalizer>();
|
||||
private readonly RenderTargetFrugalizer[] ShaderChainFrugalizers;
|
||||
private readonly RetroShaderChain ShaderChain_hq2x, ShaderChain_scanlines, ShaderChain_bicubic;
|
||||
private RetroShaderChain ShaderChain_user;
|
||||
private readonly TextureFrugalizer _videoTextureFrugalizer;
|
||||
private readonly Dictionary<string, TextureFrugalizer> _luaSurfaceFrugalizers = new Dictionary<string, TextureFrugalizer>();
|
||||
private readonly RenderTargetFrugalizer[] _shaderChainFrugalizers;
|
||||
private readonly RetroShaderChain _shaderChainHq2X, _shaderChainScanlines, _shaderChainBicubic;
|
||||
private RetroShaderChain _shaderChainUser;
|
||||
|
||||
public void RefreshUserShader()
|
||||
{
|
||||
ShaderChain_user?.Dispose();
|
||||
_shaderChainUser?.Dispose();
|
||||
if (File.Exists(GlobalConfig.DispUserFilterPath))
|
||||
{
|
||||
var fi = new FileInfo(GlobalConfig.DispUserFilterPath);
|
||||
using var stream = fi.OpenRead();
|
||||
ShaderChain_user = new RetroShaderChain(GL, new RetroShaderPreset(stream), Path.GetDirectoryName(GlobalConfig.DispUserFilterPath));
|
||||
_shaderChainUser = new RetroShaderChain(_gl, new RetroShaderPreset(stream), Path.GetDirectoryName(GlobalConfig.DispUserFilterPath));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,20 +245,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
// select user special FX shader chain
|
||||
var selectedChainProperties = new Dictionary<string, object>();
|
||||
RetroShaderChain selectedChain = null;
|
||||
if (GlobalConfig.TargetDisplayFilter == 1 && ShaderChain_hq2x != null && ShaderChain_hq2x.Available)
|
||||
if (GlobalConfig.TargetDisplayFilter == 1 && _shaderChainHq2X != null && _shaderChainHq2X.Available)
|
||||
{
|
||||
selectedChain = ShaderChain_hq2x;
|
||||
selectedChain = _shaderChainHq2X;
|
||||
}
|
||||
|
||||
if (GlobalConfig.TargetDisplayFilter == 2 && ShaderChain_scanlines != null && ShaderChain_scanlines.Available)
|
||||
if (GlobalConfig.TargetDisplayFilter == 2 && _shaderChainScanlines != null && _shaderChainScanlines.Available)
|
||||
{
|
||||
selectedChain = ShaderChain_scanlines;
|
||||
selectedChain = _shaderChainScanlines;
|
||||
selectedChainProperties["uIntensity"] = 1.0f - GlobalConfig.TargetScanlineFilterIntensity / 256.0f;
|
||||
}
|
||||
|
||||
if (GlobalConfig.TargetDisplayFilter == 3 && ShaderChain_user != null && ShaderChain_user.Available)
|
||||
if (GlobalConfig.TargetDisplayFilter == 3 && _shaderChainUser != null && _shaderChainUser.Available)
|
||||
{
|
||||
selectedChain = ShaderChain_user;
|
||||
selectedChain = _shaderChainUser;
|
||||
}
|
||||
|
||||
if (!includeUserFilters)
|
||||
|
@ -277,16 +277,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
var size = fOSD.FindInput().SurfaceFormat.Size;
|
||||
Renderer.Begin(size.Width, size.Height);
|
||||
_renderer.Begin(size.Width, size.Height);
|
||||
var myBlitter = new MyBlitter(this)
|
||||
{
|
||||
ClipBounds = new Rectangle(0, 0, size.Width, size.Height)
|
||||
};
|
||||
Renderer.SetBlendState(GL.BlendNormal);
|
||||
_renderer.SetBlendState(_gl.BlendNormal);
|
||||
OSD.Begin(myBlitter);
|
||||
OSD.DrawScreenInfo(myBlitter);
|
||||
OSD.DrawMessages(myBlitter);
|
||||
Renderer.End();
|
||||
_renderer.End();
|
||||
};
|
||||
|
||||
var chain = new FilterProgram();
|
||||
|
@ -311,8 +311,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
size.Height += padding.Vertical;
|
||||
FinalPresentation fPadding = new FinalPresentation(size);
|
||||
chain.AddFilter(fPadding, "padding");
|
||||
fPadding.GuiRenderer = Renderer;
|
||||
fPadding.GL = GL;
|
||||
fPadding.GuiRenderer = _renderer;
|
||||
fPadding.GL = _gl;
|
||||
fPadding.Config_PadOnly = true;
|
||||
fPadding.Padding = (padding.Left, padding.Top, padding.Right, padding.Bottom);
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//if bicubic is selected and unavailable, don't use it. use bilinear instead I guess
|
||||
if (finalFilter == FinalPresentation.eFilterOption.Bicubic)
|
||||
{
|
||||
if (ShaderChain_bicubic == null || !ShaderChain_bicubic.Available)
|
||||
if (_shaderChainBicubic == null || !_shaderChainBicubic.Available)
|
||||
{
|
||||
finalFilter = FinalPresentation.eFilterOption.Bilinear;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// now if bicubic is chosen, insert it
|
||||
if (finalFilter == FinalPresentation.eFilterOption.Bicubic)
|
||||
{
|
||||
AppendRetroShaderChain(chain, "bicubic", ShaderChain_bicubic, null);
|
||||
AppendRetroShaderChain(chain, "bicubic", _shaderChainBicubic, null);
|
||||
}
|
||||
|
||||
// add final presentation
|
||||
|
@ -397,13 +397,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void AppendLuaLayer(FilterProgram chain, string name)
|
||||
{
|
||||
var luaNativeSurface = LuaSurfaceSets[name].GetCurrent();
|
||||
var luaNativeSurface = _luaSurfaceSets[name].GetCurrent();
|
||||
if (luaNativeSurface == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Texture2d luaNativeTexture = LuaSurfaceFrugalizers[name].Get(luaNativeSurface);
|
||||
Texture2d luaNativeTexture = _luaSurfaceFrugalizers[name].Get(luaNativeSurface);
|
||||
var fLuaLayer = new LuaLayer();
|
||||
fLuaLayer.SetTexture(luaNativeTexture);
|
||||
chain.AddFilter(fLuaLayer, name);
|
||||
|
@ -415,7 +415,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public Point UntransformPoint(Point p)
|
||||
{
|
||||
// first, turn it into a window coordinate
|
||||
p = presentationPanel.Control.PointToClient(p);
|
||||
p = _presentationPanel.Control.PointToClient(p);
|
||||
|
||||
// now, if there's no filter program active, just give up
|
||||
if (_currentFilterProgram == null) return p;
|
||||
|
@ -452,7 +452,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return new Point((int)v.X, (int)v.Y);
|
||||
}
|
||||
|
||||
internal Size GetPanelNativeSize() => presentationPanel.NativeSize;
|
||||
internal Size GetPanelNativeSize() => _presentationPanel.NativeSize;
|
||||
|
||||
/// <summary>
|
||||
/// This will receive an emulated output frame from an IVideoProvider and run it through the complete frame processing pipeline
|
||||
|
@ -468,7 +468,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
VideoProvider = videoProvider,
|
||||
Simulate = displayNothing,
|
||||
ChainOutsize = GraphicsControl.Size,
|
||||
ChainOutsize = _graphicsControl.Size,
|
||||
IncludeOSD = true,
|
||||
IncludeUserFilters = true
|
||||
};
|
||||
|
@ -517,7 +517,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
VideoProvider = videoProvider,
|
||||
Simulate = false,
|
||||
ChainOutsize = GraphicsControl.Size,
|
||||
ChainOutsize = _graphicsControl.Size,
|
||||
Offscreen = true,
|
||||
IncludeOSD = includeOSD,
|
||||
IncludeUserFilters = true,
|
||||
|
@ -757,7 +757,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//no drawing actually happens. it's important not to begin drawing on a control
|
||||
if (!job.Simulate && !job.Offscreen)
|
||||
{
|
||||
GLManager.Activate(CR_GraphicsControl);
|
||||
_glManager.Activate(_crGraphicsControl);
|
||||
|
||||
if (job.ChainOutsize.Width == 0 || job.ChainOutsize.Height == 0)
|
||||
{
|
||||
|
@ -835,7 +835,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
//FYI: this is a million years from happening on n64, since it's all geriatric non-FBO code
|
||||
//is it workable for saturn?
|
||||
videoTexture = GL.WrapGLTexture2d(new IntPtr(videoBuffer[0]), bufferWidth, bufferHeight);
|
||||
videoTexture = _gl.WrapGLTexture2d(new IntPtr(videoBuffer[0]), bufferWidth, bufferHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -844,7 +844,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
bb.DiscardAlpha();
|
||||
|
||||
//now, acquire the data sent from the videoProvider into a texture
|
||||
videoTexture = VideoTextureFrugalizer.Get(bb);
|
||||
videoTexture = _videoTextureFrugalizer.Get(bb);
|
||||
|
||||
// lets not use this. lets define BizwareGL to make clamp by default (TBD: check opengl)
|
||||
//GL.SetTextureWrapMode(videoTexture, true);
|
||||
|
@ -852,15 +852,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// record the size of what we received, since lua and stuff is gonna want to draw onto it
|
||||
currEmuWidth = bufferWidth;
|
||||
currEmuHeight = bufferHeight;
|
||||
_currEmuWidth = bufferWidth;
|
||||
_currEmuHeight = bufferHeight;
|
||||
|
||||
//build the default filter chain and set it up with services filters will need
|
||||
Size chainInsize = new Size(bufferWidth, bufferHeight);
|
||||
|
||||
var filterProgram = BuildDefaultChain(chainInsize, chainOutsize, job.IncludeOSD, job.IncludeUserFilters);
|
||||
filterProgram.GuiRenderer = Renderer;
|
||||
filterProgram.GL = GL;
|
||||
filterProgram.GuiRenderer = _renderer;
|
||||
filterProgram.GL = _gl;
|
||||
|
||||
//setup the source image filter
|
||||
SourceImage fInput = filterProgram["input"] as SourceImage;
|
||||
|
@ -873,22 +873,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
fPresent.VirtualTextureSize = new Size(vw, vh);
|
||||
fPresent.TextureSize = new Size(presenterTextureWidth, presenterTextureHeight);
|
||||
fPresent.BackgroundColor = videoProvider.BackgroundColor;
|
||||
fPresent.GuiRenderer = Renderer;
|
||||
fPresent.GuiRenderer = _renderer;
|
||||
fPresent.Flip = isGlTextureId;
|
||||
fPresent.Config_FixAspectRatio = GlobalConfig.DispFixAspectRatio;
|
||||
fPresent.Config_FixScaleInteger = GlobalConfig.DispFixScaleInteger;
|
||||
fPresent.Padding = (ClientExtraPadding.Left, ClientExtraPadding.Top, ClientExtraPadding.Right, ClientExtraPadding.Bottom);
|
||||
fPresent.AutoPrescale = GlobalConfig.DispAutoPrescale;
|
||||
|
||||
fPresent.GL = GL;
|
||||
fPresent.GL = _gl;
|
||||
}
|
||||
|
||||
//POOPY. why are we delivering the GL context this way? such bad
|
||||
ScreenControlNDS fNDS = filterProgram["CoreScreenControl"] as ScreenControlNDS;
|
||||
if (fNDS != null)
|
||||
{
|
||||
fNDS.GuiRenderer = Renderer;
|
||||
fNDS.GL = GL;
|
||||
fNDS.GuiRenderer = _renderer;
|
||||
fNDS.GL = _gl;
|
||||
}
|
||||
|
||||
filterProgram.Compile("default", chainInsize, chainOutsize, !job.Offscreen);
|
||||
|
@ -910,13 +910,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void Blank()
|
||||
{
|
||||
GLManager.Activate(CR_GraphicsControl);
|
||||
GL.BeginScene();
|
||||
GL.BindRenderTarget(null);
|
||||
GL.SetClearColor(Color.Black);
|
||||
GL.Clear(OpenTK.Graphics.OpenGL.ClearBufferMask.ColorBufferBit);
|
||||
GL.EndScene();
|
||||
presentationPanel.GraphicsControl.SwapBuffers();
|
||||
_glManager.Activate(_crGraphicsControl);
|
||||
_gl.BeginScene();
|
||||
_gl.BindRenderTarget(null);
|
||||
_gl.SetClearColor(Color.Black);
|
||||
_gl.Clear(OpenTK.Graphics.OpenGL.ClearBufferMask.ColorBufferBit);
|
||||
_gl.EndScene();
|
||||
_presentationPanel.GraphicsControl.SwapBuffers();
|
||||
}
|
||||
|
||||
private void UpdateSourceDrawingWork(JobInfo job)
|
||||
|
@ -942,7 +942,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//for now, it's assumed that the presentation panel is the main window, but that may not always be true
|
||||
if (vsync && GlobalConfig.DispAlternateVsync && GlobalConfig.VSyncThrottle)
|
||||
{
|
||||
dx9 = GL as IGL_SlimDX9;
|
||||
dx9 = _gl as IGL_SlimDX9;
|
||||
if (dx9 != null)
|
||||
{
|
||||
alternateVsync = true;
|
||||
|
@ -954,16 +954,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
//TODO - whats so hard about triple buffering anyway? just enable it always, and change api to SetVsync(enable,throttle)
|
||||
//maybe even SetVsync(enable,throttlemethod) or just SetVsync(enable,throttle,advanced)
|
||||
|
||||
if (LastVsyncSetting != vsync || LastVsyncSettingGraphicsControl != presentationPanel.GraphicsControl)
|
||||
if (_lastVsyncSetting != vsync || _lastVsyncSettingGraphicsControl != _presentationPanel.GraphicsControl)
|
||||
{
|
||||
if (LastVsyncSetting == null && vsync)
|
||||
if (_lastVsyncSetting == null && vsync)
|
||||
{
|
||||
// Workaround for vsync not taking effect at startup (Intel graphics related?)
|
||||
presentationPanel.GraphicsControl.SetVsync(false);
|
||||
_presentationPanel.GraphicsControl.SetVsync(false);
|
||||
}
|
||||
presentationPanel.GraphicsControl.SetVsync(vsync);
|
||||
LastVsyncSettingGraphicsControl = presentationPanel.GraphicsControl;
|
||||
LastVsyncSetting = vsync;
|
||||
_presentationPanel.GraphicsControl.SetVsync(vsync);
|
||||
_lastVsyncSettingGraphicsControl = _presentationPanel.GraphicsControl;
|
||||
_lastVsyncSetting = vsync;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -975,9 +975,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
//TODO - auto-create and age these (and dispose when old)
|
||||
int rtCounter = 0;
|
||||
|
||||
_currentFilterProgram.RenderTargetProvider = new DisplayManagerRenderTargetProvider(size => ShaderChainFrugalizers[rtCounter++].Get(size));
|
||||
_currentFilterProgram.RenderTargetProvider = new DisplayManagerRenderTargetProvider(size => _shaderChainFrugalizers[rtCounter++].Get(size));
|
||||
|
||||
GL.BeginScene();
|
||||
_gl.BeginScene();
|
||||
|
||||
// run filter chain
|
||||
Texture2d texCurr = null;
|
||||
|
@ -1007,7 +1007,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
case FilterProgram.ProgramStepType.NewTarget:
|
||||
{
|
||||
var size = (Size)step.Args;
|
||||
rtCurr = ShaderChainFrugalizers[rtCounter++].Get(size);
|
||||
rtCurr = _shaderChainFrugalizers[rtCounter++].Get(size);
|
||||
rtCurr.Bind();
|
||||
_currentFilterProgram.CurrRenderTarget = rtCurr;
|
||||
break;
|
||||
|
@ -1017,13 +1017,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
inFinalTarget = true;
|
||||
rtCurr = null;
|
||||
_currentFilterProgram.CurrRenderTarget = null;
|
||||
GL.BindRenderTarget(null);
|
||||
_gl.BindRenderTarget(null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL.EndScene();
|
||||
_gl.EndScene();
|
||||
|
||||
if (job.Offscreen)
|
||||
{
|
||||
|
@ -1038,7 +1038,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (alternateVsync) dx9.AlternateVsyncPass(0);
|
||||
|
||||
// present and conclude drawing
|
||||
presentationPanel.GraphicsControl.SwapBuffers();
|
||||
_presentationPanel.GraphicsControl.SwapBuffers();
|
||||
|
||||
// wait for vsync to end
|
||||
if (alternateVsync) dx9.AlternateVsyncPass(1);
|
||||
|
@ -1059,20 +1059,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
Marshal.FreeCoTaskMem(data);
|
||||
}
|
||||
|
||||
private bool? LastVsyncSetting;
|
||||
private GraphicsControl LastVsyncSettingGraphicsControl;
|
||||
private bool? _lastVsyncSetting;
|
||||
private GraphicsControl _lastVsyncSettingGraphicsControl;
|
||||
|
||||
private readonly Dictionary<string, DisplaySurface> MapNameToLuaSurface = new Dictionary<string,DisplaySurface>();
|
||||
private readonly Dictionary<DisplaySurface, string> MapLuaSurfaceToName = new Dictionary<DisplaySurface, string>();
|
||||
private readonly Dictionary<string, SwappableDisplaySurfaceSet> LuaSurfaceSets = new Dictionary<string, SwappableDisplaySurfaceSet>();
|
||||
private readonly Dictionary<string, DisplaySurface> _mapNameToLuaSurface = new Dictionary<string,DisplaySurface>();
|
||||
private readonly Dictionary<DisplaySurface, string> _mapLuaSurfaceToName = new Dictionary<DisplaySurface, string>();
|
||||
private readonly Dictionary<string, SwappableDisplaySurfaceSet> _luaSurfaceSets = new Dictionary<string, SwappableDisplaySurfaceSet>();
|
||||
|
||||
/// <summary>
|
||||
/// Peeks a locked lua surface, or returns null if it isn't locked
|
||||
/// </summary>
|
||||
public DisplaySurface PeekLockedLuaSurface(string name)
|
||||
{
|
||||
if (MapNameToLuaSurface.ContainsKey(name))
|
||||
return MapNameToLuaSurface[name];
|
||||
if (_mapNameToLuaSurface.ContainsKey(name))
|
||||
return _mapNameToLuaSurface[name];
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1080,20 +1080,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <exception cref="InvalidOperationException">already locked, or unknown surface</exception>
|
||||
public DisplaySurface LockLuaSurface(string name, bool clear=true)
|
||||
{
|
||||
if (MapNameToLuaSurface.ContainsKey(name))
|
||||
if (_mapNameToLuaSurface.ContainsKey(name))
|
||||
{
|
||||
throw new InvalidOperationException($"Lua surface is already locked: {name}");
|
||||
}
|
||||
|
||||
if (!LuaSurfaceSets.TryGetValue(name, out var sdss))
|
||||
if (!_luaSurfaceSets.TryGetValue(name, out var sdss))
|
||||
{
|
||||
sdss = new SwappableDisplaySurfaceSet();
|
||||
LuaSurfaceSets.Add(name, sdss);
|
||||
_luaSurfaceSets.Add(name, sdss);
|
||||
}
|
||||
|
||||
// placeholder logic for more abstracted surface definitions from filter chain
|
||||
int currNativeWidth = presentationPanel.NativeSize.Width;
|
||||
int currNativeHeight = presentationPanel.NativeSize.Height;
|
||||
int currNativeWidth = _presentationPanel.NativeSize.Width;
|
||||
int currNativeHeight = _presentationPanel.NativeSize.Height;
|
||||
|
||||
currNativeWidth += ClientExtraPadding.Horizontal;
|
||||
currNativeHeight += ClientExtraPadding.Vertical;
|
||||
|
@ -1101,8 +1101,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
int width,height;
|
||||
if (name == "emu")
|
||||
{
|
||||
width = currEmuWidth;
|
||||
height = currEmuHeight;
|
||||
width = _currEmuWidth;
|
||||
height = _currEmuHeight;
|
||||
width += GameExtraPadding.Horizontal;
|
||||
height += GameExtraPadding.Vertical;
|
||||
}
|
||||
|
@ -1113,14 +1113,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
else throw new InvalidOperationException($"Unknown lua surface name: {name}");
|
||||
|
||||
DisplaySurface ret = sdss.AllocateSurface(width, height, clear);
|
||||
MapNameToLuaSurface[name] = ret;
|
||||
MapLuaSurfaceToName[ret] = name;
|
||||
_mapNameToLuaSurface[name] = ret;
|
||||
_mapLuaSurfaceToName[ret] = name;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void ClearLuaSurfaces()
|
||||
{
|
||||
foreach (var kvp in LuaSurfaceSets)
|
||||
foreach (var kvp in _luaSurfaceSets)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1136,7 +1136,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
UnlockLuaSurface(surfLocked);
|
||||
}
|
||||
|
||||
LuaSurfaceSets[kvp.Key].SetPending(null);
|
||||
_luaSurfaceSets[kvp.Key].SetPending(null);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
|
@ -1148,15 +1148,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <exception cref="InvalidOperationException">already unlocked</exception>
|
||||
public void UnlockLuaSurface(DisplaySurface surface)
|
||||
{
|
||||
if (!MapLuaSurfaceToName.ContainsKey(surface))
|
||||
if (!_mapLuaSurfaceToName.ContainsKey(surface))
|
||||
{
|
||||
throw new InvalidOperationException("Surface was not locked as a lua surface");
|
||||
}
|
||||
|
||||
string name = MapLuaSurfaceToName[surface];
|
||||
MapLuaSurfaceToName.Remove(surface);
|
||||
MapNameToLuaSurface.Remove(name);
|
||||
LuaSurfaceSets[name].SetPending(surface);
|
||||
string name = _mapLuaSurfaceToName[surface];
|
||||
_mapLuaSurfaceToName.Remove(surface);
|
||||
_mapNameToLuaSurface.Remove(name);
|
||||
_luaSurfaceSets[name].SetPending(surface);
|
||||
}
|
||||
|
||||
// helper classes:
|
||||
|
@ -1181,15 +1181,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
IBlitterFont IBlitter.GetFontType(string fontType)
|
||||
{
|
||||
return new FontWrapper(_owner.TheOneFont);
|
||||
return new FontWrapper(_owner._theOneFont);
|
||||
}
|
||||
|
||||
void IBlitter.DrawString(string s, IBlitterFont font, Color color, float x, float y)
|
||||
{
|
||||
var stringRenderer = ((FontWrapper)font).Font;
|
||||
_owner.Renderer.SetModulateColor(color);
|
||||
stringRenderer.RenderString(_owner.Renderer, x, y, s);
|
||||
_owner.Renderer.SetModulateColorWhite();
|
||||
_owner._renderer.SetModulateColor(color);
|
||||
stringRenderer.RenderString(_owner._renderer, x, y, s);
|
||||
_owner._renderer.SetModulateColorWhite();
|
||||
}
|
||||
|
||||
SizeF IBlitter.MeasureString(string s, IBlitterFont font)
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public static Input Instance => _instance.Value;
|
||||
|
||||
private readonly Thread UpdateThread;
|
||||
private readonly Thread _updateThread;
|
||||
|
||||
public readonly HostInputAdapter Adapter = GlobalWin.Config.HostInputMethod switch
|
||||
{
|
||||
|
@ -122,12 +122,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
private Input()
|
||||
{
|
||||
Adapter.UpdateConfig(GlobalWin.Config);
|
||||
UpdateThread = new Thread(UpdateThreadProc)
|
||||
_updateThread = new Thread(UpdateThreadProc)
|
||||
{
|
||||
IsBackground = true,
|
||||
Priority = ThreadPriority.AboveNormal // why not? this thread shouldn't be very heavy duty, and we want it to be responsive
|
||||
};
|
||||
UpdateThread.Start();
|
||||
_updateThread.Start();
|
||||
}
|
||||
|
||||
public enum InputEventType
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.btnClose.TabIndex = 2;
|
||||
this.btnClose.Text = "Close";
|
||||
this.btnClose.UseVisualStyleBackColor = true;
|
||||
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
|
||||
this.btnClose.Click += new System.EventHandler(this.BtnClose_Click);
|
||||
//
|
||||
// btnClear
|
||||
//
|
||||
|
@ -61,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.btnClear.TabIndex = 1;
|
||||
this.btnClear.Text = "&Clear";
|
||||
this.btnClear.UseVisualStyleBackColor = true;
|
||||
this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
|
||||
this.btnClear.Click += new System.EventHandler(this.BtnClear_Click);
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
|
|
|
@ -88,14 +88,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void btnClear_Click(object sender, EventArgs e)
|
||||
private void BtnClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
_lines.Clear();
|
||||
virtualListView1.VirtualListSize = 0;
|
||||
virtualListView1.SelectedIndices.Clear();
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, EventArgs e)
|
||||
private void BtnClose_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
this.btnOk.TabIndex = 4;
|
||||
this.btnOk.Text = "OK";
|
||||
this.btnOk.UseVisualStyleBackColor = true;
|
||||
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
|
||||
this.btnOk.Click += new System.EventHandler(this.BtnOk_Click);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
|
@ -190,7 +190,7 @@
|
|||
this.btnSelectUserFilter.TabIndex = 5;
|
||||
this.btnSelectUserFilter.Text = "Select";
|
||||
this.btnSelectUserFilter.UseVisualStyleBackColor = true;
|
||||
this.btnSelectUserFilter.Click += new System.EventHandler(this.btnSelectUserFilter_Click);
|
||||
this.btnSelectUserFilter.Click += new System.EventHandler(this.BtnSelectUserFilter_Click);
|
||||
//
|
||||
// rbUser
|
||||
//
|
||||
|
@ -213,8 +213,8 @@
|
|||
this.tbScanlineIntensity.TabIndex = 3;
|
||||
this.tbScanlineIntensity.TickFrequency = 32;
|
||||
this.tbScanlineIntensity.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
|
||||
this.tbScanlineIntensity.Scroll += new System.EventHandler(this.tbScanlineIntensity_Scroll);
|
||||
this.tbScanlineIntensity.ValueChanged += new System.EventHandler(this.tbScanlineIntensity_Scroll);
|
||||
this.tbScanlineIntensity.Scroll += new System.EventHandler(this.TbScanlineIntensity_Scroll);
|
||||
this.tbScanlineIntensity.ValueChanged += new System.EventHandler(this.TbScanlineIntensity_Scroll);
|
||||
//
|
||||
// rbNone
|
||||
//
|
||||
|
@ -258,7 +258,7 @@
|
|||
this.checkLetterbox.TabIndex = 8;
|
||||
this.checkLetterbox.Text = "Maintain aspect ratio (letterbox)";
|
||||
this.checkLetterbox.UseVisualStyleBackColor = true;
|
||||
this.checkLetterbox.CheckedChanged += new System.EventHandler(this.checkLetterbox_CheckedChanged);
|
||||
this.checkLetterbox.CheckedChanged += new System.EventHandler(this.CheckLetterbox_CheckedChanged);
|
||||
//
|
||||
// checkPadInteger
|
||||
//
|
||||
|
@ -269,7 +269,7 @@
|
|||
this.checkPadInteger.TabIndex = 9;
|
||||
this.checkPadInteger.Text = "Expand pixels by integers only (e.g. no 1.3333x)";
|
||||
this.checkPadInteger.UseVisualStyleBackColor = true;
|
||||
this.checkPadInteger.CheckedChanged += new System.EventHandler(this.checkPadInteger_CheckedChanged);
|
||||
this.checkPadInteger.CheckedChanged += new System.EventHandler(this.CheckPadInteger_CheckedChanged);
|
||||
//
|
||||
// grpFinalFilter
|
||||
//
|
||||
|
@ -326,7 +326,7 @@
|
|||
this.rbUseRaw.TabStop = true;
|
||||
this.rbUseRaw.Text = "Use 1:1 pixel size (for crispness or debugging)";
|
||||
this.rbUseRaw.UseVisualStyleBackColor = true;
|
||||
this.rbUseRaw.CheckedChanged += new System.EventHandler(this.rbUseRaw_CheckedChanged);
|
||||
this.rbUseRaw.CheckedChanged += new System.EventHandler(this.RbUseRaw_CheckedChanged);
|
||||
//
|
||||
// rbUseSystem
|
||||
//
|
||||
|
@ -338,7 +338,7 @@
|
|||
this.rbUseSystem.TabStop = true;
|
||||
this.rbUseSystem.Text = "Use system\'s recommendation";
|
||||
this.rbUseSystem.UseVisualStyleBackColor = true;
|
||||
this.rbUseSystem.CheckedChanged += new System.EventHandler(this.rbUseSystem_CheckedChanged);
|
||||
this.rbUseSystem.CheckedChanged += new System.EventHandler(this.RbUseSystem_CheckedChanged);
|
||||
//
|
||||
// grpARSelection
|
||||
//
|
||||
|
@ -565,7 +565,7 @@
|
|||
this.btnDefaults.Text = "Defaults";
|
||||
this.toolTip1.SetToolTip(this.btnDefaults, "Unless I forgot to update the button\'s code when I changed a default");
|
||||
this.btnDefaults.UseVisualStyleBackColor = true;
|
||||
this.btnDefaults.Click += new System.EventHandler(this.btnDefaults_Click);
|
||||
this.btnDefaults.Click += new System.EventHandler(this.BtnDefaults_Click);
|
||||
//
|
||||
// cbAutoPrescale
|
||||
//
|
||||
|
@ -649,8 +649,8 @@
|
|||
this.label13.Location = new System.Drawing.Point(45, 60);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Text = resources.GetString("label13.Text");
|
||||
this.label13.Click += new System.EventHandler(this.label13_Click);
|
||||
this.label13.DoubleClick += new System.EventHandler(this.label13_Click);
|
||||
this.label13.Click += new System.EventHandler(this.Label13_Click);
|
||||
this.label13.DoubleClick += new System.EventHandler(this.Label13_Click);
|
||||
//
|
||||
// cbAlternateVsync
|
||||
//
|
||||
|
@ -937,7 +937,7 @@
|
|||
this.linkLabel1.TabIndex = 18;
|
||||
this.linkLabel1.TabStop = true;
|
||||
this.linkLabel1.Text = "Documentation";
|
||||
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
|
||||
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabel1_LinkClicked);
|
||||
//
|
||||
// DisplayConfigLite
|
||||
//
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void btnOk_Click(object sender, EventArgs e)
|
||||
private void BtnOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (rbNone.Checked)
|
||||
_config.TargetDisplayFilter = 0;
|
||||
|
@ -243,7 +243,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
lblUserFilterName.Text = Path.GetFileNameWithoutExtension(_pathSelection);
|
||||
}
|
||||
|
||||
private void btnSelectUserFilter_Click(object sender, EventArgs e)
|
||||
private void BtnSelectUserFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
|
@ -283,22 +283,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void checkLetterbox_CheckedChanged(object sender, EventArgs e)
|
||||
private void CheckLetterbox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshAspectRatioOptions();
|
||||
}
|
||||
|
||||
private void checkPadInteger_CheckedChanged(object sender, EventArgs e)
|
||||
private void CheckPadInteger_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshAspectRatioOptions();
|
||||
}
|
||||
|
||||
private void rbUseRaw_CheckedChanged(object sender, EventArgs e)
|
||||
private void RbUseRaw_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshAspectRatioOptions();
|
||||
}
|
||||
|
||||
private void rbUseSystem_CheckedChanged(object sender, EventArgs e)
|
||||
private void RbUseSystem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshAspectRatioOptions();
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
checkPadInteger.Enabled = checkLetterbox.Checked;
|
||||
}
|
||||
|
||||
public void tbScanlineIntensity_Scroll(object sender, EventArgs e)
|
||||
public void TbScanlineIntensity_Scroll(object sender, EventArgs e)
|
||||
{
|
||||
_config.TargetScanlineFilterIntensity = tbScanlineIntensity.Value;
|
||||
int scanlines = _config.TargetScanlineFilterIntensity;
|
||||
|
@ -340,17 +340,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start("http://tasvideos.org/Bizhawk/DisplayConfig.html");
|
||||
}
|
||||
|
||||
private void label13_Click(object sender, EventArgs e)
|
||||
private void Label13_Click(object sender, EventArgs e)
|
||||
{
|
||||
cbAlternateVsync.Checked ^= true;
|
||||
}
|
||||
|
||||
private void btnDefaults_Click(object sender, EventArgs e)
|
||||
private void BtnDefaults_Click(object sender, EventArgs e)
|
||||
{
|
||||
nudPrescale.Value = 1;
|
||||
rbNone.Checked = true;
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.lvFirmwares.TabIndex = 24;
|
||||
this.lvFirmwares.UseCompatibleStateImageBehavior = false;
|
||||
this.lvFirmwares.View = System.Windows.Forms.View.Details;
|
||||
this.lvFirmwares.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvFirmwares_ColumnClick);
|
||||
this.lvFirmwares.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.LvFirmwares_ColumnClick);
|
||||
this.lvFirmwares.DragDrop += new System.Windows.Forms.DragEventHandler(this.LvFirmwares_DragDrop);
|
||||
this.lvFirmwares.DragEnter += new System.Windows.Forms.DragEventHandler(this.LvFirmwares_DragEnter);
|
||||
this.lvFirmwares.KeyDown += new System.Windows.Forms.KeyEventHandler(this.LvFirmwares_KeyDown);
|
||||
|
|
|
@ -234,7 +234,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
lvFirmwares.ShowGroups = !lvFirmwares.ShowGroups;
|
||||
}
|
||||
|
||||
private void lvFirmwares_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||
private void LvFirmwares_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||
{
|
||||
if (_listViewSorter.Column != e.Column)
|
||||
{
|
||||
|
|
|
@ -222,17 +222,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
// _1ByteMenuItem
|
||||
//
|
||||
this._1ByteMenuItem.Text = "1 Byte";
|
||||
this._1ByteMenuItem.Click += new System.EventHandler(this._1ByteMenuItem_Click);
|
||||
this._1ByteMenuItem.Click += new System.EventHandler(this.OneByteMenuItem_Click);
|
||||
//
|
||||
// _2ByteMenuItem
|
||||
//
|
||||
this._2ByteMenuItem.Text = "2 Bytes";
|
||||
this._2ByteMenuItem.Click += new System.EventHandler(this._2ByteMenuItem_Click);
|
||||
this._2ByteMenuItem.Click += new System.EventHandler(this.TwoByteMenuItem_Click);
|
||||
//
|
||||
// _4ByteMenuItem
|
||||
//
|
||||
this._4ByteMenuItem.Text = "4 Bytes";
|
||||
this._4ByteMenuItem.Click += new System.EventHandler(this._4ByteMenuItem_Click);
|
||||
this._4ByteMenuItem.Click += new System.EventHandler(this.FourByteMenuItem_Click);
|
||||
//
|
||||
// BigEndianMenuItem
|
||||
//
|
||||
|
@ -342,7 +342,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.toolTip1.SetToolTip(this.btnCopyBestInput, "\"Copy to Clipboard. Then possible to paste to text file or directly into TasStud" +
|
||||
"io.");
|
||||
this.btnCopyBestInput.UseVisualStyleBackColor = true;
|
||||
this.btnCopyBestInput.Click += new System.EventHandler(this.btnCopyBestInput_Click);
|
||||
this.btnCopyBestInput.Click += new System.EventHandler(this.BtnCopyBestInput_Click);
|
||||
//
|
||||
// PlayBestButton
|
||||
//
|
||||
|
|
|
@ -405,17 +405,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
_4ByteMenuItem.Checked = _dataSize == 4;
|
||||
}
|
||||
|
||||
private void _1ByteMenuItem_Click(object sender, EventArgs e)
|
||||
private void OneByteMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_dataSize = 1;
|
||||
}
|
||||
|
||||
private void _2ByteMenuItem_Click(object sender, EventArgs e)
|
||||
private void TwoByteMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_dataSize = 2;
|
||||
}
|
||||
|
||||
private void _4ByteMenuItem_Click(object sender, EventArgs e)
|
||||
private void FourByteMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_dataSize = 4;
|
||||
}
|
||||
|
@ -1182,7 +1182,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// Copy to Clipboard
|
||||
private void btnCopyBestInput_Click(object sender, EventArgs e)
|
||||
private void BtnCopyBestInput_Click(object sender, EventArgs e)
|
||||
{
|
||||
Clipboard.SetText(BestAttemptLogLabel.Text);
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(268, 147);
|
||||
this.listBox1.TabIndex = 2;
|
||||
this.listBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.listBox1_DragDrop);
|
||||
this.listBox1.DragEnter += new System.Windows.Forms.DragEventHandler(this.listBox1_DragEnter);
|
||||
this.listBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.ListBox1_DragDrop);
|
||||
this.listBox1.DragEnter += new System.Windows.Forms.DragEventHandler(this.ListBox1_DragEnter);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
|
@ -72,7 +72,7 @@
|
|||
this.buttonClear.TabIndex = 4;
|
||||
this.buttonClear.Text = "Clear!";
|
||||
this.buttonClear.UseVisualStyleBackColor = true;
|
||||
this.buttonClear.Click += new System.EventHandler(this.buttonClear_Click);
|
||||
this.buttonClear.Click += new System.EventHandler(this.ButtonClear_Click);
|
||||
//
|
||||
// buttonGo
|
||||
//
|
||||
|
@ -82,7 +82,7 @@
|
|||
this.buttonGo.TabIndex = 5;
|
||||
this.buttonGo.Text = "Go!";
|
||||
this.buttonGo.UseVisualStyleBackColor = true;
|
||||
this.buttonGo.Click += new System.EventHandler(this.buttonGo_Click);
|
||||
this.buttonGo.Click += new System.EventHandler(this.ButtonGo_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
|
@ -123,7 +123,7 @@
|
|||
this.buttonDump.TabIndex = 10;
|
||||
this.buttonDump.Text = "Dump...";
|
||||
this.buttonDump.UseVisualStyleBackColor = true;
|
||||
this.buttonDump.Click += new System.EventHandler(this.buttonDump_Click);
|
||||
this.buttonDump.Click += new System.EventHandler(this.ButtonDump_Click);
|
||||
//
|
||||
// BatchRun
|
||||
//
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void listBox1_DragEnter(object sender, DragEventArgs e)
|
||||
private void ListBox1_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Set(DragDropEffects.Link);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
label2.Text = $"Number of files: {listBox1.Items.Count}";
|
||||
}
|
||||
|
||||
private void listBox1_DragDrop(object sender, DragEventArgs e)
|
||||
private void ListBox1_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
{
|
||||
|
@ -42,13 +42,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void buttonClear_Click(object sender, EventArgs e)
|
||||
private void ButtonClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
listBox1.Items.Clear();
|
||||
SetCount();
|
||||
}
|
||||
|
||||
private void buttonGo_Click(object sender, EventArgs e)
|
||||
private void ButtonGo_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_thread != null)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
label3.Text = "Status: Running...";
|
||||
int numFrames = (int)numericUpDownFrames.Value;
|
||||
List<string> files = new List<string>(listBox1.Items.Count);
|
||||
var files = new List<string>(listBox1.Items.Count);
|
||||
foreach (string s in listBox1.Items)
|
||||
{
|
||||
files.Add(s);
|
||||
|
@ -88,7 +88,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var pp = (Tuple<int, List<string>>)o;
|
||||
BatchRunner br = new BatchRunner(_createCoreComm(), pp.Item2, pp.Item1);
|
||||
br.OnProgress += br_OnProgress;
|
||||
br.OnProgress += BrOnProgress;
|
||||
var results = br.Run();
|
||||
this.Invoke(() => { label3.Text = "Status: Finished!"; _mostRecentResults = results; });
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.Invoke(() => _thread = null);
|
||||
}
|
||||
|
||||
private void br_OnProgress(object sender, BatchRunner.ProgressEventArgs e)
|
||||
private void BrOnProgress(object sender, BatchRunner.ProgressEventArgs e)
|
||||
{
|
||||
this.Invoke(() => ProgressUpdate(e.Completed, e.Total));
|
||||
e.ShouldCancel = false;
|
||||
|
@ -115,7 +115,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void buttonDump_Click(object sender, EventArgs e)
|
||||
private void ButtonDump_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_mostRecentResults != null)
|
||||
{
|
||||
|
|
|
@ -54,10 +54,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
[RequiredService]
|
||||
private ICodeDataLogger CodeDataLogger
|
||||
{
|
||||
get
|
||||
{
|
||||
return _icdlogger;
|
||||
}
|
||||
get => _icdlogger;
|
||||
set
|
||||
{
|
||||
_icdlogger?.SetCDL(null);
|
||||
|
@ -556,16 +553,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void tsbViewStyle_SelectedIndexChanged(object sender, EventArgs e)
|
||||
private void TsbViewStyle_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateDisplay(true);
|
||||
}
|
||||
|
||||
private void tsbLoggingActive_CheckedChanged(object sender, EventArgs e)
|
||||
private void TsbLoggingActive_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (tsbLoggingActive.Checked && _cdl == null)
|
||||
{
|
||||
//implicitly create a new file
|
||||
// implicitly create a new file
|
||||
NewFileLogic();
|
||||
}
|
||||
|
||||
|
@ -575,13 +572,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
CodeDataLogger.SetCDL(null);
|
||||
}
|
||||
|
||||
private void lvCDL_QueryItemText(int index, RollColumn column, out string text, ref int offsetX, ref int offsetY)
|
||||
private void LvCDL_QueryItemText(int index, RollColumn column, out string text, ref int offsetX, ref int offsetY)
|
||||
{
|
||||
var subItem = lvCDL.AllColumns.IndexOf(column);
|
||||
text = _listContents[index][subItem];
|
||||
}
|
||||
|
||||
private void tsbExportText_Click(object sender, EventArgs e)
|
||||
private void TsbExportText_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var sw = new StringWriter();
|
||||
foreach(var line in _listContents)
|
||||
|
@ -593,17 +590,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
Clipboard.SetText(sw.ToString());
|
||||
}
|
||||
|
||||
private void miAutoSave_Click(object sender, EventArgs e)
|
||||
private void MiAutoSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
CDLAutoSave ^= true;
|
||||
}
|
||||
|
||||
private void miAutoStart_Click(object sender, EventArgs e)
|
||||
private void MiAutoStart_Click(object sender, EventArgs e)
|
||||
{
|
||||
CDLAutoStart ^= true;
|
||||
}
|
||||
|
||||
private void miAutoResume_Click(object sender, EventArgs e)
|
||||
private void MiAutoResume_Click(object sender, EventArgs e)
|
||||
{
|
||||
CDLAutoResume ^= true;
|
||||
}
|
||||
|
|
|
@ -125,12 +125,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
// miAutoStart
|
||||
//
|
||||
this.miAutoStart.Text = "Auto-Start";
|
||||
this.miAutoStart.Click += new System.EventHandler(this.miAutoStart_Click);
|
||||
this.miAutoStart.Click += new System.EventHandler(this.MiAutoStart_Click);
|
||||
//
|
||||
// miAutoSave
|
||||
//
|
||||
this.miAutoSave.Text = "Auto-Save";
|
||||
this.miAutoSave.Click += new System.EventHandler(this.miAutoSave_Click);
|
||||
this.miAutoSave.Click += new System.EventHandler(this.MiAutoSave_Click);
|
||||
//
|
||||
// ClearMenuItem
|
||||
//
|
||||
|
@ -163,7 +163,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.tsbLoggingActive.Name = "tsbLoggingActive";
|
||||
this.tsbLoggingActive.Size = new System.Drawing.Size(41, 22);
|
||||
this.tsbLoggingActive.Text = "Active";
|
||||
this.tsbLoggingActive.CheckedChanged += new System.EventHandler(this.tsbLoggingActive_CheckedChanged);
|
||||
this.tsbLoggingActive.CheckedChanged += new System.EventHandler(this.TsbLoggingActive_CheckedChanged);
|
||||
//
|
||||
// tsbViewUpdate
|
||||
//
|
||||
|
@ -185,7 +185,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"Show KBytes"});
|
||||
this.tsbViewStyle.Name = "tsbViewStyle";
|
||||
this.tsbViewStyle.Size = new System.Drawing.Size(121, 25);
|
||||
this.tsbViewStyle.SelectedIndexChanged += new System.EventHandler(this.tsbViewStyle_SelectedIndexChanged);
|
||||
this.tsbViewStyle.SelectedIndexChanged += new System.EventHandler(this.TsbViewStyle_SelectedIndexChanged);
|
||||
//
|
||||
// tsbExportText
|
||||
//
|
||||
|
@ -193,7 +193,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.tsbExportText.Name = "tsbExportText";
|
||||
this.tsbExportText.Size = new System.Drawing.Size(87, 22);
|
||||
this.tsbExportText.Text = "To Clipboard";
|
||||
this.tsbExportText.Click += new System.EventHandler(this.tsbExportText_Click);
|
||||
this.tsbExportText.Click += new System.EventHandler(this.TsbExportText_Click);
|
||||
//
|
||||
// lvCDL
|
||||
//
|
||||
|
@ -208,12 +208,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.lvCDL.TabIndex = 9;
|
||||
this.lvCDL.AllowColumnReorder = false;
|
||||
this.lvCDL.AllowColumnResize = true;
|
||||
this.lvCDL.QueryItemText += new InputRoll.QueryItemTextHandler(this.lvCDL_QueryItemText);
|
||||
this.lvCDL.QueryItemText += new InputRoll.QueryItemTextHandler(this.LvCDL_QueryItemText);
|
||||
//
|
||||
// miAutoResume
|
||||
//
|
||||
this.miAutoResume.Text = "Auto-Resume";
|
||||
this.miAutoResume.Click += new System.EventHandler(this.miAutoResume_Click);
|
||||
this.miAutoResume.Click += new System.EventHandler(this.MiAutoResume_Click);
|
||||
//
|
||||
// CDL
|
||||
//
|
||||
|
|
|
@ -788,9 +788,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (MessageBox.Show($"Bad data between frames {lastState} and {Emulator.Frame}. Save the relevant state (raw data)?", "Integrity Failed!", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
var sfd = new SaveFileDialog();
|
||||
sfd.FileName = "integrity.fresh";
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
var sfd = new SaveFileDialog { FileName = "integrity.fresh" };
|
||||
if (sfd.ShowDialog().IsOk())
|
||||
{
|
||||
File.WriteAllBytes(sfd.FileName, state);
|
||||
var path = Path.ChangeExtension(sfd.FileName, ".greenzoned");
|
||||
|
|
Loading…
Reference in New Issue