CDL reorg
This commit is contained in:
parent
10bbf6e9d0
commit
fbe010a18d
|
@ -673,6 +673,12 @@
|
|||
<DependentUpon>BatchRun.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\BatchRunner.cs" />
|
||||
<Compile Include="tools\CDL.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\CDL.designer.cs">
|
||||
<DependentUpon>CDL.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\Cheats\CheatEdit.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -917,12 +923,6 @@
|
|||
<Compile Include="tools\PCE\PCEBGViewer.Designer.cs">
|
||||
<DependentUpon>PCEBGViewer.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\PCE\PCECDL.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\PCE\PCECDL.Designer.cs">
|
||||
<DependentUpon>PCECDL.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\PCE\PCESoundDebugger.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -1349,6 +1349,9 @@
|
|||
<EmbeddedResource Include="tools\BatchRun.resx">
|
||||
<DependentUpon>BatchRun.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\CDL.resx">
|
||||
<DependentUpon>CDL.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\Cheats\CheatEdit.resx">
|
||||
<DependentUpon>CheatEdit.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -1446,9 +1449,6 @@
|
|||
<EmbeddedResource Include="tools\PCE\PCEBGViewer.resx">
|
||||
<DependentUpon>PCEBGViewer.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\PCE\PCECDL.resx">
|
||||
<DependentUpon>PCECDL.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\PCE\PCESoundDebugger.resx">
|
||||
<DependentUpon>PCESoundDebugger.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -1387,7 +1387,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void CodeDataLoggerMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.Tools.Load<PCECDL>();
|
||||
GlobalWin.Tools.Load<CDL>();
|
||||
}
|
||||
|
||||
private void PCEAlwaysPerformSpriteLimitMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -2610,8 +2610,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
else if (ext.ToUpper() == ".CDL" && Global.Emulator is PCEngine)
|
||||
{
|
||||
GlobalWin.Tools.Load<PCECDL>();
|
||||
(GlobalWin.Tools.Get<PCECDL>() as PCECDL).LoadFile(filePaths[0]);
|
||||
GlobalWin.Tools.Load<CDL>();
|
||||
(GlobalWin.Tools.Get<CDL>() as CDL).LoadFile(filePaths[0]);
|
||||
}
|
||||
|
||||
else if (MovieImport.IsValidMovieExtension(Path.GetExtension(filePaths[0])))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
partial class PCECDL
|
||||
partial class CDL
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@ -28,7 +28,7 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PCECDL));
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CDL));
|
||||
this.LoggingActiveCheckbox = new System.Windows.Forms.CheckBox();
|
||||
this.menuStrip1 = new MenuStripEx();
|
||||
this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
|
@ -16,7 +16,7 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class PCECDL : Form, IToolFormAutoConfig
|
||||
public partial class CDL : Form, IToolFormAutoConfig
|
||||
{
|
||||
[RequiredService]
|
||||
public IEmulator _emu { get; private set; }
|
||||
|
@ -44,7 +44,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private string _currentFileName = string.Empty;
|
||||
|
||||
public PCECDL()
|
||||
public CDL()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
|
@ -118,6 +118,7 @@
|
|||
<DependentUpon>TI83.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Calculator\TI83LinkPort.cs" />
|
||||
<Compile Include="CDL.cs" />
|
||||
<Compile Include="Computers\AppleII\AppleII.cs" />
|
||||
<Compile Include="Computers\AppleII\AppleII.IAudioProvider.cs">
|
||||
<DependentUpon>AppleII.cs</DependentUpon>
|
||||
|
@ -825,6 +826,7 @@
|
|||
<Compile Include="CoreInventory.cs" />
|
||||
<Compile Include="CPUs\CP1610\CP1610.Disassembler.cs" />
|
||||
<Compile Include="CPUs\CP1610\CP1610.Execute.cs" />
|
||||
<Compile Include="CPUs\HuC6280\CodeDataLog_PCE.cs" />
|
||||
<Compile Include="CPUs\W65816\Disassembler.cs" />
|
||||
<Compile Include="CPUs\68000\Diassembler.cs" />
|
||||
<Compile Include="CPUs\68000\Instructions\BitArithemetic.cs" />
|
||||
|
@ -838,7 +840,6 @@
|
|||
<Compile Include="CPUs\68000\Tables.cs" />
|
||||
<Compile Include="CPUs\ARM\Darm.cs" />
|
||||
<Compile Include="CPUs\CP1610\CP1610.cs" />
|
||||
<Compile Include="CPUs\HuC6280\CDL.cs" />
|
||||
<Compile Include="CPUs\HuC6280\CDLOpcodes.cs" />
|
||||
<Compile Include="CPUs\HuC6280\Disassembler.cs" />
|
||||
<Compile Include="CPUs\HuC6280\Execute.cs" />
|
||||
|
|
|
@ -5,99 +5,12 @@ using System.Text;
|
|||
using System.IO;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
//TODO - reorg please
|
||||
//needed for being a factory
|
||||
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
||||
using BizHawk.Emulation.Cores.Components.H6280;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Components.H6280
|
||||
{
|
||||
public class CodeDataLog_PCE : CodeDataLog
|
||||
{
|
||||
public static CodeDataLog_PCE Create(IEnumerable<HuC6280.MemMapping> mm)
|
||||
{
|
||||
var t = new CodeDataLog_PCE();
|
||||
foreach (var kvp in SizesFromHuMap(mm))
|
||||
{
|
||||
t[kvp.Key] = new byte[kvp.Value];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public override string SubType { get { return "PCE"; } }
|
||||
public override int SubVer { get { return 0; } }
|
||||
|
||||
public override void Disassemble(Stream s, IMemoryDomains mem)
|
||||
{
|
||||
var w = new StreamWriter(s);
|
||||
w.WriteLine("; Bizhawk CDL Disassembly");
|
||||
w.WriteLine();
|
||||
foreach (var kvp in this)
|
||||
{
|
||||
w.WriteLine(".\"{0}\" size=0x{1:x8}", kvp.Key, kvp.Value.Length);
|
||||
|
||||
byte[] cd = kvp.Value;
|
||||
var md = mem[kvp.Key];
|
||||
|
||||
for (int i = 0; i < kvp.Value.Length; i++)
|
||||
{
|
||||
if ((kvp.Value[i] & (byte)HuC6280.CDLUsage.Code) != 0)
|
||||
{
|
||||
int unused;
|
||||
string dis = HuC6280.DisassembleExt(
|
||||
0,
|
||||
out unused,
|
||||
delegate(ushort addr)
|
||||
{
|
||||
return md.PeekByte(addr + i);
|
||||
},
|
||||
delegate(ushort addr)
|
||||
{
|
||||
return md.PeekWord(addr + i, false);
|
||||
}
|
||||
);
|
||||
w.WriteLine("0x{0:x8}: {1}", i, dis);
|
||||
}
|
||||
}
|
||||
w.WriteLine();
|
||||
}
|
||||
w.WriteLine("; EOF");
|
||||
w.Flush();
|
||||
}
|
||||
|
||||
public bool CheckConsistency(object arg)
|
||||
{
|
||||
var mm = (IEnumerable<HuC6280.MemMapping>)arg;
|
||||
var sizes = SizesFromHuMap(mm);
|
||||
if (sizes.Count != Count)
|
||||
return false;
|
||||
foreach (var kvp in sizes)
|
||||
{
|
||||
if (!ContainsKey(kvp.Key))
|
||||
return false;
|
||||
if (this[kvp.Key].Length != kvp.Value)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Dictionary<string, int> SizesFromHuMap(IEnumerable<HuC6280.MemMapping> mm)
|
||||
{
|
||||
Dictionary<string, int> sizes = new Dictionary<string, int>();
|
||||
foreach (var m in mm)
|
||||
{
|
||||
if (!sizes.ContainsKey(m.Name) || m.MaxOffs >= sizes[m.Name])
|
||||
sizes[m.Name] = m.MaxOffs;
|
||||
}
|
||||
|
||||
List<string> keys = new List<string>(sizes.Keys);
|
||||
foreach (var key in keys)
|
||||
{
|
||||
// becase we were looking at offsets, and each bank is 8192 big, we need to add that size
|
||||
sizes[key] += 8192;
|
||||
}
|
||||
return sizes;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class CodeDataLog : Dictionary<string, byte[]>
|
||||
{
|
||||
public CodeDataLog()
|
|
@ -0,0 +1,97 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Components.H6280
|
||||
{
|
||||
public class CodeDataLog_PCE : CodeDataLog
|
||||
{
|
||||
public static CodeDataLog_PCE Create(IEnumerable<HuC6280.MemMapping> mm)
|
||||
{
|
||||
var t = new CodeDataLog_PCE();
|
||||
foreach (var kvp in SizesFromHuMap(mm))
|
||||
{
|
||||
t[kvp.Key] = new byte[kvp.Value];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public override string SubType { get { return "PCE"; } }
|
||||
public override int SubVer { get { return 0; } }
|
||||
|
||||
public override void Disassemble(Stream s, IMemoryDomains mem)
|
||||
{
|
||||
var w = new StreamWriter(s);
|
||||
w.WriteLine("; Bizhawk CDL Disassembly");
|
||||
w.WriteLine();
|
||||
foreach (var kvp in this)
|
||||
{
|
||||
w.WriteLine(".\"{0}\" size=0x{1:x8}", kvp.Key, kvp.Value.Length);
|
||||
|
||||
byte[] cd = kvp.Value;
|
||||
var md = mem[kvp.Key];
|
||||
|
||||
for (int i = 0; i < kvp.Value.Length; i++)
|
||||
{
|
||||
if ((kvp.Value[i] & (byte)HuC6280.CDLUsage.Code) != 0)
|
||||
{
|
||||
int unused;
|
||||
string dis = HuC6280.DisassembleExt(
|
||||
0,
|
||||
out unused,
|
||||
delegate(ushort addr)
|
||||
{
|
||||
return md.PeekByte(addr + i);
|
||||
},
|
||||
delegate(ushort addr)
|
||||
{
|
||||
return md.PeekWord(addr + i, false);
|
||||
}
|
||||
);
|
||||
w.WriteLine("0x{0:x8}: {1}", i, dis);
|
||||
}
|
||||
}
|
||||
w.WriteLine();
|
||||
}
|
||||
w.WriteLine("; EOF");
|
||||
w.Flush();
|
||||
}
|
||||
|
||||
public bool CheckConsistency(object arg)
|
||||
{
|
||||
var mm = (IEnumerable<HuC6280.MemMapping>)arg;
|
||||
var sizes = SizesFromHuMap(mm);
|
||||
if (sizes.Count != Count)
|
||||
return false;
|
||||
foreach (var kvp in sizes)
|
||||
{
|
||||
if (!ContainsKey(kvp.Key))
|
||||
return false;
|
||||
if (this[kvp.Key].Length != kvp.Value)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Dictionary<string, int> SizesFromHuMap(IEnumerable<HuC6280.MemMapping> mm)
|
||||
{
|
||||
Dictionary<string, int> sizes = new Dictionary<string, int>();
|
||||
foreach (var m in mm)
|
||||
{
|
||||
if (!sizes.ContainsKey(m.Name) || m.MaxOffs >= sizes[m.Name])
|
||||
sizes[m.Name] = m.MaxOffs;
|
||||
}
|
||||
|
||||
List<string> keys = new List<string>(sizes.Keys);
|
||||
foreach (var key in keys)
|
||||
{
|
||||
// becase we were looking at offsets, and each bank is 8192 big, we need to add that size
|
||||
sizes[key] += 8192;
|
||||
}
|
||||
return sizes;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue