lynx: memory domains. R/W: RAM, Save Ram. R: Cart A, Cart B.
This commit is contained in:
parent
829ee72914
commit
fa8934b1d4
|
@ -31,6 +31,10 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
|||
[DllImport(dllname, CallingConvention = cc)]
|
||||
public static extern bool GetSaveRamPtr(IntPtr s, out int size, out IntPtr data);
|
||||
|
||||
[DllImport(dllname, CallingConvention = cc)]
|
||||
public static extern void GetReadOnlyCartPtrs(IntPtr s, out int s0, out IntPtr p0, out int s1, out IntPtr p1);
|
||||
|
||||
|
||||
[DllImport(dllname, CallingConvention = cc)]
|
||||
public static extern int BinStateSize(IntPtr s);
|
||||
[DllImport(dllname, CallingConvention = cc)]
|
||||
|
@ -42,6 +46,8 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
|||
[DllImport(dllname, CallingConvention = cc)]
|
||||
public static extern void TxtStateLoad(IntPtr s, [In]ref TextStateFPtrs ff);
|
||||
|
||||
[DllImport(dllname, CallingConvention = cc)]
|
||||
public static extern IntPtr GetRamPointer(IntPtr s);
|
||||
|
||||
[Flags]
|
||||
public enum Buttons : ushort
|
||||
|
|
|
@ -12,7 +12,7 @@ using Newtonsoft.Json;
|
|||
namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||
{
|
||||
[CoreAttributes("Handy", "K. Wilkins", true, false, "mednafen 0-9-34-1", "http://mednafen.sourceforge.net/")]
|
||||
public class Lynx : IEmulator, IVideoProvider, ISyncSoundProvider
|
||||
public class Lynx : IEmulator, IVideoProvider, ISyncSoundProvider, IMemoryDomains
|
||||
{
|
||||
IntPtr Core;
|
||||
|
||||
|
@ -112,6 +112,7 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
|||
BufferWidth = WIDTH;
|
||||
BufferHeight = HEIGHT;
|
||||
}
|
||||
SetupMemoryDomains();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -161,10 +162,6 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
|||
}
|
||||
}
|
||||
|
||||
#region debugging
|
||||
|
||||
#endregion
|
||||
|
||||
#region Controller
|
||||
|
||||
private static readonly ControllerDefinition LynxTroller = new ControllerDefinition
|
||||
|
@ -366,5 +363,33 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MemoryDomains
|
||||
|
||||
private void SetupMemoryDomains()
|
||||
{
|
||||
var mms = new List<MemoryDomain>();
|
||||
mms.Add(MemoryDomain.FromIntPtr("RAM", 65536, MemoryDomain.Endian.Little, LibLynx.GetRamPointer(Core), true));
|
||||
|
||||
IntPtr p;
|
||||
int s;
|
||||
if (LibLynx.GetSaveRamPtr(Core, out s, out p))
|
||||
mms.Add(MemoryDomain.FromIntPtr("Save RAM", s, MemoryDomain.Endian.Little, p, true));
|
||||
|
||||
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));
|
||||
if (s1 > 0 && p1 != IntPtr.Zero)
|
||||
mms.Add(MemoryDomain.FromIntPtr("Cart B", s1, MemoryDomain.Endian.Little, p1, false));
|
||||
|
||||
MemoryDomains = new MemoryDomainList(mms, 0);
|
||||
}
|
||||
|
||||
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -331,6 +331,14 @@ bool CCart::GetSaveRamPtr(int &size, uint8 *&data)
|
|||
}
|
||||
}
|
||||
|
||||
void CCart::GetReadOnlyPtrs(int &s0, uint8 *&p0, int &s1, uint8 *&p1)
|
||||
{
|
||||
s0 = mMaskBank0 + 1;
|
||||
s1 = mMaskBank1 + 1;
|
||||
p0 = mCartBank0;
|
||||
p1 = mCartBank1;
|
||||
}
|
||||
|
||||
SYNCFUNC(CCart)
|
||||
{
|
||||
NSS(mWriteEnableBank0);
|
||||
|
|
|
@ -108,6 +108,7 @@ public:
|
|||
// when the original cart did not have it
|
||||
|
||||
bool GetSaveRamPtr(int &size, uint8 *&data);
|
||||
void GetReadOnlyPtrs(int &s0, uint8 *&p0, int &s1, uint8 *&p1);
|
||||
|
||||
template<bool isReader>void SyncState(NewState *ns);
|
||||
|
||||
|
|
|
@ -47,6 +47,10 @@ EXPORT int GetSaveRamPtr(CSystem *s, int *size, uint8 **data)
|
|||
return s->GetSaveRamPtr(*size, *data);
|
||||
}
|
||||
|
||||
EXPORT void GetReadOnlyCartPtrs(CSystem *s, int *s0, uint8 **p0, int *s1, uint8 **p1)
|
||||
{
|
||||
s->GetReadOnlyCartPtrs(*s0, *p0, *s1, *p1);
|
||||
}
|
||||
|
||||
EXPORT int BinStateSize(CSystem *s)
|
||||
{
|
||||
|
@ -81,3 +85,8 @@ EXPORT void TxtStateLoad(CSystem *s, FPtrs *ff)
|
|||
s->SyncState<true>(&loader);
|
||||
}
|
||||
|
||||
EXPORT void *GetRamPointer(CSystem *s)
|
||||
{
|
||||
return s->GetRamPointer();
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ public:
|
|||
|
||||
bool Advance(int buttons, uint32 *vbuff, int16 *sbuff, int &sbuffsize);
|
||||
bool GetSaveRamPtr(int &size, uint8 *&data) { return mCart->GetSaveRamPtr(size, data); }
|
||||
void GetReadOnlyCartPtrs(int &s0, uint8 *&p0, int &s1, uint8 *&p1) { mCart->GetReadOnlyPtrs(s0, p0, s1, p1); }
|
||||
|
||||
//
|
||||
// We MUST have separate CPU & RAM peek & poke handlers as all CPU accesses must
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue