i don't want to talk about it

This commit is contained in:
goyuken 2013-12-20 05:38:07 +00:00
parent 57c8b2f75f
commit 1f4ff7b1ce
10 changed files with 500 additions and 10 deletions

View File

@ -467,6 +467,12 @@
<Compile Include="tools\GB\GBGPUView.Designer.cs">
<DependentUpon>GBGPUView.cs</DependentUpon>
</Compile>
<Compile Include="tools\Genesis\GenDbgWind.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="tools\Genesis\GenDbgWind.Designer.cs">
<DependentUpon>GenDbgWind.cs</DependentUpon>
</Compile>
<Compile Include="tools\Genesis\GenGameGenie.cs">
<SubType>Form</SubType>
</Compile>
@ -932,6 +938,9 @@
<EmbeddedResource Include="tools\GB\GBGPUView.resx">
<DependentUpon>GBGPUView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\Genesis\GenDbgWind.resx">
<DependentUpon>GenDbgWind.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\Genesis\GenGameGenie.resx">
<DependentUpon>GenGameGenie.cs</DependentUpon>
</EmbeddedResource>

View File

@ -0,0 +1,109 @@
namespace BizHawk.Client.EmuHawk.tools.Genesis
{
partial class GenDbgWind
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.listBox1 = new System.Windows.Forms.ListBox();
this.listBox2 = new System.Windows.Forms.ListBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(12, 12);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(114, 264);
this.listBox1.TabIndex = 0;
//
// listBox2
//
this.listBox2.FormattingEnabled = true;
this.listBox2.Location = new System.Drawing.Point(132, 12);
this.listBox2.Name = "listBox2";
this.listBox2.Size = new System.Drawing.Size(120, 264);
this.listBox2.TabIndex = 1;
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 282);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 2;
this.button1.Text = "Save";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(132, 282);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 3;
this.button2.Text = "Save";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(70, 311);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 4;
this.button3.Text = "Compare";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// GenDbgWind
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(404, 365);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.listBox2);
this.Controls.Add(this.listBox1);
this.Name = "GenDbgWind";
this.Text = "GenDbgWind";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.GenDbgWind_FormClosed);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.ListBox listBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
}
}

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
namespace BizHawk.Client.EmuHawk.tools.Genesis
{
public partial class GenDbgWind : Form
{
GenDbgHlp dbg;
public GenDbgWind()
{
InitializeComponent();
for (int i = 0; i < 10; i++)
{
listBox1.Items.Add(i.ToString());
listBox2.Items.Add(i.ToString());
}
dbg = new GenDbgHlp();
}
private void button1_Click(object sender, EventArgs e)
{
if (listBox1.SelectedIndex != -1)
dbg.SaveState(int.Parse((string)listBox1.SelectedItem));
}
private void button2_Click(object sender, EventArgs e)
{
if (listBox2.SelectedIndex != -1)
dbg.SaveState(int.Parse((string)listBox2.SelectedItem));
}
private void button3_Click(object sender, EventArgs e)
{
if (listBox1.SelectedIndex != -1 && listBox2.SelectedIndex != -1)
dbg.Cmp(int.Parse((string)listBox1.SelectedItem), int.Parse((string)listBox2.SelectedItem));
}
private void GenDbgWind_FormClosed(object sender, FormClosedEventArgs e)
{
dbg.Dispose();
dbg = null;
}
}
}

View File

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

View File

@ -408,6 +408,7 @@
<Compile Include="Consoles\Sega\Genesis\Cart\SaveRAM.cs" />
<Compile Include="Consoles\Sega\Genesis\Input.cs" />
<Compile Include="Consoles\Sega\Genesis\Native68000\Musashi.cs" />
<Compile Include="Consoles\Sega\gpgx\GenDbgHlp.cs" />
<Compile Include="Consoles\Sega\gpgx\GPGX.cs" />
<Compile Include="Consoles\Sega\gpgx\GPGXControlConverter.cs" />
<Compile Include="Consoles\Sega\gpgx\LibGPGX.cs" />

View File

@ -0,0 +1,198 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;
namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
{
public class GenDbgHlp : IDisposable
{
private static class Win32
{
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
[DllImport("kernel32.dll")]
public static extern bool FreeLibrary(IntPtr hModule);
}
// config
const string modulename = "libgenplusgx.dll";
const string symbolname = @"D:\encodes\bizhawksrc\genplus-gx\libretro\msvc\Debug\vars.txt";
const int start = 0x0c7d8000 - 0x0c540000;
const int length = 0x01082000;
bool disposed = false;
public void Dispose()
{
if (!disposed)
{
Win32.FreeLibrary(DllBase);
DllBase = IntPtr.Zero;
disposed = true;
}
}
IntPtr DllBase;
List<Symbol> SymbolsByAddr = new List<Symbol>();
Dictionary<string, Symbol> SymbolsByName = new Dictionary<string, Symbol>();
byte[][] data = new byte[10][];
public void SaveState(int statenum)
{
if (disposed) throw new ObjectDisposedException(this.GetType().ToString());
if (data[statenum] == null)
data[statenum] = new byte[length];
Marshal.Copy(DllBase + start, data[statenum], 0, length);
Console.WriteLine("State {0} saved", statenum);
}
unsafe public void Cmp(int statex, int statey)
{
if (disposed) throw new ObjectDisposedException(this.GetType().ToString());
List<Tuple<int, int>> bads = new List<Tuple<int, int>>();
byte[] x = data[statex];
byte[] y = data[statey];
if (x == null || y == null)
{
Console.WriteLine("Missing State!");
return;
}
bool inrange = false;
int startsec = 0;
fixed (byte* p0 = &x[0])
fixed (byte* p1 = &y[0])
{
for (int i = 0; i < length; i++)
{
if (!inrange)
{
if (p0[i] != p1[i])
{
startsec = i;
inrange = true;
}
}
else
{
if (p0[i] == p1[i])
{
bads.Add(new Tuple<int, int>(startsec, i));
inrange = false;
}
}
}
}
if (inrange)
bads.Add(new Tuple<int, int>(startsec, length));
for (int i = 0; i < bads.Count; i++)
{
IntPtr addr = (IntPtr)(bads[i].Item1 + start);
int len = bads[i].Item2 - bads[i].Item1;
var ss = Find(addr, len);
Console.WriteLine("0x{0:X8}[0x{1}]", (int)addr, len);
foreach (var sym in ss)
Console.WriteLine(sym);
Console.WriteLine();
}
if (bads.Count == 0)
Console.WriteLine("Clean!");
}
public GenDbgHlp()
{
using (StreamReader sr = new StreamReader(symbolname))
{
string line;
while ((line = sr.ReadLine()) != null)
{
Symbol sym = Symbol.FromString(line);
SymbolsByAddr.Add(sym);
SymbolsByName.Add(sym.name, sym);
}
SymbolsByAddr.Sort();
}
DllBase = Win32.LoadLibrary(modulename);
if (DllBase == IntPtr.Zero)
throw new Exception();
}
public List<Symbol> Find(IntPtr addr, int length)
{
if (disposed) throw new ObjectDisposedException(this.GetType().ToString());
Symbol min = new Symbol { addr = addr };
Symbol max = new Symbol { addr = addr + length };
int minidx = SymbolsByAddr.BinarySearch(min);
if (minidx < 0)
{
minidx = ~minidx;
// inexact matches return the first larger value, so find the next smallset one
if (minidx > 0)
minidx--;
}
int maxidx = SymbolsByAddr.BinarySearch(max);
if (maxidx < 0)
{
maxidx = ~maxidx;
if (maxidx > 0)
maxidx--;
}
return SymbolsByAddr.GetRange(minidx, maxidx - minidx + 1);
}
public struct Symbol : IComparable<Symbol>
{
public IntPtr addr;
public string section;
public string name;
public static Symbol FromString(string s)
{
string[] ss = s.Split(',');
if (ss.Length != 4)
throw new Exception();
if (!ss[1].StartsWith("0x"))
throw new Exception();
Symbol ret = new Symbol
{
addr = (IntPtr)int.Parse(ss[1].Substring(2), System.Globalization.NumberStyles.AllowHexSpecifier),
section = ss[3],
name = ss[0]
};
return ret;
}
public int CompareTo(Symbol other)
{
return (int)this.addr - (int)other.addr;
}
public override string ToString()
{
return string.Format("0x{0:X8} {1} ({2})", (int)addr, name, section);
}
}
}
}

View File

@ -240,7 +240,7 @@ void gen_reset(int hard_reset)
}
/* 68k & Z80 could be anywhere in VDP frame (Bonkers, Eternal Champions, X-Men 2) */
m68k.cycles = Z80.cycles = (uint32)((MCYCLES_PER_LINE * lines_per_frame) * ((double)rand() / (double)RAND_MAX));
m68k.cycles = Z80.cycles = 0; //(uint32)((MCYCLES_PER_LINE * lines_per_frame) * ((double)rand() / (double)RAND_MAX));
/* 68k cycles should be a multiple of 7 */
m68k.cycles = (m68k.cycles / 7) * 7;

View File

@ -231,7 +231,7 @@ typedef struct
{
cpu_memory_map memory_map[256]; /* memory mapping */
cpu_idle_t poll; /* polling detection */
cpu_idle_t poll; /* polling detection */ // 0x1400
uint cycles; /* current master cycle count */
uint cycle_end; /* aimed master cycle count for current execution frame */

View File

@ -36,14 +36,14 @@ enum {
/****************************************************************************/
typedef struct
{
PAIR pc,sp,af,bc,de,hl,ix,iy,wz;
PAIR af2,bc2,de2,hl2;
UINT8 r,r2,iff1,iff2,halt,im,i;
UINT8 nmi_state; /* nmi line state */
UINT8 nmi_pending; /* nmi pending */
UINT8 irq_state; /* irq line state */
UINT8 after_ei; /* are we in the EI shadow? */
UINT32 cycles; /* master clock cycles global counter */
PAIR pc,sp,af,bc,de,hl,ix,iy,wz; // 0x00
PAIR af2,bc2,de2,hl2; // 0x24
UINT8 r,r2,iff1,iff2,halt,im,i; // 0x34
UINT8 nmi_state; // 0x3b /* nmi line state */
UINT8 nmi_pending; // 0x3c /* nmi pending */
UINT8 irq_state; // 0x3d /* irq line state */
UINT8 after_ei; // 0x3e /* are we in the EI shadow? */
UINT32 cycles; // 0x40 /* master clock cycles global counter */
const struct z80_irq_daisy_chain *daisy;
int (*irq_callback)(int irqline);
} Z80_Regs;

Binary file not shown.