Merge pull request #1 from TASVideos/master

sync up to test
This commit is contained in:
alyosha-tas 2016-05-16 06:55:49 -04:00
commit 3625bdaf9d
119 changed files with 3275 additions and 1426 deletions

4
.editorconfig Normal file
View File

@ -0,0 +1,4 @@
root = true
[*]
indent_style = tab

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
@ -22,6 +23,7 @@ namespace BizHawk.Client.ApiHawk
private static readonly Assembly clientAssembly;
private static readonly object clientMainFormInstance;
private static readonly Type mainFormClass;
private static readonly Array joypadButtonsArray = Enum.GetValues(typeof(JoypadButton));
internal static readonly BizHawkSystemIdToEnumConverter SystemIdConverter = new BizHawkSystemIdToEnumConverter();
internal static readonly JoypadStringToEnumConverter JoypadConverter = new JoypadStringToEnumConverter();
@ -120,16 +122,13 @@ namespace BizHawk.Client.ApiHawk
/// <param name="bottom">Bottom padding</param>
public static void SetExtraPadding(int left, int top, int right, int bottom)
{
Type emuLuaLib = clientAssembly.GetType("BizHawk.Client.EmuHawk.EmuHawkLuaLibrary");
MethodInfo paddingMethod = emuLuaLib.GetMethod("SetClientExtraPadding");
paddingMethod.Invoke(paddingMethod, new object[] { left, top, right, bottom });
FieldInfo f = clientAssembly.GetType("BizHawk.Client.EmuHawk.GlobalWin").GetField("DisplayManager");
object displayManager = f.GetValue(null);
f = f.FieldType.GetField("ClientExtraPadding");
f.SetValue(displayManager, new Padding(left, top, right, bottom));
/*FieldInfo f = clientAssembly.GetType("BizHawk.Client.EmuHawk.GlobalWin").GetField("DisplayManager").FieldType.GetField("ClientExtraPadding");
f.SetValue(clientAssembly.GetType("BizHawk.Client.EmuHawk.GlobalWin").GetField("DisplayManager"), new System.Windows.Forms.Padding(left, top, right, bottom));
MethodInfo resize = mainFormClass.GetMethod("FrameBufferResized");
resize.Invoke(clientMainFormInstance, null);*/
/*GlobalWin.DisplayManager.ClientExtraPadding = new System.Windows.Forms.Padding(left, top, right, bottom);
GlobalWin.MainForm.FrameBufferResized();*/
resize.Invoke(clientMainFormInstance, null);
}
/// <summary>
@ -169,6 +168,7 @@ namespace BizHawk.Client.ApiHawk
/// <param name="player">Player (one based) whom inputs must be set</param>
/// <param name="joypad"><see cref="Joypad"/> with inputs</param>
/// <exception cref="IndexOutOfRangeException">Raised when you specify a player less than 1 or greater than maximum allows (see SystemInfo class to get this information)</exception>
/// <remarks>Still have some strange behaviour with multiple inputs; so this feature is still in beta</remarks>
public static void SetInput(int player, Joypad joypad)
{
if (player < 1 || player > RunningSystem.MaxControllers)
@ -184,16 +184,33 @@ namespace BizHawk.Client.ApiHawk
}
else
{
Parallel.ForEach<JoypadButton>((IEnumerable<JoypadButton>)Enum.GetValues(typeof(JoypadButton)), button =>
foreach (JoypadButton button in joypadButtonsArray)
{
if (joypad.Inputs.HasFlag(button))
{
AutoFireStickyXorAdapter joypadAdaptor = Global.AutofireStickyXORAdapter;
joypadAdaptor.SetSticky(string.Format("P{0} {1}", player, JoypadConverter.ConvertBack(button, RunningSystem)), true);
if (RunningSystem == SystemInfo.GB)
{
joypadAdaptor.SetSticky(string.Format("{0}", JoypadConverter.ConvertBack(button, RunningSystem)), true);
}
else
{
joypadAdaptor.SetSticky(string.Format("P{0} {1}", player, JoypadConverter.ConvertBack(button, RunningSystem)), true);
}
}
}
);
}
//Using this break joypad usage (even in UI); have to figure out why
/*if ((RunningSystem.AvailableButtons & JoypadButton.AnalogStick) == JoypadButton.AnalogStick)
{
AutoFireStickyXorAdapter joypadAdaptor = Global.AutofireStickyXORAdapter;
for (int i = 1; i <= RunningSystem.MaxControllers; i++)
{
joypadAdaptor.SetFloat(string.Format("P{0} X Axis", i), allJoypads[i - 1].AnalogX);
joypadAdaptor.SetFloat(string.Format("P{0} Y Axis", i), allJoypads[i - 1].AnalogY);
}
}*/
}
}
@ -202,7 +219,7 @@ namespace BizHawk.Client.ApiHawk
/// Resume the emulation
/// </summary>
public static void UnpauseEmulation()
{
{
MethodInfo method = mainFormClass.GetMethod("UnpauseEmulator");
method.Invoke(clientMainFormInstance, null);
}
@ -228,15 +245,26 @@ namespace BizHawk.Client.ApiHawk
Parallel.ForEach<string>(pressedButtons, button =>
{
int player;
if (int.TryParse(button.Substring(1, 2), out player))
if (RunningSystem == SystemInfo.GB)
{
allJoypads[player - 1].AddInput(JoypadConverter.Convert(button.Substring(3)));
allJoypads[0].AddInput(JoypadConverter.Convert(button));
}
else
{
if (int.TryParse(button.Substring(1, 2), out player))
{
allJoypads[player - 1].AddInput(JoypadConverter.Convert(button.Substring(3)));
}
}
});
if ((RunningSystem.AvailableButtons & JoypadButton.AnalogStick) == JoypadButton.AnalogStick)
{
//joypadAdaptor.GetFloat();
for (int i = 1; i <= RunningSystem.MaxControllers; i++)
{
allJoypads[i - 1].AnalogX = joypadAdaptor.GetFloat(string.Format("P{0} X Axis", i));
allJoypads[i - 1].AnalogY = joypadAdaptor.GetFloat(string.Format("P{0} Y Axis", i));
}
}
}

View File

@ -12,6 +12,8 @@ namespace BizHawk.Client.ApiHawk
private SystemInfo _System;
private JoypadButton _PressedButtons;
private float _AnalogX;
private float _AnalogY;
private int _Player;
#endregion
@ -72,6 +74,38 @@ namespace BizHawk.Client.ApiHawk
#region Properties
/// <summary>
/// Gets or sets X value for Analog stick
/// </summary>
/// <remarks>The value you get will aways be rounded to 0 decimal</remarks>
public float AnalogX
{
get
{
return (float)Math.Round(_AnalogX, 0);
}
set
{
_AnalogX = value;
}
}
/// <summary>
/// Gets or sets Y value for Analog stick
/// </summary>
/// <remarks>The value you get will aways be rounded to 0 decimal</remarks>
public float AnalogY
{
get
{
return (float)Math.Round(_AnalogY, 0);
}
set
{
_AnalogY = value;
}
}
/// <summary>
/// Gets or sets inputs
/// If you pass inputs unavailable for current system, they'll be removed

View File

@ -30,7 +30,37 @@ namespace BizHawk.Client.ApiHawk
return JoypadButton.A;
case "B":
return JoypadButton.B;
return JoypadButton.B;
case "B1":
return JoypadButton.B1;
case "B2":
return JoypadButton.B2;
case "C":
return JoypadButton.C;
case "C UP":
return JoypadButton.CUp;
case "C DOWN":
return JoypadButton.CDown;
case "C LEFT":
return JoypadButton.CLeft;
case "C RIGHT":
return JoypadButton.CRight;
case "X":
return JoypadButton.X;
case "Y":
return JoypadButton.Y;
case "Z":
return JoypadButton.Z;
case "START":
return JoypadButton.Start;
@ -39,17 +69,27 @@ namespace BizHawk.Client.ApiHawk
return JoypadButton.Select;
case "UP":
case "DPAD U":
return JoypadButton.Up;
case "DOWN":
case "DPAD D":
return JoypadButton.Down;
case "LEFT":
case "DPAD L":
return JoypadButton.Left;
case "RIGHT":
case "DPAD R":
return JoypadButton.Right;
case "L":
return JoypadButton.L;
case "R":
return JoypadButton.R;
default:
throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", value));
}
@ -87,6 +127,36 @@ namespace BizHawk.Client.ApiHawk
case JoypadButton.B:
return "B";
case JoypadButton.B1:
return "B1";
case JoypadButton.B2:
return "B2";
case JoypadButton.C:
return "C";
case JoypadButton.CUp:
return "C Up";
case JoypadButton.CDown:
return "C Down";
case JoypadButton.CLeft:
return "C Left";
case JoypadButton.CRight:
return "C Right";
case JoypadButton.X:
return "X";
case JoypadButton.Y:
return "Y";
case JoypadButton.Z:
return "Z";
case JoypadButton.Start:
return "Start";
@ -94,16 +164,50 @@ namespace BizHawk.Client.ApiHawk
return "Select";
case JoypadButton.Up:
return "Up";
if (((SystemInfo)parameter) == SystemInfo.N64)
{
return "Dpad U";
}
else
{
return "Up";
}
case JoypadButton.Down:
return "Down";
if (((SystemInfo)parameter) == SystemInfo.N64)
{
return "Dpad D";
}
else
{
return "Down";
}
case JoypadButton.Left:
return "Left";
if (((SystemInfo)parameter) == SystemInfo.N64)
{
return "Dpad L";
}
else
{
return "Left";
}
case JoypadButton.Right:
return "Right";
if (((SystemInfo)parameter) == SystemInfo.N64)
{
return "Dpad R";
}
else
{
return "Right";
}
case JoypadButton.L:
return "L";
case JoypadButton.R:
return "R";
default:
throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", value));

View File

@ -52,7 +52,7 @@ namespace BizHawk.Client.Common
allSystemInfos.Add(new SystemInfo("Commodore 64", CoreSystem.Commodore64, 1));
allSystemInfos.Add(new SystemInfo("ColecoVision", CoreSystem.ColecoVision, 1));
allSystemInfos.Add(new SystemInfo("Gameboy Advance", CoreSystem.GameBoyAdvance, 1, StandardButtons | JoypadButton.L | JoypadButton.R));
allSystemInfos.Add(new SystemInfo("Nintendo 64", CoreSystem.Nintendo64, 4, StandardButtons ^ JoypadButton.Select | JoypadButton.Z | JoypadButton.CUp | JoypadButton.CDown | JoypadButton.CLeft | JoypadButton.CRight | JoypadButton.AnalogStick));
allSystemInfos.Add(new SystemInfo("Nintendo 64", CoreSystem.Nintendo64, 4, StandardButtons ^ JoypadButton.Select | JoypadButton.Z | JoypadButton.CUp | JoypadButton.CDown | JoypadButton.CLeft | JoypadButton.CRight | JoypadButton.AnalogStick | JoypadButton.L | JoypadButton.R));
allSystemInfos.Add(new SystemInfo("Saturn", CoreSystem.Saturn, 2, UpDownLeftRight | JoypadButton.A | JoypadButton.B | JoypadButton.C | JoypadButton.X | JoypadButton.Y | JoypadButton.Z));
allSystemInfos.Add(new SystemInfo("Game Boy Link", CoreSystem.DualGameBoy, 2, StandardButtons));
allSystemInfos.Add(new SystemInfo("WonderSwan", CoreSystem.WonderSwan, 1));
@ -106,7 +106,7 @@ namespace BizHawk.Client.Common
{
get
{
return allSystemInfos[24];
return allSystemInfos[25];
}
}

View File

@ -127,6 +127,7 @@ namespace BizHawk.Client.Common
public DateTime? Update_LastCheckTimeUTC = null;
public string Update_LatestVersion = "";
public string Update_IgnoreVersion = "";
public bool CDLAutoSave = true, CDLAutoStart = true;
//public bool TurboSeek = true; // When PauseOnFrame is set, this will decide whether the client goes into turbo mode or not

View File

@ -229,7 +229,7 @@ namespace BizHawk.Client.Common
var d = (string.IsNullOrEmpty(domain)) ? Domain : DomainList[VerifyMemoryDomain(domain)];
if (addr < d.Size)
{
var val = d.PeekDWord(addr, bigendian);
var val = d.PeekUint(addr, bigendian);
var bytes = BitConverter.GetBytes(val);
return BitConverter.ToSingle(bytes, 0);
}
@ -252,7 +252,7 @@ namespace BizHawk.Client.Common
var dv = (float)value;
var bytes = BitConverter.GetBytes(dv);
var v = BitConverter.ToUInt32(bytes, 0);
d.PokeDWord(addr, v, bigendian);
d.PokeUint(addr, v, bigendian);
}
else
{

View File

@ -79,10 +79,14 @@ namespace BizHawk.Client.Common
LagLog.Clear();
}
public void RemoveFrom(int frame)
public bool RemoveFrom(int frame)
{
if (LagLog.Count > frame && frame >= 0)
{
LagLog.RemoveRange(frame + 1, LagLog.Count - frame - 1);
return true;
}
return false;
}
public void RemoveHistoryAt(int frame)

View File

@ -266,6 +266,8 @@ namespace BizHawk.Client.Common
var states = inputStates.ToList();
for (int i = 0; i < states.Count; i++)
{
if (_log.Count <= frame + i)
break;
lg.SetSource(states[i]);
_log[frame + i] = lg.GenerateLogEntry();
}

View File

@ -354,14 +354,13 @@ namespace BizHawk.Client.Common
movie.BindMarkersToInput = bindMarkers;
if (redoLength != length)
movie.InsertEmptyFrame(movie.InputLogLength, length - redoLength);
movie.InsertEmptyFrame(FirstFrame, length - redoLength);
if (undoLength != length)
movie.RemoveFrames(FirstFrame, movie.InputLogLength - undoLength);
for (int i = 0; i < undoLength; i++)
movie.SetFrame(FirstFrame + i, oldLog[i]);
if (undoLength != length)
movie.RemoveFrames(FirstFrame + undoLength, movie.InputLogLength);
movie.ChangeLog.IsRecording = wasRecording;
movie.BindMarkersToInput = bindMarkers;
}
@ -373,14 +372,13 @@ namespace BizHawk.Client.Common
movie.BindMarkersToInput = bindMarkers;
if (undoLength != length)
movie.InsertEmptyFrame(movie.InputLogLength, length - undoLength);
movie.InsertEmptyFrame(FirstFrame, length - undoLength);
if (redoLength != length)
movie.RemoveFrames(FirstFrame, movie.InputLogLength - redoLength);
for (int i = 0; i < redoLength; i++)
movie.SetFrame(FirstFrame + i, newLog[i]);
if (redoLength != length)
movie.RemoveFrames(FirstFrame + redoLength, movie.InputLogLength);
movie.ChangeLog.IsRecording = wasRecording;
movie.BindMarkersToInput = bindMarkers;
}

View File

@ -211,7 +211,7 @@ namespace BizHawk.Client.Common
}
// Movie should always have a state at frame 0.
if (!this.StartsFromSavestate)
if (!this.StartsFromSavestate && Global.Emulator.Frame == 0)
StateManager.Capture();
}

View File

@ -224,8 +224,8 @@ namespace BizHawk.Client.Common
/// <param name="frame">The last frame that can be valid.</param>
private void InvalidateAfter(int frame)
{
LagLog.RemoveFrom(frame);
var anyInvalidated = StateManager.Invalidate(frame + 1);
var anyInvalidated = LagLog.RemoveFrom(frame);
StateManager.Invalidate(frame + 1);
Changes = true; // TODO check if this actually removed anything before flagging changes
if (anyInvalidated && Global.MovieSession.Movie.IsCountingRerecords)

View File

@ -81,6 +81,11 @@ namespace BizHawk.Client.Common
get { return (int)(Settings.Cap / _expectedStateSize) + (int)((ulong)Settings.DiskCapacitymb * 1024 * 1024 / _expectedStateSize); }
}
private int _stateGap
{
get { return 1 << Settings.StateGap; }
}
public TasStateManager(TasMovie movie)
{
_movie = movie;
@ -195,7 +200,7 @@ namespace BizHawk.Client.Common
}
else
{
shouldCapture = frame - States.Keys.LastOrDefault(k => k < frame) >= StateFrequency;
shouldCapture = frame % StateFrequency == 0;
}
if (shouldCapture)
@ -390,7 +395,7 @@ namespace BizHawk.Client.Common
if (BranchStates[frame][branch].IsOnDisk)
BranchStates[frame][branch].Dispose();
else
Used -= (ulong)BranchStates[frame][branch].Length;
//Used -= (ulong)BranchStates[frame][branch].Length;
BranchStates[frame].RemoveAt(BranchStates[frame].IndexOfKey(branch));
if (BranchStates[frame].Count == 0)
@ -520,9 +525,27 @@ namespace BizHawk.Client.Common
private List<int> ExcludeStates()
{
List<int> ret = new List<int>();
ulong saveUsed = Used + DiskUsed;
int index = -1;
// respect state gap no matter how small the resulting size will be
// still leave marker states
for (int i = 1; i < States.Count; i++)
{
if (_movie.Markers.IsMarker(States.ElementAt(i).Key + 1) ||
States.ElementAt(i).Key % _stateGap == 0)
continue;
ret.Add(i);
if (States.ElementAt(i).Value.IsOnDisk)
saveUsed -= _expectedStateSize;
else
saveUsed -= (ulong)States.ElementAt(i).Value.Length;
}
// if the size is still too big, exclude states form the beginning
// still leave marker states
int index = 0;
while (saveUsed > (ulong)Settings.DiskSaveCapacitymb * 1024 * 1024)
{
do
@ -530,18 +553,22 @@ namespace BizHawk.Client.Common
index++;
if (index >= States.Count)
break;
} while (_movie.Markers.IsMarker(States.ElementAt(index).Key + 1));
if (index >= States.Count) break;
}
while (_movie.Markers.IsMarker(States.ElementAt(index).Key + 1));
if (index >= States.Count)
break;
ret.Add(index);
if (States.ElementAt(index).Value.IsOnDisk)
saveUsed -= _expectedStateSize;
else
saveUsed -= (ulong)States.ElementAt(index).Value.Length;
}
// If there are enough markers to still be over the limit, remove marker frames
index = -1;
// if there are enough markers to still be over the limit, remove marker frames
index = 0;
while (saveUsed > (ulong)Settings.DiskSaveCapacitymb * 1024 * 1024)
{
index++;
@ -571,28 +598,29 @@ namespace BizHawk.Client.Common
bw.Write(kvp.Key);
bw.Write(kvp.Value.Length);
bw.Write(kvp.Value.State);
_movie.ReportProgress(100d / States.Count * i);
//_movie.ReportProgress(100d / States.Count * i);
}
}
public void Load(BinaryReader br)
{
States.Clear();
//if (br.BaseStream.Length > 0)
//{ BaseStream.Length does not return the expected value.
int nstates = br.ReadInt32();
for (int i = 0; i < nstates; i++)
try
{
int frame = br.ReadInt32();
int len = br.ReadInt32();
byte[] data = br.ReadBytes(len);
// whether we should allow state removal check here is an interesting question
// nothing was edited yet, so it might make sense to show the project untouched first
SetState(frame, data);
//States.Add(frame, data);
//Used += len;
int nstates = br.ReadInt32();
for (int i = 0; i < nstates; i++)
{
int frame = br.ReadInt32();
int len = br.ReadInt32();
byte[] data = br.ReadBytes(len);
// whether we should allow state removal check here is an interesting question
// nothing was edited yet, so it might make sense to show the project untouched first
SetState(frame, data);
//States.Add(frame, data);
//Used += len;
}
}
//}
catch (EndOfStreamException) { }
}
public void SaveBranchStates(BinaryWriter bw)
@ -650,7 +678,21 @@ namespace BizHawk.Client.Common
// 4 bytes - length of savestate
// 0 - n savestate
private ulong Used { get; set; }
private ulong _used;
private ulong Used
{
get
{
return _used;
}
set
{
if (value > 0xf000000000000000)
System.Diagnostics.Debug.Fail("ulong Used underfow!");
else
_used = value;
}
}
private ulong DiskUsed
{
@ -736,7 +778,7 @@ namespace BizHawk.Client.Common
// Loop through branch states for the given frame.
SortedList<int, StateManagerState> stateList = BranchStates[frame];
for (int i = 0; i < _movie.BranchCount; i++)
for (int i = 0; i < stateList.Count(); i++)
{
// Don't check the branch containing the state to match.
if (i == _movie.BranchIndexByHash(branchHash))
@ -797,7 +839,7 @@ namespace BizHawk.Client.Common
SortedList<int, StateManagerState> stateList = kvp.Value;
if (stateList == null)
continue;
/*
if (stateList.ContainsKey(branchHash))
{
if (stateHasDuplicate(kvp.Key, branchHash) == -2)
@ -806,7 +848,7 @@ namespace BizHawk.Client.Common
Used -= (ulong)stateList[branchHash].Length;
}
}
*/
stateList.Remove(branchHash);
if (stateList.Count == 0)
BranchStates.Remove(kvp.Key);
@ -823,7 +865,7 @@ namespace BizHawk.Client.Common
SortedList<int, StateManagerState> stateList = kvp.Value;
if (stateList == null)
continue;
/*
if (stateList.ContainsKey(branchHash))
{
if (stateHasDuplicate(kvp.Key, branchHash) == -2)
@ -832,7 +874,7 @@ namespace BizHawk.Client.Common
Used -= (ulong)stateList[branchHash].Length;
}
}
*/
stateList.Remove(branchHash);
if (stateList.Count == 0)
BranchStates.Remove(kvp.Key);

View File

@ -13,6 +13,7 @@ namespace BizHawk.Client.Common
DiskSaveCapacitymb = 512;
Capacitymb = 512;
DiskCapacitymb = 512;
StateGap = 4;
BranchStatesInTasproj = false;
EraseBranchStatesFirst = true;
}
@ -22,6 +23,7 @@ namespace BizHawk.Client.Common
DiskSaveCapacitymb = settings.DiskSaveCapacitymb;
Capacitymb = settings.Capacitymb;
DiskCapacitymb = settings.DiskCapacitymb;
StateGap = settings.StateGap;
BranchStatesInTasproj = settings.BranchStatesInTasproj;
EraseBranchStatesFirst = settings.EraseBranchStatesFirst;
}
@ -54,6 +56,13 @@ namespace BizHawk.Client.Common
[Description("The size limit of the state history buffer on the disk. When this limit is reached it will start removing previous savestates")]
public int DiskCapacitymb { get; set; }
/// <summary>
/// The amount of states to skip during project saving
/// </summary>
[DisplayName("State interval for .tasproj")]
[Description("The actual state gap in frames is calculated as Nth power on 2")]
public int StateGap { get; set; }
/// <summary>
/// Put branch states to .tasproj
/// </summary>
@ -95,6 +104,7 @@ namespace BizHawk.Client.Common
sb.AppendLine(DiskSaveCapacitymb.ToString());
sb.AppendLine(Capacitymb.ToString());
sb.AppendLine(DiskCapacitymb.ToString());
sb.AppendLine(StateGap.ToString());
sb.AppendLine(BranchStatesInTasproj.ToString());
sb.AppendLine(EraseBranchStatesFirst.ToString());
@ -125,12 +135,17 @@ namespace BizHawk.Client.Common
DiskCapacitymb = 512;
if (lines.Length > 3)
BranchStatesInTasproj = bool.Parse(lines[3]);
StateGap = int.Parse(lines[3]);
else
StateGap = 4;
if (lines.Length > 4)
BranchStatesInTasproj = bool.Parse(lines[4]);
else
BranchStatesInTasproj = false;
if (lines.Length > 4)
EraseBranchStatesFirst = bool.Parse(lines[4]);
if (lines.Length > 5)
EraseBranchStatesFirst = bool.Parse(lines[5]);
else
EraseBranchStatesFirst = true;
}

View File

