saturnus: use waterboxcore

This commit is contained in:
nattthebear 2017-06-17 15:30:03 -04:00
parent c04beea4d0
commit 5a8fad73b9
16 changed files with 4554 additions and 4796 deletions

View File

@ -1,4 +1,5 @@
using BizHawk.Common.BizInvoke;
using BizHawk.Emulation.Cores.Waterbox;
using System;
using System.Collections.Generic;
using System.Linq;
@ -8,14 +9,12 @@ using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
{
public abstract class LibSaturnus
public abstract class LibSaturnus : LibWaterboxCore
{
// some of the internal code uses wizardry by which certain pointers in ss.wbx[.text]
// must be greater than or equal to this address, but less than 4GB bigger than it
public const ulong StartAddress = 0x36d00000000;
const CallingConvention CC = CallingConvention.Cdecl;
[StructLayout(LayoutKind.Sequential)]
public class TOC
{
@ -36,30 +35,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
public Track[] Tracks;
}
[StructLayout(LayoutKind.Explicit)]
public class FrameAdvanceInfo
[StructLayout(LayoutKind.Sequential)]
public new class FrameInfo : LibWaterboxCore.FrameInfo
{
[FieldOffset(0)]
public IntPtr SoundBuf;
[FieldOffset(8)]
public IntPtr Pixels;
[FieldOffset(16)]
public IntPtr Controllers;
[FieldOffset(24)]
public long MasterCycles;
[FieldOffset(32)]
public int SoundBufMaxSize;
[FieldOffset(36)]
public int SoundBufSize;
[FieldOffset(40)]
public int Width;
[FieldOffset(44)]
public int Height;
[FieldOffset(48)]
public short ResetPushed;
[FieldOffset(50)]
public short InputLagged;
};
public int ResetPushed;
}
[UnmanagedFunctionPointer(CC)]
public delegate int FirmwareSizeCallback(string filename);
@ -69,10 +49,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
public delegate void CDTOCCallback(int disk, [In, Out]TOC toc);
[UnmanagedFunctionPointer(CC)]
public delegate void CDSectorCallback(int disk, int lba, IntPtr dest);
[UnmanagedFunctionPointer(CC)]
public delegate void InputCallback();
[UnmanagedFunctionPointer(CC)]
public delegate void AddMemoryDomainCallback(string name, IntPtr ptr, int size, bool writable);
[BizImport(CC)]
public abstract void SetFirmwareCallbacks(FirmwareSizeCallback sizecallback, FirmwareDataCallback datacallback);
@ -89,14 +65,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
[BizImport(CC)]
public abstract void SetDisk(int disk, bool open);
[BizImport(CC)]
public abstract void FrameAdvance([In, Out]FrameAdvanceInfo f);
public abstract void SetControllerData(byte[] controllerData);
[BizImport(CC)]
public abstract void SetupInput(int[] portdevices, int[] multitaps);
[BizImport(CC)]
public abstract void SetInputCallback(InputCallback callback);
[BizImport(CC)]
public abstract void SetAddMemoryDomainCallback(AddMemoryDomainCallback callback);
[BizImport(CC)]
public abstract void SetRtc(long ticks, Saturnus.SyncSettings.LanguageType language);
[BizImport(CC)]
public abstract void SetVideoParameters(bool correctAspect, bool hBlend, bool hOverscan, int sls, int sle);

View File

@ -19,8 +19,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
{
[CoreAttributes("Saturnus", "Ryphecha", true, false, "0.9.44.1",
"https://mednafen.github.io/releases/", false)]
public class Saturnus : IEmulator, IVideoProvider, ISoundProvider,
IInputPollable, IDriveLight, IStatable, IRegionable, ISaveRam,
public class Saturnus : WaterboxCore,
IDriveLight, IRegionable,
ISettable<Saturnus.Settings, Saturnus.SyncSettings>
{
private static readonly DiscSectorReaderPolicy _diskPolicy = new DiscSectorReaderPolicy
@ -28,7 +28,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
DeinterleavedSubcode = false
};
private PeRunner _exe;
private LibSaturnus _core;
private Disc[] _disks;
private DiscSectorReader[] _diskReaders;
@ -64,9 +63,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
public Saturnus(CoreComm comm, IEnumerable<Disc> disks, bool deterministic, Settings settings,
SyncSettings syncSettings)
:base(comm, new Configuration
{
MaxSamples = 8192,
DefaultWidth = 320,
DefaultHeight = 240,
MaxWidth = 1024,
MaxHeight = 1024,
SystemId = "SAT"
})
{
ServiceProvider = new BasicServiceProvider(this);
CoreComm = comm;
settings = settings ?? new Settings();
syncSettings = syncSettings ?? new SyncSettings();
@ -76,9 +82,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
throw new InvalidOperationException("Some disks are not valid");
InitCallbacks();
_exe = new PeRunner(new PeRunnerOptions
_core = PreInit<LibSaturnus>(new PeRunnerOptions
{
Path = comm.CoreFileProvider.DllPath(),
Filename = "ss.wbx",
SbrkHeapSizeKB = 128,
SealedHeapSizeKB = 4096, // 512KB of bios, 2MB of kof95/ultraman carts
@ -87,11 +92,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
PlainHeapSizeKB = 24 * 1024, // up to 16MB of cart ram
StartAddress = LibSaturnus.StartAddress
});
_core = BizInvoker.GetInvoker<LibSaturnus>(_exe, _exe);
SetFirmwareCallbacks();
SetCdCallbacks();
_core.SetAddMemoryDomainCallback(_addMemoryDomainCallback);
if (!_core.Init(_disks.Length, syncSettings.ExpansionCart, syncSettings.Region, syncSettings.RegionAutodetect))
throw new InvalidOperationException("Core rejected the disks!");
ClearAllCallbacks();
@ -125,20 +129,15 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
_core.SetRtc((long)syncSettings.InitialTime.Subtract(new DateTime(1970, 1, 1)).TotalSeconds,
syncSettings.Language);
_exe.Seal();
PostInit();
SetCdCallbacks();
_core.SetDisk(0, false);
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(
new MemoryDomainList(_memoryDomains.Values.Cast<MemoryDomain>().ToList())
{
MainMemory = _memoryDomains["Work Ram Low"]
});
PutSettings(settings);
_syncSettings = syncSettings;
DeterministicEmulation = deterministic || !_syncSettings.UseRealTime;
}
public unsafe void FrameAdvance(IController controller, bool render, bool rendersound = true)
protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController controller, bool render, bool rendersound)
{
var prevDiskSignal = controller.IsPressed("Previous Disk");
var nextDiskSignal = controller.IsPressed("Next Disk");
@ -169,61 +168,13 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
DriveLightOn = false;
if (controller.IsPressed("Power"))
_core.HardReset();
SetInputCallback();
fixed (short* _sp = _soundBuffer)
fixed (int* _vp = _videoBuffer)
fixed (byte* _cp = _controllerDeck.Poll(controller))
{
var info = new LibSaturnus.FrameAdvanceInfo
{
SoundBuf = (IntPtr)_sp,
SoundBufMaxSize = _soundBuffer.Length / 2,
Pixels = (IntPtr)_vp,
Controllers = (IntPtr)_cp,
ResetPushed = (short)(controller.IsPressed("Reset") ? 1 : 0)
};
_core.SetControllerData(_controllerDeck.Poll(controller));
_core.FrameAdvance(info);
Frame++;
IsLagFrame = info.InputLagged != 0;
if (IsLagFrame)
LagCount++;
_numSamples = info.SoundBufSize;
BufferWidth = info.Width;
BufferHeight = info.Height;
}
}
private bool _disposed = false;
public void Dispose()
{
if (!_disposed)
{
_exe.Dispose();
_exe = null;
_core = null;
_disposed = true;
}
}
public int Frame { get; private set; }
public int LagCount { get; set; }
public bool IsLagFrame { get; set; }
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
public void ResetCounters()
{
Frame = 0;
return new LibSaturnus.FrameInfo { ResetPushed = controller.IsPressed("Reset") ? 1 : 0 };
}
public DisplayType Region => _isPal ? DisplayType.PAL : DisplayType.NTSC;
public IEmulatorServiceProvider ServiceProvider { get; private set; }
public string SystemId { get { return "SAT"; } }
public bool DeterministicEmulation { get; private set; }
public CoreComm CoreComm { get; }
public ControllerDefinition ControllerDefinition { get; }
#region ISettable
@ -469,72 +420,22 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
#endregion
#region IMemoryDomains
private readonly Dictionary<string, MemoryDomainIntPtrMonitor> _memoryDomains = new Dictionary<string, MemoryDomainIntPtrMonitor>();
private void AddMemoryDomain(string name, IntPtr ptr, int size, bool writable)
{
_memoryDomains.Add(name, new MemoryDomainIntPtrMonitor(name, MemoryDomain.Endian.Big, ptr, size, writable, 2, _exe));
}
#endregion
#region IStatable
public bool BinarySaveStatesPreferred => true;
public void SaveStateText(TextWriter writer)
protected override void SaveStateBinaryInternal(BinaryWriter writer)
{
var temp = SaveStateBinary();
temp.SaveAsHexFast(writer);
// write extra copy of stuff we don't use
writer.WriteLine("Frame {0}", Frame);
}
public void LoadStateText(TextReader reader)
{
string hex = reader.ReadLine();
byte[] state = new byte[hex.Length / 2];
state.ReadFromHexFast(hex);
LoadStateBinary(new BinaryReader(new MemoryStream(state)));
}
public void LoadStateBinary(BinaryReader reader)
{
_exe.LoadStateBinary(reader);
// other variables
Frame = reader.ReadInt32();
LagCount = reader.ReadInt32();
IsLagFrame = reader.ReadBoolean();
_activeDisk = reader.ReadInt32();
_prevDiskSignal = reader.ReadBoolean();
_nextDiskSignal = reader.ReadBoolean();
// any managed pointers that we sent to the core need to be resent now!
SetCdCallbacks();
_core.SetInputCallback(null);
}
public void SaveStateBinary(BinaryWriter writer)
{
_exe.SaveStateBinary(writer);
// other variables
writer.Write(Frame);
writer.Write(LagCount);
writer.Write(IsLagFrame);
writer.Write(_activeDisk);
writer.Write(_prevDiskSignal);
writer.Write(_nextDiskSignal);
}
public byte[] SaveStateBinary()
protected override void LoadStateBinaryInternal(BinaryReader reader)
{
var ms = new MemoryStream();
var bw = new BinaryWriter(ms);
SaveStateBinary(bw);
bw.Flush();
ms.Close();
return ms.ToArray();
_activeDisk = reader.ReadInt32();
_prevDiskSignal = reader.ReadBoolean();
_nextDiskSignal = reader.ReadBoolean();
// any managed pointers that we sent to the core need to be resent now!
SetCdCallbacks();
}
#endregion
@ -545,8 +446,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
private LibSaturnus.FirmwareDataCallback _firmwareDataCallback;
private LibSaturnus.CDTOCCallback _cdTocCallback;
private LibSaturnus.CDSectorCallback _cdSectorCallback;
private LibSaturnus.InputCallback _inputCallback;
private LibSaturnus.AddMemoryDomainCallback _addMemoryDomainCallback;
private void InitCallbacks()
{
@ -554,8 +453,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
_firmwareDataCallback = FirmwareData;
_cdTocCallback = CDTOCCallback;
_cdSectorCallback = CDSectorCallback;
_inputCallback = InputCallbacks.Call;
_addMemoryDomainCallback = AddMemoryDomain;
}
private void SetFirmwareCallbacks()
@ -566,16 +463,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
{
_core.SetCDCallbacks(_cdTocCallback, _cdSectorCallback);
}
private void SetInputCallback()
{
_core.SetInputCallback(InputCallbacks.Count > 0 ? _inputCallback : null);
}
private void ClearAllCallbacks()
{
_core.SetFirmwareCallbacks(null, null);
_core.SetCDCallbacks(null, null);
_core.SetInputCallback(null);
_core.SetAddMemoryDomainCallback(null);
}
private string TranslateFirmwareName(string filename)
@ -641,111 +533,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
#endregion
#region IVideoProvider
private int[] _videoBuffer = new int[1024 * 1024];
public int[] GetVideoBuffer()
{
return _videoBuffer;
}
private const int PalFpsNum = 1734687500;
private const int PalFpsDen = 61 * 455 * 1251;
private const int NtscFpsNum = 1746818182; // 1746818181.8
private const int NtscFpsDen = 61 * 455 * 1051;
public int VirtualWidth => BufferWidth; // TODO
public int VirtualHeight => BufferHeight; // TODO
public int BufferWidth { get; private set; } = 320;
public int BufferHeight { get; private set; } = 240;
public int VsyncNumerator => _isPal ? PalFpsNum : NtscFpsNum;
public int VsyncDenominator => _isPal ? PalFpsDen : NtscFpsDen;
public int BackgroundColor => unchecked((int)0xff000000);
#endregion
#region ISoundProvider
private short[] _soundBuffer = new short[16384];
private int _numSamples;
public void SetSyncMode(SyncSoundMode mode)
{
if (mode == SyncSoundMode.Async)
{
throw new NotSupportedException("Async mode is not supported.");
}
}
public void GetSamplesSync(out short[] samples, out int nsamp)
{
samples = _soundBuffer;
nsamp = _numSamples;
}
public void GetSamplesAsync(short[] samples)
{
throw new InvalidOperationException("Async mode is not supported.");
}
public void DiscardSamples()
{
}
public bool CanProvideAsync => false;
public SyncSoundMode SyncMode => SyncSoundMode.Sync;
#endregion
#region ISaveRam
private static readonly string[] SaveRamDomains = new[] { "Backup Ram", "Backup Cart" };
private int SaveRamSize()
{
return ActiveSaveRamDomains()
.Select(m => (int)m.Size)
.Sum();
}
private IEnumerable<MemoryDomainIntPtrMonitor> ActiveSaveRamDomains()
{
return SaveRamDomains.Where(_memoryDomains.ContainsKey)
.Select(s => _memoryDomains[s]);
}
public byte[] CloneSaveRam()
{
var ret = new byte[SaveRamSize()];
var offs = 0;
using (_exe.EnterExit())
{
foreach (var m in ActiveSaveRamDomains())
{
Marshal.Copy(m.Data, ret, offs, (int)m.Size);
offs += (int)m.Size;
}
}
return ret;
}
public void StoreSaveRam(byte[] data)
{
if (data.Length != SaveRamSize())
throw new InvalidOperationException("Saveram was the wrong size!");
var offs = 0;
using (_exe.EnterExit())
{
foreach (var m in ActiveSaveRamDomains())
{
Marshal.Copy(data, offs, m.Data, (int)m.Size);
offs += (int)m.Size;
}
}
}
public bool SaveRamModified => true;
#endregion
public override int VsyncNumerator => _isPal ? PalFpsNum : NtscFpsNum;
public override int VsyncDenominator => _isPal ? PalFpsDen : NtscFpsDen;
}
}

