15 |
|
|
16 |
namespace RomCheater.Docking |
namespace RomCheater.Docking |
17 |
{ |
{ |
18 |
public partial class FloatingRamDumperDialog : DockContent, IProcessConfig |
public partial class FloatingRamDumperDialog : DockContent, IProcessConfig, IAcceptsPlugin<IConfigPlugin> |
19 |
{ |
{ |
20 |
#region sub-classes |
#region sub-classes |
21 |
private const int BYTE_CORRECTION_VALUE = 23; |
private const int BYTE_CORRECTION_VALUE = 23; |
40 |
} |
} |
41 |
|
|
42 |
|
|
43 |
#region IProcessConfig Members' |
#region IProcessConfig Members |
44 |
public Process AcceptedProcess { get; set; } |
public Process AcceptedProcess { get; set; } |
45 |
#endregion |
#endregion |
46 |
#region IAcceptsPlugin<IConfigPlugin> Members |
#region IAcceptsPlugin<IConfigPlugin> Members |
47 |
public IConfigPlugin AcceptedPlugin { get; set; } |
public IConfigPlugin AcceptedPlugin { get; set; } |
48 |
#endregion |
#endregion |
49 |
|
#region ram-dump specific |
50 |
private void radioBTNBytes_CheckedChanged(object sender, EventArgs e) |
private void radioBTNBytes_CheckedChanged(object sender, EventArgs e) { dumpSize = DumpSize.Bytes; } |
51 |
{ |
private void radioBTNKiloBytes_CheckedChanged(object sender, EventArgs e) { dumpSize = DumpSize.KiloBytes; } |
52 |
dumpSize = DumpSize.Bytes; |
private void radioBTNMegaBytes_CheckedChanged(object sender, EventArgs e) { dumpSize = DumpSize.MegaBytes; } |
53 |
} |
private void radioBTNGigaBytes_CheckedChanged(object sender, EventArgs e) { dumpSize = DumpSize.GigaBytes; } |
|
|
|
|
private void radioBTNKiloBytes_CheckedChanged(object sender, EventArgs e) |
|
|
{ |
|
|
dumpSize = DumpSize.KiloBytes; |
|
|
} |
|
|
|
|
|
private void radioBTNMegaBytes_CheckedChanged(object sender, EventArgs e) |
|
|
{ |
|
|
dumpSize = DumpSize.MegaBytes; |
|
|
} |
|
|
|
|
|
private void radioBTNGigaBytes_CheckedChanged(object sender, EventArgs e) |
|
|
{ |
|
|
dumpSize = DumpSize.GigaBytes; |
|
|
} |
|
|
|
|
54 |
private void btnCalcEndAddr_Click(object sender, EventArgs e) |
private void btnCalcEndAddr_Click(object sender, EventArgs e) |
55 |
{ |
{ |
56 |
ulong start = 0; |
ulong start = 0; |
76 |
break; |
break; |
77 |
} |
} |
78 |
} |
} |
|
|
|
79 |
private void btnCalcStartAddr_Click(object sender, EventArgs e) |
private void btnCalcStartAddr_Click(object sender, EventArgs e) |
80 |
{ |
{ |
81 |
long start = 0; |
long start = 0; |
85 |
{ |
{ |
86 |
case DumpSize.Bytes: |
case DumpSize.Bytes: |
87 |
start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1.0)) + BYTE_CORRECTION_VALUE; |
start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1.0)) + BYTE_CORRECTION_VALUE; |
88 |
txtStart.Value = (ulong)start;; |
txtStart.Value = (ulong)start; ; |
89 |
break; |
break; |
90 |
case DumpSize.KiloBytes: |
case DumpSize.KiloBytes: |
91 |
start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000.0)) + BYTE_CORRECTION_VALUE; |
start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000.0)) + BYTE_CORRECTION_VALUE; |
92 |
txtStart.Value = (ulong)start;; |
txtStart.Value = (ulong)start; ; |
93 |
break; |
break; |
94 |
case DumpSize.MegaBytes: |
case DumpSize.MegaBytes: |
95 |
start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000000.0)) + BYTE_CORRECTION_VALUE; |
start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000000.0)) + BYTE_CORRECTION_VALUE; |
96 |
txtStart.Value = (ulong)start;; |
txtStart.Value = (ulong)start; ; |
97 |
break; |
break; |
98 |
case DumpSize.GigaBytes: |
case DumpSize.GigaBytes: |
99 |
start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000000000.0)) + BYTE_CORRECTION_VALUE; |
start = (long)((double)end - (Convert.ToDouble(txtDumpSize.Text) * 1000000000.0)) + BYTE_CORRECTION_VALUE; |
101 |
break; |
break; |
102 |
} |
} |
103 |
} |
} |
|
|
|
104 |
private void btnCalcDumpSize_Click(object sender, EventArgs e) |
private void btnCalcDumpSize_Click(object sender, EventArgs e) |
105 |
{ |
{ |
106 |
ulong start = txtStart.Value; |
ulong start = txtStart.Value; |
122 |
break; |
break; |
123 |
} |
} |
124 |
} |
} |
|
|
|
125 |
private void btnDumpRam_Click(object sender, EventArgs e) |
private void btnDumpRam_Click(object sender, EventArgs e) |
126 |
{ |
{ |
127 |
if (this.AcceptedProcess == null) |
if (this.AcceptedProcess == null) |
133 |
if (result != DialogResult.OK) return; |
if (result != DialogResult.OK) return; |
134 |
DumpRam(txtStart.Value, txtEnd.Value, dumpsaver.FileName); |
DumpRam(txtStart.Value, txtEnd.Value, dumpsaver.FileName); |
135 |
} |
} |
136 |
|
#endregion |
137 |
|
|
138 |
#region memory support |
#region memory support |
139 |
private void DumpRam(ulong start, ulong end, string filename) |
private void DumpRam(ulong start, ulong end, string filename) |