Hex editor - more cleanups
This commit is contained in:
parent
7472e112ab
commit
46385174da
|
@ -120,7 +120,7 @@ namespace BizHawk.Client.EmuHawk.WinFormExtensions
|
||||||
form.StartPosition = FormStartPosition.Manual;
|
form.StartPosition = FormStartPosition.Manual;
|
||||||
form.Location = position;
|
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();
|
GlobalWin.Sound.StartSound();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
AddressesLabel.BackColor = Color.Transparent;
|
AddressesLabel.BackColor = Color.Transparent;
|
||||||
LoadConfigSettings();
|
LoadConfigSettings();
|
||||||
SetHeader();
|
SetHeader();
|
||||||
Closing += (o, e) => SaveConfigSettings();
|
Closing += (o, e) => CloseHexFind();
|
||||||
|
|
||||||
Header.Font = font;
|
Header.Font = font;
|
||||||
AddressesLabel.Font = font;
|
AddressesLabel.Font = font;
|
||||||
|
@ -353,21 +353,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
return '?';
|
return '?';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (val < ' ')
|
|
||||||
{
|
|
||||||
return '.';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (val >= 0x7F)
|
if (val < ' ' || val >= 0x7F)
|
||||||
{
|
{
|
||||||
return '.';
|
return '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
return (char)val;
|
return (char)val;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static bool CurrentRomIsArchive()
|
private static bool CurrentRomIsArchive()
|
||||||
{
|
{
|
||||||
|
@ -471,8 +464,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Header.ForeColor = Global.Config.HexForegrndColor;
|
Header.ForeColor = Global.Config.HexForegrndColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: rename me
|
private void CloseHexFind()
|
||||||
private void SaveConfigSettings()
|
|
||||||
{
|
{
|
||||||
if (_hexFind.IsHandleCreated || !_hexFind.IsDisposed)
|
if (_hexFind.IsHandleCreated || !_hexFind.IsDisposed)
|
||||||
{
|
{
|
||||||
|
@ -715,7 +707,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private bool IsVisible(long address)
|
private bool IsVisible(long address)
|
||||||
{
|
{
|
||||||
var i = address >> 4;
|
var i = address >> 4;
|
||||||
return i >= HexScrollBar.Value && i < (_rowsVisible + HexScrollBar.Value);
|
return i >= HexScrollBar.Value && i < _rowsVisible + HexScrollBar.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetHeader()
|
private void SetHeader()
|
||||||
|
@ -773,14 +765,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (address >= 0)
|
if (address >= 0)
|
||||||
{
|
{
|
||||||
// TODO: can't unfreeze address 0??
|
|
||||||
Global.CheatList.RemoveRange(Global.CheatList.Where(x => x.Contains(address)));
|
Global.CheatList.RemoveRange(Global.CheatList.Where(x => x.Contains(address)));
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryViewerBox.Refresh();
|
MemoryViewerBox.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO refactor to int?
|
|
||||||
private void FreezeAddress(long address)
|
private void FreezeAddress(long address)
|
||||||
{
|
{
|
||||||
if (address >= 0)
|
if (address >= 0)
|
||||||
|
@ -846,7 +836,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return "Binary (*.bin)|*.bin|All Files|*.*";
|
return "Binary (*.bin)|*.bin|All Files|*.*";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private string RomDirectory
|
private string RomDirectory
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -855,7 +844,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(path))
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
{
|
{
|
||||||
return path;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path.Contains("|"))
|
if (path.Contains("|"))
|
||||||
|
@ -875,7 +864,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(path))
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
{
|
{
|
||||||
return path;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path.Contains("|"))
|
if (path.Contains("|"))
|
||||||
|
@ -1064,27 +1053,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: obsolete me
|
|
||||||
private void PokeWord(long address, byte _1, byte _2)
|
|
||||||
{
|
|
||||||
if (BigEndian)
|
|
||||||
{
|
|
||||||
_domain.PokeByte(address, _2);
|
|
||||||
_domain.PokeByte(address + 1, _1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_domain.PokeByte(address, _1);
|
|
||||||
_domain.PokeByte(address + 1, _2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void IncrementAddress(long address)
|
private void IncrementAddress(long address)
|
||||||
{
|
{
|
||||||
if (Global.CheatList.IsActive(_domain, address))
|
if (Global.CheatList.IsActive(_domain, address))
|
||||||
{
|
{
|
||||||
// TODO: Increment should be intelligent since IsActive is. If this address is part of a multi-byte cheat it should intelligently increment just that byte
|
// TODO: Increment should be intelligent since IsActive is. If this address is part of a multi-byte cheat it should intelligently increment just that byte
|
||||||
Global.CheatList.FirstOrDefault(x => x.Domain == _domain && x.Address == address).Increment();
|
Global.CheatList.First(x => x.Domain == _domain && x.Address == address).Increment();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1117,7 +1091,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (Global.CheatList.IsActive(_domain, address))
|
if (Global.CheatList.IsActive(_domain, address))
|
||||||
{
|
{
|
||||||
// TODO: Increment should be intelligent since IsActive is. If this address is part of a multi-byte cheat it should intelligently increment just that byte
|
// TODO: Increment should be intelligent since IsActive is. If this address is part of a multi-byte cheat it should intelligently increment just that byte
|
||||||
Global.CheatList.FirstOrDefault(x => x.Domain == _domain && x.Address == address).Decrement();
|
Global.CheatList.First(x => x.Domain == _domain && x.Address == address).Decrement();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1411,9 +1385,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
for (int i = 0; i < addresses.Length; i++)
|
for (int i = 0; i < addresses.Length; i++)
|
||||||
{
|
{
|
||||||
sb.Append(ValueString(addresses[i]));
|
sb.Append(ValueString(addresses[i]));
|
||||||
if(i != addresses.Length-1)
|
if (i != addresses.Length - 1)
|
||||||
|
{
|
||||||
sb.Append(' ');
|
sb.Append(' ');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var addr in addresses)
|
foreach (var addr in addresses)
|
||||||
|
@ -2106,7 +2082,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (_domain.ToString() == cheat.Domain.Name)
|
if (_domain.ToString() == cheat.Domain.Name)
|
||||||
{
|
{
|
||||||
var gaps = (int)cheat.Size - (int)DataSize;
|
var gaps = (int)cheat.Size - DataSize;
|
||||||
|
|
||||||
if (cheat.Size == WatchSize.DWord && DataSize == 2)
|
if (cheat.Size == WatchSize.DWord && DataSize == 2)
|
||||||
{
|
{
|
||||||
|
@ -2128,6 +2104,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (_highlightedAddress.HasValue && IsVisible(_highlightedAddress.Value))
|
if (_highlightedAddress.HasValue && IsVisible(_highlightedAddress.Value))
|
||||||
{
|
{
|
||||||
long addressHighlighted = _highlightedAddress ?? 0;
|
long addressHighlighted = _highlightedAddress ?? 0;
|
||||||
|
|
||||||
// Create a slight offset to increase rectangle sizes
|
// Create a slight offset to increase rectangle sizes
|
||||||
var point = GetAddressCoordinates(addressHighlighted);
|
var point = GetAddressCoordinates(addressHighlighted);
|
||||||
var textX = (int)GetTextX(addressHighlighted);
|
var textX = (int)GetTextX(addressHighlighted);
|
||||||
|
@ -2244,7 +2221,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _programmaticallyChangingValue = false;
|
private bool _programmaticallyChangingValue;
|
||||||
private void HexScrollBar_ValueChanged(object sender, EventArgs e)
|
private void HexScrollBar_ValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!_programmaticallyChangingValue)
|
if (!_programmaticallyChangingValue)
|
||||||
|
@ -2267,7 +2244,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void viewN64MatrixToolStripMenuItem_Click(object sender, EventArgs e)
|
private void viewN64MatrixToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!_highlightedAddress.HasValue)
|
if (!_highlightedAddress.HasValue)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool bigEndian = true;
|
bool bigEndian = true;
|
||||||
long addr = _highlightedAddress.Value;
|
long addr = _highlightedAddress.Value;
|
||||||
|
|
Loading…
Reference in New Issue