View File

@ -89,7 +89,11 @@ namespace BizHawk.Emulation.Cores.Waterbox
/// <summary>
/// native wordsize. only a hint
/// </summary>
WordSize8 = 256
WordSize8 = 256,
/// <summary>
/// for a yuge endian domain, if true, bytes are stored word-swapped from their native ordering
/// </summary>
Swapped = 512,
}
[StructLayout(LayoutKind.Sequential)]
@ -171,7 +175,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
else
throw new InvalidOperationException("Unknown word size for memory domain");
_monitor = monitor;
if (EndianType == Endian.Big)
if ((m.Flags & MemoryDomainFlags.Swapped) != 0 && EndianType == Endian.Big)
{
_addressMangler = WordSize - 1;
}

View File

@ -210,7 +210,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
public string SystemId { get; }
public bool DeterministicEmulation { get; protected set; } = true;
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
public abstract ControllerDefinition ControllerDefinition { get; }
public virtual ControllerDefinition ControllerDefinition { get; protected set; } = NullController.Instance.Definition;
#endregion

Binary file not shown.

View File

@ -33,6 +33,7 @@ typedef struct
#define MEMORYAREA_FLAGS_WORDSIZE2 64
#define MEMORYAREA_FLAGS_WORDSIZE4 128
#define MEMORYAREA_FLAGS_WORDSIZE8 256
#define MEMORYAREA_FLAGS_SWAPPED 512
#ifdef __cplusplus
}

View File

@ -131,41 +131,20 @@ namespace MDFN_IEN_SS
extern void Emulate(EmulateSpecStruct *espec_arg);
}
struct FrameAdvanceInfo
{
int16 *SoundBuf;
uint32 *Pixels;
uint8 *Controllers;
int64 MasterCycles;
int32 SoundBufMaxSize;
int32 SoundBufSize;
int32 Width;
int32 Height;
int16 ResetPushed;
int16 InputLagged;
// Set by the system emulation code every frame, to denote the horizontal and vertical offsets of the image, and the size
// of the image. If the emulated system sets the elements of LineWidths, then the width(w) of this structure
// is ignored while drawing the image.
// int32 x, y, h;
// Set(optionally) by emulation code. If InterlaceOn is true, then assume field height is 1/2 DisplayRect.h, and
// only every other line in surface (with the start line defined by InterlacedField) has valid data
// (it's up to internal Mednafen code to deinterlace it).
// bool InterlaceOn;
// bool InterlaceField;
};
static uint8 ControllerInput[12 * 32];
bool InputLagged;
EXPORT void FrameAdvance(FrameAdvanceInfo &f)
EXPORT void SetControllerData(const uint8_t* controllerData)
{
memcpy(ControllerInput, controllerData, sizeof(ControllerInput));
}
struct MyFrameInfo: public FrameInfo
{
int32_t ResetPushed;
};
EXPORT void FrameAdvance(MyFrameInfo& f)
{
EmulateSpecStruct e;
int32 LineWidths[1024];
@ -173,22 +152,21 @@ EXPORT void FrameAdvance(FrameAdvanceInfo &f)
e.pixels = FrameBuffer;
e.pitch32 = 1024;
e.LineWidths = LineWidths;
e.SoundBuf = f.SoundBuf;
e.SoundBufMaxSize = f.SoundBufMaxSize;
memcpy(ControllerInput, f.Controllers, sizeof(ControllerInput));
e.SoundBuf = f.SoundBuffer;
e.SoundBufMaxSize = 8192;
IsResetPushed = f.ResetPushed;
InputLagged = true;
Emulate(&e);
f.SoundBufSize = e.SoundBufSize;
f.MasterCycles = e.MasterCycles;
f.InputLagged = InputLagged;
f.Samples = e.SoundBufSize;
f.Cycles = e.MasterCycles;
f.Lagged = InputLagged;
int w = 256;
for (int i = 0; i < e.h; i++)
w = std::max(w, LineWidths[i]);
const uint32 *src = FrameBuffer;
uint32 *dst = f.Pixels;
uint32 *dst = f.VideoBuffer;
const int srcp = 1024;
const int dstp = w;
src += e.y * srcp + e.x;
@ -226,11 +204,21 @@ EXPORT void SetInputCallback(void (*callback)())
InputCallback = callback;
}
void (*AddMemoryDomain)(const char *name, const void *ptr, int size, bool writable);
static std::vector<MemoryArea> MemoryAreas;
EXPORT void SetAddMemoryDomainCallback(void (*callback)(const char *name, const void *ptr, int size, bool writable))
void AddMemoryDomain(const char *name, const void *ptr, int size, int flags)
{
AddMemoryDomain = callback;
MemoryArea m;
m.Data = (void*)ptr;
m.Name = name;
m.Size = size;
m.Flags = flags;
MemoryAreas.push_back(m);
}
EXPORT void GetMemoryAreas(MemoryArea* m)
{
memcpy(m, MemoryAreas.data(), MemoryAreas.size() * sizeof(MemoryArea));
}
EXPORT void SetRtc(int64 ticks, int language)