@ -888,11 +888,11 @@ namespace BizHawk.Client.Common
return theByte;
case WatchSize.Word:
var theWord = _settings.Domain.PeekWord(addr % Domain.Size, _settings.BigEndian);
var theWord = _settings.Domain.PeekUshort(addr % Domain.Size, _settings.BigEndian);
return theWord;
case WatchSize.DWord:
var theDWord = _settings.Domain.PeekDWord(addr % Domain.Size, _settings.BigEndian);
var theDWord = _settings.Domain.PeekUint(addr % Domain.Size, _settings.BigEndian);
return theDWord;
}
}
@ -958,7 +958,7 @@ namespace BizHawk.Client.Common
public MiniWordWatch(MemoryDomain domain, long addr, bool bigEndian)
{
Address = addr;
_previous = domain.PeekWord(Address % domain.Size, bigEndian);
_previous = domain.PeekUshort(Address % domain.Size, bigEndian);
}
public long Previous
@ -968,7 +968,7 @@ namespace BizHawk.Client.Common
public void SetPreviousToCurrent(MemoryDomain domain, bool bigendian)
{
_previous = domain.PeekWord(Address, bigendian);
_previous = domain.PeekUshort(Address, bigendian);
}
}
@ -980,7 +980,7 @@ namespace BizHawk.Client.Common
public MiniDWordWatch(MemoryDomain domain, long addr, bool bigEndian)
{
Address = addr;
_previous = domain.PeekDWord(Address % domain.Size, bigEndian);
_previous = domain.PeekUint(Address % domain.Size, bigEndian);
}
public long Previous
@ -990,7 +990,7 @@ namespace BizHawk.Client.Common
public void SetPreviousToCurrent(MemoryDomain domain, bool bigendian)
{
_previous = domain.PeekDWord(Address, bigendian);
_previous = domain.PeekUint(Address, bigendian);
}
}
@ -1071,7 +1071,7 @@ namespace BizHawk.Client.Common
public void SetPreviousToCurrent(MemoryDomain domain, bool bigendian)
{
_previous = _prevFrame = domain.PeekWord(Address % domain.Size, bigendian);
_previous = _prevFrame = domain.PeekUshort(Address % domain.Size, bigendian);
}
public long Previous
@ -1086,7 +1086,7 @@ namespace BizHawk.Client.Common
public void Update(PreviousType type, MemoryDomain domain, bool bigendian)
{
var value = domain.PeekWord(Address % domain.Size, bigendian);
var value = domain.PeekUshort(Address % domain.Size, bigendian);
if (value != Previous)
{
_changecount++;
@ -1131,7 +1131,7 @@ namespace BizHawk.Client.Common
public void SetPreviousToCurrent(MemoryDomain domain, bool bigendian)
{
_previous = _prevFrame = domain.PeekDWord(Address % domain.Size, bigendian);
_previous = _prevFrame = domain.PeekUint(Address % domain.Size, bigendian);
}
public long Previous
@ -1146,7 +1146,7 @@ namespace BizHawk.Client.Common
public void Update(PreviousType type, MemoryDomain domain, bool bigendian)
{
var value = domain.PeekDWord(Address % domain.Size, bigendian);
var value = domain.PeekUint(Address % domain.Size, bigendian);
if (value != Previous)
{
_changecount++;
@ -1180,7 +1180,7 @@ namespace BizHawk.Client.Common
public Settings(IMemoryDomains memoryDomains)
{
BigEndian = memoryDomains.MainMemory.EndianType == MemoryDomain.Endian.Big;
Size = (WatchSize)memoryDomains.MainMemory.ByteSize;
Size = (WatchSize)memoryDomains.MainMemory.WordSize;
Type = DisplayType.Unsigned;
Mode = memoryDomains.MainMemory.Size > (1024 * 1024) ?
SearchMode.Fast :

View File

@ -373,11 +373,11 @@ namespace BizHawk.Client.Common
{
if (_domain.Size == 0)
{
return _domain.PeekWord(_address, _bigEndian);
return _domain.PeekUshort(_address, _bigEndian);
}
else
{
return _domain.PeekWord(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
return _domain.PeekUshort(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
}
}
}
@ -393,11 +393,11 @@ namespace BizHawk.Client.Common
{
if (_domain.Size == 0)
{
return _domain.PeekDWord(_address, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
return _domain.PeekUint(_address, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
}
else
{
return _domain.PeekDWord(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
return _domain.PeekUint(_address % _domain.Size, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
}
}
}
@ -412,15 +412,15 @@ namespace BizHawk.Client.Common
protected void PokeWord(ushort val)
{
if (_domain.Size == 0)
_domain.PokeWord(_address, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
else _domain.PokeWord(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
_domain.PokeUshort(_address, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
else _domain.PokeUshort(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
}
protected void PokeDWord(uint val)
{
if (_domain.Size == 0)
_domain.PokeDWord(_address, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
else _domain.PokeDWord(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
_domain.PokeUint(_address, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
else _domain.PokeUint(_address % _domain.Size, val, _bigEndian); // TODO: % size stil lisn't correct since it could be the last byte of the domain
}
#endregion Protected
@ -736,7 +736,7 @@ namespace BizHawk.Client.Common
}
else
{
throw new InvalidOperationException("You cannot set diffrent domain to a watch on the fly");
throw new InvalidOperationException("You cannot set a different domain to a watch on the fly");
}
}
}

View File

@ -326,7 +326,9 @@ namespace BizHawk.Client.Common
{
_memoryDomains = core;
Parallel.ForEach<Watch>(_watchList, watch =>
{
{
if (watch.IsSeparator)
return;
watch.Domain = core[watch.Domain.Name];
watch.ResetPrevious();
watch.Update();

View File

@ -141,31 +141,35 @@ namespace BizHawk.Client.EmuHawk
}
Bitmap bmp = new Bitmap(source.BufferWidth, source.BufferHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
using (var bmp = new Bitmap(source.BufferWidth, source.BufferHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
{
var data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
System.Runtime.InteropServices.Marshal.Copy(source.GetVideoBuffer(), 0, data.Scan0, bmp.Width * bmp.Height);
bmp.UnlockBits(data);
}
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
byte[] b = ms.GetBuffer();
if (!firstdone)
{
firstdone = true;
b[10] = (byte)(b[10] & 0x78); // no global color table
f.Write(b, 0, 13);
f.Write(GifAnimation, 0, GifAnimation.Length);
}
b[785] = Delay[0];
b[786] = Delay[1];
b[798] = (byte)(b[798] | 0x87);
f.Write(b, 781, 18);
f.Write(b, 13, 768);
f.Write(b, 799, (int)(ms.Length - 800));
using (var qBmp = new OctreeQuantizer(255, 8).Quantize(bmp))
{
MemoryStream ms = new MemoryStream();
qBmp.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
byte[] b = ms.GetBuffer();
if (!firstdone)
{
firstdone = true;
b[10] = (byte)(b[10] & 0x78); // no global color table
f.Write(b, 0, 13);
f.Write(GifAnimation, 0, GifAnimation.Length);
}
b[785] = Delay[0];
b[786] = Delay[1];
b[798] = (byte)(b[798] | 0x87);
f.Write(b, 781, 18);
f.Write(b, 13, 768);
f.Write(b, 799, (int)(ms.Length - 800));
lastbyte = b[ms.Length - 1];
lastbyte = b[ms.Length - 1];
}
}
}
public void AddSamples(short[] samples)

View File

@ -0,0 +1,583 @@
/////////////////////////////////////////////////////////////////////////////////
// Paint.NET
// Copyright (C) Rick Brewster, Chris Crosetto, Dennis Dietrich, Tom Jackson,
// Michael Kelsey, Brandon Ortiz, Craig Taylor, Chris Trevino,
// and Luke Walker
// Portions Copyright (C) Microsoft Corporation. All Rights Reserved.
// See src/setup/License.rtf for complete licensing and attribution information.
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
// Copied for Paint.NET PCX Plugin
// Copyright (C) Joshua Bell
/////////////////////////////////////////////////////////////////////////////////
// Based on: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/colorquant.asp
//Bizhawk says: adapted from https://github.com/inexorabletash/PcxFileType/blob/master/Quantize
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
namespace BizHawk.Client.EmuHawk
{
/// <summary>
/// Quantize using an Octree
/// </summary>
unsafe class OctreeQuantizer : Quantizer
{
/// <summary>
/// Stores the tree
/// </summary>
private Octree _octree;
/// <summary>
/// Maximum allowed color depth
/// </summary>
private int _maxColors;
/// <summary>
/// Construct the octree quantizer
/// </summary>
/// <remarks>
/// The Octree quantizer is a two pass algorithm. The initial pass sets up the octree,
/// the second pass quantizes a color based on the nodes in the tree
/// </remarks>
/// <param name="maxColors">The maximum number of colors to return</param>
/// <param name="maxColorBits">The number of significant bits</param>
public OctreeQuantizer(int maxColors, int maxColorBits)
: base(false)
{
if (maxColors > 255)
throw new ArgumentOutOfRangeException("maxColors", maxColors, "The number of colors should be less than 256");
if ((maxColorBits < 1) |(maxColorBits > 8))
throw new ArgumentOutOfRangeException("maxColorBits", maxColorBits, "This should be between 1 and 8");
_octree = new Octree(maxColorBits);
_maxColors = maxColors;
}
/// <summary>
/// Process the pixel in the first pass of the algorithm
/// </summary>
/// <param name="pixel">The pixel to quantize</param>
/// <remarks>
/// This function need only be overridden if your quantize algorithm needs two passes,
/// such as an Octree quantizer.
/// </remarks>
protected override void InitialQuantizePixel(int pixel)
{
_octree.AddColor(pixel);
}
/// <summary>
/// Override this to process the pixel in the second pass of the algorithm
/// </summary>
/// <param name="pixel">The pixel to quantize</param>
/// <returns>The quantized value</returns>
protected override byte QuantizePixel(int pixel)
{
byte paletteIndex = (byte)_maxColors; // The color at [_maxColors] is set to transparent
// Get the palette index if this non-transparent
int a = (pixel>>24)&0xFF;
#if HANDLE_TRANSPARENCY
if (a > 0)
#endif
{
paletteIndex = (byte)_octree.GetPaletteIndex(pixel);
}
return paletteIndex;
}
/// <summary>
/// Retrieve the palette for the quantized image
/// </summary>
/// <param name="original">Any old palette, this is overrwritten</param>
/// <returns>The new color palette</returns>
protected override ColorPalette GetPalette(ColorPalette original)
{
// First off convert the octree to _maxColors colors
List<Color> palette = _octree.Palletize(_maxColors - 1);
// Then convert the palette based on those colors
for (int index = 0; index < palette.Count; index++)
{
original.Entries[index] = palette[index];
}
#if ORIGINAL_CODE
for (int i = palette.Count; i < original.Entries.Length; ++i)
{
original.Entries[i] = Color.FromArgb(255, 0, 0, 0);
}
// Add the transparent color
original.Entries[_maxColors] = Color.FromArgb(0, 0, 0, 0);
#else // PCX Plugin
// For PCX: Pad with transparency
for (int i = palette.Count; i < original.Entries.Length; ++i)
original.Entries[i] = Color.Transparent;
#endif
return original;
}
/// <summary>
/// Class which does the actual quantization
/// </summary>
private class Octree
{
/// <summary>
/// Construct the octree
/// </summary>
/// <param name="maxColorBits">The maximum number of significant bits in the image</param>
public Octree(int maxColorBits)
{
_maxColorBits = maxColorBits;
_leafCount = 0;
_reducibleNodes = new OctreeNode[9];
_root = new OctreeNode(0, _maxColorBits, this);
_previousColor = 0;
_previousNode = null;
}
/// <summary>
/// Add a given color value to the octree
/// </summary>
/// <param name="pixel"></param>
public void AddColor(int pixel)
{
// Check if this request is for the same color as the last
if (_previousColor == pixel)
{
// If so, check if I have a previous node setup. This will only ocurr if the first color in the image
// happens to be black, with an alpha component of zero.
if (null == _previousNode)
{
_previousColor = pixel;
_root.AddColor(pixel, _maxColorBits, 0, this);
}
else
{
// Just update the previous node
_previousNode.Increment(pixel);
}
}
else
{
_previousColor = pixel;
_root.AddColor(pixel, _maxColorBits, 0, this);
}
}
/// <summary>
/// Reduce the depth of the tree
/// </summary>
public void Reduce()
{
int index;
// Find the deepest level containing at least one reducible node
for (index = _maxColorBits - 1; (index > 0) && (null == _reducibleNodes[index]); index--)
{
// intentionally blank
}
// Reduce the node most recently added to the list at level 'index'
OctreeNode node = _reducibleNodes[index];
_reducibleNodes[index] = node.NextReducible;
// Decrement the leaf count after reducing the node
_leafCount -= node.Reduce();
// And just in case I've reduced the last color to be added, and the next color to
// be added is the same, invalidate the previousNode...
_previousNode = null;
}
/// <summary>
/// Get/Set the number of leaves in the tree
/// </summary>
public int Leaves
{
get
{
return _leafCount;
}
set
{
_leafCount = value;
}
}
/// <summary>
/// Return the array of reducible nodes
/// </summary>
protected OctreeNode[] ReducibleNodes
{
get
{
return _reducibleNodes;
}
}
/// <summary>
/// Keep track of the previous node that was quantized
/// </summary>
/// <param name="node">The node last quantized</param>
protected void TrackPrevious(OctreeNode node)
{
_previousNode = node;
}
private Color[] _palette;
private PaletteTable paletteTable;
/// <summary>
/// Convert the nodes in the octree to a palette with a maximum of colorCount colors
/// </summary>
/// <param name="colorCount">The maximum number of colors</param>
/// <returns>A list with the palettized colors</returns>
public List<Color> Palletize(int colorCount)
{
while (Leaves > colorCount)
{
Reduce();
}
// Now palettize the nodes
List<Color> palette = new List<Color>(Leaves);
int paletteIndex = 0;
_root.ConstructPalette(palette, ref paletteIndex);
// And return the palette
this._palette = palette.ToArray();
this.paletteTable = null;
return palette;
}
/// <summary>
/// Get the palette index for the passed color
/// </summary>
/// <param name="pixel"></param>
/// <returns></returns>
public int GetPaletteIndex(int pixel)
{
int ret = -1;
ret = _root.GetPaletteIndex(pixel, 0);
if (ret < 0)
{
if (this.paletteTable == null)
{
this.paletteTable = new PaletteTable(this._palette);
}
ret = this.paletteTable.FindClosestPaletteIndex(Color.FromArgb(pixel));
}
return ret;
}
/// <summary>
/// Mask used when getting the appropriate pixels for a given node
/// </summary>
private static int[] mask = new int[8] { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
/// <summary>
/// The root of the octree
/// </summary>
private OctreeNode _root;
/// <summary>
/// Number of leaves in the tree
/// </summary>
private int _leafCount;
/// <summary>
/// Array of reducible nodes
/// </summary>
private OctreeNode[] _reducibleNodes;
/// <summary>
/// Maximum number of significant bits in the image
/// </summary>
private int _maxColorBits;
/// <summary>
/// Store the last node quantized
/// </summary>
private OctreeNode _previousNode;
/// <summary>
/// Cache the previous color quantized
/// </summary>
private int _previousColor;
/// <summary>
/// Class which encapsulates each node in the tree
/// </summary>
protected class OctreeNode
{
/// <summary>
/// Construct the node
/// </summary>
/// <param name="level">The level in the tree = 0 - 7</param>
/// <param name="colorBits">The number of significant color bits in the image</param>
/// <param name="octree">The tree to which this node belongs</param>
public OctreeNode(int level, int colorBits, Octree octree)
{
// Construct the new node
_leaf = (level == colorBits);
_red = 0;
_green = 0;
_blue = 0;
_pixelCount = 0;
// If a leaf, increment the leaf count
if (_leaf)
{
octree.Leaves++;
_nextReducible = null;
_children = null;
}
else
{
// Otherwise add this to the reducible nodes
_nextReducible = octree.ReducibleNodes[level];
octree.ReducibleNodes[level] = this;
_children = new OctreeNode[8];
}
}
/// <summary>
/// Add a color into the tree
/// </summary>
/// <param name="pixel">The color</param>
/// <param name="colorBits">The number of significant color bits</param>
/// <param name="level">The level in the tree</param>
/// <param name="octree">The tree to which this node belongs</param>
public void AddColor(int pixel, int colorBits, int level, Octree octree)
{
// Update the color information if this is a leaf
if (_leaf)
{
Increment(pixel);
// Setup the previous node
octree.TrackPrevious(this);
}
else
{
// Go to the next level down in the tree
int shift = 7 - level;
int b = pixel & 0xFF;
int g = (pixel >> 8) & 0xFF;
int r = (pixel >> 16) & 0xFF;
int index = ((r & mask[level]) >> (shift - 2)) |
((g & mask[level]) >> (shift - 1)) |
((b & mask[level]) >> (shift));
OctreeNode child = _children[index];
if (null == child)
{
// Create a new child node & store in the array
child = new OctreeNode(level + 1, colorBits, octree);
_children[index] = child;
}
// Add the color to the child node
child.AddColor(pixel, colorBits, level + 1, octree);
}
}
/// <summary>
/// Get/Set the next reducible node
/// </summary>
public OctreeNode NextReducible
{
get
{
return _nextReducible;
}
set
{
_nextReducible = value;
}
}
/// <summary>
/// Return the child nodes
/// </summary>
public OctreeNode[] Children
{
get
{
return _children;
}
}
/// <summary>
/// Reduce this node by removing all of its children
/// </summary>
/// <returns>The number of leaves removed</returns>
public int Reduce()
{
int children = 0;
_red = 0;
_green = 0;
_blue = 0;
// Loop through all children and add their information to this node
for (int index = 0; index < 8; index++)
{
if (null != _children[index])
{
_red += _children[index]._red;
_green += _children[index]._green;
_blue += _children[index]._blue;
_pixelCount += _children[index]._pixelCount;
++children;
_children[index] = null;
}
}
// Now change this to a leaf node
_leaf = true;
// Return the number of nodes to decrement the leaf count by
return(children - 1);
}
/// <summary>
/// Traverse the tree, building up the color palette
/// </summary>
/// <param name="palette">The palette</param>
/// <param name="paletteIndex">The current palette index</param>
public void ConstructPalette(List<Color> palette, ref int paletteIndex)
{
if (_leaf)
{
// Consume the next palette index
_paletteIndex = paletteIndex++;
// And set the color of the palette entry
int r = _red / _pixelCount;
int g = _green / _pixelCount;
int b = _blue / _pixelCount;
palette.Add(Color.FromArgb(r, g, b));
}
else
{
// Loop through children looking for leaves
for (int index = 0; index < 8; index++)
{
if (null != _children[index])
{
_children[index].ConstructPalette(palette, ref paletteIndex);
}
}
}
}
/// <summary>
/// Return the palette index for the passed color
/// </summary>
public int GetPaletteIndex(int pixel, int level)
{
int paletteIndex = _paletteIndex;
if (!_leaf)
{
int shift = 7 - level;
int b = pixel & 0xFF;
int g = (pixel >> 8) & 0xFF;
int r = (pixel >> 16) & 0xFF;
int index = ((r & mask[level]) >> (shift - 2)) |
((g & mask[level]) >> (shift - 1)) |
((b & mask[level]) >> (shift));
if (null != _children[index])
{
paletteIndex = _children[index].GetPaletteIndex(pixel, level + 1);
}
else
{
paletteIndex = -1;
}
}
return paletteIndex;
}
/// <summary>
/// Increment the pixel count and add to the color information
/// </summary>
public void Increment(int pixel)
{
++_pixelCount;
int b = pixel&0xFF;
int g = (pixel>>8) & 0xFF;
int r = (pixel >> 16) & 0xFF;
_red += r;
_green += g;
_blue += b;
}
/// <summary>
/// Flag indicating that this is a leaf node
/// </summary>
private bool _leaf;
/// <summary>
/// Number of pixels in this node
/// </summary>
private int _pixelCount;
/// <summary>
/// Red component
/// </summary>
private int _red;
/// <summary>
/// Green Component
/// </summary>
private int _green;
/// <summary>
/// Blue component
/// </summary>
private int _blue;
/// <summary>
/// Pointers to any child nodes
/// </summary>
private OctreeNode[] _children;
/// <summary>
/// Pointer to next reducible node
/// </summary>
private OctreeNode _nextReducible;
/// <summary>
/// The index of this node in the palette
/// </summary>
private int _paletteIndex;
}
}
}
}

View File

@ -0,0 +1,77 @@
/////////////////////////////////////////////////////////////////////////////////
// Paint.NET
// Copyright (C) Rick Brewster, Chris Crosetto, Dennis Dietrich, Tom Jackson,
// Michael Kelsey, Brandon Ortiz, Craig Taylor, Chris Trevino,
// and Luke Walker
// Portions Copyright (C) Microsoft Corporation. All Rights Reserved.
// See src/setup/License.rtf for complete licensing and attribution information.
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
// Copied for Paint.NET PCX Plugin
// Copyright (C) Joshua Bell
/////////////////////////////////////////////////////////////////////////////////
//Bizhawk says: adapted from https://github.com/inexorabletash/PcxFileType/blob/master/Quantize
using System.Drawing;
namespace BizHawk.Client.EmuHawk
{
public sealed class PaletteTable
{
private Color[] palette;
public Color this[int index]
{
get
{
return this.palette[index];
}
set
{
this.palette[index] = value;
}
}
private int GetDistanceSquared(Color a, Color b)
{
int dsq = 0; // delta squared
int v;
v = a.B - b.B;
dsq += v * v;
v = a.G - b.G;
dsq += v * v;
v = a.R - b.R;
dsq += v * v;
return dsq;
}
public int FindClosestPaletteIndex(Color pixel)
{
int dsqBest = int.MaxValue;
int ret = 0;
for (int i = 0; i < this.palette.Length; ++i)
{
int dsq = GetDistanceSquared(this.palette[i], pixel);
if (dsq < dsqBest)
{
dsqBest = dsq;
ret = i;
}
}
return ret;
}
public PaletteTable(Color[] palette)
{
this.palette = (Color[])palette.Clone();
}
}
}

View File

@ -0,0 +1,372 @@
/////////////////////////////////////////////////////////////////////////////////
// Paint.NET
// Copyright (C) Rick Brewster, Chris Crosetto, Dennis Dietrich, Tom Jackson,
// Michael Kelsey, Brandon Ortiz, Craig Taylor, Chris Trevino,
// and Luke Walker
// Portions Copyright (C) Microsoft Corporation. All Rights Reserved.
// See src/setup/License.rtf for complete licensing and attribution information.
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
// Copied for Paint.NET PCX Plugin
// Copyright (C) Joshua Bell
/////////////////////////////////////////////////////////////////////////////////
// Based on: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/colorquant.asp
//Bizhawk says: adapted from https://github.com/inexorabletash/PcxFileType/blob/master/Quantize
using System;
using System.Drawing;
using System.Drawing.Imaging;
namespace BizHawk.Client.EmuHawk
{
/// <summary>
/// Summary description for Class1.
/// </summary>
internal unsafe abstract class Quantizer
{
/// <summary>
/// Flag used to indicate whether a single pass or two passes are needed for quantization.
/// </summary>
private bool _singlePass;
protected bool highquality;
public bool HighQuality
{
get
{
return highquality;
}
set
{
highquality = value;
}
}
protected int ditherLevel;
public int DitherLevel
{
get
{
return this.ditherLevel;
}
set
{
this.ditherLevel = value;
}
}
/// <summary>
/// Construct the quantizer
/// </summary>
/// <param name="singlePass">If true, the quantization only needs to loop through the source pixels once</param>
/// <remarks>
/// If you construct this class with a true value for singlePass, then the code will, when quantizing your image,
/// only call the 'QuantizeImage' function. If two passes are required, the code will call 'InitialQuantizeImage'
/// and then 'QuantizeImage'.
/// </remarks>
public Quantizer(bool singlePass)
{
_singlePass = singlePass;
}
/// <summary>
/// Quantize an image and return the resulting output bitmap
/// </summary>
/// <param name="source">The image to quantize</param>
/// <returns>A quantized version of the image</returns>
public Bitmap Quantize(Image source)
{
// Get the size of the source image
int height = source.Height;
int width = source.Width;
// And construct a rectangle from these dimensions
Rectangle bounds = new Rectangle(0, 0, width, height);
// First off take a 32bpp copy of the image
Bitmap copy;
if (source is Bitmap && source.PixelFormat == PixelFormat.Format32bppArgb)
{
copy = (Bitmap)source;
}
else
{
copy = new Bitmap(width, height, PixelFormat.Format32bppArgb);
// Now lock the bitmap into memory
using (Graphics g = Graphics.FromImage(copy))
{
g.PageUnit = GraphicsUnit.Pixel;
// Draw the source image onto the copy bitmap,
// which will effect a widening as appropriate.
g.DrawImage(source, 0, 0, bounds.Width, bounds.Height);
}
}
// And construct an 8bpp version
Bitmap output = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
// Define a pointer to the bitmap data
BitmapData sourceData = null;
try
{
// Get the source image bits and lock into memory
sourceData = copy.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
// Call the FirstPass function if not a single pass algorithm.
// For something like an octree quantizer, this will run through
// all image pixels, build a data structure, and create a palette.
if (!_singlePass)
{
FirstPass(sourceData, width, height);
}
// Then set the color palette on the output bitmap. I'm passing in the current palette
// as there's no way to construct a new, empty palette.
output.Palette = this.GetPalette(output.Palette);
// Then call the second pass which actually does the conversion
SecondPass(sourceData, output, width, height, bounds);
}
finally
{
// Ensure that the bits are unlocked
copy.UnlockBits(sourceData);
}
if (copy != source)
{
copy.Dispose();
}
// Last but not least, return the output bitmap
return output;
}
/// <summary>
/// Execute the first pass through the pixels in the image
/// </summary>
/// <param name="sourceData">The source data</param>
/// <param name="width">The width in pixels of the image</param>
/// <param name="height">The height in pixels of the image</param>
protected virtual void FirstPass(BitmapData sourceData, int width, int height)
{
// Define the source data pointers. The source row is a byte to
// keep addition of the stride value easier (as this is in bytes)
byte* pSourceRow = (byte*)sourceData.Scan0.ToPointer();
int* pSourcePixel;
// Loop through each row
for (int row = 0; row < height; row++)
{
// Set the source pixel to the first pixel in this row
pSourcePixel = (Int32*)pSourceRow;
// And loop through each column
for (int col = 0; col < width; col++, pSourcePixel++)
{
InitialQuantizePixel(*pSourcePixel);
}
// Add the stride to the source row
pSourceRow += sourceData.Stride;
}
}
int ClampToByte(int val)
{
if (val < 0) return 0;
else if (val > 255) return 255;
else return val;
}
/// <summary>
/// Execute a second pass through the bitmap
/// </summary>
/// <param name="sourceData">The source bitmap, locked into memory</param>
/// <param name="output">The output bitmap</param>
/// <param name="width">The width in pixels of the image</param>
/// <param name="height">The height in pixels of the image</param>
/// <param name="bounds">The bounding rectangle</param>
protected virtual void SecondPass(BitmapData sourceData, Bitmap output, int width, int height, Rectangle bounds)
{
BitmapData outputData = null;
Color[] pallete = output.Palette.Entries;
int weight = ditherLevel;
try
{
// Lock the output bitmap into memory
outputData = output.LockBits(bounds, ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);
// Define the source data pointers. The source row is a byte to
// keep addition of the stride value easier (as this is in bytes)
byte* pSourceRow = (byte *)sourceData.Scan0.ToPointer();
Int32* pSourcePixel = (Int32 *)pSourceRow;
// Now define the destination data pointers
byte* pDestinationRow = (byte *)outputData.Scan0.ToPointer();
byte* pDestinationPixel = pDestinationRow;
int[] errorThisRowR = new int[width + 1];
int[] errorThisRowG = new int[width + 1];
int[] errorThisRowB = new int[width + 1];
for (int row = 0; row < height; row++)
{
int[] errorNextRowR = new int[width + 1];
int[] errorNextRowG = new int[width + 1];
int[] errorNextRowB = new int[width + 1];
int ptrInc;
if ((row & 1) == 0)
{
pSourcePixel = (Int32*)pSourceRow;
pDestinationPixel = pDestinationRow;
ptrInc = +1;
}
else
{
pSourcePixel = (Int32*)pSourceRow + width - 1;
pDestinationPixel = pDestinationRow + width - 1;
ptrInc = -1;
}
// Loop through each pixel on this scan line
for (int col = 0; col < width; ++col)
{
// Quantize the pixel
int srcPixel = *pSourcePixel;
int srcR = srcPixel & 0xFF; //not
int srcG = (srcPixel>>8) & 0xFF; //a
int srcB = (srcPixel>>16) & 0xFF; //mistake
int srcA = (srcPixel >> 24) & 0xFF;
int targetB = ClampToByte(srcB - ((errorThisRowB[col] * weight) / 8));
int targetG = ClampToByte(srcG - ((errorThisRowG[col] * weight) / 8));
int targetR = ClampToByte(srcR - ((errorThisRowR[col] * weight) / 8));
int targetA = srcA;
int target = (targetA<<24)|(targetB<<16)|(targetG<<8)|targetR;
byte pixelValue = QuantizePixel(target);
*pDestinationPixel = pixelValue;
int actual = pallete[pixelValue].ToArgb();
int actualR = actual & 0xFF;
int actualG = (actual >> 8) & 0xFF;
int actualB = (actual >> 16) & 0xFF;
int errorR = actualR - targetR;
int errorG = actualG - targetG;
int errorB = actualB - targetB;
// Floyd-Steinberg Error Diffusion:
// a) 7/16 error goes to x+1
// b) 5/16 error goes to y+1
// c) 3/16 error goes to x-1,y+1
// d) 1/16 error goes to x+1,y+1
const int a = 7;
const int b = 5;
const int c = 3;
int errorRa = (errorR * a) / 16;
int errorRb = (errorR * b) / 16;
int errorRc = (errorR * c) / 16;
int errorRd = errorR - errorRa - errorRb - errorRc;
int errorGa = (errorG * a) / 16;
int errorGb = (errorG * b) / 16;
int errorGc = (errorG * c) / 16;
int errorGd = errorG - errorGa - errorGb - errorGc;
int errorBa = (errorB * a) / 16;
int errorBb = (errorB * b) / 16;
int errorBc = (errorB * c) / 16;
int errorBd = errorB - errorBa - errorBb - errorBc;
errorThisRowR[col + 1] += errorRa;
errorThisRowG[col + 1] += errorGa;
errorThisRowB[col + 1] += errorBa;
errorNextRowR[width - col] += errorRb;
errorNextRowG[width - col] += errorGb;
errorNextRowB[width - col] += errorBb;
if (col != 0)
{
errorNextRowR[width - (col - 1)] += errorRc;
errorNextRowG[width - (col - 1)] += errorGc;
errorNextRowB[width - (col - 1)] += errorBc;
}
errorNextRowR[width - (col + 1)] += errorRd;
errorNextRowG[width - (col + 1)] += errorGd;
errorNextRowB[width - (col + 1)] += errorBd;
unchecked
{
pSourcePixel += ptrInc;
pDestinationPixel += ptrInc;
}
}
// Add the stride to the source row
pSourceRow += sourceData.Stride;
// And to the destination row
pDestinationRow += outputData.Stride;
errorThisRowB = errorNextRowB;
errorThisRowG = errorNextRowG;
errorThisRowR = errorNextRowR;
}
}
finally
{
// Ensure that I unlock the output bits
output.UnlockBits(outputData);
}
}
/// <summary>
/// Override this to process the pixel in the first pass of the algorithm
/// </summary>
/// <param name="pixel">The pixel to quantize</param>
/// <remarks>
/// This function need only be overridden if your quantize algorithm needs two passes,
/// such as an Octree quantizer.
/// </remarks>
protected virtual void InitialQuantizePixel(int pixel)
{
}
/// <summary>
/// Override this to process the pixel in the second pass of the algorithm
/// </summary>
/// <param name="pixel">The pixel to quantize</param>
/// <returns>The quantized value</returns>
protected abstract byte QuantizePixel(int pixel);
/// <summary>
/// Retrieve the palette for the quantized image
/// </summary>
/// <param name="original">Any old palette, this is overrwritten</param>
/// <returns>The new color palette</returns>
protected abstract ColorPalette GetPalette(ColorPalette original);
}
}

View File

@ -86,7 +86,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(198, 70);
this.label1.Location = new System.Drawing.Point(198, 84);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(46, 13);
this.label1.TabIndex = 3;
@ -95,7 +95,7 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(198, 85);
this.label2.Location = new System.Drawing.Point(198, 99);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(149, 13);
this.label2.TabIndex = 4;
@ -114,17 +114,17 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(206, 31);
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(207, 31);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(156, 16);
this.label4.Size = new System.Drawing.Size(168, 32);
this.label4.TabIndex = 6;
this.label4.Text = "A multi-Platform Emulator";
this.label4.Text = "\"A multi-platform emulator...\r\nfor productive people.\"";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(198, 105);
this.label5.Location = new System.Drawing.Point(198, 119);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(66, 13);
this.label5.TabIndex = 8;
@ -133,7 +133,7 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(198, 119);
this.label6.Location = new System.Drawing.Point(198, 133);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(220, 13);
this.label6.TabIndex = 9;
@ -142,7 +142,7 @@
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(198, 133);
this.label7.Location = new System.Drawing.Point(198, 147);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(216, 13);
this.label7.TabIndex = 10;
@ -151,7 +151,7 @@
// label27
//
this.label27.AutoSize = true;
this.label27.Location = new System.Drawing.Point(198, 147);
this.label27.Location = new System.Drawing.Point(198, 161);
this.label27.Name = "label27";
this.label27.Size = new System.Drawing.Size(201, 13);
this.label27.TabIndex = 12;
@ -160,7 +160,7 @@
// label37
//
this.label37.AutoSize = true;
this.label37.Location = new System.Drawing.Point(198, 162);
this.label37.Location = new System.Drawing.Point(198, 176);
this.label37.Name = "label37";
this.label37.Size = new System.Drawing.Size(96, 13);
this.label37.TabIndex = 13;
@ -173,9 +173,9 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.CoreInfoPanel.AutoScroll = true;
this.CoreInfoPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.CoreInfoPanel.Location = new System.Drawing.Point(12, 180);
this.CoreInfoPanel.Location = new System.Drawing.Point(12, 197);
this.CoreInfoPanel.Name = "CoreInfoPanel";
this.CoreInfoPanel.Size = new System.Drawing.Size(423, 276);
this.CoreInfoPanel.Size = new System.Drawing.Size(423, 259);
this.CoreInfoPanel.TabIndex = 14;
//
// textBox1
@ -194,10 +194,11 @@
// VersionLabel
//
this.VersionLabel.AutoSize = true;
this.VersionLabel.Location = new System.Drawing.Point(198, 52);
this.VersionLabel.Location = new System.Drawing.Point(198, 66);
this.VersionLabel.Name = "VersionLabel";
this.VersionLabel.Size = new System.Drawing.Size(0, 13);
this.VersionLabel.Size = new System.Drawing.Size(104, 13);
this.VersionLabel.TabIndex = 7;
this.VersionLabel.Text = "timestamp goes here";
//
// btnCopyHash
//

View File

@ -26,16 +26,19 @@ namespace BizHawk.Client.EmuHawk
private void BizBox_Load(object sender, EventArgs e)
{
string mainversion = VersionInfo.MAINVERSION;
if (IntPtr.Size == 8)
mainversion += " (x64)";
if (VersionInfo.DeveloperBuild)
{
Text = " BizHawk (GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH + ")";
}
else
{
Text = "Version " + VersionInfo.MAINVERSION + " (GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH + ")";
Text = "Version " + mainversion + " (GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH + ")";
}
VersionLabel.Text = "Version " + VersionInfo.MAINVERSION + " " + VersionInfo.RELEASEDATE;
VersionLabel.Text = "Version " + mainversion + " " + VersionInfo.RELEASEDATE;
var cores = Assembly
.Load("BizHawk.Emulation.Cores")

View File

@ -197,6 +197,15 @@
<Compile Include="AVOut\NutMuxer.cs" />
<Compile Include="AVOut\NutWriter.cs" />
<Compile Include="AVOut\ImageSequenceWriter.cs" />
<Compile Include="AVOut\Quantize\OctreeQuantizer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="AVOut\Quantize\PaletteTable.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="AVOut\Quantize\Quantizer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="AVOut\SynclessRecorder.cs" />
<Compile Include="AVOut\SynclessRecordingTools.cs">
<SubType>Form</SubType>

View File

@ -45,7 +45,8 @@ namespace BizHawk.Client.EmuHawk.CustomControls
public GDIRenderer()
{
SetBkMode(_hdc, BkModes.OPAQUE);
//zero 04-16-2016 : this can't be legal, theres no HDC yet
//SetBkMode(_hdc, BkModes.OPAQUE);
}
public void Dispose()
@ -141,22 +142,30 @@ namespace BizHawk.Client.EmuHawk.CustomControls
TextOut(CurrentHDC, point.X, point.Y, str, str.Length);
}
public static IntPtr CreateNormalHFont(Font font, int width)
{
LOGFONT logf = new LOGFONT();
font.ToLogFont(logf);
logf.lfWidth = width;
logf.lfOutPrecision = (byte)FontPrecision.OUT_TT_ONLY_PRECIS;
var ret = CreateFontIndirect(logf);
return ret;
}
//this returns an IntPtr HFONT because .net's Font class will erase the relevant properties when using its Font.FromLogFont()
//note that whether this is rotated clockwise or CCW might affect how you have to position the text (right-aligned sometimes?, up or down by the height of the font?)
public static IntPtr CreateRotatedHFont(Font font, bool CW)
{
LOGFONT logf = new LOGFONT();
//font.ToLogFont(logf);
//logf.lfEscapement = CW ? 2700 : 900;
logf.lfFaceName = "System";
logf.lfEscapement = 3600 - 450;
font.ToLogFont(logf);
logf.lfEscapement = CW ? 2700 : 900;
logf.lfOrientation = logf.lfEscapement;
logf.lfOutPrecision = (byte)FontPrecision.OUT_TT_ONLY_PRECIS;
//this doesnt work! .net erases the relevant propreties.. it seems?
//return Font.FromLogFont(logf);
var ret = CreateFontIndirect(ref logf);
var ret = CreateFontIndirect(logf);
return ret;
}
@ -168,7 +177,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
public void PrepDrawString(IntPtr hfont, Color color)
{
SetGraphicsMode(CurrentHDC, 2); //shouldnt be necessary.. cant hurt
SelectObject(_hdc, hfont);
SelectObject(CurrentHDC, hfont);
SetTextColor(color);
}
@ -299,7 +308,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
/// </summary>
private void SetFont(Font font)
{
SelectObject(_hdc, GetCachedHFont(font));
SelectObject(CurrentHDC, GetCachedHFont(font));
}
private IntPtr GetCachedHFont(Font font)
@ -333,8 +342,10 @@ namespace BizHawk.Client.EmuHawk.CustomControls
[DllImport("user32.dll")]
private static extern IntPtr EndPaint(IntPtr hWnd, IntPtr lpPaint);
[DllImport("gdi32.dll")]
static extern IntPtr CreateFontIndirect([In] ref LOGFONT lplf);
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr CreateFontIndirect(
[In, MarshalAs(UnmanagedType.LPStruct)]LOGFONT lplf
);
[DllImport("gdi32.dll")]
private static extern int Rectangle(IntPtr hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);

View File

@ -103,7 +103,7 @@ namespace BizHawk.Client.EmuHawk
{
int start = -VBar.Value;
Gdi.PrepDrawString(RotatedFont, _foreColor);
Gdi.PrepDrawString(NormalFont, _foreColor);
foreach (var column in visibleColumns)
{
@ -125,9 +125,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
//zeromus test
//Gdi.PrepDrawString(NormalFont, _foreColor);
Gdi.PrepDrawString(RotatedFont, _foreColor);
Gdi.PrepDrawString(NormalFont, _foreColor);
foreach (var column in visibleColumns)
{
@ -135,13 +133,9 @@ namespace BizHawk.Client.EmuHawk
if (IsHoveringOnColumnCell && column == CurrentCell.Column)
{
//zeromus test
//Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText);
Gdi.PrepDrawString(RotatedFont, SystemColors.HighlightText);
Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText);
Gdi.DrawString(column.Text, point);
//zeromus test
//Gdi.PrepDrawString(NormalFont, _foreColor);
Gdi.PrepDrawString(RotatedFont, _foreColor);
Gdi.PrepDrawString(NormalFont, _foreColor);
}
else
{
@ -196,15 +190,23 @@ namespace BizHawk.Client.EmuHawk
var point = new Point(x + strOffsetX, y + strOffsetY);
var rePrep = false;
if(j==1)
if (SelectedItems.Contains(new Cell { Column = visibleColumns[j], RowIndex = i + startRow }))
{
Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText);
Gdi.PrepDrawString(RotatedFont, SystemColors.HighlightText);
rePrep = true;
}
else if (j == 1)
{
//1. not sure about this; 2. repreps may be excess, but if we render one column at a time, we do need to change back after rendering the header
rePrep = true;
Gdi.PrepDrawString(RotatedFont, _foreColor);
}
if (!string.IsNullOrWhiteSpace(text))
{
{
Gdi.DrawString(text, point);
}

View File

@ -45,15 +45,15 @@ namespace BizHawk.Client.EmuHawk
public bool denoteMarkersWithBGColor { get; set; }
public bool allowRightClickSelecton { get; set; }
public bool letKeysModifySelection { get; set; }
public bool suspendHotkeys { get; set; }
private IntPtr RotatedFont;
private readonly Font NormalFont;
private readonly IntPtr NormalFont;
private Color _foreColor;
private Color _backColor;
public InputRoll()
{
UseCustomBackground = true;
GridLines = true;
CellWidthPadding = 3;
@ -61,11 +61,11 @@ namespace BizHawk.Client.EmuHawk
CurrentCell = null;
ScrollMethod = "near";
NormalFont = new Font("Courier New", 8); // Only support fixed width
Font CommonFont = new Font("Arial", 8, FontStyle.Bold);
NormalFont = GDIRenderer.CreateNormalHFont(CommonFont, 6);
// PrepDrawString doesn't actually set the font, so this is rather useless.
// I'm leaving this stuff as-is so it will be a bit easier to fix up with another rendering method.
RotatedFont = GDIRenderer.CreateRotatedHFont(Font, true);
RotatedFont = GDIRenderer.CreateRotatedHFont(CommonFont, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);
@ -77,7 +77,7 @@ namespace BizHawk.Client.EmuHawk
using (var g = CreateGraphics())
using (var LCK = Gdi.LockGraphics(g))
{
_charSize = Gdi.MeasureString("A", NormalFont); // TODO make this a property so changing it updates other values.
_charSize = Gdi.MeasureString("A", CommonFont); // TODO make this a property so changing it updates other values.
}
UpdateCellSize();
@ -132,7 +132,7 @@ namespace BizHawk.Client.EmuHawk
{
Gdi.Dispose();
NormalFont.Dispose();
GDIRenderer.DestroyHFont(NormalFont);
GDIRenderer.DestroyHFont(RotatedFont);
base.Dispose(disposing);
@ -1264,93 +1264,96 @@ namespace BizHawk.Client.EmuHawk
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.Control && !e.Alt && e.Shift && e.KeyCode == Keys.F) // Ctrl+Shift+F
if (!suspendHotkeys)
{
HorizontalOrientation ^= true;
}
else if (!e.Control && !e.Alt && !e.Shift && e.KeyCode == Keys.PageUp) // Page Up
{
if (FirstVisibleRow > 0)
if (e.Control && !e.Alt && e.Shift && e.KeyCode == Keys.F) // Ctrl+Shift+F
{
LastVisibleRow = FirstVisibleRow;
Refresh();
HorizontalOrientation ^= true;
}
}
else if (!e.Control && !e.Alt && !e.Shift && e.KeyCode == Keys.PageDown) // Page Down
{
var totalRows = LastVisibleRow - FirstVisibleRow;
if (totalRows <= RowCount)
else if (!e.Control && !e.Alt && !e.Shift && e.KeyCode == Keys.PageUp) // Page Up
{
var final = LastVisibleRow + totalRows;
if (final > RowCount)
if (FirstVisibleRow > 0)
{
final = RowCount;
LastVisibleRow = FirstVisibleRow;
Refresh();
}
}
else if (!e.Control && !e.Alt && !e.Shift && e.KeyCode == Keys.PageDown) // Page Down
{
var totalRows = LastVisibleRow - FirstVisibleRow;
if (totalRows <= RowCount)
{
var final = LastVisibleRow + totalRows;
if (final > RowCount)
{
final = RowCount;
}
LastVisibleRow = final;
Refresh();
}
}
else if (!e.Control && !e.Alt && !e.Shift && e.KeyCode == Keys.Home) // Home
{
FirstVisibleRow = 0;
Refresh();
}
else if (!e.Control && !e.Alt && !e.Shift && e.KeyCode == Keys.End) // End
{
LastVisibleRow = RowCount;
Refresh();
}
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Up) // Ctrl + Up
{
if (SelectedRows.Any() && letKeysModifySelection)
{
foreach (var row in SelectedRows.ToList())
{
SelectRow(row - 1, true);
SelectRow(row, false);
LastVisibleRow = final;
Refresh();
}
}
}
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Down) // Ctrl + Down
{
if (SelectedRows.Any() && letKeysModifySelection)
else if (!e.Control && !e.Alt && !e.Shift && e.KeyCode == Keys.Home) // Home
{
foreach (var row in SelectedRows.Reverse().ToList())
FirstVisibleRow = 0;
Refresh();
}
else if (!e.Control && !e.Alt && !e.Shift && e.KeyCode == Keys.End) // End
{
LastVisibleRow = RowCount;
Refresh();
}
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Up) // Ctrl + Up
{
if (SelectedRows.Any() && letKeysModifySelection)
{
SelectRow(row + 1, true);
SelectRow(row, false);
foreach (var row in SelectedRows.ToList())
{
SelectRow(row - 1, true);
SelectRow(row, false);
}
}
}
}
else if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.Up) // Shift + Up
{
if (SelectedRows.Any() && letKeysModifySelection)
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Down) // Ctrl + Down
{
SelectRow(SelectedRows.First() - 1, true);
if (SelectedRows.Any() && letKeysModifySelection)
{
foreach (var row in SelectedRows.Reverse().ToList())
{
SelectRow(row + 1, true);
SelectRow(row, false);
}
}
}
}
else if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.Down) // Shift + Down
{
if (SelectedRows.Any() && letKeysModifySelection)
else if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.Up) // Shift + Up
{
SelectRow(SelectedRows.Last() + 1, true);
if (SelectedRows.Any() && letKeysModifySelection)
{
SelectRow(SelectedRows.First() - 1, true);
}
}
}
else if (!e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Up) // Up
{
if (FirstVisibleRow > 0)
else if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.Down) // Shift + Down
{
FirstVisibleRow--;
Refresh();
if (SelectedRows.Any() && letKeysModifySelection)
{
SelectRow(SelectedRows.Last() + 1, true);
}
}
}
else if (!e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Down) // Down
{
if (FirstVisibleRow < RowCount - 1)
else if (!e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Up) // Up
{
FirstVisibleRow++;
Refresh();
if (FirstVisibleRow > 0)
{
FirstVisibleRow--;
Refresh();
}
}
else if (!e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Down) // Down
{
if (FirstVisibleRow < RowCount - 1)
{
FirstVisibleRow++;
Refresh();
}
}
}

View File

@ -11,9 +11,11 @@ namespace BizHawk.Client.EmuHawk.CustomControls
{
public partial class PrereqsAlert : Form
{
public PrereqsAlert()
public PrereqsAlert(bool warn_only)
{
InitializeComponent();
if (warn_only)
button1.Text = "Continue";
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

View File

@ -121,6 +121,6 @@
<value>We're not checking the version number of the VC 2010 runtime. Be sure you have the SP1 version installed.
DirectX Web Update is reportedly failing for some people as part of our prereqs installer. Try installing it manually.
The VC 2015 prerequisite has prerequisites of its own, so install it yourself manually at your own peril.
</value>
You can proceed without Direct3d9 fully installed, but we're going to continue warning you, so you'll come help us figure out what's going wrong.</value>
</data>
</root>

View File

@ -19,8 +19,8 @@ namespace BizHawk.Client.EmuHawk
[StructLayout(LayoutKind.Sequential)]
internal struct NmHdr
{
public int HwndFrom;
public int IdFrom;
public IntPtr HwndFrom;
public IntPtr IdFrom;
public int Code;
}

View File

@ -109,9 +109,6 @@ namespace BizHawk.Client.EmuHawk
f.Dispose();
}
//dont know what to do about this yet
public bool NeedsToPaint { get; set; }
//rendering resources:
public IGL GL;
StringRenderer TheOneFont;
@ -596,6 +593,12 @@ namespace BizHawk.Client.EmuHawk
FilterProgram UpdateSourceInternal(JobInfo job)
{
if (job.chain_outsize.Width == 0 || job.chain_outsize.Height == 0)
{
//this has to be a NOP, because lots of stuff will malfunction on a 0-sized viewport
return null;
}
//no drawing actually happens. it's important not to begin drawing on a control
if (!job.simulate && !job.offscreen)
{
@ -830,8 +833,6 @@ namespace BizHawk.Client.EmuHawk
//nope. dont do this. workaround for slow context switching on intel GPUs. just switch to another context when necessary before doing anything
//presentationPanel.GraphicsControl.End();
NeedsToPaint = false; //??
}
}
@ -868,7 +869,7 @@ namespace BizHawk.Client.EmuHawk
/// <summary>
/// Locks the requested lua surface name
/// </summary>
public DisplaySurface LockLuaSurface(string name)
public DisplaySurface LockLuaSurface(string name, bool clear=true)
{
if (MapNameToLuaSurface.ContainsKey(name))
throw new InvalidOperationException("Lua surface is already locked: " + name);
@ -897,7 +898,7 @@ namespace BizHawk.Client.EmuHawk
else if(name == "native") { width = currNativeWidth; height = currNativeHeight; }
else throw new InvalidOperationException("Unknown lua surface name: " +name);
DisplaySurface ret = sdss.AllocateSurface(width, height);
DisplaySurface ret = sdss.AllocateSurface(width, height, clear);
MapNameToLuaSurface[name] = ret;
MapLuaSurfaceToName[ret] = name;
return ret;
@ -912,8 +913,9 @@ namespace BizHawk.Client.EmuHawk
var surf = PeekLockedLuaSurface(kvp.Key);
DisplaySurface surfLocked = null;
if (surf == null)
surf = surfLocked = LockLuaSurface(kvp.Key);
surf.Clear();
surf = surfLocked = LockLuaSurface(kvp.Key,true);
//zero 21-apr-2016 - we shouldnt need this
//surf.Clear();
if (surfLocked != null)
UnlockLuaSurface(surfLocked);
LuaSurfaceSets[kvp.Key].SetPending(null);

View File

@ -19,7 +19,6 @@ namespace BizHawk.Client.EmuHawk
/// </summary>
public interface IBlitter
{
IBlitterFont GetFontType(string fontType);
void DrawString(string s, IBlitterFont font, Color color, float x, float y);
SizeF MeasureString(string s, IBlitterFont font);
@ -133,13 +132,11 @@ namespace BizHawk.Client.EmuHawk
public void AddMessage(string message)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
messages.Add(new UIMessage { Message = message, ExpireAt = DateTime.Now + TimeSpan.FromSeconds(2) });
}
public void AddGUIText(string message, int x, int y, Color backGround, Color foreColor, int anchor)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
GUITextList.Add(new UIDisplay
{
Message = message,
@ -153,7 +150,6 @@ namespace BizHawk.Client.EmuHawk
public void ClearGUIText()
{
GlobalWin.DisplayManager.NeedsToPaint = true;
GUITextList.Clear();
}

View File

@ -810,37 +810,31 @@ namespace BizHawk.Client.EmuHawk
private void DisplayFPSMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
ToggleFPS();
}
private void DisplayFrameCounterMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
ToggleFrameCounter();
}
private void DisplayLagCounterMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
ToggleLagCounter();
}
private void DisplayInputMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
ToggleInputDisplay();
}
private void DisplayRerecordsMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
Global.Config.DisplayRerecordCount ^= true;
}
private void DisplaySubtitlesMenuItem_Click(object sender, EventArgs e)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
Global.Config.DisplaySubtitles ^= true;
}
@ -2672,7 +2666,6 @@ namespace BizHawk.Client.EmuHawk
private void MainForm_Enter(object sender, EventArgs e)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
AutohideCursor(false);
}
@ -2710,7 +2703,6 @@ namespace BizHawk.Client.EmuHawk
private void MainformMenu_Leave(object sender, EventArgs e)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
}
private void MainformMenu_MenuActivate(object sender, EventArgs e)
@ -2726,7 +2718,6 @@ namespace BizHawk.Client.EmuHawk
private void MainformMenu_MenuDeactivate(object sender, EventArgs e)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
if (!_wasPaused)
{
UnpauseEmulator();

View File

@ -276,23 +276,18 @@ namespace BizHawk.Client.EmuHawk
break;
case "Toggle MultiTrack":
Global.MovieSession.ToggleMultitrack();
GlobalWin.DisplayManager.NeedsToPaint = true;
break;
case "MT Select All":
Global.MovieSession.MultiTrack.SelectAll();
GlobalWin.DisplayManager.NeedsToPaint = true;
break;
case "MT Select None":
Global.MovieSession.MultiTrack.SelectNone();
GlobalWin.DisplayManager.NeedsToPaint = true;
break;
case "MT Increment Player":
Global.MovieSession.MultiTrack.Increment();
GlobalWin.DisplayManager.NeedsToPaint = true;
break;
case "MT Decrement Player":
Global.MovieSession.MultiTrack.Decrement();
GlobalWin.DisplayManager.NeedsToPaint = true;
break;
case "Movie Poke":
ToggleModePokeMode();

View File

@ -95,7 +95,6 @@ namespace BizHawk.Client.EmuHawk
SetMainformMovieInfo();
GlobalWin.Tools.Restart<VirtualpadTool>();
GlobalWin.DisplayManager.NeedsToPaint = true;
if (Global.MovieSession.Movie.Hash != Global.Game.Hash)

View File

@ -455,10 +455,9 @@ namespace BizHawk.Client.EmuHawk
SynchChrome();
//TODO POOP
PresentationPanel.Control.Paint += (o, e) =>
{
GlobalWin.DisplayManager.NeedsToPaint = true;
//I would like to trigger a repaint here, but this isnt done yet
};
}
@ -517,18 +516,10 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.Tools.LuaConsole.ResumeScripts(false);
}
if (Global.Config.DisplayInput) // Input display wants to update even while paused
{
GlobalWin.DisplayManager.NeedsToPaint = true;
}
StepRunLoop_Core();
StepRunLoop_Throttle();
if (GlobalWin.DisplayManager.NeedsToPaint)
{
Render();
}
Render();
CheckMessages();
@ -2841,7 +2832,6 @@ namespace BizHawk.Client.EmuHawk
Global.MovieSession.HandleMovieAfterFrameLoop();
GlobalWin.DisplayManager.NeedsToPaint = true;
Global.CheatList.Pulse();
if (!PauseAVI)
@ -3122,7 +3112,6 @@ namespace BizHawk.Client.EmuHawk
private void AvFrameAdvance()
{
GlobalWin.DisplayManager.NeedsToPaint = true;
if (_currAviWriter != null)
{
//TODO ZERO - this code is pretty jacked. we'll want to frugalize buffers better for speedier dumping, and we might want to rely on the GL layer for padding
@ -3231,8 +3220,6 @@ namespace BizHawk.Client.EmuHawk
}
}
}
GlobalWin.DisplayManager.NeedsToPaint = true;
}
}
@ -3707,8 +3694,6 @@ namespace BizHawk.Client.EmuHawk
if (fromLua)
Global.MovieSession.Movie.IsCountingRerecords = false;
GlobalWin.DisplayManager.NeedsToPaint = true;
if (SavestateManager.LoadStateFile(path, userFriendlyStateName))
{
if (GlobalWin.Tools.Has<LuaConsole>())

View File

@ -17,6 +17,10 @@ namespace BizHawk.Client.EmuHawk
{
static Program()
{
//this needs to be done before the warnings/errors show up
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//http://www.codeproject.com/Articles/310675/AppDomain-AssemblyResolve-Event-Tips
#if WINDOWS
//try loading libraries we know we'll need
@ -26,12 +30,12 @@ namespace BizHawk.Client.EmuHawk
var vc2015 = Win32.LoadLibrary("vcruntime140.dll");
var vc2010 = Win32.LoadLibrary("msvcr100.dll"); //TODO - check version?
var vc2010p = Win32.LoadLibrary("msvcp100.dll");
bool fail = false;
fail |= d3dx9 == IntPtr.Zero;
bool fail = false, warn = false;
warn |= d3dx9 == IntPtr.Zero;
fail |= vc2015 == IntPtr.Zero;
fail |= vc2010 == IntPtr.Zero;
fail |= vc2010p == IntPtr.Zero;
if (fail)
if (fail || warn)
{
var sw = new System.IO.StringWriter();
sw.WriteLine("[ OK ] .Net 4.0 (You couldn't even get here without it)");
@ -39,10 +43,12 @@ namespace BizHawk.Client.EmuHawk
sw.WriteLine("[{0}] Visual C++ 2010 SP1 Runtime", (vc2010 == IntPtr.Zero || vc2010p == IntPtr.Zero) ? "FAIL" : " OK ");
sw.WriteLine("[{0}] Visual C++ 2015 Runtime", (vc2015 == IntPtr.Zero) ? "FAIL" : " OK ");
var str = sw.ToString();
var box = new BizHawk.Client.EmuHawk.CustomControls.PrereqsAlert();
var box = new BizHawk.Client.EmuHawk.CustomControls.PrereqsAlert(!fail);
box.textBox1.Text = str;
box.ShowDialog();
System.Diagnostics.Process.GetCurrentProcess().Kill();
if (!fail) { }
else
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
Win32.FreeLibrary(d3dx9);
@ -102,8 +108,7 @@ namespace BizHawk.Client.EmuHawk
}
BizHawk.Common.TempFileCleaner.Start();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
HawkFile.ArchiveHandlerFactory = new SevenZipSharpArchiveHandler();
@ -136,7 +141,20 @@ namespace BizHawk.Client.EmuHawk
if (Global.Config.DispMethod == Config.EDispMethod.GdiPlus)
GlobalWin.GL = new Bizware.BizwareGL.Drivers.GdiPlus.IGL_GdiPlus();
else if (Global.Config.DispMethod == Config.EDispMethod.SlimDX9)
GlobalWin.GL = new Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9();
{
try
{
GlobalWin.GL = new Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9();
}
catch(Exception ex)
{
var e2 = new Exception("Initialization of Direct3d 9 Display Method failed; falling back to GDI+", ex);
new ExceptionBox(e2).ShowDialog();
//fallback
Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
goto REDO_DISPMETHOD;
}
}
else
{
GlobalWin.GL = GlobalWin.IGL_GL;

View File

@ -34,6 +34,7 @@
this.checkBoxMuted = new System.Windows.Forms.CheckBox();
this.cbDisplayBG = new System.Windows.Forms.CheckBox();
this.cbDisplayOBJ = new System.Windows.Forms.CheckBox();
this.cbDisplayWIN = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// propertyGrid1
@ -44,7 +45,7 @@
this.propertyGrid1.Location = new System.Drawing.Point(3, 3);
this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.PropertySort = System.Windows.Forms.PropertySort.Alphabetical;
this.propertyGrid1.Size = new System.Drawing.Size(330, 276);
this.propertyGrid1.Size = new System.Drawing.Size(338, 279);
this.propertyGrid1.TabIndex = 0;
this.propertyGrid1.ToolbarVisible = false;
this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid1_PropertyValueChanged);
@ -52,7 +53,7 @@
// buttonDefaults
//
this.buttonDefaults.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDefaults.Location = new System.Drawing.Point(258, 285);
this.buttonDefaults.Location = new System.Drawing.Point(266, 288);
this.buttonDefaults.Name = "buttonDefaults";
this.buttonDefaults.Size = new System.Drawing.Size(75, 23);
this.buttonDefaults.TabIndex = 1;
@ -63,7 +64,7 @@
// buttonPalette
//
this.buttonPalette.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonPalette.Location = new System.Drawing.Point(3, 285);
this.buttonPalette.Location = new System.Drawing.Point(3, 288);
this.buttonPalette.Name = "buttonPalette";
this.buttonPalette.Size = new System.Drawing.Size(75, 23);
this.buttonPalette.TabIndex = 2;
@ -75,11 +76,11 @@
//
this.checkBoxMuted.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkBoxMuted.AutoSize = true;
this.checkBoxMuted.Location = new System.Drawing.Point(84, 289);
this.checkBoxMuted.Location = new System.Drawing.Point(82, 292);
this.checkBoxMuted.Name = "checkBoxMuted";
this.checkBoxMuted.Size = new System.Drawing.Size(80, 17);
this.checkBoxMuted.Size = new System.Drawing.Size(50, 17);
this.checkBoxMuted.TabIndex = 3;
this.checkBoxMuted.Text = "Mute Audio";
this.checkBoxMuted.Text = "Mute";
this.checkBoxMuted.UseVisualStyleBackColor = true;
this.checkBoxMuted.CheckedChanged += new System.EventHandler(this.checkBoxMuted_CheckedChanged);
//
@ -87,7 +88,7 @@
//
this.cbDisplayBG.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbDisplayBG.AutoSize = true;
this.cbDisplayBG.Location = new System.Drawing.Point(166, 289);
this.cbDisplayBG.Location = new System.Drawing.Point(130, 292);
this.cbDisplayBG.Name = "cbDisplayBG";
this.cbDisplayBG.Size = new System.Drawing.Size(41, 17);
this.cbDisplayBG.TabIndex = 4;
@ -99,7 +100,7 @@
//
this.cbDisplayOBJ.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbDisplayOBJ.AutoSize = true;
this.cbDisplayOBJ.Location = new System.Drawing.Point(206, 289);
this.cbDisplayOBJ.Location = new System.Drawing.Point(171, 292);
this.cbDisplayOBJ.Name = "cbDisplayOBJ";
this.cbDisplayOBJ.Size = new System.Drawing.Size(46, 17);
this.cbDisplayOBJ.TabIndex = 5;
@ -107,9 +108,22 @@
this.cbDisplayOBJ.UseVisualStyleBackColor = true;
this.cbDisplayOBJ.CheckedChanged += new System.EventHandler(this.cbDisplayOBJ_CheckedChanged);
//
// cbDisplayWIN
//
this.cbDisplayWIN.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbDisplayWIN.AutoSize = true;
this.cbDisplayWIN.Location = new System.Drawing.Point(218, 292);
this.cbDisplayWIN.Name = "cbDisplayWIN";
this.cbDisplayWIN.Size = new System.Drawing.Size(48, 17);
this.cbDisplayWIN.TabIndex = 6;
this.cbDisplayWIN.Text = "WIN";
this.cbDisplayWIN.UseVisualStyleBackColor = true;
this.cbDisplayWIN.CheckedChanged += new System.EventHandler(this.cbDisplayWIN_CheckedChanged);
//
// GBPrefControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.cbDisplayWIN);
this.Controls.Add(this.cbDisplayOBJ);
this.Controls.Add(this.cbDisplayBG);
this.Controls.Add(this.checkBoxMuted);
@ -117,7 +131,7 @@
this.Controls.Add(this.buttonDefaults);
this.Controls.Add(this.propertyGrid1);
this.Name = "GBPrefControl";
this.Size = new System.Drawing.Size(336, 311);
this.Size = new System.Drawing.Size(344, 314);
this.ResumeLayout(false);
this.PerformLayout();
@ -131,5 +145,6 @@
private System.Windows.Forms.CheckBox checkBoxMuted;
private System.Windows.Forms.CheckBox cbDisplayBG;
private System.Windows.Forms.CheckBox cbDisplayOBJ;
private System.Windows.Forms.CheckBox cbDisplayWIN;
}
}

View File

@ -36,6 +36,7 @@ namespace BizHawk.Client.EmuHawk.config.GB
checkBoxMuted.Checked = this.s.Muted;
cbDisplayBG.Checked = this.s.DisplayBG;
cbDisplayOBJ.Checked = this.s.DisplayOBJ;
cbDisplayWIN.Checked = this.s.DisplayWindow;
}
public void GetSettings(out Gameboy.GambatteSettings s, out Gameboy.GambatteSyncSettings ss)
@ -78,5 +79,10 @@ namespace BizHawk.Client.EmuHawk.config.GB
{
s.DisplayOBJ = (sender as CheckBox).Checked;
}
private void cbDisplayWIN_CheckedChanged(object sender, EventArgs e)
{
s.DisplayWindow = (sender as CheckBox).Checked;
}
}
}

View File

@ -873,10 +873,10 @@ namespace BizHawk.Client.EmuHawk
val = _currentDomain.PeekByte(addr);
break;
case 2:
val = _currentDomain.PeekWord(addr, _bigEndian);
val = _currentDomain.PeekUshort(addr, _bigEndian);
break;
case 4:
val = (int)_currentDomain.PeekDWord(addr, _bigEndian);
val = (int)_currentDomain.PeekUint(addr, _bigEndian);
break;
}

View File

@ -28,350 +28,368 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CDL));
this.menuStrip1 = new MenuStripEx();
this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.NewMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OpenMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveAsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AppendMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RecentSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.ClearMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DisassembleMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.tsbLoggingActive = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.tsbViewUpdate = new System.Windows.Forms.ToolStripButton();
this.tsbViewStyle = new System.Windows.Forms.ToolStripComboBox();
this.lvCDL = new BizHawk.Client.EmuHawk.VirtualListView();
this.colAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colDomain = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colPct = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colMapped = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag01 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag02 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag04 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag08 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag10 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag20 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag40 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag80 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.tsbExportText = new System.Windows.Forms.ToolStripButton();
this.menuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.ClickThrough = true;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.FileSubMenu});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(992, 24);
this.menuStrip1.TabIndex = 2;
this.menuStrip1.Text = "menuStrip1";
//
// FileSubMenu
//
this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.NewMenuItem,
this.OpenMenuItem,
this.SaveMenuItem,
this.SaveAsMenuItem,
this.AppendMenuItem,
this.RecentSubMenu,
this.toolStripSeparator2,
this.ClearMenuItem,
this.DisassembleMenuItem,
this.toolStripSeparator1,
this.ExitMenuItem});
this.FileSubMenu.Name = "FileSubMenu";
this.FileSubMenu.Size = new System.Drawing.Size(35, 20);
this.FileSubMenu.Text = "&File";
this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened);
//
// NewMenuItem
//
this.NewMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NewFile;
this.NewMenuItem.Name = "NewMenuItem";
this.NewMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.NewMenuItem.Size = new System.Drawing.Size(193, 22);
this.NewMenuItem.Text = "&New";
this.NewMenuItem.Click += new System.EventHandler(this.NewMenuItem_Click);
//
// OpenMenuItem
//
this.OpenMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.OpenFile;
this.OpenMenuItem.Name = "OpenMenuItem";
this.OpenMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.OpenMenuItem.Size = new System.Drawing.Size(193, 22);
this.OpenMenuItem.Text = "&Open...";
this.OpenMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click);
//
// SaveMenuItem
//
this.SaveMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs;
this.SaveMenuItem.Name = "SaveMenuItem";
this.SaveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.SaveMenuItem.Size = new System.Drawing.Size(193, 22);
this.SaveMenuItem.Text = "&Save";
this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click);
//
// SaveAsMenuItem
//
this.SaveAsMenuItem.Name = "SaveAsMenuItem";
this.SaveAsMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.S)));
this.SaveAsMenuItem.Size = new System.Drawing.Size(193, 22);
this.SaveAsMenuItem.Text = "&Save As...";
this.SaveAsMenuItem.Click += new System.EventHandler(this.SaveAsMenuItem_Click);
//
// AppendMenuItem
//
this.AppendMenuItem.Name = "AppendMenuItem";
this.AppendMenuItem.Size = new System.Drawing.Size(193, 22);
this.AppendMenuItem.Text = "&Append File...";
this.AppendMenuItem.Click += new System.EventHandler(this.AppendMenuItem_Click);
//
// RecentSubMenu
//
this.RecentSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.noneToolStripMenuItem});
this.RecentSubMenu.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Recent;
this.RecentSubMenu.Name = "RecentSubMenu";
this.RecentSubMenu.Size = new System.Drawing.Size(193, 22);
this.RecentSubMenu.Text = "Recent";
this.RecentSubMenu.DropDownOpened += new System.EventHandler(this.RecentSubMenu_DropDownOpened);
//
// noneToolStripMenuItem
//
this.noneToolStripMenuItem.Name = "noneToolStripMenuItem";
this.noneToolStripMenuItem.Size = new System.Drawing.Size(99, 22);
this.noneToolStripMenuItem.Text = "None";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(190, 6);
//
// ClearMenuItem
//
this.ClearMenuItem.Name = "ClearMenuItem";
this.ClearMenuItem.Size = new System.Drawing.Size(193, 22);
this.ClearMenuItem.Text = "&Clear";
this.ClearMenuItem.Click += new System.EventHandler(this.ClearMenuItem_Click);
//
// DisassembleMenuItem
//
this.DisassembleMenuItem.Name = "DisassembleMenuItem";
this.DisassembleMenuItem.Size = new System.Drawing.Size(193, 22);
this.DisassembleMenuItem.Text = "&Disassemble...";
this.DisassembleMenuItem.Click += new System.EventHandler(this.DisassembleMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(190, 6);
//
// ExitMenuItem
//
this.ExitMenuItem.Name = "ExitMenuItem";
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
this.ExitMenuItem.Size = new System.Drawing.Size(193, 22);
this.ExitMenuItem.Text = "&Close";
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbLoggingActive,
this.toolStripSeparator3,
this.tsbViewUpdate,
this.tsbViewStyle,
this.toolStripSeparator4,
this.tsbExportText});
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(992, 25);
this.toolStrip1.TabIndex = 8;
this.toolStrip1.Text = "toolStrip1";
//
// tsbLoggingActive
//
this.tsbLoggingActive.CheckOnClick = true;
this.tsbLoggingActive.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbLoggingActive.Image = ((System.Drawing.Image)(resources.GetObject("tsbLoggingActive.Image")));
this.tsbLoggingActive.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbLoggingActive.Name = "tsbLoggingActive";
this.tsbLoggingActive.Size = new System.Drawing.Size(41, 22);
this.tsbLoggingActive.Text = "Active";
this.tsbLoggingActive.CheckedChanged += new System.EventHandler(this.tsbLoggingActive_CheckedChanged);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
//
// tsbViewUpdate
//
this.tsbViewUpdate.Checked = true;
this.tsbViewUpdate.CheckOnClick = true;
this.tsbViewUpdate.CheckState = System.Windows.Forms.CheckState.Checked;
this.tsbViewUpdate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbViewUpdate.Image = ((System.Drawing.Image)(resources.GetObject("tsbViewUpdate.Image")));
this.tsbViewUpdate.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbViewUpdate.Name = "tsbViewUpdate";
this.tsbViewUpdate.Size = new System.Drawing.Size(46, 22);
this.tsbViewUpdate.Text = "Update";
//
// tsbViewStyle
//
this.tsbViewStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.tsbViewStyle.Items.AddRange(new object[] {
"Show %",
"Show Bytes",
"Show KBytes"});
this.tsbViewStyle.Name = "tsbViewStyle";
this.tsbViewStyle.Size = new System.Drawing.Size(121, 25);
this.tsbViewStyle.SelectedIndexChanged += new System.EventHandler(this.tsbViewStyle_SelectedIndexChanged);
//
// lvCDL
//
this.lvCDL.BlazingFast = false;
this.lvCDL.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colAddress,
this.colDomain,
this.colPct,
this.colMapped,
this.colSize,
this.colFlag01,
this.colFlag02,
this.colFlag04,
this.colFlag08,
this.colFlag10,
this.colFlag20,
this.colFlag40,
this.colFlag80});
this.lvCDL.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvCDL.FullRowSelect = true;
this.lvCDL.GridLines = true;
this.lvCDL.ItemCount = 0;
this.lvCDL.Location = new System.Drawing.Point(0, 49);
this.lvCDL.Name = "lvCDL";
this.lvCDL.SelectAllInProgress = false;
this.lvCDL.selectedItem = -1;
this.lvCDL.Size = new System.Drawing.Size(992, 323);
this.lvCDL.TabIndex = 9;
this.lvCDL.UseCompatibleStateImageBehavior = false;
this.lvCDL.UseCustomBackground = true;
this.lvCDL.View = System.Windows.Forms.View.Details;
this.lvCDL.VirtualMode = true;
this.lvCDL.QueryItemText += new BizHawk.Client.EmuHawk.QueryItemTextHandler(this.lvCDL_QueryItemText);
//
// colAddress
//
this.colAddress.Text = "CDL File @";
this.colAddress.Width = 107;
//
// colDomain
//
this.colDomain.Text = "Domain";
this.colDomain.Width = 126;
//
// colPct
//
this.colPct.Text = "%";
this.colPct.Width = 58;
//
// colMapped
//
this.colMapped.Text = "Mapped";
this.colMapped.Width = 64;
//
// colSize
//
this.colSize.Text = "Size";
this.colSize.Width = 102;
//
// colFlag01
//
this.colFlag01.Text = "0x01";
//
// colFlag02
//
this.colFlag02.Text = "0x02";
//
// colFlag04
//
this.colFlag04.Text = "0x04";
//
// colFlag08
//
this.colFlag08.Text = "0x08";
//
// colFlag10
//
this.colFlag10.Text = "0x10";
//
// colFlag20
//
this.colFlag20.Text = "0x20";
//
// colFlag40
//
this.colFlag40.Text = "0x40";
//
// colFlag80
//
this.colFlag80.Text = "0x80";
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25);
//
// tsbExportText
//
this.tsbExportText.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.LoadConfig;
this.tsbExportText.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbExportText.Name = "tsbExportText";
this.tsbExportText.Size = new System.Drawing.Size(87, 22);
this.tsbExportText.Text = "To Clipboard";
this.tsbExportText.Click += new System.EventHandler(this.tsbExportText_Click);
//
// CDL
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(992, 372);
this.Controls.Add(this.lvCDL);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(150, 130);
this.Name = "CDL";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Code Data Logger";
this.Load += new System.EventHandler(this.PCECDL_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.PCECDL_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.PCECDL_DragEnter);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CDL));
this.menuStrip1 = new MenuStripEx();
this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.NewMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OpenMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveAsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AppendMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RecentSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.miAutoStart = new System.Windows.Forms.ToolStripMenuItem();
this.miAutoSave = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.ClearMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DisassembleMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1 = new ToolStripEx();
this.tsbLoggingActive = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.tsbViewUpdate = new System.Windows.Forms.ToolStripButton();
this.tsbViewStyle = new System.Windows.Forms.ToolStripComboBox();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.tsbExportText = new System.Windows.Forms.ToolStripButton();
this.lvCDL = new BizHawk.Client.EmuHawk.VirtualListView();
this.colAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colDomain = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colPct = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colMapped = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag01 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag02 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag04 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag08 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag10 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag20 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag40 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag80 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.menuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.ClickThrough = true;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.FileSubMenu});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(992, 24);
this.menuStrip1.TabIndex = 2;
this.menuStrip1.Text = "menuStrip1";
//
// FileSubMenu
//
this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.NewMenuItem,
this.OpenMenuItem,
this.SaveMenuItem,
this.SaveAsMenuItem,
this.AppendMenuItem,
this.RecentSubMenu,
this.miAutoStart,
this.miAutoSave,
this.toolStripSeparator2,
this.ClearMenuItem,
this.DisassembleMenuItem,
this.toolStripSeparator1,
this.ExitMenuItem});
this.FileSubMenu.Name = "FileSubMenu";
this.FileSubMenu.Size = new System.Drawing.Size(35, 20);
this.FileSubMenu.Text = "&File";
this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened);
//
// NewMenuItem
//
this.NewMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NewFile;
this.NewMenuItem.Name = "NewMenuItem";
this.NewMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.NewMenuItem.Size = new System.Drawing.Size(193, 22);
this.NewMenuItem.Text = "&New";
this.NewMenuItem.Click += new System.EventHandler(this.NewMenuItem_Click);
//
// OpenMenuItem
//
this.OpenMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.OpenFile;
this.OpenMenuItem.Name = "OpenMenuItem";
this.OpenMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.OpenMenuItem.Size = new System.Drawing.Size(193, 22);
this.OpenMenuItem.Text = "&Open...";
this.OpenMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click);
//
// SaveMenuItem
//
this.SaveMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs;
this.SaveMenuItem.Name = "SaveMenuItem";
this.SaveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.SaveMenuItem.Size = new System.Drawing.Size(193, 22);
this.SaveMenuItem.Text = "&Save";
this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click);
//
// SaveAsMenuItem
//
this.SaveAsMenuItem.Name = "SaveAsMenuItem";
this.SaveAsMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.S)));
this.SaveAsMenuItem.Size = new System.Drawing.Size(193, 22);
this.SaveAsMenuItem.Text = "&Save As...";
this.SaveAsMenuItem.Click += new System.EventHandler(this.SaveAsMenuItem_Click);
//
// AppendMenuItem
//
this.AppendMenuItem.Name = "AppendMenuItem";
this.AppendMenuItem.Size = new System.Drawing.Size(193, 22);
this.AppendMenuItem.Text = "&Append File...";
this.AppendMenuItem.Click += new System.EventHandler(this.AppendMenuItem_Click);
//
// RecentSubMenu
//
this.RecentSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.noneToolStripMenuItem});
this.RecentSubMenu.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Recent;
this.RecentSubMenu.Name = "RecentSubMenu";
this.RecentSubMenu.Size = new System.Drawing.Size(193, 22);
this.RecentSubMenu.Text = "Recent";
this.RecentSubMenu.DropDownOpened += new System.EventHandler(this.RecentSubMenu_DropDownOpened);
//
// noneToolStripMenuItem
//
this.noneToolStripMenuItem.Name = "noneToolStripMenuItem";
this.noneToolStripMenuItem.Size = new System.Drawing.Size(99, 22);
this.noneToolStripMenuItem.Text = "None";
//
// miAutoStart
//
this.miAutoStart.Name = "miAutoStart";
this.miAutoStart.Size = new System.Drawing.Size(193, 22);
this.miAutoStart.Text = "Auto-Start";
this.miAutoStart.Click += new System.EventHandler(this.miAutoStart_Click);
//
// miAutoSave
//
this.miAutoSave.Name = "miAutoSave";
this.miAutoSave.Size = new System.Drawing.Size(193, 22);
this.miAutoSave.Text = "Auto-Save";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(190, 6);
//
// ClearMenuItem
//
this.ClearMenuItem.Name = "ClearMenuItem";
this.ClearMenuItem.Size = new System.Drawing.Size(193, 22);
this.ClearMenuItem.Text = "&Clear";
this.ClearMenuItem.Click += new System.EventHandler(this.ClearMenuItem_Click);
//
// DisassembleMenuItem
//
this.DisassembleMenuItem.Name = "DisassembleMenuItem";
this.DisassembleMenuItem.Size = new System.Drawing.Size(193, 22);
this.DisassembleMenuItem.Text = "&Disassemble...";
this.DisassembleMenuItem.Click += new System.EventHandler(this.DisassembleMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(190, 6);
//
// ExitMenuItem
//
this.ExitMenuItem.Name = "ExitMenuItem";
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
this.ExitMenuItem.Size = new System.Drawing.Size(193, 22);
this.ExitMenuItem.Text = "&Close";
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
//
// toolStrip1
//
this.toolStrip1.ClickThrough = true;
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbLoggingActive,
this.toolStripSeparator3,
this.tsbViewUpdate,
this.tsbViewStyle,
this.toolStripSeparator4,
this.tsbExportText});
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(992, 25);
this.toolStrip1.TabIndex = 8;
this.toolStrip1.Text = "toolStrip1";
//
// tsbLoggingActive
//
this.tsbLoggingActive.CheckOnClick = true;
this.tsbLoggingActive.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbLoggingActive.Image = ((System.Drawing.Image)(resources.GetObject("tsbLoggingActive.Image")));
this.tsbLoggingActive.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbLoggingActive.Name = "tsbLoggingActive";
this.tsbLoggingActive.Size = new System.Drawing.Size(41, 22);
this.tsbLoggingActive.Text = "Active";
this.tsbLoggingActive.CheckedChanged += new System.EventHandler(this.tsbLoggingActive_CheckedChanged);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
//
// tsbViewUpdate
//
this.tsbViewUpdate.Checked = true;
this.tsbViewUpdate.CheckOnClick = true;
this.tsbViewUpdate.CheckState = System.Windows.Forms.CheckState.Checked;
this.tsbViewUpdate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.tsbViewUpdate.Image = ((System.Drawing.Image)(resources.GetObject("tsbViewUpdate.Image")));
this.tsbViewUpdate.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbViewUpdate.Name = "tsbViewUpdate";
this.tsbViewUpdate.Size = new System.Drawing.Size(46, 22);
this.tsbViewUpdate.Text = "Update";
//
// tsbViewStyle
//
this.tsbViewStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.tsbViewStyle.Items.AddRange(new object[] {
"Show %",
"Show Bytes",
"Show KBytes"});
this.tsbViewStyle.Name = "tsbViewStyle";
this.tsbViewStyle.Size = new System.Drawing.Size(121, 25);
this.tsbViewStyle.SelectedIndexChanged += new System.EventHandler(this.tsbViewStyle_SelectedIndexChanged);
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25);
//
// tsbExportText
//
this.tsbExportText.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.LoadConfig;
this.tsbExportText.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbExportText.Name = "tsbExportText";
this.tsbExportText.Size = new System.Drawing.Size(87, 22);
this.tsbExportText.Text = "To Clipboard";
this.tsbExportText.Click += new System.EventHandler(this.tsbExportText_Click);
//
// lvCDL
//
this.lvCDL.BlazingFast = false;
this.lvCDL.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colAddress,
this.colDomain,
this.colPct,
this.colMapped,
this.colSize,
this.colFlag01,
this.colFlag02,
this.colFlag04,
this.colFlag08,
this.colFlag10,
this.colFlag20,
this.colFlag40,
this.colFlag80});
this.lvCDL.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvCDL.FullRowSelect = true;
this.lvCDL.GridLines = true;
this.lvCDL.ItemCount = 0;
this.lvCDL.Location = new System.Drawing.Point(0, 49);
this.lvCDL.Name = "lvCDL";
this.lvCDL.SelectAllInProgress = false;
this.lvCDL.selectedItem = -1;
this.lvCDL.Size = new System.Drawing.Size(992, 323);
this.lvCDL.TabIndex = 9;
this.lvCDL.UseCompatibleStateImageBehavior = false;
this.lvCDL.UseCustomBackground = true;
this.lvCDL.View = System.Windows.Forms.View.Details;
this.lvCDL.VirtualMode = true;
this.lvCDL.QueryItemText += new BizHawk.Client.EmuHawk.QueryItemTextHandler(this.lvCDL_QueryItemText);
//
// colAddress
//
this.colAddress.Text = "CDL File @";
this.colAddress.Width = 107;
//
// colDomain
//
this.colDomain.Text = "Domain";
this.colDomain.Width = 126;
//
// colPct
//
this.colPct.Text = "%";
this.colPct.Width = 58;
//
// colMapped
//
this.colMapped.Text = "Mapped";
this.colMapped.Width = 64;
//
// colSize
//
this.colSize.Text = "Size";
this.colSize.Width = 102;
//
// colFlag01
//
this.colFlag01.Text = "0x01";
//
// colFlag02
//
this.colFlag02.Text = "0x02";
//
// colFlag04
//
this.colFlag04.Text = "0x04";
//
// colFlag08
//
this.colFlag08.Text = "0x08";
//
// colFlag10
//
this.colFlag10.Text = "0x10";
//
// colFlag20
//
this.colFlag20.Text = "0x20";
//
// colFlag40
//
this.colFlag40.Text = "0x40";
//
// colFlag80
//
this.colFlag80.Text = "0x80";
//
// CDL
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(992, 372);
this.Controls.Add(this.lvCDL);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(150, 130);
this.Name = "CDL";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Code Data Logger";
this.Load += new System.EventHandler(this.PCECDL_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.PCECDL_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.PCECDL_DragEnter);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
@ -388,9 +406,8 @@
private System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveMenuItem;
private System.Windows.Forms.ToolStripMenuItem RecentSubMenu;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton tsbLoggingActive;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripButton tsbViewUpdate;
@ -410,7 +427,10 @@
private System.Windows.Forms.ColumnHeader colFlag40;
private System.Windows.Forms.ColumnHeader colFlag80;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripButton tsbExportText;
private System.Windows.Forms.ToolStripButton tsbExportText;
private System.Windows.Forms.ToolStripMenuItem miAutoStart;
private System.Windows.Forms.ToolStripMenuItem miAutoSave;
private ToolStripEx toolStrip1;
}
}

View File

@ -181,7 +181,31 @@ namespace BizHawk.Client.EmuHawk
}
public bool AskSaveChanges()
{
{
//nothing to fear:
if (_cdl == null)
return true;
//try auto-saving if appropriate
if (Global.Config.CDLAutoSave)
{
//TODO - I dont like this system. It's hard to figure out how to use it. It should be done in multiple passes.
var result = MessageBox.Show("Save changes to CDL session?", "CDL Auto Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No)
return true;
if (string.IsNullOrWhiteSpace(_currentFilename))
{
if (!RunSaveAs())
return false;
}
else
{
RunSave();
return true;
}
}
return true;
}
@ -208,8 +232,8 @@ namespace BizHawk.Client.EmuHawk
//ok, it's all good:
_cdl = newCDL;
CodeDataLogger.SetCDL(null);
if (tsbLoggingActive.Checked)
CodeDataLogger.SetCDL(null);
if (tsbLoggingActive.Checked || Global.Config.CDLAutoStart)
CodeDataLogger.SetCDL(_cdl);
SetCurrentFilename(path);
@ -225,21 +249,24 @@ namespace BizHawk.Client.EmuHawk
AppendMenuItem.Enabled =
ClearMenuItem.Enabled =
DisassembleMenuItem.Enabled =
_cdl != null;
_cdl != null;
miAutoSave.Checked = Global.Config.CDLAutoSave;
miAutoStart.Checked = Global.Config.CDLAutoStart;
}
private void RecentSubMenu_DropDownOpened(object sender, EventArgs e)
{
RecentSubMenu.DropDownItems.Clear();
RecentSubMenu.DropDownItems.AddRange(_recent.RecentMenu(LoadFile, true));
}
}
void NewFileLogic()
{
_cdl = new CodeDataLog();
CodeDataLogger.NewCDL(_cdl);
if (tsbLoggingActive.Checked)
if (tsbLoggingActive.Checked || Global.Config.CDLAutoStart)
CodeDataLogger.SetCDL(_cdl);
else CodeDataLogger.SetCDL(null);
@ -281,46 +308,51 @@ namespace BizHawk.Client.EmuHawk
}
LoadFile(file.FullName);
}
void RunSave()
{
_recent.Add(_currentFilename);
using (var fs = new FileStream(_currentFilename, FileMode.Create, FileAccess.Write))
{
_cdl.Save(fs);
}
}
private void SaveMenuItem_Click(object sender, EventArgs e)
{
{
if (_cdl == null)
{
MessageBox.Show(this, "Cannot save with no CDL loaded!", "Alert");
return;
}
if (string.IsNullOrWhiteSpace(_currentFilename))
{
RunSaveAs();
return;
}
using (var fs = new FileStream(_currentFilename, FileMode.Create, FileAccess.Write))
{
_cdl.Save(fs);
}
}
RunSave();
}
void RunSaveAs()
/// <summary>
/// returns false if the operation was canceled
/// </summary>
bool RunSaveAs()
{
if (_cdl == null)
{
MessageBox.Show(this, "Cannot save with no CDL loaded!", "Alert");
}
else
{
var file = SaveFileDialog(
_currentFilename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
"Code Data Logger Files",
"cdl");
if (file != null)
{
using (var fs = new FileStream(file.FullName, FileMode.Create, FileAccess.Write))
{
_cdl.Save(fs);
_recent.Add(file.FullName);
SetCurrentFilename(file.FullName);
}
}
}
var file = SaveFileDialog(
_currentFilename,
PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null),
"Code Data Logger Files",
"cdl");
if (file == null)
return false;
SetCurrentFilename(file.FullName);
RunSave();
return true;
}
private void SaveAsMenuItem_Click(object sender, EventArgs e)
@ -399,10 +431,24 @@ namespace BizHawk.Client.EmuHawk
private void ExitMenuItem_Click(object sender, EventArgs e)
{
Close();
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
if (!AskSaveChanges())
e.Cancel = true;
base.OnClosing(e);
}
protected override void OnShown(EventArgs e)
{
if (Global.Config.CDLAutoStart)
NewFileLogic();
base.OnShown(e);
}
protected override void OnClosed(EventArgs e)
{
{
//deactivate logger
if (CodeDataLogger != null) //just in case...
CodeDataLogger.SetCDL(null);
@ -462,6 +508,18 @@ namespace BizHawk.Client.EmuHawk
sw.WriteLine();
}
Clipboard.SetText(sw.ToString());
}
}
private void miAutoSave_Click(object sender, EventArgs e)
{
Global.Config.CDLAutoSave ^= true;
}
private void miAutoStart_Click(object sender, EventArgs e)
{
Global.Config.CDLAutoStart ^= true;
}
}
}

View File

@ -1,177 +1,176 @@
<?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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>126, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tsbLoggingActive.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="tsbViewUpdate.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAACMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwAAAAAAAAAAAACMWxApOoZ
jN1ApOoCMWyj0/Wj0/Wj0/Wj0/Wj0/Wj0/Wj0/Wj0/UCMWwAAAACMWxApOpApOoCMWxApOoZjN0CMWyj
0/UuKfAuKfCj0/XLPAPLPANApOpApOoCMWwCMWwZjN0CMWwQUHwCMWxApOoCMWxApOouKfCj0/Wj0/XL
PAOj0/XLPAOj0/UCMWwCMWxApOoCMWwQUHwCMWxApOoCMWyj0/UuKfCj0/Wj0/XLPAOj0/XLPAOj0/UC
MWwCMWxApOoCMWwQUHwCMWxApOoCMWyj0/UuKfCj0/Wj0/XLPAOj0/XLPAOj0/UCMWwCMWxApOoCMWwQ
UHwCMWwZjN0CMWyj0/UuKfAuKfCj0/XLPAPLPANApOpApOoCMWwCMWxApOoCMWwQUHwCMWwZjN0CMWyj
0/Wj0/Wj0/VApOpApOpApOpApOpApOoCMWwCMWwZjN1ApOoCMWxApOpApOoCMWyj0/Wj0/Wj0/UCMWwC
MWyj0/Wj0/Wj0/UCMWwAAAACMWxApOpApOoZjN0CMWxApOpApOqj0/UCMWyj0/Wj0/Wj0/Wj0/UCMWwA
AAAAAAAAAAACMWwCMWwCMWwCMWwCMWwCMWwCMWyj0/VApOqj0/UCMWwCMWwAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAACMWyj0/VApOqj0/UOOwMOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAOOwMjpQUCMWyj0/UOOwMhhwkjpQUOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOOwMhhwkjpQUC
MWwOOwMjpQUhhwkOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMLAQOOwMOOwMAAAAOOwMhhwkjpQUO
OwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOOwMjpQUOOwMAAADAAwAAgAEAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAAwAMAAP+BAAD/AAAA/wAAAP8QAAD/8QAA
</value>
</data>
>>>>>>> refs/remotes/TASVideos/master
<?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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>126, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tsbLoggingActive.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="tsbViewUpdate.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAACMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwCMWwAAAAAAAAAAAACMWxApOoZ
jN1ApOoCMWyj0/Wj0/Wj0/Wj0/Wj0/Wj0/Wj0/Wj0/UCMWwAAAACMWxApOpApOoCMWxApOoZjN0CMWyj
0/UuKfAuKfCj0/XLPAPLPANApOpApOoCMWwCMWwZjN0CMWwQUHwCMWxApOoCMWxApOouKfCj0/Wj0/XL
PAOj0/XLPAOj0/UCMWwCMWxApOoCMWwQUHwCMWxApOoCMWyj0/UuKfCj0/Wj0/XLPAOj0/XLPAOj0/UC
MWwCMWxApOoCMWwQUHwCMWxApOoCMWyj0/UuKfCj0/Wj0/XLPAOj0/XLPAOj0/UCMWwCMWxApOoCMWwQ
UHwCMWwZjN0CMWyj0/UuKfAuKfCj0/XLPAPLPANApOpApOoCMWwCMWxApOoCMWwQUHwCMWwZjN0CMWyj
0/Wj0/Wj0/VApOpApOpApOpApOpApOoCMWwCMWwZjN1ApOoCMWxApOpApOoCMWyj0/Wj0/Wj0/UCMWwC
MWyj0/Wj0/Wj0/UCMWwAAAACMWxApOpApOoZjN0CMWxApOpApOqj0/UCMWyj0/Wj0/Wj0/Wj0/UCMWwA
AAAAAAAAAAACMWwCMWwCMWwCMWwCMWwCMWwCMWyj0/VApOqj0/UCMWwCMWwAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAACMWyj0/VApOqj0/UOOwMOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAOOwMjpQUCMWyj0/UOOwMhhwkjpQUOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOOwMhhwkjpQUC
MWwOOwMjpQUhhwkOOwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMLAQOOwMOOwMAAAAOOwMhhwkjpQUO
OwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOOwMjpQUOOwMAAADAAwAAgAEAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAAwAMAAP+BAAD/AAAA/wAAAP8QAAD/8QAA
</value>
</data>
</root>

