remove the obsolete MemoryDomain.FromIntPtr method
This commit is contained in:
parent
5a408f9321
commit
54ebe75d2b
|
@ -35,17 +35,6 @@ namespace BizHawk.Emulation.Common
|
|||
return new MemoryDomainByteArray(name, endian, data, writable, wordSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create a memorydomain that references an unmanaged memory block
|
||||
/// </summary>
|
||||
/// <param name="data">must remain valid as long as the MemoryDomain exists!</param>
|
||||
/// <param name="writable">if false, writes will be ignored</param>
|
||||
[Obsolete]
|
||||
public static unsafe MemoryDomain FromIntPtr(string name, long size, Endian endian, IntPtr data, bool writable = true, int wordSize = 1)
|
||||
{
|
||||
return new MemoryDomainIntPtr(name, endian, data, size, writable, wordSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create a memorydomain that references an unmanaged memory block with 16 bit swaps
|
||||
/// </summary>
|
||||
|
|
|
@ -9,23 +9,30 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
|||
{
|
||||
private void SetupMemoryDomains()
|
||||
{
|
||||
var mms = new List<MemoryDomain>();
|
||||
mms.Add(MemoryDomain.FromIntPtr("RAM", 65536, MemoryDomain.Endian.Little, LibLynx.GetRamPointer(Core), true, 2));
|
||||
var mms = new List<MemoryDomain>
|
||||
{
|
||||
new MemoryDomainIntPtr("RAM", MemoryDomain.Endian.Little, LibLynx.GetRamPointer(Core), 65536, true, 2)
|
||||
};
|
||||
|
||||
IntPtr p;
|
||||
int s;
|
||||
if (LibLynx.GetSaveRamPtr(Core, out s, out p))
|
||||
{
|
||||
mms.Add(MemoryDomain.FromIntPtr("Save RAM", s, MemoryDomain.Endian.Little, p, true, 2));
|
||||
mms.Add(new MemoryDomainIntPtr("Save RAM", MemoryDomain.Endian.Little, p, s, true, 2));
|
||||
}
|
||||
|
||||
IntPtr p0, p1;
|
||||
int s0, s1;
|
||||
LibLynx.GetReadOnlyCartPtrs(Core, out s0, out p0, out s1, out p1);
|
||||
if (s0 > 0 && p0 != IntPtr.Zero)
|
||||
mms.Add(MemoryDomain.FromIntPtr("Cart A", s0, MemoryDomain.Endian.Little, p0, false, 2));
|
||||
{
|
||||
mms.Add(new MemoryDomainIntPtr("Cart A", MemoryDomain.Endian.Little, p0, s0, false, 2));
|
||||
}
|
||||
|
||||
if (s1 > 0 && p1 != IntPtr.Zero)
|
||||
mms.Add(MemoryDomain.FromIntPtr("Cart B", s1, MemoryDomain.Endian.Little, p1, false, 2));
|
||||
{
|
||||
mms.Add(new MemoryDomainIntPtr("Cart B", MemoryDomain.Endian.Little, p1, s1, false, 2));
|
||||
}
|
||||
|
||||
_memoryDomains = new MemoryDomainList(mms);
|
||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
|
@ -16,28 +15,38 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
var s = new LibVBANext.MemoryAreas();
|
||||
var l = MemoryDomain.Endian.Little;
|
||||
LibVBANext.GetMemoryAreas(Core, s);
|
||||
mm.Add(MemoryDomain.FromIntPtr("IWRAM", 32 * 1024, l, s.iwram, true, 4));
|
||||
mm.Add(MemoryDomain.FromIntPtr("EWRAM", 256 * 1024, l, s.ewram, true, 4));
|
||||
mm.Add(MemoryDomain.FromIntPtr("BIOS", 16 * 1024, l, s.bios, false, 4));
|
||||
mm.Add(MemoryDomain.FromIntPtr("PALRAM", 1024, l, s.palram, false, 4));
|
||||
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 MemoryDomainIntPtr("IWRAM", l, s.iwram, 32 * 1024, true, 4));
|
||||
mm.Add(new MemoryDomainIntPtr("EWRAM", l, s.ewram, 256 * 1024, true, 4));
|
||||
mm.Add(new MemoryDomainIntPtr("BIOS", l, s.bios, 16 * 1024, false, 4));
|
||||
mm.Add(new MemoryDomainIntPtr("PALRAM", l, s.palram, 1024, false, 4));
|
||||
mm.Add(new MemoryDomainIntPtr("VRAM", l, s.vram, 96 * 1024, true, 4));
|
||||
mm.Add(new MemoryDomainIntPtr("OAM", l, s.oam, 1024, true, 4));
|
||||
|
||||
mm.Add(new MemoryDomainIntPtr("ROM", l, s.rom, 32 * 1024 * 1024, true, 4));
|
||||
|
||||
mm.Add(new MemoryDomainIntPtr("SRAM", l, s.sram, s.sram_size, true, 4));
|
||||
|
||||
mm.Add(new MemoryDomainDelegate("System Bus", 0x10000000, l,
|
||||
delegate(long addr)
|
||||
{
|
||||
if (addr < 0 || addr >= 0x10000000)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
return LibVBANext.SystemBusRead(Core, (int)addr);
|
||||
},
|
||||
delegate(long addr, byte val)
|
||||
{
|
||||
if (addr < 0 || addr >= 0x10000000)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
LibVBANext.SystemBusWrite(Core, (int)addr, val);
|
||||
}, 4));
|
||||
|
||||
// special combined ram memory domain
|
||||
{
|
||||
var ew = mm[1];
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
|
@ -8,20 +7,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
{
|
||||
public partial class Gameboy
|
||||
{
|
||||
private List<MemoryDomain> _memoryDomains = new List<MemoryDomain>();
|
||||
private readonly List<MemoryDomain> _memoryDomains = new List<MemoryDomain>();
|
||||
internal IMemoryDomains MemoryDomains { get; set; }
|
||||
|
||||
void CreateMemoryDomain(LibGambatte.MemoryAreas which, string name)
|
||||
private void CreateMemoryDomain(LibGambatte.MemoryAreas which, string name)
|
||||
{
|
||||
IntPtr data = IntPtr.Zero;
|
||||
int length = 0;
|
||||
|
||||
if (!LibGambatte.gambatte_getmemoryarea(GambatteState, which, ref data, ref length))
|
||||
{
|
||||
throw new Exception("gambatte_getmemoryarea() failed!");
|
||||
}
|
||||
|
||||
// if length == 0, it's an empty block; (usually rambank on some carts); that's ok
|
||||
if (data != IntPtr.Zero && length > 0)
|
||||
_memoryDomains.Add(MemoryDomain.FromIntPtr(name, length, MemoryDomain.Endian.Little, data));
|
||||
{
|
||||
_memoryDomains.Add(new MemoryDomainIntPtr(name, MemoryDomain.Endian.Little, data, length, true, 1));
|
||||
}
|
||||
}
|
||||
|
||||
private void InitMemoryDomains()
|
||||
|
@ -34,18 +37,23 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
CreateMemoryDomain(LibGambatte.MemoryAreas.hram, "HRAM");
|
||||
|
||||
// also add a special memory domain for the system bus, where calls get sent directly to the core each time
|
||||
|
||||
_memoryDomains.Add(new MemoryDomainDelegate("System Bus", 65536, MemoryDomain.Endian.Little,
|
||||
delegate(long addr)
|
||||
{
|
||||
if (addr < 0 || addr >= 65536)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
return LibGambatte.gambatte_cpuread(GambatteState, (ushort)addr);
|
||||
},
|
||||
delegate(long addr, byte val)
|
||||
{
|
||||
if (addr < 0 || addr >= 65536)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
LibGambatte.gambatte_cpuwrite(GambatteState, (ushort)addr, val);
|
||||
}, 1));
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
{
|
||||
public partial class QuickNES
|
||||
{
|
||||
unsafe void InitMemoryDomains()
|
||||
private unsafe void InitMemoryDomains()
|
||||
{
|
||||
List<MemoryDomain> mm = new List<MemoryDomain>();
|
||||
for (int i = 0; ; i++)
|
||||
|
@ -23,12 +23,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
|
||||
if (data != IntPtr.Zero && size > 0 && name != IntPtr.Zero)
|
||||
{
|
||||
mm.Add(MemoryDomain.FromIntPtr(Marshal.PtrToStringAnsi(name), size, MemoryDomain.Endian.Little, data, writable));
|
||||
mm.Add(new MemoryDomainIntPtr(Marshal.PtrToStringAnsi(name), MemoryDomain.Endian.Little, data, size, writable, 1));
|
||||
}
|
||||
}
|
||||
|
||||
// add system bus
|
||||
mm.Add(new MemoryDomainDelegate
|
||||
(
|
||||
mm.Add(new MemoryDomainDelegate(
|
||||
"System Bus",
|
||||
0x10000,
|
||||
MemoryDomain.Endian.Unknown,
|
||||
|
@ -49,8 +49,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
}
|
||||
|
||||
QN.qn_poke_prgbus(Context, (int)addr, val);
|
||||
}, 1
|
||||
));
|
||||
}, 1));
|
||||
|
||||
_memoryDomains = new MemoryDomainList(mm);
|
||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Sega.Saturn
|
||||
|
@ -16,9 +13,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
var nmds = LibYabause.libyabause_getmemoryareas_ex();
|
||||
foreach (var nmd in nmds)
|
||||
{
|
||||
int l = nmd.length;
|
||||
IntPtr d = nmd.data;
|
||||
ret.Add(MemoryDomain.FromIntPtr(nmd.name, nmd.length, MemoryDomain.Endian.Little, nmd.data, true, 4));
|
||||
ret.Add(new MemoryDomainIntPtr(nmd.name, MemoryDomain.Endian.Little, nmd.data, nmd.length, true, 4));
|
||||
}
|
||||
|
||||
// main memory is in position 2
|
||||
|
|
|
@ -830,22 +830,22 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
int size;
|
||||
|
||||
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.MainRAM);
|
||||
mmd.Add(MemoryDomain.FromIntPtr("MainRAM", size, MemoryDomain.Endian.Little, ptr, true, 4));
|
||||
mmd.Add(new MemoryDomainIntPtr("MainRAM", MemoryDomain.Endian.Little, ptr, size, true, 4));
|
||||
|
||||
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.GPURAM);
|
||||
mmd.Add(MemoryDomain.FromIntPtr("GPURAM", size, MemoryDomain.Endian.Little, ptr, true, 4));
|
||||
mmd.Add(new MemoryDomainIntPtr("GPURAM", MemoryDomain.Endian.Little, ptr, size, true, 4));
|
||||
|
||||
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.SPURAM);
|
||||
mmd.Add(MemoryDomain.FromIntPtr("SPURAM", size, MemoryDomain.Endian.Little, ptr, true, 4));
|
||||
mmd.Add(new MemoryDomainIntPtr("SPURAM", MemoryDomain.Endian.Little, ptr, size, true, 4));
|
||||
|
||||
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.BiosROM);
|
||||
mmd.Add(MemoryDomain.FromIntPtr("BiosROM", size, MemoryDomain.Endian.Little, ptr, true, 4));
|
||||
mmd.Add(new MemoryDomainIntPtr("BiosROM", MemoryDomain.Endian.Little, ptr, size, true, 4));
|
||||
|
||||
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.PIOMem);
|
||||
mmd.Add(MemoryDomain.FromIntPtr("PIOMem", size, MemoryDomain.Endian.Little, ptr, true, 4));
|
||||
mmd.Add(new MemoryDomainIntPtr("PIOMem", MemoryDomain.Endian.Little, ptr, size, true, 4));
|
||||
|
||||
OctoshockDll.shock_GetMemData(psx, out ptr, out size, OctoshockDll.eMemType.DCache);
|
||||
mmd.Add(MemoryDomain.FromIntPtr("DCache", size, MemoryDomain.Endian.Little, ptr, true, 4));
|
||||
mmd.Add(new MemoryDomainIntPtr("DCache", MemoryDomain.Endian.Little, ptr, size, true, 4));
|
||||
|
||||
MemoryDomains = new MemoryDomainList(mmd);
|
||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(MemoryDomains);
|
||||
|
|
|
@ -1,31 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
|
||||
namespace BizHawk.Emulation.Cores.WonderSwan
|
||||
{
|
||||
partial class WonderSwan
|
||||
public partial class WonderSwan
|
||||
{
|
||||
void InitIMemoryDomains()
|
||||
private void InitIMemoryDomains()
|
||||
{
|
||||
var mmd = new List<MemoryDomain>();
|
||||
for (int i = 0; ; i++)
|
||||
for (int i = 0;; i++)
|
||||
{
|
||||
IntPtr name;
|
||||
int size;
|
||||
IntPtr data;
|
||||
if (!BizSwan.bizswan_getmemoryarea(Core, i, out name, out size, out data))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string sname = Marshal.PtrToStringAnsi(name);
|
||||
mmd.Add(MemoryDomain.FromIntPtr(sname, size, MemoryDomain.Endian.Little, data));
|
||||
mmd.Add(new MemoryDomainIntPtr(sname, MemoryDomain.Endian.Little, data, size, true, 1));
|
||||
}
|
||||
|
||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(new MemoryDomainList(mmd));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,5 +48,6 @@
|
|||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SNES/@EntryIndexedValue">SNES</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TI/@EntryIndexedValue">TI</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TIA/@EntryIndexedValue">TIA</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VBA/@EntryIndexedValue">VBA</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=MethodPropertyEvent/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" /></s:String></wpf:ResourceDictionary>
|
||||
|
Loading…
Reference in New Issue