View File

@ -86,6 +86,6 @@ void CART_Backup_Init(CartInfo *c)
c->GetClearNVDirty = GetClearNVDirty;
c->GetNVInfo = GetNVInfo;
AddMemoryDomain("Backup Cart", ExtBackupRAM, 524288, true);
AddMemoryDomain("Backup Cart", ExtBackupRAM, 524288, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_SAVERAMMABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
}
}

View File

@ -55,6 +55,6 @@ void CART_CS1RAM_Init(CartInfo *c)
CS1RAM_RW_DB<uint16, true>);
c->Reset = Reset;
AddMemoryDomain("CS1 Cart", CS1RAM, 0x1000000, true);
AddMemoryDomain("CS1 Cart", CS1RAM, 0x1000000, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
}
}

View File

@ -79,6 +79,6 @@ void CART_ExtRAM_Init(CartInfo *c, bool R4MiB)
c->CS01_SetRW8W16(/*0x04FFFFFE*/ 0x04F00000, 0x04FFFFFF, CartID_Read_DB);
c->Reset = Reset;
AddMemoryDomain("Ram Cart", ExtRAM, 0x400000, true);
AddMemoryDomain("Ram Cart", ExtRAM, 0x400000, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
}
}

View File

@ -48,6 +48,6 @@ void CART_ROM_Init(CartInfo *c, const char *filename)
SS_SetPhysMemMap(0x02000000, 0x03FFFFFF, ROM, 0x200000, false);
c->CS01_SetRW8W16(0x02000000, 0x03FFFFFF, ROM_Read);
AddMemoryDomain("Rom Cart", ROM, 0x200000, false);
AddMemoryDomain("Rom Cart", ROM, 0x200000, MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
}
}