View File

@ -23,6 +23,28 @@ namespace BizHawk.Client.EmuHawk
// int to long TODO: 32 bit domains have more digits than the hex editor can account for and the address covers up the 0 column
public partial class HexEditor : ToolFormBase, IToolFormAutoConfig
{
private class NullMemoryDomain : MemoryDomain
{
public override byte PeekByte(long addr)
{
return 0;
}
public override void PokeByte(long addr, byte val)
{
}
public NullMemoryDomain()
{
EndianType = Endian.Unknown;
Name = "Null";
Size = 1024;
Writable = true;
WordSize = 1;
}
}
[RequiredService]
private IMemoryDomains MemoryDomains { get; set; }
@ -47,8 +69,7 @@ namespace BizHawk.Client.EmuHawk
private long _maxRow;
private MemoryDomain _domain = new MemoryDomain(
"NULL", 1024, MemoryDomain.Endian.Little, addr => 0, delegate(long a, byte v) { v = 0; });
private MemoryDomain _domain = new NullMemoryDomain();
private long _row;
private long _addr;
@ -429,7 +450,7 @@ namespace BizHawk.Client.EmuHawk
private void HexEditor_Load(object sender, EventArgs e)
{
DataSize = _domain.ByteSize;
DataSize = _domain.WordSize;
SetDataSize(DataSize);
if (RecentTables.AutoLoad)
@ -555,9 +576,9 @@ namespace BizHawk.Client.EmuHawk
case 1:
return _domain.PeekByte(address);
case 2:
return _domain.PeekWord(address, BigEndian);
return _domain.PeekUshort(address, BigEndian);
case 4:
return (int)_domain.PeekDWord(address, BigEndian);
return (int)_domain.PeekUint(address, BigEndian);
}
}
@ -1096,15 +1117,15 @@ namespace BizHawk.Client.EmuHawk
(byte)(_domain.PeekByte(address) + 1));
break;
case 2:
_domain.PokeWord(
_domain.PokeUshort(
address,
(ushort)(_domain.PeekWord(address, BigEndian) + 1),
(ushort)(_domain.PeekUshort(address, BigEndian) + 1),
BigEndian);
break;
case 4:
_domain.PokeDWord(
_domain.PokeUint(
address,
_domain.PeekDWord(address, BigEndian) + 1,
_domain.PeekUint(address, BigEndian) + 1,
BigEndian);
break;
}
@ -1129,15 +1150,15 @@ namespace BizHawk.Client.EmuHawk
(byte)(_domain.PeekByte(address) - 1));
break;
case 2:
_domain.PokeWord(
_domain.PokeUshort(
address,
(ushort)(_domain.PeekWord(address, BigEndian) - 1),
(ushort)(_domain.PeekUshort(address, BigEndian) - 1),
BigEndian);
break;
case 4:
_domain.PokeDWord(
_domain.PokeUint(
address,
_domain.PeekDWord(address, BigEndian) - 1,
_domain.PeekUint(address, BigEndian) - 1,
BigEndian);
break;
}
@ -2293,8 +2314,8 @@ namespace BizHawk.Client.EmuHawk
{
for (int j = 0; j < 4; j++)
{
ushort hi = _domain.PeekWord(((addr+(i<<3)+(j<<1) )^0x0),bigend);
ushort lo = _domain.PeekWord(((addr+(i<<3)+(j<<1) + 32)^0x0),bigend);
ushort hi = _domain.PeekUshort(((addr+(i<<3)+(j<<1) )^0x0),bigend);
ushort lo = _domain.PeekUshort(((addr+(i<<3)+(j<<1) + 32)^0x0),bigend);
matVals[i,j] = (int)(((hi << 16) | lo)) / 65536.0f;
}
}

View File

@ -279,15 +279,6 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.Tools.Load<TraceLogger>();
}
[LuaMethodAttributes(
"paint",
"Causes the client UI to repaint the screen"
)]
public static void Paint()
{
GlobalWin.DisplayManager.NeedsToPaint = true;
}
[LuaMethodAttributes(
"pause",
"Pauses the emulator"

View File

@ -54,14 +54,14 @@ namespace BizHawk.Client.EmuHawk
[LuaMethodAttributes(
"DrawNew",
"Changes drawing target to the specified lua surface name. This may clobber any previous drawing to this surface."
"Changes drawing target to the specified lua surface name. This may clobber any previous drawing to this surface (pass false if you don't want it to)"
)]
public void DrawNew(string name)
public void DrawNew(string name, bool? clear=true)
{
try
{
DrawFinish();
_luaSurface = GlobalWin.DisplayManager.LockLuaSurface(name);
_luaSurface = GlobalWin.DisplayManager.LockLuaSurface(name,clear??true);
}
catch (InvalidOperationException ex)
{
@ -69,6 +69,10 @@ namespace BizHawk.Client.EmuHawk
}
}
[LuaMethodAttributes(
"DrawFinish",
"Finishes drawing to the current lua surface and causes it to get displayed."
)]
public void DrawFinish()
{
if(_luaSurface != null)
@ -149,7 +153,6 @@ namespace BizHawk.Client.EmuHawk
)]
public void ClearGraphics()
{
GlobalWin.DisplayManager.NeedsToPaint = true;
_luaSurface.Clear();
}
@ -219,7 +222,6 @@ namespace BizHawk.Client.EmuHawk
)]
public void DrawBezier(LuaTable points, Color color)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
using (var g = GetGraphics())
{
try
@ -298,7 +300,6 @@ namespace BizHawk.Client.EmuHawk
)]
public void DrawEllipse(int x, int y, int width, int height, Color? line = null, Color? background = null)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
using (var g = GetGraphics())
{
try
@ -326,7 +327,6 @@ namespace BizHawk.Client.EmuHawk
)]
public void DrawIcon(string path, int x, int y, int? width = null, int? height = null)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
using (var g = GetGraphics())
{
try
@ -358,7 +358,6 @@ namespace BizHawk.Client.EmuHawk
)]
public void DrawImage(string path, int x, int y, int? width = null, int? height = null)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
using (var g = GetGraphics())
{
Image img;
@ -382,7 +381,6 @@ namespace BizHawk.Client.EmuHawk
)]
public void DrawImageRegion(string path, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int? dest_width = null, int? dest_height = null)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
using (var g = GetGraphics())
{
Image img;
@ -408,7 +406,6 @@ namespace BizHawk.Client.EmuHawk
)]
public void DrawLine(int x1, int y1, int x2, int y2, Color? color = null)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
using (var g = GetGraphics())
{
g.DrawLine(GetPen(color ?? DefaultForeground), x1, y1, x2, y2);
@ -441,7 +438,6 @@ namespace BizHawk.Client.EmuHawk
Color? line = null,
Color? background = null)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
using (var g = GetGraphics())
{
var bg = background ?? DefaultBackground;
@ -462,7 +458,6 @@ namespace BizHawk.Client.EmuHawk
)]
public void DrawPixel(int x, int y, Color? color = null)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
using (var g = GetGraphics())
{
try
@ -482,8 +477,6 @@ namespace BizHawk.Client.EmuHawk
)]
public void DrawPolygon(LuaTable points, Color? line = null, Color? background = null)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
using (var g = GetGraphics())
{
try
@ -558,7 +551,6 @@ namespace BizHawk.Client.EmuHawk
string fontfamily = null,
string fontstyle = null)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
using (var g = GetGraphics())
{
try
@ -618,7 +610,6 @@ namespace BizHawk.Client.EmuHawk
Color? backcolor = null,
string fontfamily = null)
{
GlobalWin.DisplayManager.NeedsToPaint = true;
using (var g = GetGraphics())
{
try
@ -661,14 +652,13 @@ namespace BizHawk.Client.EmuHawk
[LuaMethodAttributes(
"text",
"Displays the given text on the screen at the given coordinates. Optional Foreground and background colors. The optional anchor flag anchors the text to one of the four corners. Anchor flag parameters: topleft, topright, bottomleft, bottomright"
"Displays the given text on the screen at the given coordinates. Optional Foreground color. The optional anchor flag anchors the text to one of the four corners. Anchor flag parameters: topleft, topright, bottomleft, bottomright"
)]
public void Text(
int x,
int y,
string message,
Color? forecolor = null,
Color? background = null,
string anchor = null)
{
var a = 0;
@ -701,7 +691,7 @@ namespace BizHawk.Client.EmuHawk
y -= Global.Emulator.CoreComm.ScreenLogicalOffsetY;
}
GlobalWin.OSD.AddGUIText(message, x, y, background ?? Color.Black, forecolor ?? Color.White, a);
GlobalWin.OSD.AddGUIText(message, x, y, Color.Black, forecolor ?? Color.White, a);
}
[LuaMethodAttributes(

View File

@ -206,7 +206,6 @@ namespace BizHawk.Client.EmuHawk
private void EmuYield()
{
GlobalWin.DisplayManager.NeedsToPaint = true;
_currThread.Yield(0);
}

View File

@ -162,7 +162,6 @@ namespace BizHawk.Client.EmuHawk
private void LoadBranch(TasBranch branch)
{
Tastudio.CurrentTasMovie.LoadBranch(branch);
GlobalWin.DisplayManager.NeedsToPaint = true;
var stateInfo = new KeyValuePair<int, byte[]>(branch.Frame, branch.CoreData);
Tastudio.LoadState(stateInfo);
QuickBmpFile.Copy(new BitmapBufferVideoProvider(branch.OSDFrameBuffer), Global.Emulator.VideoProvider());
@ -277,6 +276,9 @@ namespace BizHawk.Client.EmuHawk
public void LoadBranchExternal(int slot = -1)
{
if (Tastudio.FloatEditingMode)
return;
if (slot != -1)
{
if (GetBranch(slot) != null)
@ -294,6 +296,9 @@ namespace BizHawk.Client.EmuHawk
public void UpdateBranchExternal(int slot = -1)
{
if (Tastudio.FloatEditingMode)
return;
if (slot != -1)
{
if (GetBranch(slot) != null)
@ -316,6 +321,9 @@ namespace BizHawk.Client.EmuHawk
public void SelectBranchExternal(int slot)
{
if (Tastudio.FloatEditingMode)
return;
if (GetBranch(slot) != null)
{
BranchView.SelectRow(slot, true);

View File

@ -68,7 +68,7 @@
//
// NumFramesBox
//
this.NumFramesBox.ByteSize = BizHawk.Client.Common.WatchSize.Byte;
this.NumFramesBox.ByteSize = BizHawk.Client.Common.WatchSize.Word;
this.NumFramesBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.NumFramesBox.Location = new System.Drawing.Point(138, 16);
this.NumFramesBox.MaxLength = 5;

View File

@ -55,16 +55,21 @@ namespace BizHawk.Client.EmuHawk
this.NumSaveStatesLabel = new System.Windows.Forms.Label();
this.BranchStatesInTasproj = new System.Windows.Forms.CheckBox();
this.EraseBranchStatesFirst = new System.Windows.Forms.CheckBox();
this.StateGap = new System.Windows.Forms.NumericUpDown();
this.label10 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.NumFramesLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.MemCapacityNumeric)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DiskCapacityNumeric)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.SaveCapacityNumeric)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.StateGap)).BeginInit();
this.SuspendLayout();
//
// CancelBtn
//
this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.CancelBtn.Location = new System.Drawing.Point(216, 163);
this.CancelBtn.Location = new System.Drawing.Point(217, 220);
this.CancelBtn.Name = "CancelBtn";
this.CancelBtn.Size = new System.Drawing.Size(60, 23);
this.CancelBtn.TabIndex = 0;
@ -75,7 +80,7 @@ namespace BizHawk.Client.EmuHawk
// OkBtn
//
this.OkBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OkBtn.Location = new System.Drawing.Point(150, 163);
this.OkBtn.Location = new System.Drawing.Point(151, 220);
this.OkBtn.Name = "OkBtn";
this.OkBtn.Size = new System.Drawing.Size(60, 23);
this.OkBtn.TabIndex = 1;
@ -85,7 +90,7 @@ namespace BizHawk.Client.EmuHawk
//
// MemCapacityNumeric
//
this.MemCapacityNumeric.Location = new System.Drawing.Point(12, 26);
this.MemCapacityNumeric.Location = new System.Drawing.Point(15, 49);
this.MemCapacityNumeric.Maximum = new decimal(new int[] {
1024,
0,
@ -109,7 +114,7 @@ namespace BizHawk.Client.EmuHawk
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(67, 29);
this.label1.Location = new System.Drawing.Point(70, 52);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(21, 13);
this.label1.TabIndex = 4;
@ -118,7 +123,7 @@ namespace BizHawk.Client.EmuHawk
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(9, 9);
this.label2.Location = new System.Drawing.Point(12, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(88, 13);
this.label2.TabIndex = 5;
@ -127,7 +132,7 @@ namespace BizHawk.Client.EmuHawk
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(147, 9);
this.label3.Location = new System.Drawing.Point(12, 9);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(79, 13);
this.label3.TabIndex = 6;
@ -136,7 +141,7 @@ namespace BizHawk.Client.EmuHawk
// SavestateSizeLabel
//
this.SavestateSizeLabel.AutoSize = true;
this.SavestateSizeLabel.Location = new System.Drawing.Point(229, 9);
this.SavestateSizeLabel.Location = new System.Drawing.Point(94, 9);
this.SavestateSizeLabel.Name = "SavestateSizeLabel";
this.SavestateSizeLabel.Size = new System.Drawing.Size(25, 13);
this.SavestateSizeLabel.TabIndex = 7;
@ -145,7 +150,7 @@ namespace BizHawk.Client.EmuHawk
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(9, 89);
this.label4.Location = new System.Drawing.Point(12, 136);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(84, 13);
this.label4.TabIndex = 8;
@ -154,7 +159,7 @@ namespace BizHawk.Client.EmuHawk
// NumStatesLabel
//
this.NumStatesLabel.AutoSize = true;
this.NumStatesLabel.Location = new System.Drawing.Point(96, 89);
this.NumStatesLabel.Location = new System.Drawing.Point(99, 136);
this.NumStatesLabel.Name = "NumStatesLabel";
this.NumStatesLabel.Size = new System.Drawing.Size(25, 13);
this.NumStatesLabel.TabIndex = 9;
@ -162,7 +167,7 @@ namespace BizHawk.Client.EmuHawk
//
// DiskCapacityNumeric
//
this.DiskCapacityNumeric.Location = new System.Drawing.Point(12, 66);
this.DiskCapacityNumeric.Location = new System.Drawing.Point(15, 113);
this.DiskCapacityNumeric.Maximum = new decimal(new int[] {
65536,
0,
@ -181,7 +186,7 @@ namespace BizHawk.Client.EmuHawk
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(67, 69);
this.label5.Location = new System.Drawing.Point(70, 116);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(21, 13);
this.label5.TabIndex = 4;
@ -190,7 +195,7 @@ namespace BizHawk.Client.EmuHawk
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(9, 49);
this.label6.Location = new System.Drawing.Point(12, 96);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(72, 13);
this.label6.TabIndex = 5;
@ -198,7 +203,7 @@ namespace BizHawk.Client.EmuHawk
//
// SaveCapacityNumeric
//
this.SaveCapacityNumeric.Location = new System.Drawing.Point(150, 66);
this.SaveCapacityNumeric.Location = new System.Drawing.Point(150, 49);
this.SaveCapacityNumeric.Maximum = new decimal(new int[] {
65536,
0,
@ -217,7 +222,7 @@ namespace BizHawk.Client.EmuHawk
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(205, 69);
this.label7.Location = new System.Drawing.Point(205, 52);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(21, 13);
this.label7.TabIndex = 4;
@ -226,7 +231,7 @@ namespace BizHawk.Client.EmuHawk
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(147, 49);
this.label8.Location = new System.Drawing.Point(147, 32);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(112, 13);
this.label8.TabIndex = 5;
@ -235,7 +240,7 @@ namespace BizHawk.Client.EmuHawk
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(147, 89);
this.label9.Location = new System.Drawing.Point(147, 72);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(84, 13);
this.label9.TabIndex = 8;
@ -244,7 +249,7 @@ namespace BizHawk.Client.EmuHawk
// NumSaveStatesLabel
//
this.NumSaveStatesLabel.AutoSize = true;
this.NumSaveStatesLabel.Location = new System.Drawing.Point(234, 89);
this.NumSaveStatesLabel.Location = new System.Drawing.Point(234, 72);
this.NumSaveStatesLabel.Name = "NumSaveStatesLabel";
this.NumSaveStatesLabel.Size = new System.Drawing.Size(25, 13);
this.NumSaveStatesLabel.TabIndex = 9;
@ -252,8 +257,9 @@ namespace BizHawk.Client.EmuHawk
//
// BranchStatesInTasproj
//
this.BranchStatesInTasproj.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.BranchStatesInTasproj.AutoSize = true;
this.BranchStatesInTasproj.Location = new System.Drawing.Point(12, 115);
this.BranchStatesInTasproj.Location = new System.Drawing.Point(15, 165);
this.BranchStatesInTasproj.Name = "BranchStatesInTasproj";
this.BranchStatesInTasproj.Size = new System.Drawing.Size(158, 17);
this.BranchStatesInTasproj.TabIndex = 10;
@ -263,10 +269,11 @@ namespace BizHawk.Client.EmuHawk
//
// EraseBranchStatesFirst
//
this.EraseBranchStatesFirst.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.EraseBranchStatesFirst.AutoSize = true;
this.EraseBranchStatesFirst.Checked = true;
this.EraseBranchStatesFirst.CheckState = System.Windows.Forms.CheckState.Checked;
this.EraseBranchStatesFirst.Location = new System.Drawing.Point(12, 140);
this.EraseBranchStatesFirst.Location = new System.Drawing.Point(15, 190);
this.EraseBranchStatesFirst.Name = "EraseBranchStatesFirst";
this.EraseBranchStatesFirst.Size = new System.Drawing.Size(139, 17);
this.EraseBranchStatesFirst.TabIndex = 11;
@ -274,13 +281,62 @@ namespace BizHawk.Client.EmuHawk
this.EraseBranchStatesFirst.UseVisualStyleBackColor = true;
this.EraseBranchStatesFirst.CheckedChanged += new System.EventHandler(this.EraseBranchStatesFIrst_CheckedChanged);
//
// StateGap
//
this.StateGap.Location = new System.Drawing.Point(151, 112);
this.StateGap.Maximum = new decimal(new int[] {
8,
0,
0,
0});
this.StateGap.Name = "StateGap";
this.StateGap.Size = new System.Drawing.Size(55, 20);
this.StateGap.TabIndex = 12;
this.StateGap.Value = new decimal(new int[] {
1,
0,
0,
0});
this.StateGap.ValueChanged += new System.EventHandler(this.StateGap_ValueChanged);
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(148, 96);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(91, 13);
this.label10.TabIndex = 13;
this.label10.Text = "Project State Gap";
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(147, 135);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(61, 13);
this.label11.TabIndex = 14;
this.label11.Text = "State every";
//
// NumFramesLabel
//
this.NumFramesLabel.AutoSize = true;
this.NumFramesLabel.Location = new System.Drawing.Point(204, 135);
this.NumFramesLabel.Name = "NumFramesLabel";
this.NumFramesLabel.Size = new System.Drawing.Size(47, 13);
this.NumFramesLabel.TabIndex = 15;
this.NumFramesLabel.Text = "0 frames";
//
// StateHistorySettingsForm
//
this.AcceptButton = this.OkBtn;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.CancelBtn;
this.ClientSize = new System.Drawing.Size(288, 198);
this.ClientSize = new System.Drawing.Size(289, 255);
this.Controls.Add(this.NumFramesLabel);
this.Controls.Add(this.label11);
this.Controls.Add(this.label10);
this.Controls.Add(this.StateGap);
this.Controls.Add(this.EraseBranchStatesFirst);
this.Controls.Add(this.BranchStatesInTasproj);
this.Controls.Add(this.NumSaveStatesLabel);
@ -309,6 +365,7 @@ namespace BizHawk.Client.EmuHawk
((System.ComponentModel.ISupportInitialize)(this.MemCapacityNumeric)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DiskCapacityNumeric)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.SaveCapacityNumeric)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.StateGap)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -333,5 +390,9 @@ namespace BizHawk.Client.EmuHawk
private Label NumSaveStatesLabel;
private CheckBox BranchStatesInTasproj;
private CheckBox EraseBranchStatesFirst;
private NumericUpDown StateGap;
private Label label10;
private Label label11;
private Label NumFramesLabel;
}
}

View File

@ -41,6 +41,7 @@ namespace BizHawk.Client.EmuHawk
SaveCapacityNumeric.Value = Settings.DiskSaveCapacitymb < MemCapacityNumeric.Maximum ?
Settings.DiskSaveCapacitymb : MemCapacityNumeric.Maximum;
StateGap.Value = Settings.StateGap;
SavestateSizeLabel.Text = Math.Round(_stateSizeMb, 2).ToString() + " mb";
CapacityNumeric_ValueChanged(null, null);
SaveCapacityNumeric_ValueChanged(null, null);
@ -60,6 +61,7 @@ namespace BizHawk.Client.EmuHawk
Settings.Capacitymb = (int)MemCapacityNumeric.Value;
Settings.DiskCapacitymb = (int)DiskCapacityNumeric.Value;
Settings.DiskSaveCapacitymb = (int)SaveCapacityNumeric.Value;
Settings.StateGap = (int)StateGap.Value;
DialogResult = DialogResult.OK;
Close();
}
@ -91,5 +93,10 @@ namespace BizHawk.Client.EmuHawk
{
Settings.EraseBranchStatesFirst = EraseBranchStatesFirst.Checked;
}
private void StateGap_ValueChanged(object sender, EventArgs e)
{
NumFramesLabel.Text = ((StateGap.Value == 0) ? "frame" : (1 << (int)StateGap.Value).ToString() + " frames");
}
}
}

View File

@ -83,6 +83,8 @@ namespace BizHawk.Client.EmuHawk
this.SetMaxUndoLevelsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SetBranchCellHoverIntervalMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SetSeekingCutoffIntervalMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.setAutosaveIntervalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AutosaveAsBk2MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
this.AutoadjustInputMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
@ -606,6 +608,8 @@ namespace BizHawk.Client.EmuHawk
this.SetMaxUndoLevelsMenuItem,
this.SetBranchCellHoverIntervalMenuItem,
this.SetSeekingCutoffIntervalMenuItem,
this.setAutosaveIntervalToolStripMenuItem,
this.AutosaveAsBk2MenuItem,
this.toolStripSeparator9,
this.AutoadjustInputMenuItem,
this.toolStripSeparator11,
@ -647,8 +651,23 @@ namespace BizHawk.Client.EmuHawk
this.SetSeekingCutoffIntervalMenuItem.Name = "SetSeekingCutoffIntervalMenuItem";
this.SetSeekingCutoffIntervalMenuItem.Size = new System.Drawing.Size(253, 22);
this.SetSeekingCutoffIntervalMenuItem.Text = "Set Seeking Cutoff Interval";
this.SetSeekingCutoffIntervalMenuItem.Visible = false;
this.SetSeekingCutoffIntervalMenuItem.Click += new System.EventHandler(this.SetSeekingCutoffIntervalMenuItem_Click);
//
// setAutosaveIntervalToolStripMenuItem
//
this.setAutosaveIntervalToolStripMenuItem.Name = "setAutosaveIntervalToolStripMenuItem";
this.setAutosaveIntervalToolStripMenuItem.Size = new System.Drawing.Size(253, 22);
this.setAutosaveIntervalToolStripMenuItem.Text = "Set Autosave Interval";
this.setAutosaveIntervalToolStripMenuItem.Click += new System.EventHandler(this.SetAutosaveIntervalMenuItem_Click);
//
// AutosaveAsBk2MenuItem
//
this.AutosaveAsBk2MenuItem.Name = "AutosaveAsBk2MenuItem";
this.AutosaveAsBk2MenuItem.Size = new System.Drawing.Size(253, 22);
this.AutosaveAsBk2MenuItem.Text = "Autosave As Bk2";
this.AutosaveAsBk2MenuItem.Click += new System.EventHandler(this.AutosaveAsBk2MenuItem_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
@ -1149,11 +1168,11 @@ namespace BizHawk.Client.EmuHawk
this.TasView.Name = "TasView";
this.TasView.RowCount = 0;
this.TasView.ScrollSpeed = 1;
this.TasView.SeekingCutoffInterval = 0;
this.TasView.Size = new System.Drawing.Size(289, 528);
this.TasView.TabIndex = 1;
this.TasView.ColumnClick += new BizHawk.Client.EmuHawk.InputRoll.ColumnClickEventHandler(this.TasView_ColumnClick);
this.TasView.ColumnRightClick += new BizHawk.Client.EmuHawk.InputRoll.ColumnClickEventHandler(this.TasView_ColumnRightClick);
this.TasView.SelectedIndexChanged += new System.EventHandler(this.TasView_SelectedIndexChanged);
this.TasView.RightMouseScrolled += new BizHawk.Client.EmuHawk.InputRoll.RightMouseScrollEventHandler(this.TasView_MouseWheel);
this.TasView.ColumnReordered += new BizHawk.Client.EmuHawk.InputRoll.ColumnReorderedEventHandler(this.TasView_ColumnReordered);
this.TasView.CellDropped += new BizHawk.Client.EmuHawk.InputRoll.CellDroppedEvent(this.TasView_CellDropped);
@ -1701,5 +1720,7 @@ namespace BizHawk.Client.EmuHawk
private System.Windows.Forms.ToolStripMenuItem SetBranchCellHoverIntervalMenuItem;
private System.Windows.Forms.ToolStripMenuItem SetMarkerWithTextContextMenuItem;
private System.Windows.Forms.ToolStripMenuItem SetSeekingCutoffIntervalMenuItem;
private System.Windows.Forms.ToolStripMenuItem setAutosaveIntervalToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem AutosaveAsBk2MenuItem;
}
}

View File

@ -25,6 +25,14 @@ namespace BizHawk.Client.EmuHawk
// SuuperW: For editing analog input
private string _floatEditColumn = string.Empty;
private int _floatEditRow = -1;
private int floatEditRow
{
set
{
_floatEditRow = value;
TasView.suspendHotkeys = FloatEditingMode;
}
}
private string _floatTypedValue;
private int _floatEditYPos = -1;
// Right-click dragging
@ -77,7 +85,7 @@ namespace BizHawk.Client.EmuHawk
else
GlobalWin.MainForm.UnpauseEmulator();
if (!_seekBackgroundWorker.IsBusy && diff.Value > TasView.SeekingCutoffInterval)
if (!_seekBackgroundWorker.IsBusy && diff.Value > TasView.VisibleRows)
_seekBackgroundWorker.RunWorkerAsync();
}
@ -86,6 +94,11 @@ namespace BizHawk.Client.EmuHawk
_seekBackgroundWorker.CancelAsync();
}
public bool FloatEditingMode
{
get { return _floatEditRow != -1; }
}
// public static Color CurrentFrame_FrameCol = Color.FromArgb(0xCFEDFC); Why?
public static Color CurrentFrame_InputLog = Color.FromArgb(0xB5E7F7);
@ -400,7 +413,7 @@ namespace BizHawk.Client.EmuHawk
{
if (_floatEditColumn != buttonName || _floatEditRow != frame)
{
_floatEditRow = -1;
floatEditRow = -1;
RefreshTasView();
}
else
@ -486,12 +499,12 @@ namespace BizHawk.Client.EmuHawk
else // Double-click enters float editing mode
{
if (_floatEditColumn == buttonName && _floatEditRow == frame)
_floatEditRow = -1;
floatEditRow = -1;
else
{
CurrentTasMovie.ChangeLog.BeginNewBatch("Float Edit: " + frame);
_floatEditColumn = buttonName;
_floatEditRow = frame;
floatEditRow = frame;
_floatTypedValue = "";
_floatEditYPos = e.Y;
_triggerAutoRestore = true;
@ -559,7 +572,7 @@ namespace BizHawk.Client.EmuHawk
// Exit float editing if value was changed with cursor
if (_floatEditRow != -1 && _floatPaintState != CurrentTasMovie.GetFloatState(_floatEditRow, _floatEditColumn))
{
_floatEditRow = -1;
floatEditRow = -1;
RefreshDialog();
}
_floatPaintState = 0;
@ -704,6 +717,7 @@ namespace BizHawk.Client.EmuHawk
{
TasView.SelectRow(i, _selectionDragState);
}
SetSplicer();
}
}
@ -936,7 +950,7 @@ namespace BizHawk.Client.EmuHawk
_floatEditYPos = -1;
CurrentTasMovie.SetFloatState(_floatEditRow, _floatEditColumn, _floatPaintState);
}
_floatEditRow = -1;
floatEditRow = -1;
}
else
{

View File

@ -85,20 +85,21 @@ namespace BizHawk.Client.EmuHawk
}
else
{
if (_exiting)
{
CurrentTasMovie.Save();
}
else
{
_saveBackgroundWorker.RunWorkerAsync();
}
_autosaveTimer.Stop();
MessageStatusLabel.Text = "Saving...";
this.Cursor = Cursors.WaitCursor;
Update();
CurrentTasMovie.Save();
Settings.RecentTas.Add(CurrentTasMovie.Filename);
_autosaveTimer.Start();
MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " saved.";
this.Cursor = Cursors.Default;
}
}
private void SaveAsTasMenuItem_Click(object sender, EventArgs e)
{
_autosaveTimer.Stop();
var filename = CurrentTasMovie.Filename;
if (string.IsNullOrWhiteSpace(filename) || filename == DefaultTasProjName())
{
@ -114,18 +115,15 @@ namespace BizHawk.Client.EmuHawk
if (file != null)
{
CurrentTasMovie.Filename = file.FullName;
if (_exiting)
{
CurrentTasMovie.Save();
}
else
{
_saveBackgroundWorker.RunWorkerAsync();
}
MessageStatusLabel.Text = "Saving...";
this.Cursor = Cursors.WaitCursor;
Update();
CurrentTasMovie.Save();
Settings.RecentTas.Add(CurrentTasMovie.Filename);
SetTextProperty();
_autosaveTimer.Start();
MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " saved.";
this.Cursor = Cursors.Default;
}
}
@ -162,10 +160,15 @@ namespace BizHawk.Client.EmuHawk
private void ToBk2MenuItem_Click(object sender, EventArgs e)
{
_autosaveTimer.Stop();
var bk2 = CurrentTasMovie.ToBk2(true);
MessageStatusLabel.Text = "Exporting to .bk2...";
this.Cursor = Cursors.WaitCursor;
Update();
bk2.Save();
MessageStatusLabel.Text = Path.GetFileName(bk2.Filename) + " created.";
_autosaveTimer.Start();
MessageStatusLabel.Text = Path.GetFileName(bk2.Filename) + " exported.";
this.Cursor = Cursors.Default;
}
private void ExitMenuItem_Click(object sender, EventArgs e)
@ -202,10 +205,10 @@ namespace BizHawk.Client.EmuHawk
private void showUndoHistoryToolStripMenuItem_Click(object sender, EventArgs e)
{
undoForm = new UndoHistoryForm(this);
undoForm.Owner = this;
undoForm.Show();
undoForm.UpdateValues();
_undoForm = new UndoHistoryForm(this);
_undoForm.Owner = this;
_undoForm.Show();
_undoForm.UpdateValues();
}
private void EditSubMenu_DropDownOpened(object sender, EventArgs e)
@ -258,7 +261,7 @@ namespace BizHawk.Client.EmuHawk
{
TasView.SelectRow(i, true);
}
SetSplicer();
RefreshTasView();
}
}
@ -270,7 +273,7 @@ namespace BizHawk.Client.EmuHawk
{
TasView.SelectRow(item.Frame, true);
}
SetSplicer();
RefreshTasView();
}
@ -285,6 +288,8 @@ namespace BizHawk.Client.EmuHawk
foreach (var index in list)
{
var input = CurrentTasMovie.GetInputState(index);
if (input == null)
break;
_tasClipboard.Add(new TasClipboardEntry(index, input));
var lg = CurrentTasMovie.LogGeneratorInstance();
lg.SetSource(input);
@ -371,6 +376,8 @@ namespace BizHawk.Client.EmuHawk
for (var i = 0; i < list.Length; i++)
{
var input = CurrentTasMovie.GetInputState(i);
if (input == null)
break;
_tasClipboard.Add(new TasClipboardEntry(list[i], input));
var lg = CurrentTasMovie.LogGeneratorInstance();
lg.SetSource(input);
@ -718,11 +725,39 @@ namespace BizHawk.Client.EmuHawk
}
}
private void SetAutosaveIntervalMenuItem_Click(object sender, EventArgs e)
{
using (var prompt = new InputPrompt
{
TextInputType = InputPrompt.InputType.Unsigned,
Message = "Autosave Interval in seconds",
InitialValue = (Settings.AutosaveInterval / 1000).ToString()
})
{
DialogResult result = prompt.ShowDialog();
if (result == DialogResult.OK)
{
int val = int.Parse(prompt.PromptText) * 1000;
if (val > 0)
{
Settings.AutosaveInterval = val;
_autosaveTimer.Interval = val;
}
}
}
}
private void AutosaveAsBk2MenuItem_Click(object sender, EventArgs e)
{
Settings.AutosaveAsBk2 ^= true;
}
private void ConfigSubMenu_DropDownOpened(object sender, EventArgs e)
{
DrawInputByDraggingMenuItem.Checked = Settings.DrawInput;
AutopauseAtEndOfMovieMenuItem.Checked = Settings.AutoPause;
EmptyNewMarkerNotesMenuItem.Checked = Settings.EmptyMarkers;
AutosaveAsBk2MenuItem.Checked = Settings.AutosaveAsBk2;
}
private void DrawInputByDraggingMenuItem_Click(object sender, EventArgs e)

View File

@ -36,7 +36,8 @@ namespace BizHawk.Client.EmuHawk
return (lg as Bk2LogEntryGenerator).Map();
}
private UndoHistoryForm undoForm;
private UndoHistoryForm _undoForm;
private Timer _autosaveTimer = new Timer();
public ScreenshotPopupControl ScreenshotControl = new ScreenshotPopupControl
{
@ -61,11 +62,13 @@ namespace BizHawk.Client.EmuHawk
DrawInput = true;
AutoPause = true;
FollowCursor = true;
ScrollSpeed = 3;
ScrollSpeed = 6;
FollowCursorAlwaysScroll = false;
FollowCursorScrollMethod = "near";
BranchCellHoverInterval = 1;
SeekingCutoffInterval = 2;
SeekingCutoffInterval = 2; // unused, relying on VisibleRows is smarter
AutosaveInterval = 120000;
AutosaveAsBk2 = false;
// default to taseditor fashion
denoteStatesWithIcons = false;
denoteStatesWithBGColor = true;
@ -84,6 +87,8 @@ namespace BizHawk.Client.EmuHawk
public string FollowCursorScrollMethod { get; set; }
public int BranchCellHoverInterval { get; set; }
public int SeekingCutoffInterval { get; set; }
public int AutosaveInterval { get; set; }
public bool AutosaveAsBk2 { get; set; }
public bool denoteStatesWithIcons { get; set; }
public bool denoteStatesWithBGColor { get; set; }
@ -146,6 +151,25 @@ namespace BizHawk.Client.EmuHawk
TasView.MultiSelect = true;
TasView.MaxCharactersInHorizontal = 1;
WantsToControlRestartMovie = true;
_autosaveTimer.Interval = Settings.AutosaveInterval;
_autosaveTimer.Tick += AutosaveTimerEventProcessor;
_autosaveTimer.Start();
}
private void AutosaveTimerEventProcessor(object sender, EventArgs e)
{
if (!CurrentTasMovie.Changes)
return;
if (Settings.AutosaveAsBk2)
{
ToBk2MenuItem_Click(sender, e);
}
else
{
SaveTasMenuItem_Click(sender, e);
}
}
private void InitializeSaveWorker()
@ -394,7 +418,13 @@ namespace BizHawk.Client.EmuHawk
}
var columnsToHide = TasView.AllColumns
.Where(c => c.Name == "Power" || c.Name == "Reset");
.Where(c =>
// todo: make a proper user editable list?
c.Name == "Power" ||
c.Name == "Reset" ||
c.Name.StartsWith("Tilt") ||
c.Name == "Light Sensor"
);
foreach (var column in columnsToHide)
{
@ -494,7 +524,7 @@ namespace BizHawk.Client.EmuHawk
Settings.RecentTas.Add(newMovie.Filename); // only add if it did load
if (TasView.AllColumns.Count() == 0 || file.Extension != TasMovie.Extension)
if (TasView.AllColumns.Count() == 0 || file.Extension != "." + TasMovie.Extension)
SetUpColumns();
if (startsFromSavestate)
@ -699,8 +729,8 @@ namespace BizHawk.Client.EmuHawk
if (BookMarkControl != null)
BookMarkControl.UpdateValues();
if (undoForm != null && !undoForm.IsDisposed)
undoForm.UpdateValues();
if (_undoForm != null && !_undoForm.IsDisposed)
_undoForm.UpdateValues();
}
private void RefreshTasView()
@ -855,8 +885,8 @@ namespace BizHawk.Client.EmuHawk
_exiting = false;
}
if (undoForm != null)
undoForm.Close();
if (_undoForm != null)
_undoForm.Close();
}
/// <summary>

View File

@ -326,12 +326,12 @@ namespace BizHawk.Client.EmuHawk
// back on regular object serialization when needed. so try to undo a TypeConverter
// operation here
var converter = TypeDescriptor.GetConverter(prop.PropertyType);
val = converter.ConvertFromString((string)val);
val = converter.ConvertFromString(null,System.Globalization.CultureInfo.InvariantCulture,((string)val));
}
else if (!(val is bool) && prop.PropertyType.IsPrimitive)
{
// numeric constanst are similarly hosed
val = Convert.ChangeType(val, prop.PropertyType);
val = Convert.ChangeType(val, prop.PropertyType, System.Globalization.CultureInfo.InvariantCulture);
}
prop.SetValue(tool, val, null);
}
@ -345,7 +345,7 @@ namespace BizHawk.Client.EmuHawk
data.Clear();
foreach (var prop in props)
{
data.Add(prop.Name, prop.GetValue(tool, null));
data.Add(prop.Name, prop.GetValue(tool, BindingFlags.GetProperty, Type.DefaultBinder, null, System.Globalization.CultureInfo.InvariantCulture));
}
}

View File

@ -102,6 +102,7 @@ namespace BizHawk.Client.EmuHawk
else
{
DumpToDisk(_logFile);
_instructions.Clear();
}
}

View File

@ -5,6 +5,7 @@ using System.Linq;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES;
using System;
namespace BizHawk.Client.EmuHawk
{
[SchemaAttributes("NES")]
@ -75,6 +76,8 @@ namespace BizHawk.Client.EmuHawk
yield return PowerPad(1);
currentControlerNo++;
break;
case "ControllerSNES":
throw new Exception("TODO");
}
switch (ss.Controls.NesRightPort)
@ -99,6 +102,8 @@ namespace BizHawk.Client.EmuHawk
case "PowerPad":
yield return PowerPad(currentControlerNo);
break;
case "ControllerSNES":
throw new Exception("TODO");
}
if (currentControlerNo == 0)

View File

@ -46,7 +46,7 @@ namespace BizHawk.Client.EmuHawk
{
default:
case Mode.New:
switch (MemoryDomains.First().ByteSize)
switch (MemoryDomains.First().WordSize)
{
default:
case 1:

View File

@ -78,9 +78,6 @@ namespace BizHawk.Client.MultiHawk
f.Dispose();
}
//dont know what to do about this yet
public bool NeedsToPaint { get { return true; } } // TODO
//rendering resources:
public IGL GL;
IGuiRenderer Renderer;

View File

@ -5,37 +5,23 @@ using System.Collections.ObjectModel;
namespace BizHawk.Emulation.Common
{
public class MemoryDomain
public abstract class MemoryDomain
{
public enum Endian { Big, Little, Unknown }
public MemoryDomain(string name, long size, Endian endian, Func<long, byte> peekByte, Action<long, byte> pokeByte, int byteSize = 1)
{
Name = name;
Size = size;
ByteSize = byteSize;
EndianType = endian;
PeekByte = peekByte;
PokeByte = pokeByte;
}
public string Name { get; protected set; }
public string Name { get; private set; }
public long Size { get; protected set; }
public long Size { get; private set; }
public int WordSize { get; protected set; }
public int ByteSize { get; private set; }
public Endian EndianType { get; protected set; }
public Endian EndianType { get; private set; }
public bool Writable { get; protected set; }
public Func<long, byte> PeekByte { get; private set; }
public abstract byte PeekByte(long addr);
public Action<long, byte> PokeByte { get; private set; }
public void SetPeekPokeDelegates(Func<long, byte> peeker, Action<long, byte> poker)
{
PeekByte = peeker;
PokeByte = poker;
}
public abstract void PokeByte(long addr, byte val);
/// <summary>
/// creates a memorydomain that references a managed byte array
@ -45,59 +31,10 @@ namespace BizHawk.Emulation.Common
/// <param name="data"></param>
/// <param name="writable">if false, writes will be ignored</param>
/// <returns></returns>
public static MemoryDomain FromByteArray(string name, Endian endian, byte[] data, bool writable = true, int byteSize = 1)
[Obsolete]
public static MemoryDomain FromByteArray(string name, Endian endian, byte[] data, bool writable = true, int wordSize = 1)
{
if (data == null)
throw new ArgumentNullException("data");
return new MemoryDomain
(
name,
data.Length,
endian,
delegate(long addr)
{
return data[addr];
},
writable ?
delegate(long addr, byte val)
{
data[addr] = val;
}
: (Action<long, byte>)null,
byteSize
);
}
public void SetDelegatesForIntPtr(long size, Endian endian, IntPtr data, bool writable = true, int byteSize = 1)
{
Func<long, byte> peeker;
Action<long, byte> poker;
CreateDelegatesForIntPtr(size, endian, data, out peeker, out poker, writable, byteSize);
PeekByte = peeker;
PokeByte = poker;
}
public unsafe static void CreateDelegatesForIntPtr(long size, Endian endian, IntPtr data, out Func<long, byte> peeker, out Action<long, byte> poker, bool writable = true, int byteSize = 1)
{
byte* p = (byte*)data;
uint l = (uint)size;
peeker = delegate(long addr)
{
if ((uint)addr >= l)
throw new ArgumentOutOfRangeException();
return p[addr];
};
poker =
writable ?
delegate(long addr, byte val)
{
if ((uint)addr >= l)
throw new ArgumentOutOfRangeException();
p[addr] = val;
}
: (Action<long, byte>)null;
return new MemoryDomainByteArray(name, endian, data, writable, wordSize);
}
/// <summary>
@ -106,16 +43,10 @@ namespace BizHawk.Emulation.Common
/// <param name="data">must remain valid as long as the MemoryDomain exists!</param>
/// <param name="writable">if false, writes will be ignored</param>
/// <returns></returns>
public unsafe static MemoryDomain FromIntPtr(string name, long size, Endian endian, IntPtr data, bool writable = true, int byteSize = 1)
[Obsolete]
public unsafe static MemoryDomain FromIntPtr(string name, long size, Endian endian, IntPtr data, bool writable = true, int wordSize = 1)
{
if (data == IntPtr.Zero)
throw new ArgumentNullException("data");
if ((ulong)size >= 0x80000000)
throw new ArgumentOutOfRangeException("size");
var md = new MemoryDomain(name,size,endian, null, null, byteSize);
md.SetDelegatesForIntPtr(size, endian, data, writable, byteSize);
return md;
return new MemoryDomainIntPtr(name, endian, data, size, writable, wordSize);
}
/// <summary>
@ -124,35 +55,10 @@ namespace BizHawk.Emulation.Common
/// <param name="data">must remain valid as long as the MemoryDomain exists!</param>
/// <param name="writable">if false, writes will be ignored</param>
/// <returns></returns>
public unsafe static MemoryDomain FromIntPtrSwap16(string name, long size, Endian endian, IntPtr data, bool writable = true, int byteSize = 1)
[Obsolete]
public unsafe static MemoryDomain FromIntPtrSwap16(string name, long size, Endian endian, IntPtr data, bool writable = true)
{
if (data == IntPtr.Zero)
throw new ArgumentNullException("data");
if ((ulong)size >= 0x80000000)
throw new ArgumentOutOfRangeException("size");
byte* p = (byte*)data;
uint l = (uint)size;
return new MemoryDomain
(
name,
size,
endian,
delegate(long addr)
{
if ((uint)addr >= l)
throw new ArgumentOutOfRangeException();
return p[addr ^ 1];
},
writable ?
delegate(long addr, byte val)
{
if ((uint)addr >= l)
throw new ArgumentOutOfRangeException();
p[addr ^ 1] = val;
}
: (Action<long, byte>)null,
byteSize
);
return new MemoryDomainIntPtrSwap16(name, endian, data, size, writable);
}
public override string ToString()
@ -160,7 +66,7 @@ namespace BizHawk.Emulation.Common
return Name;
}
public ushort PeekWord(long addr, bool bigEndian)
public virtual ushort PeekUshort(long addr, bool bigEndian)
{
Endian endian = bigEndian ? Endian.Big : Endian.Little;
switch (endian)
@ -173,7 +79,7 @@ namespace BizHawk.Emulation.Common
}
}
public uint PeekDWord(long addr, bool bigEndian)
public virtual uint PeekUint(long addr, bool bigEndian)
{
Endian endian = bigEndian ? Endian.Big : Endian.Little;
switch (endian)
@ -192,7 +98,7 @@ namespace BizHawk.Emulation.Common
}
}
public void PokeWord(long addr, ushort val, bool bigEndian)
public virtual void PokeUshort(long addr, ushort val, bool bigEndian)
{
Endian endian = bigEndian ? Endian.Big : Endian.Little;
switch (endian)
@ -209,7 +115,7 @@ namespace BizHawk.Emulation.Common
}
}
public void PokeDWord(long addr, uint val, bool bigEndian)
public virtual void PokeUint(long addr, uint val, bool bigEndian)
{
Endian endian = bigEndian ? Endian.Big : Endian.Little;
switch (endian)
@ -230,84 +136,4 @@ namespace BizHawk.Emulation.Common
}
}
}
public class MemoryDomainList : ReadOnlyCollection<MemoryDomain>, IMemoryDomains
{
private MemoryDomain _mainMemory;
private MemoryDomain _systemBus;
public bool Has(string name)
{
return this.FirstOrDefault((md) => md.Name == name) != null;
}
public MemoryDomainList(IList<MemoryDomain> domains)
: base(domains)
{
}
public MemoryDomain this[string name]
{
get
{
return this.FirstOrDefault(x => x.Name == name);
}
}
public MemoryDomain MainMemory
{
get
{
if (_mainMemory != null)
{
return _mainMemory;
}
return this.First();
}
set
{
_mainMemory = value;
}
}
public bool HasSystemBus
{
get
{
if (_systemBus != null)
{
return true;
}
return this.Any(x => x.Name == "System Bus");
}
}
public MemoryDomain SystemBus
{
get
{
if (_systemBus != null)
{
return _systemBus;
}
var bus = this.FirstOrDefault(x => x.Name == "System Bus");
if (bus != null)
{
return bus;
}
return MainMemory;
}
set
{
_systemBus = value;
}
}
}
}

View File

@ -0,0 +1,138 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Common
{
public class MemoryDomainDelegate : MemoryDomain
{
private Func<long, byte> _peek;
private Action<long, byte> _poke;
public Func<long, byte> Peek { get { return _peek; } set { _peek = value; } }
public Action<long, byte> Poke { get { return _poke; } set { _poke = value; Writable = value != null; } }
public override byte PeekByte(long addr)
{
return _peek(addr);
}
public override void PokeByte(long addr, byte val)
{
if (_poke != null)
_poke(addr, val);
}
public MemoryDomainDelegate(string name, long size, Endian endian, Func<long, byte> peek, Action<long, byte> poke, int wordSize)
{
Name = name;
EndianType = endian;
Size = size;
_peek = peek;
_poke = poke;
Writable = poke != null;
WordSize = wordSize;
}
}
public class MemoryDomainByteArray : MemoryDomain
{
private byte[] _data;
public byte[] Data { get { return _data; } set { _data = value; Size = _data.LongLength; } }
public override byte PeekByte(long addr)
{
return Data[addr];
}
public override void PokeByte(long addr, byte val)
{
if (Writable)
Data[addr] = val;
}
public MemoryDomainByteArray(string name, Endian endian, byte[] data, bool writable, int wordSize)
{
Name = name;
EndianType = endian;
Data = data;
Writable = writable;
WordSize = wordSize;
}
}
public unsafe class MemoryDomainIntPtr : MemoryDomain
{
public IntPtr Data { get; set; }
public override byte PeekByte(long addr)
{
if ((ulong)addr < (ulong)Size)
return ((byte*)Data)[addr];
else
throw new ArgumentOutOfRangeException("addr");
}
public override void PokeByte(long addr, byte val)
{
if (Writable)
{
if ((ulong)addr < (ulong)Size)
((byte*)Data)[addr] = val;
else
throw new ArgumentOutOfRangeException("addr");
}
}
public void SetSize(long size)
{
Size = size;
}
public MemoryDomainIntPtr(string name, Endian endian, IntPtr data, long size, bool writable, int wordSize)
{
Name = name;
EndianType = endian;
Data = data;
Size = size;
Writable = writable;
WordSize = wordSize;
}
}
public unsafe class MemoryDomainIntPtrSwap16 : MemoryDomain
{
public IntPtr Data { get; set; }
public override byte PeekByte(long addr)
{
if ((ulong)addr >= (ulong)Size)
return ((byte*)Data)[addr ^ 1];
else
throw new ArgumentOutOfRangeException("addr");
}
public override void PokeByte(long addr, byte val)
{
if (Writable)
{
if ((ulong)addr >= (ulong)Size)
((byte*)Data)[addr ^ 1] = val;
else
throw new ArgumentOutOfRangeException("addr");
}
}
public MemoryDomainIntPtrSwap16(string name, Endian endian, IntPtr data, long size, bool writable)
{
Name = name;
EndianType = endian;
Data = data;
Size = size;
Writable = writable;
WordSize = 2;
}
}
}

View File

@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
namespace BizHawk.Emulation.Common
{
public class MemoryDomainList : ReadOnlyCollection<MemoryDomain>, IMemoryDomains
{
private MemoryDomain _mainMemory;
private MemoryDomain _systemBus;
public bool Has(string name)
{
return this.FirstOrDefault((md) => md.Name == name) != null;
}
public MemoryDomainList(IList<MemoryDomain> domains)
: base(domains)
{
}
public MemoryDomain this[string name]
{
get
{
return this.FirstOrDefault(x => x.Name == name);
}
}
public MemoryDomain MainMemory
{
get
{
if (_mainMemory != null)
{
return _mainMemory;
}
return this.First();
}
set
{
_mainMemory = value;
}
}
public bool HasSystemBus
{
get
{
if (_systemBus != null)
{
return true;
}
return this.Any(x => x.Name == "System Bus");
}
}
public MemoryDomain SystemBus
{
get
{
if (_systemBus != null)
{
return _systemBus;
}
var bus = this.FirstOrDefault(x => x.Name == "System Bus");
if (bus != null)
{
return bus;
}
return MainMemory;
}
set
{
_systemBus = value;
}
}
}
}

View File

@ -96,6 +96,8 @@
<Compile Include="Base Implementations\InputCallbackSystem.cs" />
<Compile Include="Base Implementations\MemoryCallbackSystem.cs" />
<Compile Include="Base Implementations\MemoryDomain.cs" />
<Compile Include="Base Implementations\MemoryDomainImpls.cs" />
<Compile Include="Base Implementations\MemoryDomainList.cs" />
<Compile Include="Base Implementations\NullController.cs" />
<Compile Include="Base Implementations\NullEmulator.cs" />
<Compile Include="Base Implementations\NullSound.cs" />

View File

@ -208,7 +208,7 @@ namespace BizHawk.Emulation.Common.IEmulatorExtensions
public static bool CanPoke(this MemoryDomain d)
{
if (d.PokeByte == null)
if (!d.Writable)
{
return false;
}

View File

@ -437,6 +437,9 @@
<DependentUpon>Gambatte.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Nintendo\Gameboy\GambatteLink.cs" />
<Compile Include="Consoles\Nintendo\Gameboy\GambatteLink.ICodeDataLog.cs">
<DependentUpon>GambatteLink.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Nintendo\Gameboy\GambatteLink.IDebuggable.cs">
<DependentUpon>GambatteLink.cs</DependentUpon>
</Compile>

View File

@ -35,7 +35,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
},
delegate(ushort addr)
{
return md.PeekWord(addr + i, false);
return md.PeekUshort(addr + i, false);
}
);
w.WriteLine("0x{0:x8}: {1}", i, dis);

View File

@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Calculators
MemoryDomain.FromByteArray("Main RAM", MemoryDomain.Endian.Little, _ram)
};
var systemBusDomain = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little,
var systemBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little,
(addr) =>
{
if (addr < 0 || addr >= 65536)
@ -26,7 +26,7 @@ namespace BizHawk.Emulation.Cores.Calculators
if (addr < 0 || addr >= 65536)
throw new ArgumentOutOfRangeException();
Cpu.WriteMemory((ushort)addr, value);
});
}, 1);
domains.Add(systemBusDomain);

View File

@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
{
var domains = new List<MemoryDomain>();
var mainRamDomain = new MemoryDomain("Main Ram", 0xC000, MemoryDomain.Endian.Little,
var mainRamDomain = new MemoryDomainDelegate("Main Ram", 0xC000, MemoryDomain.Endian.Little,
(addr) =>
{
if (addr < 0 || addr >= 0xC000)
@ -23,11 +23,11 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
if (addr < 0 || addr >= 0xC000)
throw new ArgumentOutOfRangeException();
_machine.Memory.Write((int)addr, value);
});
}, 1);
domains.Add(mainRamDomain);
var systemBusDomain = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little,
var systemBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little,
(addr) =>
{
if (addr < 0 || addr >= 65536)
@ -39,7 +39,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
if (addr < 0 || addr >= 65536)
throw new ArgumentOutOfRangeException();
_machine.Memory.Write((int)addr, value);
});
}, 1);
domains.Add(systemBusDomain);

View File

@ -38,7 +38,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
{
public static MemoryDomain Create(string name, int size, Func<int, int> peekByte, Action<int, int> pokeByte)
{
return new MemoryDomain(name, size, MemoryDomain.Endian.Little, addr => unchecked((byte)peekByte((int)addr)), (addr, val) => pokeByte(unchecked((int)addr), val));
return new MemoryDomainDelegate(name, size, MemoryDomain.Endian.Little, addr => unchecked((byte)peekByte((int)addr)), (addr, val) => pokeByte(unchecked((int)addr), val), 1);
}
}
}

View File

@ -11,50 +11,45 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
var domains = new List<MemoryDomain>
{
new MemoryDomain(
new MemoryDomainByteArray(
"Main RAM",
128,
MemoryDomain.Endian.Little,
addr => Ram[addr],
(addr, value) => Ram[addr] = value),
new MemoryDomain(
Ram, true, 1),
new MemoryDomainDelegate(
"TIA",
16,
MemoryDomain.Endian.Little,
addr => _tia.ReadMemory((ushort)addr, true),
(addr, value) => this._tia.WriteMemory((ushort)addr, value)),
new MemoryDomain(
(addr, value) => this._tia.WriteMemory((ushort)addr, value), 1),
new MemoryDomainDelegate(
"PIA",
1024,
MemoryDomain.Endian.Little,
addr => M6532.ReadMemory((ushort)addr, true),
(addr, value) => M6532.WriteMemory((ushort)addr, value)),
new MemoryDomain(
(addr, value) => M6532.WriteMemory((ushort)addr, value), 1),
new MemoryDomainDelegate(
"System Bus",
65536,
MemoryDomain.Endian.Little,
addr => _mapper.PeekMemory((ushort) addr),
(addr, value) => _mapper.PokeMemory((ushort) addr, value))
(addr, value) => _mapper.PokeMemory((ushort) addr, value), 1)
};
if (_mapper is mDPC) // TODO: also mDPCPlus
{
domains.Add(new MemoryDomain(
domains.Add(new MemoryDomainByteArray(
"DPC",
2048,
MemoryDomain.Endian.Little,
addr => (_mapper as mDPC).DspData[addr],
(addr, value) => (_mapper as mDPC).DspData[addr] = value));
MemoryDomain.Endian.Little,(_mapper as mDPC).DspData, true, 1));
}
if (_mapper.HasCartRam)
{
domains.Add(new MemoryDomain(
domains.Add(new MemoryDomainDelegate(
"Cart Ram",
_mapper.CartRam.Len,
MemoryDomain.Endian.Little,
addr => _mapper.CartRam[(int)addr],
(addr, value) => _mapper.CartRam[(int)addr] = value));
(addr, value) => _mapper.CartRam[(int)addr] = value, 1));
}
MemoryDomains = new MemoryDomainList(domains);

View File

@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
_MemoryDomains = new List<MemoryDomain>();
if (theMachine is Machine7800)
{
_MemoryDomains.Add(new MemoryDomain(
_MemoryDomains.Add(new MemoryDomainDelegate(
"RAM", 0x1000, MemoryDomain.Endian.Unknown,
delegate(long addr)
{
@ -51,40 +51,22 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
{
((Machine7800)theMachine).RAM2[(ushort)addr] = val;
}
}));
}, 1));
_MemoryDomains.Add(new MemoryDomain(
"BIOS ROM", bios.Length, MemoryDomain.Endian.Unknown,
delegate(long addr)
{
return bios[addr];
},
null
));
_MemoryDomains.Add(new MemoryDomainByteArray(
"BIOS ROM", MemoryDomain.Endian.Unknown,
bios, false, 1));
if (hsc7800 != null)
{
_MemoryDomains.Add(new MemoryDomain(
"HSC ROM", hsbios.Length, MemoryDomain.Endian.Unknown,
delegate(long addr)
{
return hsbios[addr];
},
null));
_MemoryDomains.Add(new MemoryDomainByteArray(
"HSC ROM", MemoryDomain.Endian.Unknown, hsbios, false, 1));
_MemoryDomains.Add(new MemoryDomain(
"HSC RAM", hsram.Length, MemoryDomain.Endian.Unknown,
delegate(long addr)
{
return hsram[addr];
},
delegate(long addr, byte val)
{
hsram[addr] = val;
}));
_MemoryDomains.Add(new MemoryDomainByteArray(
"HSC RAM", MemoryDomain.Endian.Unknown, hsram, true, 1));
}
_MemoryDomains.Add(new MemoryDomain(
_MemoryDomains.Add(new MemoryDomainDelegate(
"System Bus", 65536, MemoryDomain.Endian.Unknown,
delegate(long addr)
{
@ -97,7 +79,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
if (addr < 0 || addr >= 0x10000)
throw new ArgumentOutOfRangeException();
theMachine.Mem[(ushort)addr] = val;
}));
}, 1));
}
else // todo 2600?
{

View File

@ -12,13 +12,9 @@ namespace BizHawk.Emulation.Cores.ColecoVision
private void SetupMemoryDomains()
{
var domains = new List<MemoryDomain>(3);
var MainMemoryDomain = new MemoryDomain("Main RAM", Ram.Length, MemoryDomain.Endian.Little,
addr => Ram[addr],
(addr, value) => Ram[addr] = value);
var VRamDomain = new MemoryDomain("Video RAM", VDP.VRAM.Length, MemoryDomain.Endian.Little,
addr => VDP.VRAM[addr],
(addr, value) => VDP.VRAM[addr] = value);
var SystemBusDomain = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little,
var MainMemoryDomain = new MemoryDomainByteArray("Main RAM", MemoryDomain.Endian.Little, Ram, true, 1);
var VRamDomain = new MemoryDomainByteArray("Video RAM", MemoryDomain.Endian.Little, VDP.VRAM, true, 1);
var SystemBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little,
(addr) =>
{
if (addr < 0 || addr >= 65536)
@ -36,7 +32,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
}
Cpu.WriteMemory((ushort)addr, value);
});
}, 1);
domains.Add(MainMemoryDomain);
domains.Add(VRamDomain);

View File

@ -174,6 +174,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
public IntPtr oam;
public IntPtr rom;
public IntPtr mmio;
public IntPtr sram;
public int sram_size;
}
// this isn't used directly at the moment. but it could be used for something eventually...

View File

@ -42,6 +42,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
public IntPtr vram;
public IntPtr oam;
public IntPtr rom;
public IntPtr sram;
public int sram_size;
}
[DllImport(dll, CallingConvention = cc)]

View File

@ -181,17 +181,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
var s = new LibmGBA.MemoryAreas();
LibmGBA.BizGetMemoryAreas(core, s);
var LE = MemoryDomain.Endian.Little;
MemoryDomains["IWRAM"].SetDelegatesForIntPtr(MemoryDomains["IWRAM"].Size, LE, s.wram, true, 4);
MemoryDomains["EWRAM"].SetDelegatesForIntPtr(MemoryDomains["EWRAM"].Size, LE, s.wram, true, 4);
MemoryDomains["BIOS"].SetDelegatesForIntPtr(MemoryDomains["BIOS"].Size, LE, s.bios, false, 4);
MemoryDomains["PALRAM"].SetDelegatesForIntPtr(MemoryDomains["PALRAM"].Size, LE, s.palram, false, 4);
MemoryDomains["VRAM"].SetDelegatesForIntPtr(MemoryDomains["VRAM"].Size, LE, s.vram, true, 4);
MemoryDomains["OAM"].SetDelegatesForIntPtr(MemoryDomains["OAM"].Size, LE, s.oam, false, 4);
MemoryDomains["ROM"].SetDelegatesForIntPtr(MemoryDomains["ROM"].Size, LE, s.rom, false, 4);
_iwram.Data = s.iwram;
_ewram.Data = s.wram;
_bios.Data = s.bios;
_palram.Data = s.palram;
_vram.Data = s.vram;
_oam.Data = s.oam;
_rom.Data = s.rom;
_sram.Data = s.sram;
_sram.SetSize(s.sram_size);
// special combined ram memory domain
MemoryDomains["Combined WRAM"].SetPeekPokeDelegates(
_cwram.Peek =
delegate(long addr)
{
LibmGBA.BizGetMemoryAreas(core, s);
@ -201,7 +203,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
return PeekWRAM(s.iwram, addr & 32767);
else
return PeekWRAM(s.wram, addr);
},
};
_cwram.Poke =
delegate(long addr, byte val)
{
if (addr < 0 || addr >= (256 + 32) * 1024)
@ -210,8 +213,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
PokeWRAM(s.iwram, addr & 32767, val);
else
PokeWRAM(s.wram, addr, val);
}
);
};
_gpumem = new GBAGPUMemoryAreas
{
@ -220,22 +222,32 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
palram = s.palram,
vram = s.vram
};
}
private MemoryDomainIntPtr _iwram;
private MemoryDomainIntPtr _ewram;
private MemoryDomainIntPtr _bios;
private MemoryDomainIntPtr _palram;
private MemoryDomainIntPtr _vram;
private MemoryDomainIntPtr _oam;
private MemoryDomainIntPtr _rom;
private MemoryDomainIntPtr _sram;
private MemoryDomainDelegate _cwram;
private void CreateMemoryDomains(int romsize)
{
var LE = MemoryDomain.Endian.Little;
var mm = new List<MemoryDomain>();
mm.Add(new MemoryDomain("IWRAM", 32 * 1024, LE, null, null, 4));
mm.Add(new MemoryDomain("EWRAM", 256 * 1024, LE, null, null, 4));
mm.Add(new MemoryDomain("BIOS", 16 * 1024, LE, null, null, 4));
mm.Add(new MemoryDomain("PALRAM", 1024, LE, null, null, 4));
mm.Add(new MemoryDomain("VRAM", 96 * 1024, LE, null, null, 4));
mm.Add(new MemoryDomain("OAM", 1024, LE, null, null, 4));
mm.Add(new MemoryDomain("ROM", romsize, LE, null, null, 4));
mm.Add(new MemoryDomain("Combined WRAM", (256 + 32) * 1024, LE, null, null, 4));
mm.Add(_iwram = new MemoryDomainIntPtr("IWRAM", LE, IntPtr.Zero, 32 * 1024, true, 4));
mm.Add(_ewram = new MemoryDomainIntPtr("EWRAM", LE, IntPtr.Zero, 256 * 1024, true, 4));
mm.Add(_bios = new MemoryDomainIntPtr("BIOS", LE, IntPtr.Zero, 16 * 1024, false, 4));
mm.Add(_palram = new MemoryDomainIntPtr("PALRAM", LE, IntPtr.Zero, 1024, true, 4));
mm.Add(_vram = new MemoryDomainIntPtr("VRAM", LE, IntPtr.Zero, 96 * 1024, true, 4));
mm.Add(_oam = new MemoryDomainIntPtr("OAM", LE, IntPtr.Zero, 1024, true, 4));
mm.Add(_rom = new MemoryDomainIntPtr("ROM", LE, IntPtr.Zero, romsize, false, 4));
mm.Add(_sram = new MemoryDomainIntPtr("SRAM", LE, IntPtr.Zero, 0, true, 4)); //size will be fixed in wireup
mm.Add(_cwram = new MemoryDomainDelegate("Combined WRAM", (256 + 32) * 1024, LE, null, null, 4));
MemoryDomains = new MemoryDomainList(mm);
WireMemoryDomainPointers();

View File

@ -36,7 +36,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
AddMemoryDomain(LibMeteor.MemoryArea.rom, 32 * 1024 * 1024, "ROM");
// special domain for system bus
{
MemoryDomain sb = new MemoryDomain("System Bus", 1 << 28, MemoryDomain.Endian.Little,
MemoryDomain sb = new MemoryDomainDelegate("System Bus", 1 << 28, MemoryDomain.Endian.Little,
delegate(long addr)
{
if (addr < 0 || addr >= 0x10000000)
@ -48,14 +48,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
if (addr < 0 || addr >= 0x10000000)
throw new IndexOutOfRangeException();
LibMeteor.libmeteor_writebus((uint)addr, val);
});
}, 4);
_domainList.Add(sb);
}
// special combined ram memory domain
{
var ew = _domainList[1];
var iw = _domainList[0];
MemoryDomain cr = new MemoryDomain("Combined WRAM", (256 + 32) * 1024, MemoryDomain.Endian.Little,
MemoryDomain cr = new MemoryDomainDelegate("Combined WRAM", (256 + 32) * 1024, MemoryDomain.Endian.Little,
delegate(long addr)
{
if (addr < 0 || addr >= (256 + 32) * 1024)
@ -73,7 +73,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
iw.PokeByte(addr & 32767, val);
else
ew.PokeByte(addr, val);
});
}, 4);
_domainList.Add(cr);
}

View File

