Merge branch 'master' into MoreUnixMonoCompatWork

This commit is contained in:
adelikat 2019-11-03 12:55:53 -06:00
commit b9ade1a555
57 changed files with 685 additions and 2026 deletions

2
.gitignore vendored
View File

@ -2,7 +2,7 @@
/snes9xgit
svnrev.cs
.vs/**
**/.vs/**
**/bin/**
**/obj/**
/output/**

View File

@ -49,8 +49,7 @@
<Reference Include="Ionic.Zip">
<HintPath>..\References\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
<SpecificVersion>False</SpecificVersion>
<Reference Include="Newtonsoft.Json">
<HintPath>..\References\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLua">

View File

@ -17,7 +17,6 @@ namespace BizHawk.Client.Common
Serializer = new JsonSerializer
{
MissingMemberHandling = MissingMemberHandling.Ignore,
MissingTypeHandling = MissingTypeHandling.Ignore,
TypeNameHandling = TypeNameHandling.Auto,
ConstructorHandling = ConstructorHandling.Default,

View File

@ -16,7 +16,6 @@ namespace BizHawk.Client.Common
}
private readonly Watch _watch;
private readonly CompareType _comparisonType;
private int? _compare;
private int _val;
private bool _enabled;
@ -27,7 +26,7 @@ namespace BizHawk.Client.Common
_watch = watch;
_compare = compare;
_val = value;
_comparisonType = comparisonType;
ComparisonType = comparisonType;
Pulse();
}
@ -131,7 +130,7 @@ namespace BizHawk.Client.Common
}
}
public CompareType ComparisonType => _comparisonType;
public CompareType ComparisonType { get; private set; }
public void Enable(bool handleChange = true)
{
@ -187,7 +186,7 @@ namespace BizHawk.Client.Common
{
if (_compare.HasValue)
{
switch (_comparisonType)
switch (ComparisonType)
{
default:
case CompareType.None: // This should never happen, but it's here just in case. adelikat: And yet it does! Cheat Code converter doesn't do this. Changing this to default to equal since 99.9999% of all cheats are going to be equals
@ -323,12 +322,12 @@ namespace BizHawk.Client.Common
else
{
if (addr == _watch.Address)
{
{
return (byte)(_val & 0xFF);
}
if (addr == _watch.Address + 1)
{
{
return (byte)((_val >> 8) & 0xFF);
}
@ -396,15 +395,13 @@ namespace BizHawk.Client.Common
public override bool Equals(object obj)
{
if (obj is Watch)
if (obj is Watch watch)
{
var watch = obj as Watch;
return Domain == watch.Domain && Address == watch.Address;
}
if (obj is Cheat)
if (obj is Cheat cheat)
{
var cheat = obj as Cheat;
return Domain == cheat.Domain && Address == cheat.Address;
}

View File

@ -25,7 +25,6 @@ namespace BizHawk.Client.Common
private const string ComparisonType = "ComparisonTypeColumn";
private List<Cheat> _cheatList = new List<Cheat>();
private string _currentFileName = "";
private string _defaultFileName = "";
private bool _changes;
@ -51,7 +50,7 @@ namespace BizHawk.Client.Common
}
}
public string CurrentFileName => _currentFileName;
public string CurrentFileName { get; private set; } = "";
public bool IsReadOnly => false;
@ -97,21 +96,26 @@ namespace BizHawk.Client.Common
if (_cheatList.Any() && _changes && autosave)
{
if (string.IsNullOrEmpty(_currentFileName))
if (string.IsNullOrEmpty(CurrentFileName))
{
_currentFileName = _defaultFileName;
CurrentFileName = _defaultFileName;
}
Save();
}
_cheatList.Clear();
_currentFileName = "";
CurrentFileName = "";
Changes = false;
}
public void Add(Cheat cheat)
{
if (cheat is null)
{
throw new ArgumentNullException($"{nameof(cheat)} can not be null");
}
if (cheat.IsSeparator)
{
_cheatList.Add(cheat);
@ -324,28 +328,28 @@ namespace BizHawk.Client.Common
{
if (Changes && _cheatList.Any())
{
if (string.IsNullOrWhiteSpace(_currentFileName))
if (string.IsNullOrWhiteSpace(CurrentFileName))
{
_currentFileName = _defaultFileName;
CurrentFileName = _defaultFileName;
}
SaveFile(_currentFileName);
SaveFile(CurrentFileName);
}
else if (!_cheatList.Any() && !string.IsNullOrWhiteSpace(_currentFileName))
else if (!_cheatList.Any() && !string.IsNullOrWhiteSpace(CurrentFileName))
{
new FileInfo(_currentFileName).Delete();
new FileInfo(CurrentFileName).Delete();
}
}
}
public bool Save()
{
if (string.IsNullOrWhiteSpace(_currentFileName))
if (string.IsNullOrWhiteSpace(CurrentFileName))
{
_currentFileName = _defaultFileName;
CurrentFileName = _defaultFileName;
}
return SaveFile(_currentFileName);
return SaveFile(CurrentFileName);
}
public bool SaveFile(string path)
@ -371,7 +375,7 @@ namespace BizHawk.Client.Common
else
{
// Set to hex for saving
var temp_cheat_type = cheat.Type;
var tempCheatType = cheat.Type;
cheat.SetType(DisplayType.Hex);
@ -388,7 +392,7 @@ namespace BizHawk.Client.Common
.Append(cheat.ComparisonType).Append('\t')
.AppendLine();
cheat.SetType(temp_cheat_type);
cheat.SetType(tempCheatType);
}
}
@ -396,8 +400,8 @@ namespace BizHawk.Client.Common
sw.WriteLine(sb.ToString());
}
_currentFileName = path;
Global.Config.RecentCheats.Add(_currentFileName);
CurrentFileName = path;
Global.Config.RecentCheats.Add(CurrentFileName);
Changes = false;
return true;
}
@ -417,7 +421,7 @@ namespace BizHawk.Client.Common
if (!append)
{
_currentFileName = path;
CurrentFileName = path;
}
using (var sr = file.OpenText())
@ -441,7 +445,7 @@ namespace BizHawk.Client.Common
int? compare;
var size = WatchSize.Byte;
var type = DisplayType.Hex;
var bigendian = false;
var bigEndian = false;
Cheat.CompareType comparisonType = Cheat.CompareType.None;
if (s.Length < 6)
@ -471,13 +475,13 @@ namespace BizHawk.Client.Common
{
size = Watch.SizeFromChar(vals[6][0]);
type = Watch.DisplayTypeFromChar(vals[7][0]);
bigendian = vals[8] == "1";
bigEndian = vals[8] == "1";
}
// For backwards compatibility, don't assume these values exist
if (vals.Length > 9)
{
if (!Enum.TryParse<Cheat.CompareType>(vals[9], out comparisonType))
if (!Enum.TryParse(vals[9], out comparisonType))
{
continue; // Not sure if this is the best answer, could just resort to ==
}
@ -488,7 +492,7 @@ namespace BizHawk.Client.Common
address,
size,
type,
bigendian,
bigEndian,
name);
Add(new Cheat(watch, value, compare, !Global.Config.DisableCheatsOnLoad && enabled, comparisonType));

View File

@ -97,7 +97,7 @@ namespace BizHawk.Client.EmuHawk
public string MmfRead(string mmf_filename, int expectedSize)
{
return GlobalWin.memoryMappedFiles.ReadFromFile(mmf_filename, expectedSize).ToString();
return GlobalWin.memoryMappedFiles.ReadFromFile(mmf_filename, expectedSize);
}

View File

@ -582,12 +582,6 @@
<Compile Include="CustomControls\HexTextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\HexView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\InputConfigBase.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CustomControls\InputRoll\Cell.cs" />
<Compile Include="CustomControls\InputRoll\ColumnType.cs" />
<Compile Include="CustomControls\InputRoll\InputRoll.cs">
@ -617,27 +611,12 @@
<Compile Include="CustomControls\PrereqsAlert.Designer.cs">
<DependentUpon>PrereqsAlert.cs</DependentUpon>
</Compile>
<Compile Include="CustomControls\QuickProgressPopup.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CustomControls\QuickProgressPopup.Designer.cs">
<DependentUpon>QuickProgressPopup.cs</DependentUpon>
</Compile>
<Compile Include="CustomControls\RepeatButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\TransparentTrackbar.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\ReadonlyCheckbox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\SmartTextBoxControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\TextDebugView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\ToolStripEx.cs">
<SubType>Component</SubType>
</Compile>
@ -937,12 +916,6 @@
<Compile Include="tools\HexEditor\HexFind.Designer.cs">
<DependentUpon>HexFind.cs</DependentUpon>
</Compile>
<Compile Include="tools\HexEditor\NewHexEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="tools\HexEditor\NewHexEditor.Designer.cs">
<DependentUpon>NewHexEditor.cs</DependentUpon>
</Compile>
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Client.cs" />
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Communication.cs" />
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Console.cs" />
@ -1506,18 +1479,12 @@
<EmbeddedResource Include="CustomControls\ExceptionBox.resx">
<DependentUpon>ExceptionBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CustomControls\InputConfigBase.resx">
<DependentUpon>InputConfigBase.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CustomControls\MsgBox.resx">
<DependentUpon>MsgBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CustomControls\PrereqsAlert.resx">
<DependentUpon>PrereqsAlert.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CustomControls\QuickProgressPopup.resx">
<DependentUpon>QuickProgressPopup.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
<SubType>Designer</SubType>
@ -1616,9 +1583,6 @@
<EmbeddedResource Include="tools\HexEditor\HexFind.resx">
<DependentUpon>HexFind.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\HexEditor\NewHexEditor.resx">
<DependentUpon>NewHexEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\Lua\LuaCanvas.resx">
<DependentUpon>LuaCanvas.cs</DependentUpon>
</EmbeddedResource>

View File

@ -11,57 +11,53 @@ using System.Drawing;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public class Communication
{
public class HttpCommunication
{
private static HttpClient client = new HttpClient();
private static readonly HttpClient Client = new HttpClient();
public string PostUrl { get; set; } = null;
public string GetUrl { get; set; } = null;
private ScreenShot screenShot = new ScreenShot();
public int timeout = 0;
public int default_timeout = 500;
private readonly ScreenShot _screenShot = new ScreenShot();
public int Timeout { get; set; }
public int DefaultTimeout { get; set; } = 500;
public void SetTimeout(int _timeout)
public void SetTimeout(int timeout)
{
if (timeout == 0 && _timeout == 0)
if (Timeout == 0 && timeout == 0)
{
timeout = default_timeout;
Timeout = DefaultTimeout;
}
if (_timeout != 0)
if (timeout != 0)
{
client.Timeout = new TimeSpan(0, 0, 0, _timeout / 1000, _timeout % 1000);
timeout = _timeout;
Client.Timeout = new TimeSpan(0, 0, 0, timeout / 1000, timeout % 1000);
Timeout = timeout;
}
}
public async Task<string> Get(string url)
{
client.DefaultRequestHeaders.ConnectionClose = false;
HttpResponseMessage response = await client.GetAsync(url).ConfigureAwait(false);
Client.DefaultRequestHeaders.ConnectionClose = false;
HttpResponseMessage response = await Client.GetAsync(url).ConfigureAwait(false);
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync();
}
else
{
return null;
}
return null;
}
public async Task<string> Post(string url, FormUrlEncodedContent content)
{
client.DefaultRequestHeaders.ConnectionClose = true;
HttpResponseMessage response = null;
Client.DefaultRequestHeaders.ConnectionClose = true;
HttpResponseMessage response;
try
{
response = await client.PostAsync(url, content).ConfigureAwait(false);
response = await Client.PostAsync(url, content).ConfigureAwait(false);
}
catch (Exception e)
{
@ -77,23 +73,23 @@ namespace BizHawk.Client.EmuHawk
public string TestGet()
{
Task<String> getResponse = Get(GetUrl);
Task<string> getResponse = Get(GetUrl);
return getResponse.Result;
}
public string SendScreenshot(string url, string parameter)
private string SendScreenshot(string url, string parameter)
{
int trials = 5;
var values = new Dictionary<string, string>
{
{parameter, screenShot.GetScreenShotAsString()},
{ parameter, _screenShot.GetScreenShotAsString() }
};
FormUrlEncodedContent content = new FormUrlEncodedContent(values);
Task<string> postResponse = null;
while (postResponse == null && trials > 0)
{
postResponse = Post(PostUrl, content);
postResponse = Post(url, content);
trials -= 1;
}
return postResponse.Result;
@ -123,7 +119,7 @@ namespace BizHawk.Client.EmuHawk
{
var values = new Dictionary<string, string>
{
{"payload", payload},
["payload"] = payload
};
FormUrlEncodedContent content = new FormUrlEncodedContent(values);
return Post(url, content).Result;
@ -133,7 +129,7 @@ namespace BizHawk.Client.EmuHawk
{
var values = new Dictionary<string, string>
{
{"payload", payload},
["payload"] = payload,
};
FormUrlEncodedContent content = new FormUrlEncodedContent(values);
return Post(PostUrl, content).Result;
@ -142,97 +138,101 @@ namespace BizHawk.Client.EmuHawk
public class SocketServer
{
string ip = null;
string _ip;
public string Ip
{
get { return ip; }
get => _ip;
set
{
ip = value;
ipAdd = System.Net.IPAddress.Parse(ip);
_ip = value;
_ipAdd = IPAddress.Parse(_ip);
Connect();
}
}
int port = 0;
int _port;
public int Port
{
get { return port; }
get => _port;
set
{
port = value;
_port = value;
Connect();
}
}
readonly Decoder decoder = Encoding.UTF8.GetDecoder();
Socket soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPAddress ipAdd;
IPEndPoint remoteEP;
IVideoProvider currentVideoProvider = null;
public bool connected = false;
public bool initialized = false;
Socket _soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPAddress _ipAdd;
IPEndPoint _remoteEp;
IVideoProvider _currentVideoProvider;
public bool Connected { get; set; }
public bool Initialized { get; set; }
public int Retries { get; set; } = 10;
public bool success = false; //indicates whether the last command was executed succesfully
private bool _success; // indicates whether the last command was executed successfully
public void Initialize()
{
if (currentVideoProvider == null) currentVideoProvider = Global.Emulator.AsVideoProviderOrDefault();
initialized = true;
if (_currentVideoProvider == null)
{
_currentVideoProvider = Global.Emulator.AsVideoProviderOrDefault();
}
Initialized = true;
}
public void Connect()
{
remoteEP = new IPEndPoint(ipAdd, port);
soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
soc.Connect(remoteEP);
connected = true;
soc.ReceiveTimeout = 5;
_remoteEp = new IPEndPoint(_ipAdd, _port);
_soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_soc.Connect(_remoteEp);
Connected = true;
_soc.ReceiveTimeout = 5;
}
public void SetIp(string ip_, int port_)
public void SetIp(string ip, int port)
{
ip = ip_;
port = port_;
ipAdd = System.Net.IPAddress.Parse(ip);
_ip = ip;
_port = port;
_ipAdd = IPAddress.Parse(_ip);
Connect();
}
public string GetInfo()
{
return $"{ip}:{port}";
return $"{_ip}:{_port}";
}
public void SetTimeout(int timeout)
{
soc.ReceiveTimeout = timeout;
_soc.ReceiveTimeout = timeout;
}
public void SocketConnected()
{
bool part1 = soc.Poll(1000, SelectMode.SelectRead);
bool part2 = (soc.Available == 0);
connected = !(part1 && part2);
bool part1 = _soc.Poll(1000, SelectMode.SelectRead);
bool part2 = (_soc.Available == 0);
Connected = !(part1 && part2);
}
public int SendString(string SendString)
public int SendString(string sendString)
{
int sentBytes = SendBytes(Encoding.ASCII.GetBytes(SendString));
success = sentBytes > 0;
int sentBytes = SendBytes(Encoding.ASCII.GetBytes(sendString));
_success = sentBytes > 0;
return sentBytes;
}
public int SendBytes(byte[] SendBytes)
public int SendBytes(byte[] sendBytes)
{
int sentBytes = 0;
int sentBytes;
try
{
sentBytes = soc.Send(SendBytes);
sentBytes = _soc.Send(sendBytes);
}
catch
{
sentBytes = -1;
}
return sentBytes;
}
@ -243,46 +243,43 @@ namespace BizHawk.Client.EmuHawk
public string SendScreenshot(int waitingTime)
{
if (!initialized)
if (!Initialized)
{
Initialize();
}
ScreenShot screenShot = new ScreenShot();
var screenShot = new ScreenShot();
using (BitmapBuffer bb = screenShot.MakeScreenShotImage())
{
using (var img = bb.ToSysdrawingBitmap())
using var img = bb.ToSysdrawingBitmap();
byte[] bmpBytes = screenShot.ImageToByte(img);
int sentBytes = 0;
int tries = 0;
while (sentBytes <= 0 && tries < Retries)
{
byte[] bmpBytes = screenShot.ImageToByte(img);
int sentBytes = 0;
int tries = 0;
while (sentBytes <= 0 && tries < Retries)
try
{
try
{
tries++;
sentBytes = SendBytes(bmpBytes);
}
catch (SocketException)
{
Connect();
sentBytes = 0;
}
if (sentBytes == -1)
{
Connect();
}
tries++;
sentBytes = SendBytes(bmpBytes);
}
catch (SocketException)
{
Connect();
sentBytes = 0;
}
if (sentBytes == -1)
{
Connect();
}
success = (tries < Retries);
}
_success = tries < Retries;
}
String resp = "";
if (!success)
{
resp = "Screenshot could not be sent";
} else
{
resp = "Screenshot was sent";
}
var resp = !_success
? "Screenshot could not be sent"
: "Screenshot was sent";
if (waitingTime == 0)
{
return resp;
@ -293,15 +290,17 @@ namespace BizHawk.Client.EmuHawk
{
resp = "Failed to get a response";
}
return resp;
}
public string ReceiveMessage()
{
if (!connected)
if (!Connected)
{
Connect();
}
string resp = "";
byte[] receivedBytes = new byte[256];
int receivedLength = 1;
@ -310,7 +309,7 @@ namespace BizHawk.Client.EmuHawk
{
try
{
receivedLength = soc.Receive(receivedBytes, receivedBytes.Length, 0);
receivedLength = _soc.Receive(receivedBytes, receivedBytes.Length, 0);
resp += Encoding.ASCII.GetString(receivedBytes);
}
catch
@ -323,17 +322,15 @@ namespace BizHawk.Client.EmuHawk
public bool Successful()
{
return success;
return _success;
}
}
public class MemoryMappedFiles
{
private readonly Dictionary<string, MemoryMappedFile> _mmfFiles = new Dictionary<string, MemoryMappedFile>();
public string Filename { get; set; } = "BizhawkTemp_main";
public Dictionary<string, MemoryMappedFile> mmf_files = new Dictionary<string, MemoryMappedFile>();
public int index = 0;
public int main_size = 10 ^ 5;
ScreenShot screenShot = new ScreenShot();
public int ScreenShotToFile()
{
@ -346,74 +343,67 @@ namespace BizHawk.Client.EmuHawk
public int WriteToFile(string filename, byte[] outputBytes)
{
MemoryMappedFile mmf_file;
int bytesWritten = -1;
if (mmf_files.TryGetValue(filename, out mmf_file) == false)
if (_mmfFiles.TryGetValue(filename, out var mmfFile) == false)
{
mmf_file = MemoryMappedFile.CreateOrOpen(filename, outputBytes.Length);
mmf_files[filename] = mmf_file;
mmfFile = MemoryMappedFile.CreateOrOpen(filename, outputBytes.Length);
_mmfFiles[filename] = mmfFile;
}
try
{
using (MemoryMappedViewAccessor accessor = mmf_file.CreateViewAccessor(0, outputBytes.Length, MemoryMappedFileAccess.Write))
{
accessor.WriteArray<byte>(0, outputBytes, 0, outputBytes.Length);
bytesWritten = outputBytes.Length;
}
using MemoryMappedViewAccessor accessor = mmfFile.CreateViewAccessor(0, outputBytes.Length, MemoryMappedFileAccess.Write);
accessor.WriteArray<byte>(0, outputBytes, 0, outputBytes.Length);
bytesWritten = outputBytes.Length;
}
catch (UnauthorizedAccessException)
{
try
{
mmf_file.Dispose();
mmfFile.Dispose();
}
catch (Exception)
{
}
mmf_file = MemoryMappedFile.CreateOrOpen(filename, outputBytes.Length);
mmf_files[filename] = mmf_file;
using (MemoryMappedViewAccessor accessor = mmf_file.CreateViewAccessor(0, outputBytes.Length, MemoryMappedFileAccess.Write))
{
accessor.WriteArray<byte>(0, outputBytes, 0, outputBytes.Length);
bytesWritten = outputBytes.Length;
}
mmfFile = MemoryMappedFile.CreateOrOpen(filename, outputBytes.Length);
_mmfFiles[filename] = mmfFile;
using MemoryMappedViewAccessor accessor = mmfFile.CreateViewAccessor(0, outputBytes.Length, MemoryMappedFileAccess.Write);
accessor.WriteArray(0, outputBytes, 0, outputBytes.Length);
bytesWritten = outputBytes.Length;
}
return bytesWritten;
}
public string ReadFromFile(string filename, int expectedSize)
{
MemoryMappedFile mmf_file = mmf_file = MemoryMappedFile.OpenExisting(@filename);
using (MemoryMappedViewAccessor viewAccessor = mmf_file.CreateViewAccessor())
{
byte[] bytes = new byte[expectedSize];
viewAccessor.ReadArray(0, bytes, 0, bytes.Length);
string text = Encoding.UTF8.GetString(bytes);
return text;
}
MemoryMappedFile mmfFile = MemoryMappedFile.OpenExisting(filename);
using MemoryMappedViewAccessor viewAccessor = mmfFile.CreateViewAccessor();
byte[] bytes = new byte[expectedSize];
viewAccessor.ReadArray(0, bytes, 0, bytes.Length);
string text = Encoding.UTF8.GetString(bytes);
return text;
}
}
// makes all functionality for providing screenshots available
class ScreenShot
//makes all functionalities for providing screenshots available
{
private IVideoProvider currentVideoProvider = null;
private ImageConverter converter = new ImageConverter();
private IVideoProvider _currentVideoProvider;
private readonly ImageConverter _converter = new ImageConverter();
public BitmapBuffer MakeScreenShotImage()
{
if (currentVideoProvider == null)
if (_currentVideoProvider == null)
{
currentVideoProvider = Global.Emulator.AsVideoProviderOrDefault();
_currentVideoProvider = Global.Emulator.AsVideoProviderOrDefault();
}
return GlobalWin.DisplayManager.RenderVideoProvider(currentVideoProvider);
return GlobalWin.DisplayManager.RenderVideoProvider(_currentVideoProvider);
}
public byte[] ImageToByte(Image img)
{
return (byte[])converter.ConvertTo(img, typeof(byte[]));
return (byte[])_converter.ConvertTo(img, typeof(byte[]));
}
public string ImageToString(Image img)
@ -428,17 +418,6 @@ namespace BizHawk.Client.EmuHawk
return Convert.ToBase64String(imgBytes);
}
}
class CommunicationSocketServerException : Exception
{
public CommunicationSocketServerException()
{
}
public CommunicationSocketServerException(string message) : base(message)
{
}
}
}
}

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
@ -79,12 +74,10 @@ namespace BizHawk.Client.EmuHawk
{
protected override void OnPaint(PaintEventArgs e)
{
Rectangle rc = this.ClientRectangle;
Rectangle rc = ClientRectangle;
StringFormat fmt = new StringFormat(StringFormat.GenericTypographic);
using (var br = new SolidBrush(this.ForeColor))
{
e.Graphics.DrawString(this.Text, this.Font, br, rc, fmt);
}
using var br = new SolidBrush(ForeColor);
e.Graphics.DrawString(this.Text, this.Font, br, rc, fmt);
}
}

View File

@ -12,21 +12,20 @@ namespace BizHawk.Client.EmuHawk
{
bool Nullable { get; }
int? ToRawInt();
void SetFromRawInt(int? rawint);
void SetFromRawInt(int? rawInt);
}
public class HexTextBox : TextBox, INumberBox
{
private string _addressFormatStr = "";
private long? _maxSize;
private bool _nullable = true;
public HexTextBox()
{
CharacterCasing = CharacterCasing.Upper;
}
public bool Nullable { get { return _nullable; } set { _nullable = value; } }
public bool Nullable { get; set; } = true;
public void SetHexProperties(long domainSize)
{
@ -38,10 +37,10 @@ namespace BizHawk.Client.EmuHawk
MaxLength = _maxSize.Value.NumHexDigits();
_addressFormatStr = $"{{0:X{MaxLength}}}";
//try to preserve the old value, as best we can
// try to preserve the old value, as best we can
if(!wasMaxSizeSet)
ResetText();
else if(_nullable)
else if (Nullable)
Text = "";
else if (MaxLength != currMaxLength)
{
@ -65,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
public override void ResetText()
{
Text = _nullable ? "" : string.Format(_addressFormatStr, 0);
Text = Nullable ? "" : string.Format(_addressFormatStr, 0);
}
protected override void OnKeyPress(KeyPressEventArgs e)
@ -179,14 +178,12 @@ namespace BizHawk.Client.EmuHawk
public class UnsignedIntegerBox : TextBox, INumberBox
{
private bool _nullable = true;
public UnsignedIntegerBox()
{
CharacterCasing = CharacterCasing.Upper;
}
public bool Nullable { get { return _nullable; } set { _nullable = value; } }
public bool Nullable { get; set; } = true;
protected override void OnKeyPress(KeyPressEventArgs e)
{
@ -203,7 +200,7 @@ namespace BizHawk.Client.EmuHawk
public override void ResetText()
{
Text = _nullable ? "" : "0";
Text = Nullable ? "" : "0";
}
protected override void OnKeyDown(KeyEventArgs e)

View File

@ -1,116 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.CustomControls;
namespace BizHawk.Client.EmuHawk
{
public class HexView : Control
{
//private readonly IControlRenderer _renderer;
private readonly Font NormalFont;
private Size _charSize;
private long _arrayLength;
public HexView()
{
NormalFont = new Font("Courier New", 8); // Only support fixed width
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.Opaque, true);
//_renderer = new GdiRenderer();
//using (var g = CreateGraphics())
//using (var LCK = _renderer.LockGraphics(g))
//{
// _charSize = _renderer.MeasureString("A", NormalFont); // TODO make this a property so changing it updates other values.
//}
}
protected override void Dispose(bool disposing)
{
//_renderer.Dispose();
NormalFont.Dispose();
base.Dispose(disposing);
}
#region Paint
protected override void OnPaint(PaintEventArgs e)
{
//using (var lck = _renderer.LockGraphics(e.Graphics))
//{
// _renderer.StartOffScreenBitmap(Width, Height);
// // White Background
// _renderer.SetBrush(Color.White);
// _renderer.SetSolidPen(Color.White);
// _renderer.FillRectangle(0, 0, Width, Height);
// _renderer.DrawString("Hello World", new Point(10, 10));
// _renderer.CopyToScreen();
// _renderer.EndOffScreenBitmap();
//}
}
#endregion
#region Properties
/// <summary>
/// Gets or sets the sets the virtual number of the length of the array to display
/// </summary>
[Category("Behavior")]
public long ArrayLength
{
get
{
return _arrayLength;
}
set
{
_arrayLength = value;
RecalculateScrollBars();
}
}
#endregion
#region Event Handlers
[Category("Virtual")]
public event QueryIndexValueHandler QueryIndexValue;
[Category("Virtual")]
public event QueryIndexBkColorHandler QueryIndexBgColor;
[Category("Virtual")]
public event QueryIndexForeColorHandler QueryIndexForeColor;
public delegate void QueryIndexValueHandler(int index, out long value);
public delegate void QueryIndexBkColorHandler(int index, ref Color color);
public delegate void QueryIndexForeColorHandler(int index, ref Color color);
#endregion
private void RecalculateScrollBars()
{
}
}
}

View File

@ -1,25 +0,0 @@
using System.Collections.Generic;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public class InputConfigBase : Form
{
public void CheckDups()
{
Dictionary<string,bool> dups = new Dictionary<string,bool>();
foreach (Control c in Controls)
{
SmartTextBoxControl stbc = c as SmartTextBoxControl;
if (stbc == null) continue;
if (dups.ContainsKey(stbc.Text))
{
MessageBox.Show("DUP!");
return;
}
dups[stbc.Text] = true;
}
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,5 +1,4 @@
using System;
using System.Drawing;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
@ -7,8 +6,6 @@ namespace BizHawk.Client.EmuHawk
{
public class MenuButton : Button
{
public MenuButton() { }
[DefaultValue(null)]
public ContextMenuStrip Menu { get; set; }
@ -30,7 +27,7 @@ namespace BizHawk.Client.EmuHawk
int arrowY = ClientRectangle.Height / 2 - 1;
Brush brush = Enabled ? SystemBrushes.ControlText : SystemBrushes.ButtonShadow;
Point[] arrows = new Point[] { new Point(arrowX, arrowY), new Point(arrowX + 7, arrowY), new Point(arrowX + 3, arrowY + 4) };
Point[] arrows = { new Point(arrowX, arrowY), new Point(arrowX + 7, arrowY), new Point(arrowX + 3, arrowY + 4) };
pevent.Graphics.FillPolygon(brush, arrows);
}
}

View File

@ -18,23 +18,23 @@ namespace BizHawk.Client.EmuHawk
public class CustomCheckBox : CheckBox
{
Color _CheckBackColor = SystemColors.Control;
Color _checkBackColor = SystemColors.Control;
public Color CheckBackColor
{
get { return _CheckBackColor; }
set { _CheckBackColor = value; Refresh(); }
get => _checkBackColor;
set { _checkBackColor = value; Refresh(); }
}
bool? _ForceChecked;
bool? _forceChecked;
public bool? ForceChecked
{
get { return _ForceChecked; }
set { _ForceChecked = value; Refresh(); }
get => _forceChecked;
set { _forceChecked = value; Refresh(); }
}
protected override void OnPaint(PaintEventArgs pevent)
{
//draw text-label part of the control with something so that it isn't hallofmirrorsy
// draw text-label part of the control with something so that it isn't hallofmirrorsy
using(var brush = new SolidBrush(Parent.BackColor))
pevent.Graphics.FillRectangle(brush, ClientRectangle);
@ -42,11 +42,11 @@ namespace BizHawk.Client.EmuHawk
var glyphLoc = ClientRectangle;
glyphLoc.Size = SystemInformation.MenuCheckSize;
//draw the selectedbackdrop color roughly where the glyph belongs
using (var brush = new SolidBrush(_CheckBackColor))
// draw the selectedbackdrop color roughly where the glyph belongs
using (var brush = new SolidBrush(_checkBackColor))
pevent.Graphics.FillRectangle(brush, glyphLoc);
//draw a checkbox menu glyph (we could do this more elegantly with DrawFrameControl)
// draw a checkbox menu glyph (we could do this more elegantly with DrawFrameControl)
bool c = CheckState == CheckState.Checked;
if (ForceChecked.HasValue)
{
@ -59,7 +59,7 @@ namespace BizHawk.Client.EmuHawk
ControlPaint.DrawMenuGlyph(pevent.Graphics, glyphLoc, MenuGlyph.Checkmark, Color.Black, Color.Transparent);
}
//draw a border on top of it all
// draw a border on top of it all
ControlPaint.DrawBorder3D(pevent.Graphics, r, Border3DStyle.Sunken);
//stuff that didnt work

View File

@ -1,21 +1,17 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk.CustomControls
{
public partial class PrereqsAlert : Form
{
public PrereqsAlert(bool warn_only)
public PrereqsAlert(bool warnOnly)
{
InitializeComponent();
if (warn_only)
if (warnOnly)
{
button1.Text = "Continue";
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

View File

@ -1,77 +0,0 @@
namespace BizHawk.Client.EmuHawk
{
partial class QuickProgressPopup
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.progressBar = new System.Windows.Forms.ProgressBar();
this.lblProgress = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(12, 12);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(194, 23);
this.progressBar.TabIndex = 0;
//
// lblProgress
//
this.lblProgress.AutoSize = true;
this.lblProgress.Location = new System.Drawing.Point(12, 41);
this.lblProgress.Margin = new System.Windows.Forms.Padding(3);
this.lblProgress.Name = "lblProgress";
this.lblProgress.Size = new System.Drawing.Size(35, 13);
this.lblProgress.TabIndex = 1;
this.lblProgress.Text = "label1";
//
// QuickProgressPopup
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(229, 63);
this.ControlBox = false;
this.Controls.Add(this.lblProgress);
this.Controls.Add(this.progressBar);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "QuickProgressPopup";
this.Text = "Please wait...";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.Label lblProgress;
}
}

View File

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public partial class QuickProgressPopup : Form
{
public QuickProgressPopup()
{
InitializeComponent();
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,13 +0,0 @@
using System;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public class ReadonlyCheckBox : CheckBox
{
protected override void OnClick(EventArgs e)
{
// Do nothing
}
}
}

View File

@ -1,7 +1,4 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
@ -9,83 +6,77 @@ namespace BizHawk.Client.EmuHawk
// http://www.codeproject.com/Articles/2130/NET-port-of-Joe-s-AutoRepeat-Button-class
public class RepeatButton : Button
{
private Timer m_timer;
private bool down = false;
private bool once = false;
private int m_initdelay = 1000;
private int m_repdelay = 400;
private readonly Timer _mTimer;
private bool _down;
private bool _once;
private int _mInitDelay = 1000;
private int _mRepeatDelay = 400;
public RepeatButton()
{
this.MouseUp +=
new MouseEventHandler(RepeatButton_MouseUp);
this.MouseDown +=
new MouseEventHandler(RepeatButton_MouseDown);
MouseUp += RepeatButton_MouseUp;
MouseDown += RepeatButton_MouseDown;
m_timer = new Timer();
m_timer.Tick += new EventHandler(timerproc);
m_timer.Enabled = false;
_mTimer = new Timer();
_mTimer.Tick += TimerProcess;
_mTimer.Enabled = false;
}
private void timerproc(object o1, EventArgs e1)
private void TimerProcess(object o1, EventArgs e1)
{
m_timer.Interval = m_repdelay;
if (down)
_mTimer.Interval = _mRepeatDelay;
if (_down)
{
once = true;
this.PerformClick();
_once = true;
PerformClick();
}
}
protected override void OnClick(EventArgs e)
{
if (!once || down)
if (!_once || _down)
{
base.OnClick(e);
}
}
private void RepeatButton_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
private void RepeatButton_MouseDown(object sender, MouseEventArgs e)
{
m_timer.Interval = m_initdelay;
m_timer.Enabled = true;
down = true;
_mTimer.Interval = _mInitDelay;
_mTimer.Enabled = true;
_down = true;
}
private void RepeatButton_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs e)
private void RepeatButton_MouseUp(object sender, MouseEventArgs e)
{
m_timer.Enabled = false;
down = false;
_mTimer.Enabled = false;
_down = false;
}
public int InitialDelay
{
get
{
return m_initdelay;
}
get => _mInitDelay;
set
{
m_initdelay = value;
if (m_initdelay < 10)
m_initdelay = 10;
_mInitDelay = value;
if (_mInitDelay < 10)
{
_mInitDelay = 10;
}
}
}
public int RepeatDelay
{
get
{
return m_repdelay;
}
get => _mRepeatDelay;
set
{
m_repdelay = value;
if (m_repdelay < 10)
m_repdelay = 10;
_mRepeatDelay = value;
if (_mRepeatDelay < 10)
{
_mRepeatDelay = 10;
}
}
}

View File

@ -1,34 +0,0 @@
using System;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public class SmartTextBoxControl : TextBox
{
public SmartTextBoxControl()
{
ReadOnly = true;
}
protected override void OnKeyDown(KeyEventArgs e)
{
base.Text = e.KeyCode.ToString();
OnTextChanged(new EventArgs());
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
}
protected override void OnKeyUp(KeyEventArgs e)
{
}
public override string Text
{
get { return base.Text; }
set { }
}
}
}

View File

@ -1,57 +0,0 @@
using System.Drawing;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public class TextDebugView : Control
{
public TextDebugView()
{
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.Clear(SystemColors.Control);
using var font = new Font(new FontFamily("Courier New"), 8);
e.Graphics.DrawString(Text, font, Brushes.Black,0,0);
}
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
Invalidate();
}
}
}
public class TextDebugForm : Form
{
public TextDebugView view = new TextDebugView();
public TextDebugForm()
{
view.Dock = DockStyle.Fill;
Controls.Add(view);
}
public override string Text
{
get
{
return view.Text;
}
set
{
view.Text = value;
}
}
}
}

View File

@ -1,5 +1,4 @@
using System;
using System.Windows.Forms;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{

View File

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Threading;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
@ -130,15 +129,6 @@ namespace BizHawk.Client.EmuHawk
ewh.Set();
}
//Size logicalSize;
////int pitch;
//public void SetLogicalSize(int w, int h)
//{
// if (bmp != null) bmp.Dispose();
// bmp = new Bitmap(w, h, PixelFormat.Format32bppArgb);
// logicalSize = new Size(w, h);
//}
/// <summary>
/// Takes ownership of the provided bitmap and will use it for future painting
/// </summary>
@ -172,68 +162,5 @@ namespace BizHawk.Client.EmuHawk
SignalPaint();
base.OnPaint(e);
}
}
/// <summary>
/// A dumb panel which functions as a placeholder for framebuffer painting
/// </summary>
public class ViewportPanel : Control
{
public ViewportPanel()
{
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.UserMouse, true);
}
}
/// <summary>
/// A ViewportPanel with a vertical scroll bar
/// </summary>
public class ScrollableViewportPanel : UserControl
{
TableLayoutPanel table;
ViewportPanel view;
VScrollBar scroll;
public ViewportPanel View { get { return view; } }
public VScrollBar Scrollbar { get { return scroll; } }
public int ScrollMax { get { return Scrollbar.Maximum; } set { Scrollbar.Maximum = value; } }
public int ScrollLargeChange { get { return Scrollbar.LargeChange; } set { Scrollbar.LargeChange = value; } }
public ScrollableViewportPanel()
{
InitializeComponent();
}
public void InitializeComponent()
{
table = new TableLayoutPanel();
view = new ViewportPanel();
scroll = new VScrollBar();
scroll.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom;
view.Dock = DockStyle.Fill;
table.Dock = DockStyle.Fill;
table.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
table.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 0));
table.RowCount = 1;
table.ColumnCount = 2;
table.Controls.Add(view);
table.Controls.Add(scroll);
table.SetColumn(view, 0);
table.SetColumn(scroll, 1);
scroll.Scroll += (sender, e) => OnScroll(e);
view.Paint += (sender, e) => OnPaint(e);
Controls.Add(table);
}
}
}

View File

@ -120,7 +120,7 @@ namespace BizHawk.Client.EmuHawk.WinFormExtensions
form.StartPosition = FormStartPosition.Manual;
form.Location = position;
}
var result = (owner == null ? form.ShowDialog(new Form() { TopMost = true }) : form.ShowDialog(owner));
var result = (owner == null ? form.ShowDialog(new Form { TopMost = true }) : form.ShowDialog(owner));
GlobalWin.Sound.StartSound();
return result;
}

View File

@ -233,8 +233,6 @@
this.externalToolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dummyExternalTool = new System.Windows.Forms.ToolStripMenuItem();
this.batchRunnerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ExperimentalToolsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.NewHexEditorMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.NESSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.coreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.quickNESToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -2098,8 +2096,7 @@
this.toolStripSeparator29,
this.MultiDiskBundlerFileMenuItem,
this.externalToolToolStripMenuItem,
this.batchRunnerToolStripMenuItem,
this.ExperimentalToolsSubMenu});
this.batchRunnerToolStripMenuItem});
this.ToolsSubMenu.Name = "ToolsSubMenu";
this.ToolsSubMenu.Size = new System.Drawing.Size(47, 19);
this.ToolsSubMenu.Text = "&Tools";
@ -2261,22 +2258,6 @@
this.batchRunnerToolStripMenuItem.Visible = false;
this.batchRunnerToolStripMenuItem.Click += new System.EventHandler(this.BatchRunnerToolStripMenuItem_Click);
//
// ExperimentalToolsSubMenu
//
this.ExperimentalToolsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.NewHexEditorMenuItem});
this.ExperimentalToolsSubMenu.Name = "ExperimentalToolsSubMenu";
this.ExperimentalToolsSubMenu.Size = new System.Drawing.Size(191, 22);
this.ExperimentalToolsSubMenu.Text = "Experimental Tools";
this.ExperimentalToolsSubMenu.DropDownOpened += new System.EventHandler(this.ExperimentalToolsSubMenu_DropDownOpened);
//
// NewHexEditorMenuItem
//
this.NewHexEditorMenuItem.Name = "NewHexEditorMenuItem";
this.NewHexEditorMenuItem.Size = new System.Drawing.Size(155, 22);
this.NewHexEditorMenuItem.Text = "New Hex Editor";
this.NewHexEditorMenuItem.Click += new System.EventHandler(this.NewHexEditorMenuItem_Click);
//
// NESSubMenu
//
this.NESSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -4738,8 +4719,6 @@
private System.Windows.Forms.ToolStripMenuItem gameSharkConverterToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem dummyExternalTool;
private System.Windows.Forms.ToolStripMenuItem RecordAVMenuItem;
private System.Windows.Forms.ToolStripMenuItem ExperimentalToolsSubMenu;
private System.Windows.Forms.ToolStripMenuItem NewHexEditorMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveConfigAsMenuItem;
private System.Windows.Forms.ToolStripMenuItem LoadConfigFromMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveMovieAsMenuItem;

View File

@ -1394,8 +1394,6 @@ namespace BizHawk.Client.EmuHawk
BasicBotMenuItem.Enabled = GlobalWin.Tools.IsAvailable<BasicBot>();
gameSharkConverterToolStripMenuItem.Enabled = GlobalWin.Tools.IsAvailable<GameShark>();
ExperimentalToolsSubMenu.Visible = VersionInfo.DeveloperBuild;
}
private void ExternalToolToolStripMenuItem_DropDownOpening(object sender, EventArgs e)
@ -1425,11 +1423,6 @@ namespace BizHawk.Client.EmuHawk
}
}
private void ExperimentalToolsSubMenu_DropDownOpened(object sender, EventArgs e)
{
NewHexEditorMenuItem.Enabled = GlobalWin.Tools.IsAvailable<NewHexEditor>();
}
private void ToolBoxMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.Tools.Load<ToolBox>();
@ -1524,11 +1517,6 @@ namespace BizHawk.Client.EmuHawk
form.ShowDialog();
}
private void NewHexEditorMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.Tools.Load<NewHexEditor>();
}
#endregion
#region NES

View File

@ -3,37 +3,39 @@ using System.IO;
using System.Net;
using System.Threading;
using Newtonsoft.Json.Linq;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
public static class UpdateChecker
{
private static readonly string _latestVersionInfoURL = "http://tasvideos.org/SystemBizHawkReleaseManager.html";
private static readonly string _latestVersionInfoURL = "https://api.github.com/repos/TASVideos/BizHawk/releases/latest";
private static readonly TimeSpan _minimumCheckDuration = TimeSpan.FromHours(8);
private static bool AutoCheckEnabled
{
get { return Global.Config.Update_AutoCheckEnabled; }
set { Global.Config.Update_AutoCheckEnabled = value; }
get => Global.Config.Update_AutoCheckEnabled;
set => Global.Config.Update_AutoCheckEnabled = value;
}
private static DateTime? LastCheckTimeUTC
{
get { return Global.Config.Update_LastCheckTimeUTC; }
set { Global.Config.Update_LastCheckTimeUTC = value; }
get => Global.Config.Update_LastCheckTimeUTC;
set => Global.Config.Update_LastCheckTimeUTC = value;
}
private static string LatestVersion
{
get { return Global.Config.Update_LatestVersion; }
set { Global.Config.Update_LatestVersion = value; }
get => Global.Config.Update_LatestVersion;
set => Global.Config.Update_LatestVersion = value;
}
private static string IgnoreVersion
{
get { return Global.Config.Update_IgnoreVersion; }
set { Global.Config.Update_IgnoreVersion = value; }
get => Global.Config.Update_IgnoreVersion;
set => Global.Config.Update_IgnoreVersion = value;
}
public static void BeginCheck(bool skipCheck = false)
@ -74,9 +76,9 @@ namespace BizHawk.Client.EmuHawk
{
try
{
string latestVersionInfo = WebUtility.HtmlDecode(DownloadURLAsString(_latestVersionInfoURL));
JObject response = JObject.Parse(DownloadURLAsString(_latestVersionInfoURL));
LatestVersion = GetVersionNumberFromVersionInfo(latestVersionInfo);
LatestVersion = ValidateVersionNumberString((string)response["name"]);
}
catch
{
@ -90,31 +92,17 @@ namespace BizHawk.Client.EmuHawk
private static string DownloadURLAsString(string url)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
var request = (HttpWebRequest)WebRequest.Create(url);
request.UserAgent = "BizHawk";
request.KeepAlive = false;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (StreamReader responseStream = new StreamReader(response.GetResponseStream()))
{
return responseStream.ReadToEnd();
}
using var response = (HttpWebResponse)request.GetResponse();
using var responseStream = new StreamReader(response.GetResponseStream());
return responseStream.ReadToEnd();
}
private static string GetVersionNumberFromVersionInfo(string info)
private static string ValidateVersionNumberString(string versionNumber)
{
string versionNumber = GetTextFromTag(info, "VersionNumber");
return (versionNumber != null && ParseVersion(versionNumber) != 0) ? versionNumber : "";
}
private static string GetTextFromTag(string info, string tagName)
{
string openTag = $"[{tagName}]";
string closeTag = $"[/{tagName}]";
int start = info.IndexOf(openTag, StringComparison.OrdinalIgnoreCase);
if (start == -1) return null;
start += openTag.Length;
int end = info.IndexOf(closeTag, start, StringComparison.OrdinalIgnoreCase);
if (end == -1) return null;
return info.Substring(start, end - start).Trim();
return versionNumber != null && ParseVersion(versionNumber) != 0 ? versionNumber : "";
}
// Major version goes in the first 16 bits, and so on, up to 4 parts

View File

@ -52,11 +52,7 @@ namespace BizHawk.Client.EmuHawk
public string Bindings
{
get
{
return Text;
}
get => Text;
set
{
ClearBindings();

View File

@ -58,30 +58,31 @@ namespace BizHawk.Client.EmuHawk
_selectedMovie.Subtitles.Clear();
for (int i = 0; i < SubGrid.Rows.Count - 1; i++)
{
var s = new Subtitle();
var sub = new Subtitle();
var c = SubGrid.Rows[i].Cells[0];
try { s.Frame = int.Parse(c.Value.ToString()); }
try { sub.Frame = int.Parse(c.Value.ToString()); }
catch { ShowError(i, 0); return; }
c = SubGrid.Rows[i].Cells[1];
try { s.X = int.Parse(c.Value.ToString()); }
try { sub.X = int.Parse(c.Value.ToString()); }
catch { ShowError(i, 1); return; }
c = SubGrid.Rows[i].Cells[2];
try { s.Y = int.Parse(c.Value.ToString()); }
try { sub.Y = int.Parse(c.Value.ToString()); }
catch { ShowError(i, 2); return; }
c = SubGrid.Rows[i].Cells[3];
try { s.Duration = int.Parse(c.Value.ToString()); }
try { sub.Duration = int.Parse(c.Value.ToString()); }
catch { ShowError(i, 3); return; }
c = SubGrid.Rows[i].Cells[4];
try { s.Color = uint.Parse(c.Value.ToString(), NumberStyles.HexNumber); }
try { sub.Color = uint.Parse(c.Value.ToString(), NumberStyles.HexNumber); }
catch { ShowError(i, 4); return; }
try { c = SubGrid.Rows[i].Cells[5]; }
catch { ShowError(i, 5); return; }
s.Message = c.Value.ToString();
_selectedMovie.Subtitles.Add(s);
sub.Message = c.Value?.ToString();
_selectedMovie.Subtitles.Add(sub);
}
_selectedMovie.Save();
}
Close();
}
@ -135,32 +136,42 @@ namespace BizHawk.Client.EmuHawk
private Subtitle GetRow(int index)
{
if (index >= SubGrid.Rows.Count) return new Subtitle();
if (index >= SubGrid.Rows.Count)
{
return new Subtitle();
}
var s = new Subtitle();
var c = SubGrid.Rows[index].Cells[0];
var sub = new Subtitle();
// Empty catch because it should default to subtitle default value
try { s.Frame = int.Parse(c.Value.ToString()); }
catch { }
c = SubGrid.Rows[index].Cells[1];
try { s.X = int.Parse(c.Value.ToString()); }
catch { }
c = SubGrid.Rows[index].Cells[2];
try { s.Y = int.Parse(c.Value.ToString()); }
catch { }
c = SubGrid.Rows[index].Cells[3];
try { s.Duration = int.Parse(c.Value.ToString()); }
catch { }
c = SubGrid.Rows[index].Cells[4];
try { s.Color = uint.Parse(c.Value.ToString()); }
catch { }
c = SubGrid.Rows[index].Cells[5];
try { s.Message = c.Value.ToString(); }
catch { }
_selectedMovie.Subtitles.Add(s);
if (int.TryParse(SubGrid.Rows[index].Cells[0].Value.ToString(), out int frame))
{
sub.Frame = frame;
}
return s;
if (int.TryParse(SubGrid.Rows[index].Cells[1].Value.ToString(), out int x))
{
sub.X = x;
}
if (int.TryParse(SubGrid.Rows[index].Cells[2].Value.ToString(), out int y))
{
sub.Y = y;
}
if (int.TryParse(SubGrid.Rows[index].Cells[3].Value.ToString(), out int duration))
{
sub.Duration = duration;
}
if (uint.TryParse(SubGrid.Rows[index].Cells[4].Value.ToString(), out uint color))
{
sub.Color = color;
}
sub.Message = SubGrid.Rows[index].Cells[5].Value?.ToString() ?? "";
_selectedMovie.Subtitles.Add(sub);
return sub;
}
private void SubGrid_MouseDoubleClick(object sender, MouseEventArgs e)
@ -176,7 +187,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
using var s = new SubtitleMaker {Sub = GetRow(c[0].Index)};
using var s = new SubtitleMaker { Sub = GetRow(c[0].Index) };
if (s.ShowDialog() == DialogResult.OK)
{
ChangeRow(s.Sub, SubGrid.SelectedRows[0].Index);
@ -207,7 +218,7 @@ namespace BizHawk.Client.EmuHawk
var pal = _selectedMovie.HeaderEntries.ContainsKey(HeaderKeys.PAL)
&& _selectedMovie.HeaderEntries[HeaderKeys.PAL] == "1";
var pfr = new PlatformFrameRates();
double fps = 1;
double fps;
try
{
@ -229,7 +240,7 @@ namespace BizHawk.Client.EmuHawk
File.WriteAllText(fileName, str);
// Display success
MessageBox.Show($"Subtitles succesfully exported to {fileName}.", "Success");
MessageBox.Show($"Subtitles successfully exported to {fileName}.", "Success");
}
private void SubGrid_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)

View File

@ -7,15 +7,8 @@ namespace BizHawk.Client.EmuHawk
/// </summary>
public class MovieDetails
{
public string Keys { get; set; }
public string Values { get; set; }
public Color BackgroundColor { get; set; }
public MovieDetails()
{
Keys = "";
Values = "";
BackgroundColor = Color.White;
}
public string Keys { get; set; } = "";
public string Values { get; set; } = "";
public Color BackgroundColor { get; set; } = Color.White;
}
}

View File

@ -15,7 +15,7 @@ namespace BizHawk.Client.EmuHawk
{
public partial class PlayMovie : Form
{
private readonly PlatformFrameRates PlatformFrameRates = new PlatformFrameRates();
private readonly PlatformFrameRates _platformFrameRates = new PlatformFrameRates();
private List<IMovie> _movieList = new List<IMovie>();
private bool _sortReverse;
@ -51,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
e.Item = new ListViewItem(entry.Filename);
e.Item.SubItems.Add(entry.SystemID);
e.Item.SubItems.Add(entry.GameName);
e.Item.SubItems.Add(PlatformFrameRates.MovieTime(entry).ToString(@"hh\:mm\:ss\.fff"));
e.Item.SubItems.Add(_platformFrameRates.MovieTime(entry).ToString(@"hh\:mm\:ss\.fff"));
}
private void Run()
@ -65,38 +65,36 @@ namespace BizHawk.Client.EmuHawk
private int? AddMovieToList(string filename, bool force)
{
using (var file = new HawkFile(filename))
using var file = new HawkFile(filename);
if (!file.Exists)
{
if (!file.Exists)
{
return null;
}
var movie = PreLoadMovieFile(file, force);
if (movie == null)
{
return null;
}
int? index;
lock (_movieList)
{
// need to check IsDuplicateOf within the lock
index = IsDuplicateOf(filename);
if (index.HasValue)
{
return index;
}
_movieList.Add(movie);
index = _movieList.Count - 1;
}
_sortReverse = false;
_sortedCol = "";
return index;
return null;
}
var movie = PreLoadMovieFile(file, force);
if (movie == null)
{
return null;
}
int? index;
lock (_movieList)
{
// need to check IsDuplicateOf within the lock
index = IsDuplicateOf(filename);
if (index.HasValue)
{
return index;
}
_movieList.Add(movie);
index = _movieList.Count - 1;
}
_sortReverse = false;
_sortedCol = "";
return index;
}
private int? IsDuplicateOf(string filename)
@ -177,7 +175,7 @@ namespace BizHawk.Client.EmuHawk
{
foreach (var ext in MovieService.MovieExtensions)
{
if (Path.GetExtension(_movieList[indices[i]].Filename).ToUpper() == $".{ext}")
if (Path.GetExtension(_movieList[indices[i]].Filename)?.ToUpper() == $".{ext}")
{
tas.Add(i);
}
@ -233,7 +231,7 @@ namespace BizHawk.Client.EmuHawk
var dpTodo = new Queue<string>();
var fpTodo = new List<string>();
dpTodo.Enqueue(directory);
Dictionary<string, int> ordinals = new Dictionary<string, int>();
var ordinals = new Dictionary<string, int>();
while (dpTodo.Count > 0)
{
@ -242,9 +240,9 @@ namespace BizHawk.Client.EmuHawk
// enqueue subdirectories if appropriate
if (Global.Config.PlayMovie_IncludeSubdir)
{
foreach (var subdir in Directory.GetDirectories(dp))
foreach (var subDir in Directory.GetDirectories(dp))
{
dpTodo.Enqueue(subdir);
dpTodo.Enqueue(subDir);
}
}
@ -290,7 +288,7 @@ namespace BizHawk.Client.EmuHawk
{
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (var path in filePaths.Where(path => MovieService.MovieExtensions.Contains(Path.GetExtension(path).Replace(".", ""))))
foreach (var path in filePaths.Where(path => MovieService.MovieExtensions.Contains(Path.GetExtension(path)?.Replace(".", ""))))
{
AddMovieToList(path, force: true);
}
@ -312,9 +310,10 @@ namespace BizHawk.Client.EmuHawk
.Append(_movieList[index].Filename).Append('\t')
.Append(_movieList[index].SystemID).Append('\t')
.Append(_movieList[index].GameName).Append('\t')
.Append(PlatformFrameRates.MovieTime(_movieList[index]).ToString(@"hh\:mm\:ss\.fff"))
.Append(_platformFrameRates.MovieTime(_movieList[index]).ToString(@"hh\:mm\:ss\.fff"))
.AppendLine();
}
Clipboard.SetDataObject(copyStr.ToString());
}
}
@ -394,8 +393,6 @@ namespace BizHawk.Client.EmuHawk
var item = new ListViewItem(kvp.Key);
item.SubItems.Add(kvp.Value);
bool add = true;
switch (kvp.Key)
{
case HeaderKeys.SHA1:
@ -417,7 +414,7 @@ namespace BizHawk.Client.EmuHawk
// the problem is that for GameGear and SG100, those mismatch, resulting in false positive here
// I have a patch to make GG and SG appear as platforms in movie header (issue #1246)
// but even with it, for all the old movies, this false positive would have to be worked around anyway
// TODO: actually check header flags like "IsGGMode" and "IsSegaCDMode" (those are never parsed by bizhawk)
// TODO: actually check header flags like "IsGGMode" and "IsSegaCDMode" (those are never parsed by BizHawk)
if (kvp.Value != Global.Emulator.SystemId)
{
item.BackColor = Color.Pink;
@ -425,17 +422,16 @@ namespace BizHawk.Client.EmuHawk
break;
}
if(add)
DetailsView.Items.Add(item);
DetailsView.Items.Add(item);
}
var FpsItem = new ListViewItem("Fps");
FpsItem.SubItems.Add($"{Fps(_movieList[firstIndex]):0.#######}");
DetailsView.Items.Add(FpsItem);
var fpsItem = new ListViewItem("Fps");
fpsItem.SubItems.Add($"{Fps(_movieList[firstIndex]):0.#######}");
DetailsView.Items.Add(fpsItem);
var FramesItem = new ListViewItem("Frames");
FramesItem.SubItems.Add(_movieList[firstIndex].FrameCount.ToString());
DetailsView.Items.Add(FramesItem);
var framesItem = new ListViewItem("Frames");
framesItem.SubItems.Add(_movieList[firstIndex].FrameCount.ToString());
DetailsView.Items.Add(framesItem);
CommentsBtn.Enabled = _movieList[firstIndex].Comments.Any();
SubtitlesBtn.Enabled = _movieList[firstIndex].Subtitles.Any();
}
@ -443,8 +439,8 @@ namespace BizHawk.Client.EmuHawk
public double Fps(IMovie movie)
{
var system = movie.HeaderEntries[HeaderKeys.PLATFORM];
var pal = movie.HeaderEntries.ContainsKey(HeaderKeys.PAL) &&
movie.HeaderEntries[HeaderKeys.PAL] == "1";
var pal = movie.HeaderEntries.ContainsKey(HeaderKeys.PAL)
&& movie.HeaderEntries[HeaderKeys.PAL] == "1";
return new PlatformFrameRates()[system, pal];
@ -611,14 +607,9 @@ namespace BizHawk.Client.EmuHawk
if (StopOnFrameCheckbox.Checked &&
(StopOnFrameTextBox.ToRawInt().HasValue || LastFrameCheckbox.Checked))
{
if (LastFrameCheckbox.Checked)
{
GlobalWin.MainForm.PauseOnFrame = Global.MovieSession.Movie.InputLogLength;
}
else
{
GlobalWin.MainForm.PauseOnFrame = StopOnFrameTextBox.ToRawInt();
}
GlobalWin.MainForm.PauseOnFrame = LastFrameCheckbox.Checked
? Global.MovieSession.Movie.InputLogLength
: StopOnFrameTextBox.ToRawInt();
}
Close();
@ -631,7 +622,7 @@ namespace BizHawk.Client.EmuHawk
#endregion
private bool _programmaticallyChangingStopFrameCheckbox = false;
private bool _programmaticallyChangingStopFrameCheckbox;
private void StopOnFrameCheckbox_CheckedChanged(object sender, EventArgs e)
{
if (!_programmaticallyChangingStopFrameCheckbox)
@ -649,7 +640,7 @@ namespace BizHawk.Client.EmuHawk
private void LastFrameCheckbox_CheckedChanged(object sender, EventArgs e)
{
if (LastFrameCheckbox.Checked == true)
if (LastFrameCheckbox.Checked)
{
_programmaticallyChangingStopFrameCheckbox = true;
StopOnFrameCheckbox.Checked = true;

View File

@ -3,7 +3,6 @@ using System.IO;
using System.Windows.Forms;
using System.Linq;
using BizHawk.Common.ReflectionExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using BizHawk.Client.Common;
@ -16,15 +15,15 @@ namespace BizHawk.Client.EmuHawk
// TODO - Allow relative paths in record textbox
public partial class RecordMovie : Form
{
private IEmulator Emulator;
private readonly IEmulator _emulator;
public RecordMovie(IEmulator core)
{
InitializeComponent();
Emulator = core;
_emulator = core;
if (!Emulator.HasSavestates())
if (!_emulator.HasSavestates())
{
StartFromCombo.Items.Remove(
StartFromCombo.Items
@ -33,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
.ToLower() == "now"));
}
if (!Emulator.HasSaveRam())
if (!_emulator.HasSaveRam())
{
StartFromCombo.Items.Remove(
StartFromCombo.Items
@ -92,9 +91,9 @@ namespace BizHawk.Client.EmuHawk
Directory.CreateDirectory(fileInfo.DirectoryName);
}
if (StartFromCombo.SelectedItem.ToString() == "Now" && Emulator.HasSavestates())
if (StartFromCombo.SelectedItem.ToString() == "Now" && _emulator.HasSavestates())
{
var core = Emulator.AsStatable();
var core = _emulator.AsStatable();
movieToRecord.StartsFromSavestate = true;
movieToRecord.StartsFromSaveRam = false;
@ -105,27 +104,21 @@ namespace BizHawk.Client.EmuHawk
}
else
{
using (var sw = new StringWriter())
{
core.SaveStateText(sw);
movieToRecord.TextSavestate = sw.ToString();
}
using var sw = new StringWriter();
core.SaveStateText(sw);
movieToRecord.TextSavestate = sw.ToString();
}
// TODO: do we want to support optionally not saving this?
if (true)
movieToRecord.SavestateFramebuffer = new int[0];
if (_emulator.HasVideoProvider())
{
// hack: some IMovies eat the framebuffer, so don't bother with them
movieToRecord.SavestateFramebuffer = new int[0];
if (movieToRecord.SavestateFramebuffer != null && Emulator.HasVideoProvider())
{
movieToRecord.SavestateFramebuffer = (int[])Emulator.AsVideoProvider().GetVideoBuffer().Clone();
}
movieToRecord.SavestateFramebuffer = (int[])_emulator.AsVideoProvider().GetVideoBuffer().Clone();
}
}
else if (StartFromCombo.SelectedItem.ToString() == "SaveRam" && Emulator.HasSaveRam())
else if (StartFromCombo.SelectedItem.ToString() == "SaveRam" && _emulator.HasSaveRam())
{
var core = Emulator.AsSaveRam();
var core = _emulator.AsSaveRam();
movieToRecord.StartsFromSavestate = false;
movieToRecord.StartsFromSaveRam = true;
movieToRecord.SaveRam = core.CloneSaveRam();
@ -155,7 +148,7 @@ namespace BizHawk.Client.EmuHawk
}
private void BrowseBtn_Click(object sender, EventArgs e)
{
{
string movieFolderPath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null);
// Create movie folder if it doesn't already exist
@ -168,9 +161,8 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception movieDirException)
{
if (movieDirException is IOException ||
movieDirException is UnauthorizedAccessException ||
movieDirException is PathTooLongException)
if (movieDirException is IOException
|| movieDirException is UnauthorizedAccessException)
{
//TO DO : Pass error to user?
}

View File

@ -8,7 +8,7 @@ namespace BizHawk.Client.EmuHawk
{
public partial class SubtitleMaker : Form
{
public Subtitle Sub = new Subtitle();
public Subtitle Sub { get; set; } = new Subtitle();
public SubtitleMaker()
{

View File

@ -26,7 +26,7 @@ namespace BizHawk.Client.EmuHawk
private Cheat _cheat;
private bool _loading;
private bool _editmode;
private bool _editMode;
private Action _addCallback;
private Action _editCallback;
@ -215,7 +215,7 @@ namespace BizHawk.Client.EmuHawk
{
var valid = !string.IsNullOrWhiteSpace(AddressBox.Text) && !string.IsNullOrWhiteSpace(ValueBox.Text);
AddButton.Enabled = valid;
EditButton.Enabled = _editmode && valid;
EditButton.Enabled = _editMode && valid;
}
private void SizeDropDown_SelectedIndexChanged(object sender, EventArgs e)
@ -276,7 +276,7 @@ namespace BizHawk.Client.EmuHawk
public void SetCheat(Cheat cheat)
{
_editmode = true;
_editMode = true;
_cheat = cheat;
if (cheat.IsSeparator)
{
@ -291,7 +291,7 @@ namespace BizHawk.Client.EmuHawk
public void ClearForm()
{
_cheat = Cheat.Separator;
_editmode = false;
_editMode = false;
SetFormToDefault();
}

View File

@ -112,7 +112,6 @@
this.CheatListView.UseCustomBackground = true;
this.CheatListView.ColumnClick += new BizHawk.Client.EmuHawk.InputRoll.ColumnClickEventHandler(this.CheatListView_ColumnClick);
this.CheatListView.SelectedIndexChanged += new System.EventHandler(this.CheatListView_SelectedIndexChanged);
this.CheatListView.Click += new System.EventHandler(this.CheatListView_Click);
this.CheatListView.DragDrop += new System.Windows.Forms.DragEventHandler(this.NewCheatForm_DragDrop);
this.CheatListView.DragEnter += new System.Windows.Forms.DragEventHandler(this.NewCheatForm_DragEnter);
this.CheatListView.DoubleClick += new System.EventHandler(this.CheatListView_DoubleClick);

View File

@ -209,7 +209,7 @@ namespace BizHawk.Client.EmuHawk
private void SaveConfigSettings()
{
Settings.Columns =CheatListView.AllColumns;
Settings.Columns = CheatListView.AllColumns;
if (WindowState == FormWindowState.Normal)
{
@ -328,15 +328,9 @@ namespace BizHawk.Client.EmuHawk
private IEnumerable<int> SelectedIndices => CheatListView.SelectedRows;
private IEnumerable<Cheat> SelectedItems
{
get { return SelectedIndices.Select(index => Global.CheatList[index]); }
}
private IEnumerable<Cheat> SelectedItems => SelectedIndices.Select(index => Global.CheatList[index]);
private IEnumerable<Cheat> SelectedCheats
{
get { return SelectedItems.Where(x => !x.IsSeparator); }
}
private IEnumerable<Cheat> SelectedCheats => SelectedItems.Where(x => !x.IsSeparator);
private void DoSelectedIndexChange()
{
@ -639,10 +633,6 @@ namespace BizHawk.Client.EmuHawk
#region ListView and Dialog Events
private void CheatListView_Click(object sender, EventArgs e)
{
}
private void CheatListView_DoubleClick(object sender, EventArgs e)
{
ToggleMenuItem_Click(sender, e);

View File

@ -92,7 +92,6 @@
this.AddressLabel = new System.Windows.Forms.Label();
this.AddressesLabel = new System.Windows.Forms.Label();
this.Header = new System.Windows.Forms.Label();
this.swapBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.HexMenuStrip.SuspendLayout();
this.ViewerContextMenuStrip.SuspendLayout();
this.MemoryViewerBox.SuspendLayout();
@ -111,7 +110,6 @@
this.HexMenuStrip.Size = new System.Drawing.Size(584, 24);
this.HexMenuStrip.TabIndex = 1;
this.HexMenuStrip.Text = "menuStrip1";
this.HexMenuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.HexMenuStrip_ItemClicked);
//
// FileSubMenu
//
@ -286,7 +284,6 @@
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MemoryDomainsMenuItem,
this.DataSizeSubMenu,
this.swapBytesToolStripMenuItem,
this.BigEndianMenuItem,
this.toolStripSeparator2,
this.GoToAddressMenuItem,
@ -640,14 +637,6 @@
this.Header.TabIndex = 2;
this.Header.Text = "label1";
//
// swapBytesToolStripMenuItem
//
this.swapBytesToolStripMenuItem.CheckOnClick = true;
this.swapBytesToolStripMenuItem.Name = "swapBytesToolStripMenuItem";
this.swapBytesToolStripMenuItem.Size = new System.Drawing.Size(221, 22);
this.swapBytesToolStripMenuItem.Text = "Swap Bytes";
this.swapBytesToolStripMenuItem.Click += new System.EventHandler(this.SwapBytesMenuItem_Click);
//
// HexEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -742,6 +731,5 @@
private System.Windows.Forms.ToolStripMenuItem ExportContextItem;
private System.Windows.Forms.ToolStripMenuItem ExportMenuItem;
private System.Windows.Forms.ToolStripMenuItem importAsBinaryToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem swapBytesToolStripMenuItem;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,102 +0,0 @@
namespace BizHawk.Client.EmuHawk
{
partial class NewHexEditor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.HexMenu = new System.Windows.Forms.MenuStrip();
this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.HexViewControl = new BizHawk.Client.EmuHawk.HexView();
this.HexMenu.SuspendLayout();
this.SuspendLayout();
//
// HexMenu
//
this.HexMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.FileSubMenu});
this.HexMenu.Location = new System.Drawing.Point(0, 0);
this.HexMenu.Name = "HexMenu";
this.HexMenu.Size = new System.Drawing.Size(448, 24);
this.HexMenu.TabIndex = 0;
this.HexMenu.Text = "menuStrip1";
//
// FileSubMenu
//
this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ExitMenuItem});
this.FileSubMenu.Name = "FileSubMenu";
this.FileSubMenu.Size = new System.Drawing.Size(37, 20);
this.FileSubMenu.Text = "&File";
this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened);
//
// ExitMenuItem
//
this.ExitMenuItem.Name = "ExitMenuItem";
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
this.ExitMenuItem.Size = new System.Drawing.Size(134, 22);
this.ExitMenuItem.Text = "E&xit";
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
//
// HexViewControl
//
this.HexViewControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.HexViewControl.ArrayLength = 0;
this.HexViewControl.Location = new System.Drawing.Point(12, 27);
this.HexViewControl.Name = "HexViewControl";
this.HexViewControl.Size = new System.Drawing.Size(424, 231);
this.HexViewControl.TabIndex = 1;
this.HexViewControl.Text = "hexView1";
//
// NewHexEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(448, 270);
this.Controls.Add(this.HexViewControl);
this.Controls.Add(this.HexMenu);
this.MainMenuStrip = this.HexMenu;
this.Name = "NewHexEditor";
this.Text = "NewHexEditor";
this.Load += new System.EventHandler(this.NewHexEditor_Load);
this.HexMenu.ResumeLayout(false);
this.HexMenu.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip HexMenu;
private System.Windows.Forms.ToolStripMenuItem FileSubMenu;
private System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
private HexView HexViewControl;
}
}

View File

@ -1,105 +0,0 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class NewHexEditor : Form, IToolFormAutoConfig
{
#region Initialize and Dependencies
[RequiredService]
private IMemoryDomains MemoryDomains { get; set; }
[RequiredService]
private IEmulator Emulator { get; set; }
public NewHexEditor()
{
InitializeComponent();
Closing += (o, e) => SaveConfigSettings();
HexViewControl.QueryIndexValue += HexView_QueryIndexValue;
HexViewControl.QueryIndexForeColor += HexView_QueryIndexForeColor;
HexViewControl.QueryIndexBgColor += HexView_QueryIndexForeColor;
}
private void NewHexEditor_Load(object sender, EventArgs e)
{
HexViewControl.ArrayLength = MemoryDomains.MainMemory.Size;
}
private void SaveConfigSettings()
{
}
#endregion
#region IToolForm implementation
public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
// TODO
}
public void FastUpdate()
{
// TODO
}
public void Restart()
{
// TODO
}
public bool AskSaveChanges()
{
return true; // TODO
}
public bool UpdateBefore { get { return false; } }
#endregion
#region HexView Callbacks
private void HexView_QueryIndexValue(int index, out long value)
{
value = MemoryDomains.MainMemory.PeekByte(index);
}
private void HexView_QueryIndexBgColor(int index, ref Color color)
{
color = Color.White;
}
private void HexView_QueryIndexForeColor(int index, ref Color color)
{
color = Color.Black;
}
#endregion
#region Menu Items
private void FileSubMenu_DropDownOpened(object sender, EventArgs e)
{
}
private void ExitMenuItem_Click(object sender, EventArgs e)
{
Close();
}
#endregion
}
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="HexMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -37,7 +37,7 @@ namespace BizHawk.Client.EmuHawk
}
[LuaMethod("socketServerIsConnected", "socketServerIsConnected")]
public bool SocketServerIsConnected() => GlobalWin.socketServer.connected;
public bool SocketServerIsConnected() => GlobalWin.socketServer.Connected;
[LuaMethod("socketServerScreenShot", "sends a screenshot to the Socket server")]
public string SocketServerScreenShot()

View File

@ -625,6 +625,7 @@ namespace BizHawk.Client.EmuHawk
}
else if (Control.ModifierKeys == Keys.Shift && Control.ModifierKeys != Keys.Alt)
{
if (!TasView.AnyRowsSelected) return;
int firstSel = TasView.SelectedRows.First();
if (frame <= firstSel)

View File

@ -69,8 +69,6 @@ namespace BizHawk.Client.EmuHawk
continue;
// if (!ApiInjector.IsAvailable(, t))
// continue;
if (t == typeof(HexView) && OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows)
continue; // Skip this tool on Unix. It isn't finished and only causes exceptions
var instance = Activator.CreateInstance(t);

View File

@ -127,6 +127,7 @@ namespace BizHawk.Common
CreateNoWindow = true,
FileName = cmd,
RedirectStandardError = checkStderr,
RedirectStandardInput = true,
RedirectStandardOutput = checkStdout,
UseShellExecute = false
}
@ -149,4 +150,4 @@ namespace BizHawk.Common
}
}
}
}
}

View File

@ -41,8 +41,7 @@
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Reference Include="Newtonsoft.Json">
<HintPath>..\References\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />

View File

@ -352,7 +352,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
if (_hmp0Delay > 0)
{
_hmp0Delay++;
if (_hmp0Delay == 4)
if (_hmp0Delay == 5)
{
_hmp0Delay = 0;
_player0.HM = _hmp0Val;
@ -362,7 +362,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
if (_hmp1Delay > 0)
{
_hmp1Delay++;
if (_hmp1Delay == 4)
if (_hmp1Delay == 5)
{
_hmp1Delay = 0;
_player1.HM = _hmp1Val;
@ -372,7 +372,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
if (_hmm0Delay > 0)
{
_hmm0Delay++;
if (_hmm0Delay == 4)
if (_hmm0Delay == 5)
{
_hmm0Delay = 0;
_player0.Missile.Hm = _hmm0Val;
@ -382,7 +382,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
if (_hmm1Delay > 0)
{
_hmm1Delay++;
if (_hmm1Delay == 4)
if (_hmm1Delay == 5)
{
_hmm1Delay = 0;
_player1.Missile.Hm = _hmm1Val;
@ -392,7 +392,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
if (_hmbDelay > 0)
{
_hmbDelay++;
if (_hmbDelay == 4)
if (_hmbDelay == 5)
{
_hmbDelay = 0;
_ball.HM = _hmbVal;

View File

@ -256,6 +256,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=performant/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Phaser/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pollable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Prereqs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Regionable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=resizer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Rewinder/@EntryIndexedValue">True</s:Boolean>
@ -287,6 +288,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unpausing/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unthrottle/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Unthrottled/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=vals/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Vectrex/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Virtua/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Virtualpad/@EntryIndexedValue">True</s:Boolean>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Virtu</RootNamespace>
<AssemblyName>Virtu</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -29,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">

Binary file not shown.

Binary file not shown.