View File

@ -300,7 +300,8 @@ inline char *strdup(const char *p)
#include "stream/MemoryStream.h"
#include "math_ops.h"
#include <emulibc.h>
#include "../emulibc/emulibc.h"
#include "../emulibc/waterboxcore.h"
extern int32 (*FirmwareSizeCallback)(const char *filename);
extern void (*FirmwareDataCallback)(const char *filename, uint8 *dest);
@ -319,4 +320,4 @@ extern bool setting_ss_region_autodetect;
extern bool InputLagged;
extern void (*InputCallback)();
extern void (*AddMemoryDomain)(const char* name, const void* ptr, int size, bool writable);
void AddMemoryDomain(const char* name, const void* ptr, int size, int flags);

View File

@ -112,7 +112,7 @@ void SOUND_Init(void)
SS_SetPhysMemMap(0x05A00000, 0x05A7FFFF, SCSP.GetRAMPtr(), 0x80000, true);
// TODO: MEM4B: SS_SetPhysMemMap(0x05A00000, 0x05AFFFFF, SCSP.GetRAMPtr(), 0x40000, true);
AddMemoryDomain("Sound Ram", SCSP.GetRAMPtr(), 0x100000, true);
AddMemoryDomain("Sound Ram", SCSP.GetRAMPtr(), 0x100000, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
}
uint8 SOUND_PeekRAM(uint32 A)