@ -23,8 +23,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
mm.Add(MemoryDomain.FromIntPtr("VRAM", 96 * 1024, l, s.vram, true, 4));
mm.Add(MemoryDomain.FromIntPtr("OAM", 1024, l, s.oam, true, 4));
mm.Add(MemoryDomain.FromIntPtr("ROM", 32 * 1024 * 1024, l, s.rom, true, 4));
mm.Add(MemoryDomain.FromIntPtr("SRAM", s.sram_size, l, s.sram, true, 4));
mm.Add(new MemoryDomain("System Bus", 0x10000000, l,
mm.Add(new MemoryDomainDelegate("System Bus", 0x10000000, l,
delegate(long addr)
{
if (addr < 0 || addr >= 0x10000000)
@ -41,7 +42,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
var ew = mm[1];
var iw = mm[0];
MemoryDomain cr = new MemoryDomain("Combined WRAM", (256 + 32) * 1024, MemoryDomain.Endian.Little,
MemoryDomain cr = new MemoryDomainDelegate("Combined WRAM", (256 + 32) * 1024, MemoryDomain.Endian.Little,
delegate(long addr)
{
if (addr < 0 || addr >= (256 + 32) * 1024)

View File

@ -35,7 +35,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
// also add a special memory domain for the system bus, where calls get sent directly to the core each time
_memoryDomains.Add(new MemoryDomain("System Bus", 65536, MemoryDomain.Endian.Little,
_memoryDomains.Add(new MemoryDomainDelegate("System Bus", 65536, MemoryDomain.Endian.Little,
delegate(long addr)
{
if (addr < 0 || addr >= 65536)
@ -47,7 +47,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
if (addr < 0 || addr >= 65536)
throw new ArgumentOutOfRangeException();
LibGambatte.gambatte_cpuwrite(GambatteState, (ushort)addr, val);
}));
}, 1));
MemoryDomains = new MemoryDomainList(_memoryDomains);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(MemoryDomains);

View File

@ -52,7 +52,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
public int[] GBPalette;
public GBColors.ColorType CGBColors;
public bool DisplayBG = true, DisplayOBJ = true;
public bool DisplayBG = true, DisplayOBJ = true, DisplayWindow = true;
/// <summary>
/// true to mute all audio

View File

@ -24,7 +24,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
.PadRight(30),
RegisterInfo =
string.Format(
"SP:{2:x2} A:{3:x2} B:{4:x2} C:{5:x2} D:{6:x2} E:{7:x2} F:{8:x2} H:{9:x2} L:{10:x2} LY:{14:x2} {11} Cy:{0}",
"SP:{2:x2} A:{3:x2} B:{4:x2} C:{5:x2} D:{6:x2} E:{7:x2} F:{8:x2} H:{9:x2} L:{10:x2} LY:{13:x2} {11} Cy:{0}",
s[0],
s[1] & 0xffff,
s[2] & 0xffff,
@ -37,7 +37,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
s[9] & 0xff,
s[10] & 0xff,
s[11] != 0 ? "skip" : "",
s[12] & 0xff
s[12] & 0xff,
s[13] & 0xff
)
});
}

View File

@ -302,7 +302,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
tracecb = null;
LibGambatte.gambatte_settracecallback(GambatteState, tracecb);
LibGambatte.gambatte_setlayers(GambatteState, (_settings.DisplayBG ? 1 : 0) | (_settings.DisplayOBJ ? 2 : 0));
LibGambatte.gambatte_setlayers(GambatteState, (_settings.DisplayBG ? 1 : 0) | (_settings.DisplayOBJ ? 2 : 0) | (_settings.DisplayWindow ? 4 : 0 ) );
}
internal void FrameAdvancePost()

View File

@ -0,0 +1,24 @@
using System;
using System.IO;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
partial class GambatteLink
{
void ICodeDataLogger.SetCDL(CodeDataLog cdl)
{
((ICodeDataLogger)L).SetCDL(cdl);
}
void ICodeDataLogger.NewCDL(CodeDataLog cdl)
{
((ICodeDataLogger)L).NewCDL(cdl);
}
void ICodeDataLogger.DisassembleCDL(Stream s, CodeDataLog cdl) { ((ICodeDataLogger)L).DisassembleCDL(s, cdl); }
}
}

View File

@ -16,16 +16,43 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
foreach (var md in L.MemoryDomains)
{
mm.Add(new MemoryDomain("L " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte));
mm.Add(new WrappedMemoryDomain("L " + md.Name, md));
}
foreach (var md in R.MemoryDomains)
{
mm.Add(new MemoryDomain("R " + md.Name, md.Size, md.EndianType, md.PeekByte, md.PokeByte));
mm.Add(new WrappedMemoryDomain("R " + md.Name, md));
}
_memoryDomains = new MemoryDomainList(mm);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
}
// todo: clean this up
private class WrappedMemoryDomain : MemoryDomain
{
private readonly MemoryDomain _m;
public WrappedMemoryDomain(string name, MemoryDomain m)
{
_m = m;
Name = name;
Size = m.Size;
WordSize = m.WordSize;
EndianType = m.EndianType;
Writable = m.Writable;
}
public override byte PeekByte(long addr)
{
return _m.PeekByte(addr);
}
public override void PokeByte(long addr, byte val)
{
_m.PokeByte(addr, val);
}
}
}
}

View File

@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
)]
[ServiceNotApplicable(typeof(IDriveLight))]
public partial class GambatteLink : IEmulator, IVideoProvider, ISyncSoundProvider, IInputPollable, ISaveRam, IStatable, ILinkable,
IDebuggable, ISettable<GambatteLink.GambatteLinkSettings, GambatteLink.GambatteLinkSyncSettings>
IDebuggable, ISettable<GambatteLink.GambatteLinkSettings, GambatteLink.GambatteLinkSyncSettings>, ICodeDataLogger
{
public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom, object Settings, object SyncSettings, bool deterministic)
{

View File

@ -229,7 +229,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
/// sets layers to be rendered
/// </summary>
/// <param name="core">opaque state pointer</param>
/// <param name="mask">layermask, 1=BG, 2=OBJ</param>
/// <param name="mask">layermask, 1=BG, 2=OBJ, 4=WINDOW</param>
[DllImport("libgambatte.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void gambatte_setlayers(IntPtr core, int mask);

View File

@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
public string Disassemble(MemoryDomain m, uint addr, out int length)
{
length = 4; // TODO: is this right?
var instruction = m.PeekDWord(addr, true);
var instruction = m.PeekUint(addr, true);
//TODO - reserve buffer here for disassembling into. allocating repeatedly will be slower
var result = api.m64p_decode_op(instruction, addr);

View File

@ -71,7 +71,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
};
}
var md = new MemoryDomain(name, size, endian, peekByte, pokeByte, 4);
var md = new MemoryDomainDelegate(name, size, endian, peekByte, pokeByte, 4);
_memoryDomains.Add(md);
}
@ -129,13 +129,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
api.m64p_write_memory_8((uint)addr, val);
};
_memoryDomains.Add(new MemoryDomain
_memoryDomains.Add(new MemoryDomainDelegate
(
name: "System Bus",
size: uint.MaxValue,
endian: MemoryDomain.Endian.Big,
peekByte: peekByte,
pokeByte: pokeByte
"System Bus",
uint.MaxValue,
MemoryDomain.Endian.Big,
peekByte,
pokeByte, 4
));
MemoryDomains = new MemoryDomainList(_memoryDomains);

View File

@ -33,18 +33,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
case "COLORDREAMS-74*377":
AssertPrg(32, 64, 128); AssertChr(16, 32, 64, 128); AssertVram(0); AssertWram(0);
break;
case "AGCI-47516":
SetMirrorType(Cart.pad_h, Cart.pad_v);
break;
case "AGCI-50282": // death race
case "MAPPER144":
bus_conflict_50282 = true;
bus_conflict = false;
SetMirrorType(Cart.pad_h, Cart.pad_v);
break;
default:
return false;
}
@ -54,6 +49,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
prg_bank_mask_32k = Cart.prg_size / 32 - 1;
chr_bank_mask_8k = Cart.chr_size / 8 - 1;
SetMirrorType(Cart.pad_h, Cart.pad_v);
return true;
}
public override byte ReadPRG(int addr)

View File

@ -302,7 +302,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
case 0x1000: //$9000
case 0x1001: //$9001
switch (value & 3)
switch (value & (type - 1)) // VRC2 only supports V, H, and not A, B
{
case 0: SetMirrorType(NES.NESBoardBase.EMirrorType.Vertical); break;
case 1: SetMirrorType(NES.NESBoardBase.EMirrorType.Horizontal); break;

View File

@ -228,7 +228,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public MemoryDomain GetDiskPeeker()
{
return new MemoryDomain("FDS Side", diskdrive.NumBytes, MemoryDomain.Endian.Little, diskdrive.PeekData, null);
return new MemoryDomainDelegate("FDS Side", diskdrive.NumBytes, MemoryDomain.Endian.Little, diskdrive.PeekData, null, 1);
}
void SetIRQ()

View File

@ -13,16 +13,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private void SetupMemoryDomains()
{
var domains = new List<MemoryDomain>();
var RAM = new MemoryDomain("RAM", 0x800, MemoryDomain.Endian.Little,
addr => ram[addr], (addr, value) => ram[addr] = value);
var SystemBus = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little,
addr => PeekMemory((ushort)addr), (addr, value) => ApplySystemBusPoke((int)addr, value));
var PPUBus = new MemoryDomain("PPU Bus", 0x4000, MemoryDomain.Endian.Little,
addr => ppu.ppubus_peek((int)addr), (addr, value) => ppu.ppubus_write((int)addr, value));
var CIRAMdomain = new MemoryDomain("CIRAM (nametables)", 0x800, MemoryDomain.Endian.Little,
addr => CIRAM[addr], (addr, value) => CIRAM[addr] = value);
var OAMdoman = new MemoryDomain("OAM", 64 * 4, MemoryDomain.Endian.Unknown,
addr => ppu.OAM[addr], (addr, value) => ppu.OAM[addr] = value);
var RAM = new MemoryDomainByteArray("RAM", MemoryDomain.Endian.Little, ram, true, 1);
var SystemBus = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little,
addr => PeekMemory((ushort)addr), (addr, value) => ApplySystemBusPoke((int)addr, value), 1);
var PPUBus = new MemoryDomainDelegate("PPU Bus", 0x4000, MemoryDomain.Endian.Little,
addr => ppu.ppubus_peek((int)addr), (addr, value) => ppu.ppubus_write((int)addr, value), 1);
var CIRAMdomain = new MemoryDomainByteArray("CIRAM (nametables)", MemoryDomain.Endian.Little, CIRAM, true, 1);
var OAMdoman = new MemoryDomainByteArray("OAM", MemoryDomain.Endian.Unknown, ppu.OAM, true, 1);
domains.Add(RAM);
domains.Add(SystemBus);
@ -32,36 +29,31 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (!(Board is FDS) && Board.SaveRam != null)
{
var BatteryRam = new MemoryDomain("Battery RAM", Board.SaveRam.Length, MemoryDomain.Endian.Little,
addr => Board.SaveRam[addr], (addr, value) => Board.SaveRam[addr] = value);
var BatteryRam = new MemoryDomainByteArray("Battery RAM", MemoryDomain.Endian.Little, Board.SaveRam, true, 1);
domains.Add(BatteryRam);
}
if (Board.ROM != null)
{
var PRGROM = new MemoryDomain("PRG ROM", cart.prg_size * 1024, MemoryDomain.Endian.Little,
addr => Board.ROM[addr], (addr, value) => Board.ROM[addr] = value);
var PRGROM = new MemoryDomainByteArray("PRG ROM", MemoryDomain.Endian.Little, Board.ROM, true, 1);
domains.Add(PRGROM);
}
if (Board.VROM != null)
{
var CHRROM = new MemoryDomain("CHR VROM", cart.chr_size * 1024, MemoryDomain.Endian.Little,
addr => Board.VROM[addr], (addr, value) => Board.VROM[addr] = value);
var CHRROM = new MemoryDomainByteArray("CHR VROM", MemoryDomain.Endian.Little, Board.VROM, true, 1);
domains.Add(CHRROM);
}
if (Board.VRAM != null)
{
var VRAM = new MemoryDomain("VRAM", Board.VRAM.Length, MemoryDomain.Endian.Little,
addr => Board.VRAM[addr], (addr, value) => Board.VRAM[addr] = value);
var VRAM = new MemoryDomainByteArray("VRAM", MemoryDomain.Endian.Little, Board.VRAM, true, 1);
domains.Add(VRAM);
}
if (Board.WRAM != null)
{
var WRAM = new MemoryDomain("WRAM", Board.WRAM.Length, MemoryDomain.Endian.Little,
addr => Board.WRAM[addr], (addr, value) => Board.WRAM[addr] = value);
var WRAM = new MemoryDomainByteArray("WRAM", MemoryDomain.Endian.Little, Board.WRAM, true, 1);
domains.Add(WRAM);
}

View File

@ -320,6 +320,69 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
/// <summary>
/// a SNES controller plugged into a NES? heresy
/// </summary>
public class ControllerSNES : INesPort
{
bool resetting = false;
int latchedvalue = 0;
static readonly string[] Buttons =
{
"0B", "0Y", "0Select", "0Start", "0Up", "0Down", "0Left", "0Right",
"0A", "0X", "0L", "0R", null, null, null, null // 4 0s at end
};
ControllerDefinition Definition;
public ControllerSNES()
{
Definition = new ControllerDefinition
{
BoolButtons = Buttons.Where(s => s != null).ToList()
};
}
// reset is not edge triggered; so long as it's high, the latch is continuously reloading
// so we need to latch in two places:
// 1. when OUT0 goes low, to get the last set
// 2. wheneven reading with OUT0 high, since new data for controller is always loading
void Latch(IController c)
{
latchedvalue = SerialUtil.Latch(Buttons, c);
}
public void Strobe(StrobeInfo s, IController c)
{
resetting = s.OUT0 != 0;
if (s.OUT0 < s.OUT0old)
Latch(c);
}
public byte Read(IController c)
{
if (resetting)
Latch(c);
byte ret = (byte)(latchedvalue & 1);
if (!resetting)
latchedvalue >>= 1; // ASR not LSR, so endless stream of 1s after data
return ret;
}
public ControllerDefinition GetDefinition()
{
return Definition;
}
public void SyncState(Serializer ser)
{
ser.Sync("restting", ref resetting);
ser.Sync("latchedvalue", ref latchedvalue);
}
}
/// <summary>
/// vaus paddle, the NES (not famicom) version
/// </summary>

View File

@ -27,7 +27,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
}
}
// add system bus
mm.Add(new MemoryDomain
mm.Add(new MemoryDomainDelegate
(
"System Bus",
0x10000,
@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
}
QN.qn_poke_prgbus(Context, (int)addr, val);
}
}, 1
));
_memoryDomains = new MemoryDomainList(mm);

View File

@ -1076,7 +1076,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
byte* blockptr = api.QUERY_get_memory_data(LibsnesApi.SNES_MEMORY.WRAM);
var md = new MemoryDomain("System Bus", 0x1000000, MemoryDomain.Endian.Little,
var md = new MemoryDomainDelegate("System Bus", 0x1000000, MemoryDomain.Endian.Little,
(addr) =>
{
var a = FakeBusMap((int)addr);
@ -1090,7 +1090,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
var a = FakeBusMap((int)addr);
if (a.HasValue)
blockptr[a.Value] = val;
}, byteSize: 2);
}, wordSize: 2);
_memoryDomains.Add(md);
}
@ -1116,17 +1116,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
//maybe a better way to visualize it is with an empty bus and adjacent banks
//so, we just throw away everything above its size of 544 bytes
if (size != 544) throw new InvalidOperationException("oam size isnt 544 bytes.. wtf?");
md = new MemoryDomain(name, size, endian,
md = new MemoryDomainDelegate(name, size, endian,
(addr) => (addr < 544) ? blockptr[addr] : (byte)0x00,
(addr, value) => { if (addr < 544) blockptr[addr] = value; },
byteSize);
}
else if(pow2)
md = new MemoryDomain(name, size, endian,
md = new MemoryDomainDelegate(name, size, endian,
(addr) => blockptr[addr & mask],
(addr, value) => blockptr[addr & mask] = value, byteSize);
else
md = new MemoryDomain(name, size, endian,
md = new MemoryDomainDelegate(name, size, endian,
(addr) => blockptr[addr % size],
(addr, value) => blockptr[addr % size] = value, byteSize);
@ -1137,9 +1137,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
void SetupMemoryDomains(byte[] romData, byte[] sgbRomData)
{
// remember, MainMemory must always be the same as MemoryDomains[0], else GIANT DRAGONS
//<zeromus> - this is stupid.
//lets just do this entirely differently for SGB
if (IsSGB)
{
@ -1147,13 +1144,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
//You wouldnt expect a DMG game to access excess wram, but what if it tried to? maybe an oversight in bsnes?
MakeMemoryDomain("SGB WRAM", LibsnesApi.SNES_MEMORY.SGB_WRAM, MemoryDomain.Endian.Little);
var romDomain = new MemoryDomain("SGB CARTROM", romData.Length, MemoryDomain.Endian.Little,
(addr) => romData[addr],
(addr, value) => romData[addr] = value);
var romDomain = new MemoryDomainByteArray("SGB CARTROM", MemoryDomain.Endian.Little, romData, true, 1);
_memoryDomains.Add(romDomain);
//the last 1 byte of this is special.. its an interrupt enable register, instead of ram. weird. maybe its actually ram and just getting specially used?
MakeMemoryDomain("SGB HRAM", LibsnesApi.SNES_MEMORY.SGB_HRAM, MemoryDomain.Endian.Little);
@ -1161,9 +1154,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
MainMemory = MakeMemoryDomain("WRAM", LibsnesApi.SNES_MEMORY.WRAM, MemoryDomain.Endian.Little);
var sgbromDomain = new MemoryDomain("SGB.SFC ROM", sgbRomData.Length, MemoryDomain.Endian.Little,
(addr) => sgbRomData[addr],
(addr, value) => sgbRomData[addr] = value);
var sgbromDomain = new MemoryDomainByteArray("SGB.SFC ROM", MemoryDomain.Endian.Little, sgbRomData, true, 1);
_memoryDomains.Add(sgbromDomain);
}
else
@ -1180,9 +1171,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
if (!DeterministicEmulation)
{
_memoryDomains.Add(new MemoryDomain("System Bus", 0x1000000, MemoryDomain.Endian.Little,
_memoryDomains.Add(new MemoryDomainDelegate("System Bus", 0x1000000, MemoryDomain.Endian.Little,
(addr) => api.QUERY_peek(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr),
(addr, val) => api.QUERY_poke(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr, val), byteSize: 2));
(addr, val) => api.QUERY_poke(LibsnesApi.SNES_MEMORY.SYSBUS, (uint)addr, val), wordSize: 2));
}
else
{

View File

@ -513,13 +513,10 @@ namespace BizHawk.Emulation.Cores.PCEngine
{
var domains = new List<MemoryDomain>(10);
int mainmemorymask = Ram.Length - 1;
var MainMemoryDomain = new MemoryDomain("Main Memory", Ram.Length, MemoryDomain.Endian.Little,
addr => Ram[addr],
(addr, value) => Ram[addr] = value,
byteSize: 2);
var MainMemoryDomain = new MemoryDomainByteArray("Main Memory", MemoryDomain.Endian.Little, Ram, true, 1);
domains.Add(MainMemoryDomain);
var SystemBusDomain = new MemoryDomain("System Bus (21 bit)", 0x200000, MemoryDomain.Endian.Little,
var SystemBusDomain = new MemoryDomainDelegate("System Bus (21 bit)", 0x200000, MemoryDomain.Endian.Little,
(addr) =>
{
if (addr < 0 || addr >= 0x200000)
@ -532,10 +529,10 @@ namespace BizHawk.Emulation.Cores.PCEngine
throw new ArgumentOutOfRangeException();
Cpu.WriteMemory21((int)addr, value);
},
byteSize: 2);
wordSize: 2);
domains.Add(SystemBusDomain);
var CpuBusDomain = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little,
var CpuBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little,
(addr) =>
{
if (addr < 0 || addr >= 0x10000)
@ -548,63 +545,41 @@ namespace BizHawk.Emulation.Cores.PCEngine
throw new ArgumentOutOfRangeException();
Cpu.WriteMemory((ushort)addr, value);
},
byteSize: 2);
wordSize: 2);
domains.Add(CpuBusDomain);
var RomDomain = new MemoryDomain("ROM", RomLength, MemoryDomain.Endian.Little,
addr => RomData[addr],
(addr, value) => RomData[addr] = value,
byteSize: 2);
var RomDomain = new MemoryDomainByteArray("ROM", MemoryDomain.Endian.Little, RomData, true, 1);
domains.Add(RomDomain);
if (BRAM != null)
{
var BRAMMemoryDomain = new MemoryDomain("Battery RAM", Ram.Length, MemoryDomain.Endian.Little,
addr => BRAM[addr],
(addr, value) => BRAM[addr] = value,
byteSize: 2);
var BRAMMemoryDomain = new MemoryDomainByteArray("Battery RAM", MemoryDomain.Endian.Little, BRAM, true, 1);
domains.Add(BRAMMemoryDomain);
}
if (TurboCD)
{
var CDRamMemoryDomain = new MemoryDomain("TurboCD RAM", CDRam.Length, MemoryDomain.Endian.Little,
addr => CDRam[addr],
(addr, value) => CDRam[addr] = value,
byteSize: 2);
var CDRamMemoryDomain = new MemoryDomainByteArray("TurboCD RAM", MemoryDomain.Endian.Little, CDRam, true, 1);
domains.Add(CDRamMemoryDomain);
var AdpcmMemoryDomain = new MemoryDomain("ADPCM RAM", ADPCM.RAM.Length, MemoryDomain.Endian.Little,
addr => ADPCM.RAM[addr],
(addr, value) => ADPCM.RAM[addr] = value,
byteSize: 2);
var AdpcmMemoryDomain = new MemoryDomainByteArray("ADPCM RAM", MemoryDomain.Endian.Little, ADPCM.RAM, true, 1);
domains.Add(AdpcmMemoryDomain);
if (SuperRam != null)
{
var SuperRamMemoryDomain = new MemoryDomain("Super System Card RAM", SuperRam.Length, MemoryDomain.Endian.Little,
addr => SuperRam[addr],
(addr, value) => SuperRam[addr] = value,
byteSize: 2);
var SuperRamMemoryDomain = new MemoryDomainByteArray("Super System Card RAM", MemoryDomain.Endian.Little, SuperRam, true, 1);
domains.Add(SuperRamMemoryDomain);
}
}
if (ArcadeCard)
{
var ArcadeRamMemoryDomain = new MemoryDomain("Arcade Card RAM", ArcadeRam.Length, MemoryDomain.Endian.Little,
addr => ArcadeRam[addr],
(addr, value) => ArcadeRam[addr] = value,
byteSize: 2);
domains.Add(ArcadeRamMemoryDomain);
var ArcadeRamMemoryDomain = new MemoryDomainByteArray("Arcade Card RAM", MemoryDomain.Endian.Little, ArcadeRam, true, 1);
}
if (PopulousRAM != null)
{
var PopulusRAMDomain = new MemoryDomain("Cart Battery RAM", PopulousRAM.Length, MemoryDomain.Endian.Little,
addr => PopulousRAM[addr],
(addr, value) => PopulousRAM[addr] = value,
byteSize: 2);
var PopulusRAMDomain = new MemoryDomainByteArray("Cart Battery RAM", MemoryDomain.Endian.Little, PopulousRAM, true, 1);
domains.Add(PopulusRAMDomain);
}

View File

@ -458,6 +458,7 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis
void SetupMemoryDomains()
{
/*
var domains = new List<MemoryDomain>(3);
var MainMemoryDomain = new MemoryDomain("Main RAM", Ram.Length, MemoryDomain.Endian.Big,
addr => Ram[addr & 0xFFFF],
@ -485,6 +486,8 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis
domains.Add(SystemBusDomain);
memoryDomains = new MemoryDomainList(domains);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(memoryDomains);
*/
throw new NotImplementedException();
}
public void Dispose() { }

View File

@ -12,18 +12,12 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
void SetupMemoryDomains()
{
var domains = new List<MemoryDomain>(3);
var MainMemoryDomain = new MemoryDomain("Main RAM", SystemRam.Length, MemoryDomain.Endian.Little,
addr => SystemRam[addr],
(addr, value) => SystemRam[addr] = value);
var VRamDomain = new MemoryDomain("Video RAM", Vdp.VRAM.Length, MemoryDomain.Endian.Little,
addr => Vdp.VRAM[addr],
(addr, value) => Vdp.VRAM[addr] = value);
var MainMemoryDomain = new MemoryDomainByteArray("Main RAM", MemoryDomain.Endian.Little, SystemRam, true, 1);
var VRamDomain = new MemoryDomainByteArray("Video RAM", MemoryDomain.Endian.Little, Vdp.VRAM, true, 1);
var ROMDomain = new MemoryDomain("ROM", RomData.Length, MemoryDomain.Endian.Little,
addr => RomData[addr],
(addr, value) => RomData[addr] = value);
var ROMDomain = new MemoryDomainByteArray("ROM", MemoryDomain.Endian.Little, RomData, true, 1);
var SystemBusDomain = new MemoryDomain("System Bus", 0x10000, MemoryDomain.Endian.Little,
var SystemBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little,
(addr) =>
{
if (addr < 0 || addr >= 65536)
@ -41,7 +35,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
}
Cpu.WriteMemory((ushort)addr, value);
});
}, 1);
domains.Add(MainMemoryDomain);
domains.Add(VRamDomain);
@ -50,17 +44,15 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
if (SaveRAM != null)
{
var SaveRamDomain = new MemoryDomain("Save RAM", SaveRAM.Length, MemoryDomain.Endian.Little,
var SaveRamDomain = new MemoryDomainDelegate("Save RAM", SaveRAM.Length, MemoryDomain.Endian.Little,
addr => SaveRAM[addr],
(addr, value) => { SaveRAM[addr] = value; SaveRamModified = true; });
(addr, value) => { SaveRAM[addr] = value; SaveRamModified = true; }, 1);
domains.Add(SaveRamDomain);
}
if (ExtRam != null)
{
var ExtRamDomain = new MemoryDomain("Cart (Volatile) RAM", ExtRam.Length, MemoryDomain.Endian.Little,
addr => ExtRam[addr],
(addr, value) => { ExtRam[addr] = value; });
var ExtRamDomain = new MemoryDomainByteArray("Cart (Volatile) RAM", MemoryDomain.Endian.Little, ExtRam, true, 1);
domains.Add(ExtRamDomain);
}

View File

@ -29,9 +29,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
public string Disassemble(MemoryDomain m, uint addr, out int length)
{
_disassemblerInstance.ReadWord = (a) => (short)m.PeekWord(a, m.EndianType == MemoryDomain.Endian.Big);
_disassemblerInstance.ReadWord = (a) => (short)m.PeekUshort(a, m.EndianType == MemoryDomain.Endian.Big);
_disassemblerInstance.ReadByte = (a) => (sbyte)m.PeekByte(a);
_disassemblerInstance.ReadLong = (a) => (int)m.PeekDWord(a, m.EndianType == MemoryDomain.Endian.Big);
_disassemblerInstance.ReadLong = (a) => (int)m.PeekUint(a, m.EndianType == MemoryDomain.Endian.Big);
var info = _disassemblerInstance.Disassemble((int)addr);
length = info.Length;

View File

@ -25,7 +25,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
{
// vram pokes need to go through hook which invalidates cached tiles
byte* p = (byte*)area;
mm.Add(new MemoryDomain(name, size, MemoryDomain.Endian.Unknown,
mm.Add(new MemoryDomainDelegate(name, size, MemoryDomain.Endian.Unknown,
delegate(long addr)
{
if (addr < 0 || addr >= 65536)
@ -38,17 +38,17 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
throw new ArgumentOutOfRangeException();
Core.gpgx_poke_vram(((int)addr) ^ 1, val);
},
byteSize: 2));
wordSize: 2));
}
else
{
var byteSize = name.Contains("Z80") ? 1 : 2;
// TODO: are the Z80 domains really Swap16 in the core? Check this
mm.Add(MemoryDomain.FromIntPtrSwap16(name, size,
MemoryDomain.Endian.Big, area, name != "MD CART" && name != "CD BOOT ROM", byteSize));
MemoryDomain.Endian.Big, area, name != "MD CART" && name != "CD BOOT ROM"));
}
}
var m68Bus = new MemoryDomain("M68K BUS", 0x1000000, MemoryDomain.Endian.Big,
var m68Bus = new MemoryDomainDelegate("M68K BUS", 0x1000000, MemoryDomain.Endian.Big,
delegate (long addr)
{
var a = (uint)addr;
@ -66,7 +66,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
mm.Add(m68Bus);
var s68Bus = new MemoryDomain("S68K BUS", 0x1000000, MemoryDomain.Endian.Big,
var s68Bus = new MemoryDomainDelegate("S68K BUS", 0x1000000, MemoryDomain.Endian.Big,
delegate (long addr)
{
var a = (uint)addr;

Some files were not shown because too many files have changed in this diff Show More