N64 - start a system bus memory domain, doesn't yet work
This commit is contained in:
parent
7a25e05189
commit
8a36049b81
|
@ -113,6 +113,28 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
MakeMemoryDomain("Mempak 4", mupen64plusApi.N64_MEMORY.MEMPAK4, MemoryDomain.Endian.Little);
|
||||
}
|
||||
|
||||
|
||||
Func<int, byte> peekByte;
|
||||
Action<int, byte> pokeByte;
|
||||
|
||||
peekByte = delegate(int addr)
|
||||
{
|
||||
return api.m64p_read_memory_8((uint)addr);
|
||||
};
|
||||
pokeByte = delegate(int addr, byte val)
|
||||
{
|
||||
api.m64p_write_memory_8((uint)addr, val);
|
||||
};
|
||||
|
||||
_memoryDomains.Add(new MemoryDomain
|
||||
(
|
||||
name: "Sytem Bus",
|
||||
size: int.MaxValue,
|
||||
endian: MemoryDomain.Endian.Big,
|
||||
peekByte: peekByte,
|
||||
pokeByte: pokeByte
|
||||
));
|
||||
|
||||
MemoryDomains = new MemoryDomainList(_memoryDomains);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,6 +260,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
|
|||
delegate m64p_error CoreDoCommandRenderCallback(m64p_command Command, int ParamInt, RenderCallback ParamPtr);
|
||||
CoreDoCommandRenderCallback m64pCoreDoCommandRenderCallback;
|
||||
|
||||
/// <summary>
|
||||
/// Reads from the "system bus"
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate byte biz_read_memory(uint addr);
|
||||
public biz_read_memory m64p_read_memory_8;
|
||||
|
||||
/// <summary>
|
||||
/// Writes to the "system bus"
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void biz_write_memory(uint addr, byte value);
|
||||
public biz_write_memory m64p_write_memory_8;
|
||||
|
||||
// These are common for all four plugins
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -428,6 +428,12 @@ void write_memory_16(uint32 addr, uint16 value)
|
|||
write_memory_8(addr + 1, value & 0xFF); //then again, it works unaligned
|
||||
}
|
||||
|
||||
|
||||
EXPORT uint8 CALL biz_read_memory(uint32 addr)
|
||||
{
|
||||
return read_memory_8(addr);
|
||||
}
|
||||
|
||||
uint8 read_memory_8(uint32 addr)
|
||||
{
|
||||
uint32 word;
|
||||
|
@ -436,6 +442,11 @@ uint8 read_memory_8(uint32 addr)
|
|||
return (word >> ((3 - (addr & 3)) * 8)) & 0xFF;
|
||||
}
|
||||
|
||||
EXPORT void CALL biz_write_memory(uint32 addr, uint8 value)
|
||||
{
|
||||
write_memory_8(addr, value);
|
||||
}
|
||||
|
||||
void write_memory_8(uint32 addr, uint8 value)
|
||||
{
|
||||
uint32 word, mask;
|
||||
|
|
Loading…
Reference in New Issue