View File

@ -935,17 +935,17 @@ static bool MDFN_COLD InitCommon(const unsigned cart_type, const unsigned smpc_a
memset(BackupRAM, 0x00, sizeof(BackupRAM));
for (unsigned i = 0; i < 0x40; i++)
BackupRAM[i] = BRAM_Init_Data[i & 0x0F];
AddMemoryDomain("Backup Ram", BackupRAM, sizeof(BackupRAM), true);
AddMemoryDomain("Backup Ram", BackupRAM, sizeof(BackupRAM), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_SAVERAMMABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
// Call InitFastMemMap() before functions like SOUND_Init()
InitFastMemMap();
BIOSROM = (uint16*)alloc_sealed(524288);
AddMemoryDomain("Boot Rom", BIOSROM, 524288, false);
AddMemoryDomain("Boot Rom", BIOSROM, 524288, MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
SS_SetPhysMemMap(0x00000000, 0x000FFFFF, BIOSROM, 524288);
SS_SetPhysMemMap(0x00200000, 0x003FFFFF, WorkRAML, sizeof(WorkRAML), true);
SS_SetPhysMemMap(0x06000000, 0x07FFFFFF, WorkRAMH, sizeof(WorkRAMH), true);
AddMemoryDomain("Work Ram Low", WorkRAML, sizeof(WorkRAML), true);
AddMemoryDomain("Work Ram High", WorkRAMH, sizeof(WorkRAMH), true);
AddMemoryDomain("Work Ram Low", WorkRAML, sizeof(WorkRAML), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
AddMemoryDomain("Work Ram High", WorkRAMH, sizeof(WorkRAMH), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2 | MEMORYAREA_FLAGS_PRIMARY);
CART_Init(cart_type);
//

View File

@ -118,8 +118,8 @@ void Init(void)
//
//
SS_SetPhysMemMap(0x05C00000, 0x05C7FFFF, VRAM, sizeof(VRAM), true);
AddMemoryDomain("VDP1 Ram", VRAM, sizeof(VRAM), true);
AddMemoryDomain("VDP1 Framebuffer", FB, sizeof(FB), true);
AddMemoryDomain("VDP1 Ram", VRAM, sizeof(VRAM), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
AddMemoryDomain("VDP1 Framebuffer", FB, sizeof(FB), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
//SS_SetPhysMemMap(0x05C80000, 0x05CFFFFF, FB[FBDrawWhich], sizeof(FB[0]), true);
vb_status = false;

View File

@ -789,8 +789,8 @@ void Init(const bool IsPAL)
lastts = 0;
SS_SetPhysMemMap(0x05E00000, 0x05EFFFFF, VRAM, 0x80000, true);
AddMemoryDomain("VDP2 Ram", VRAM, sizeof(VRAM), true);
AddMemoryDomain("VDP2 CRam", CRAM, sizeof(CRAM), true);
AddMemoryDomain("VDP2 Ram", VRAM, sizeof(VRAM), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
AddMemoryDomain("VDP2 CRam", CRAM, sizeof(CRAM), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
VDP2REND_Init(IsPAL);
}