move pcfx to nymacore

This commit is contained in:
nattthebear 2020-06-09 08:15:06 -04:00
parent 11e1019590
commit 9bb56f0b5c
10 changed files with 134 additions and 643 deletions

Binary file not shown.

View File

@ -334,12 +334,10 @@ namespace BizHawk.Client.Common
);
break;
case "PCFX":
nextEmulator = new Tst(
nextComm,
new[] { disc },
(Tst.Settings) GetCoreSettings<Tst>(),
(Tst.SyncSettings) GetCoreSyncSettings<Tst>()
);
nextEmulator = new Tst(nextComm, game, new[] { disc },
(NymaCore.NymaSettings)GetCoreSettings<Tst>(),
(NymaCore.NymaSyncSettings)GetCoreSyncSettings<Tst>(),
Deterministic);
break;
case "PCE": // TODO: this is clearly not used, its set to PCE by code above
case "PCECD":
@ -833,12 +831,10 @@ namespace BizHawk.Client.Common
case "PCFX":
var pcfxDiscs = DiscsFromXml(xmlGame, "PCFX", DiscType.PCFX);
if (pcfxDiscs.Count == 0) return false;
nextEmulator = new Tst(
nextComm,
pcfxDiscs,
(Tst.Settings) GetCoreSettings<Tst>(),
(Tst.SyncSettings) GetCoreSyncSettings<Tst>()
);
nextEmulator = new Tst(nextComm, game, pcfxDiscs,
(NymaCore.NymaSettings)GetCoreSettings<Tst>(),
(NymaCore.NymaSyncSettings)GetCoreSyncSettings<Tst>(),
Deterministic);
return true;
case "GEN":
var genDiscs = DiscsFromXml(xmlGame, "GEN", DiscType.MegaCD);

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Drawing;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.NEC.PCFX;
@ -11,34 +12,35 @@ namespace BizHawk.Client.EmuHawk
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
var ss = ((Tst)core).GetSyncSettings();
throw new NotImplementedException();
// var ss = ((Tst)core).GetSyncSettings();
var schemas = new List<PadSchema>();
if (ss.Port1 != ControllerType.None || ss.Port2 != ControllerType.None)
{
switch (ss.Port1)
{
case ControllerType.Gamepad:
schemas.Add(StandardController(1));
break;
case ControllerType.Mouse:
schemas.Add(Mouse(1));
break;
}
// var schemas = new List<PadSchema>();
// if (ss.Port1 != ControllerType.None || ss.Port2 != ControllerType.None)
// {
// switch (ss.Port1)
// {
// case ControllerType.Gamepad:
// schemas.Add(StandardController(1));
// break;
// case ControllerType.Mouse:
// schemas.Add(Mouse(1));
// break;
// }
int controllerNum = ss.Port1 != ControllerType.None ? 2 : 1;
switch (ss.Port2)
{
case ControllerType.Gamepad:
schemas.Add(StandardController(controllerNum));
break;
case ControllerType.Mouse:
schemas.Add(Mouse(controllerNum));
break;
}
}
// int controllerNum = ss.Port1 != ControllerType.None ? 2 : 1;
// switch (ss.Port2)
// {
// case ControllerType.Gamepad:
// schemas.Add(StandardController(controllerNum));
// break;
// case ControllerType.Mouse:
// schemas.Add(Mouse(controllerNum));
// break;
// }
// }
return schemas;
// return schemas;
}
private static PadSchema StandardController(int controller)

View File

@ -1,64 +0,0 @@
using BizHawk.BizInvoke;
using BizHawk.Emulation.Cores.Consoles.Sega.Saturn;
using BizHawk.Emulation.Cores.Waterbox;
using System;
using System.Runtime.InteropServices;
namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX
{
public abstract class LibTst : LibWaterboxCore
{
[StructLayout(LayoutKind.Sequential)]
public new class FrameInfo : LibWaterboxCore.FrameInfo
{
public uint Port1Buttons;
public uint Port2Buttons;
public uint ConsoleButtons;
}
[Flags]
public enum Layers : int
{
None = 0,
BG0 = 1,
BG1 = 2,
BG2 = 4,
BG3 = 8,
VDCA_BG = 16,
VDCA_SPR = 32,
VDCB_BG = 64,
VDCB_SPR = 128,
RAINBOW = 256
}
[StructLayout(LayoutKind.Sequential)]
public class FrontendSettings
{
public int AdpcmEmulateBuggyCodec;
public int AdpcmSuppressChannelResetClicks;
public int HiResEmulation;
public int DisableSpriteLimit;
public int ChromaInterpolation;
public int ScanlineStart;
public int ScanlineEnd;
public int CdSpeed;
public int CpuEmulation;
public int Port1;
public int Port2;
public int PixelPro;
}
[BizImport(CC)]
public abstract void SetCDCallbacks(LibSaturnus.CDTOCCallback toccallback,
LibSaturnus.CDSectorCallback sectorcallback);
[BizImport(CC)]
public abstract bool Init(int numDisks, byte[] bios);
[BizImport(CC)]
public abstract void EnableLayers(Layers mask);
[BizImport(CC)]
public abstract void PutSettingsBeforeInit(FrontendSettings s);
}
}

View File

@ -15,378 +15,43 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX
{
[Core("T. S. T.", "Mednafen Team", true, true, "0.9.44.1",
"https://mednafen.github.io/releases/", false)]
public class Tst : WaterboxCore, IDriveLight,
ISettable<Tst.Settings, Tst.SyncSettings>
public class Tst : NymaCore
{
private static readonly DiscSectorReaderPolicy _diskPolicy = new DiscSectorReaderPolicy
{
DeinterleavedSubcode = false
};
private LibTst _core;
private Disc[] _disks;
private DiscSectorReader[] _diskReaders;
private LibSaturnus.CDTOCCallback _cdTocCallback;
private LibSaturnus.CDSectorCallback _cdSectorCallback;
private TstControllerDeck _controllerDeck;
[CoreConstructor("PCFX")]
public Tst(CoreComm comm, byte[] rom)
: base(comm, new Configuration())
public Tst(CoreComm comm, NymaSettings settings, NymaSyncSettings syncSettings)
: base(comm, "PCFX", "PCFX Controller Deck", settings, syncSettings)
{
throw new InvalidOperationException("To load a PC-FX game, please load the CUE file and not the BIN file.");
}
public Tst(CoreComm comm, IEnumerable<Disc> disks, Settings settings, SyncSettings syncSettings)
: base(comm, new Configuration
{
DefaultFpsNumerator = 7159091,
DefaultFpsDenominator = 455 * 263,
DefaultWidth = 256,
DefaultHeight = 232,
MaxWidth = 1024,
MaxHeight = 480,
MaxSamples = 2048,
SystemId = "PCFX"
})
public Tst(CoreComm comm, GameInfo game,
IEnumerable<Disc> disks, NymaSettings settings, NymaSyncSettings syncSettings, bool deterministic)
: base(comm, "PCFX", "PCFX Controller Deck", settings, syncSettings)
{
var bios = comm.CoreFileProvider.GetFirmware("PCFX", "BIOS", true);
if (bios.Length != 1024 * 1024)
throw new InvalidOperationException("Wrong size BIOS file!");
_disks = disks.ToArray();
_diskReaders = disks.Select(d => new DiscSectorReader(d) { Policy = _diskPolicy }).ToArray();
_cdTocCallback = CDTOCCallback;
_cdSectorCallback = CDSectorCallback;
_settings = settings ?? new Settings();
_syncSettings = syncSettings ?? new SyncSettings();
BufferHeight = _settings.ScanlineEnd - _settings.ScanlineStart + 1;
_core = PreInit<LibTst>(new WaterboxOptions
var firmwares = new Dictionary<string, byte[]>
{
Filename = "pcfx.wbx",
SbrkHeapSizeKB = 512,
SealedHeapSizeKB = 2 * 1024,
InvisibleHeapSizeKB = 4,
PlainHeapSizeKB = 4 * 1024,
MmapHeapSizeKB = 6 * 1024,
SkipCoreConsistencyCheck = comm.CorePreferences.HasFlag(CoreComm.CorePreferencesFlags.WaterboxCoreConsistencyCheck),
SkipMemoryConsistencyCheck = comm.CorePreferences.HasFlag(CoreComm.CorePreferencesFlags.WaterboxMemoryConsistencyCheck),
});
SetCdCallbacks();
SetNativeSettingsBeforeInit();
if (!_core.Init(_disks.Length, bios))
throw new InvalidOperationException("Core rejected the CDs!");
ClearCdCallbacks();
PostInit();
SetCdCallbacks();
_controllerDeck = new TstControllerDeck(new[] { _syncSettings.Port1, _syncSettings.Port2 });
ControllerDefinition = _controllerDeck.Definition;
SetLayerSettings();
}
public override int VirtualWidth => VirtualHeight > 240 ? 586 : 293;
protected override void LoadStateBinaryInternal(BinaryReader reader)
{
SetCdCallbacks();
}
protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController controller, bool render, bool rendersound)
{
DriveLightOn = false;
var ret = new LibTst.FrameInfo();
var controls = _controllerDeck.GetData(controller);
ret.Port1Buttons = controls[0];
ret.Port2Buttons = controls[1];
ret.ConsoleButtons = controls[2];
return ret;
}
private void CDTOCCallback(int disk, [In, Out]LibSaturnus.TOC t)
{
Saturnus.SetupTOC(t, _disks[disk].TOC);
}
private void CDSectorCallback(int disk, int lba, IntPtr dest)
{
var buff = new byte[2448];
_diskReaders[disk].ReadLBA_2448(lba, buff, 0);
Marshal.Copy(buff, 0, dest, 2448);
DriveLightOn = true;
}
private void SetCdCallbacks()
{
_core.SetCDCallbacks(_cdTocCallback, _cdSectorCallback);
}
private void ClearCdCallbacks()
{
_core.SetCDCallbacks(null, null);
}
public bool DriveLightEnabled => true;
public bool DriveLightOn { get; private set; }
public class Settings
{
[Description("Emulate a buggy ADPCM codec that makes some games sound better")]
[DefaultValue(false)]
public bool AdpcmEmulateBuggyCodec { get; set; }
[Description("Suppress clicks on ADPCM channel resets")]
[DefaultValue(true)]
public bool AdpcmSuppressChannelResetClicks { get; set; }
public enum DotClockWidths
{
Fastest = 256,
Fast = 341,
Good = 1024
}
[Description("Quality for high-width resolution output")]
[DefaultValue(DotClockWidths.Good)]
public DotClockWidths HiResEmulation { get; set; }
[Description("Disable the hardware limit of 16 sprites per scanline")]
[DefaultValue(false)]
public bool DisableSpriteLimit { get; set; }
[Description("Increase quality of some YUV output. Can cause graphical glitches")]
[DefaultValue(false)]
public bool ChromaInterpolation { get; set; }
[Description("First scanline to render")]
[DefaultValue(4)]
[Range(0, 8)]
public int ScanlineStart { get; set; }
[Description("Last scanline to render")]
[DefaultValue(235)]
[Range(231, 239)]
public int ScanlineEnd { get; set; }
[Description("Show layer BG0")]
[DefaultValue(true)]
public bool ShowLayerBG0
{
get => _showLayerBG0;
set => _showLayerBG0 = value;
}
[DeepEqualsIgnore]
private bool _showLayerBG0;
[Description("Show layer BG1")]
[DefaultValue(true)]
public bool ShowLayerBG1
{
get => _showLayerBG1;
set => _showLayerBG1 = value;
}
[DeepEqualsIgnore]
private bool _showLayerBG1;
[Description("Show layer BG2")]
[DefaultValue(true)]
public bool ShowLayerBG2
{
get => _showLayerBG2;
set => _showLayerBG2 = value;
}
[DeepEqualsIgnore]
private bool _showLayerBG2;
[Description("Show layer BG3")]
[DefaultValue(true)]
public bool ShowLayerBG3
{
get => _showLayerBG3;
set => _showLayerBG3 = value;
}
[DeepEqualsIgnore]
private bool _showLayerBG3;
[Description("Show layer VDC-A BG")]
[DefaultValue(true)]
public bool ShowLayerVDCABG
{
get => _showLayerVDCABG;
set => _showLayerVDCABG = value;
}
[DeepEqualsIgnore]
private bool _showLayerVDCABG;
[Description("Show layer VDC-A SPR")]
[DefaultValue(true)]
public bool ShowLayerVDCASPR
{
get => _showLayerVDCASPR;
set => _showLayerVDCASPR = value;
}
[DeepEqualsIgnore]
private bool _showLayerVDCASPR;
[Description("Show layer VDC-B BG")]
[DefaultValue(true)]
public bool ShowLayerVDCBBG
{
get => _showLayerVDCBBG;
set => _showLayerVDCBBG = value;
}
[DeepEqualsIgnore]
private bool _showLayerVDCBBG;
[Description("Show layer VDC-B SPR")]
[DefaultValue(true)]
public bool ShowLayerVDCBSPR
{
get => _showLayerVDCBSPR;
set => _showLayerVDCBSPR = value;
}
[DeepEqualsIgnore]
private bool _showLayerVDCBSPR;
[Description("Show layer RAINBOW")]
[DefaultValue(true)]
public bool ShowLayerRAINBOW
{
get => _showLayerRAINBOW;
set => _showLayerRAINBOW = value;
}
[DeepEqualsIgnore]
private bool _showLayerRAINBOW;
[Description("Pixel Pro. Overrides HiResEmulation if set")]
[DefaultValue(false)]
public bool PixelPro { get; set; }
public Settings Clone()
{
return (Settings)MemberwiseClone();
}
public static bool NeedsReboot(Settings x, Settings y)
{
return !DeepEquality.DeepEquals(x, y);
}
public Settings()
{
SettingsUtil.SetDefaultValues(this);
}
}
public class SyncSettings
{
[Description("Speed of the CD-ROM drive. Can decrease load times")]
[DefaultValue(2)]
[Range(2, 10)]
public int CdSpeed { get; set; }
public enum CpuType
{
Fast,
Accurate,
Auto
}
[Description("CPU emulation accuracy. Auto chooses per game from a database")]
[DefaultValue(CpuType.Auto)]
public CpuType CpuEmulation { get; set; }
[Description("Input device for the left port")]
[DefaultValue(ControllerType.Gamepad)]
public ControllerType Port1 { get; set; }
[Description("Input device for the right port")]
[DefaultValue(ControllerType.Gamepad)]
public ControllerType Port2 { get; set; }
public SyncSettings Clone()
{
return (SyncSettings)MemberwiseClone();
}
public static bool NeedsReboot(SyncSettings x, SyncSettings y)
{
return !DeepEquality.DeepEquals(x, y);
}
public SyncSettings()
{
SettingsUtil.SetDefaultValues(this);
}
}
private Settings _settings;
private SyncSettings _syncSettings;
public Settings GetSettings()
{
return _settings.Clone();
}
public SyncSettings GetSyncSettings()
{
return _syncSettings.Clone();
}
public PutSettingsDirtyBits PutSettings(Settings o)
{
var ret = Settings.NeedsReboot(_settings, o);
_settings = o;
SetLayerSettings();
return ret ? PutSettingsDirtyBits.RebootCore : PutSettingsDirtyBits.None;
}
public PutSettingsDirtyBits PutSyncSettings(SyncSettings o)
{
var ret = SyncSettings.NeedsReboot(_syncSettings, o);
_syncSettings = o;
return ret ? PutSettingsDirtyBits.RebootCore : PutSettingsDirtyBits.None;
}
private void SetNativeSettingsBeforeInit()
{
var s = new LibTst.FrontendSettings
{
AdpcmEmulateBuggyCodec = _settings.AdpcmEmulateBuggyCodec ? 1 : 0,
AdpcmSuppressChannelResetClicks = _settings.AdpcmSuppressChannelResetClicks ? 1 : 0,
HiResEmulation = (int)_settings.HiResEmulation,
DisableSpriteLimit = _settings.DisableSpriteLimit ? 1 : 0,
ChromaInterpolation = _settings.ChromaInterpolation ? 1 : 0,
ScanlineStart = _settings.ScanlineStart,
ScanlineEnd = _settings.ScanlineEnd,
CdSpeed = _syncSettings.CdSpeed,
CpuEmulation = (int)_syncSettings.CpuEmulation,
Port1 = (int)_syncSettings.Port1,
Port2 = (int)_syncSettings.Port2,
PixelPro = _settings.PixelPro ? 1 : 0
{ "FIRMWARE:pcfx.rom", bios },
};
_core.PutSettingsBeforeInit(s);
DoInit<LibNymaCore>(game, null, disks.ToArray(), "pcfx.wbx", null, deterministic, firmwares);
}
private void SetLayerSettings()
protected override IDictionary<string, string> SettingsOverrides { get; } = new Dictionary<string, string>
{
var l = LibTst.Layers.None;
if (_settings.ShowLayerBG0)
l |= LibTst.Layers.BG0;
if (_settings.ShowLayerBG1)
l |= LibTst.Layers.BG1;
if (_settings.ShowLayerBG2)
l |= LibTst.Layers.BG2;
if (_settings.ShowLayerBG3)
l |= LibTst.Layers.BG3;
if (_settings.ShowLayerVDCABG)
l |= LibTst.Layers.VDCA_BG;
if (_settings.ShowLayerVDCASPR)
l |= LibTst.Layers.VDCA_SPR;
if (_settings.ShowLayerVDCBBG)
l |= LibTst.Layers.VDCB_BG;
if (_settings.ShowLayerVDCBSPR)
l |= LibTst.Layers.VDCB_SPR;
if (_settings.ShowLayerRAINBOW)
l |= LibTst.Layers.RAINBOW;
_core.EnableLayers(l);
}
{ "pcfx.input.port1.multitap", null },
{ "pcfx.input.port2.multitap", null },
{ "pcfx.bios", null },
{ "pcfx.fxscsi", null },
{ "nyma.rtcinitialtime", null },
{ "nyma.rtcrealtime", null },
};
protected override ISet<string> NonSyncSettingNames { get; } = new HashSet<string>
{
"pcfx.slstart", "pcfx.slend",
};
}
}

View File

@ -1,163 +0,0 @@
using BizHawk.Emulation.Common;
using System.Collections.Generic;
using System.Linq;
namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX
{
public enum ControllerType
{
None = 0,
Gamepad = 1,
Mouse
}
public class TstControllerDeck
{
private readonly ControlDefUnMerger[] _cdums;
private readonly IPortDevice[] _devices;
private static readonly string[] _consoleButtons =
{
"Power",
"Reset",
"Previous Disk",
"Next Disk"
};
public TstControllerDeck(IEnumerable<ControllerType> ports)
{
_devices = ports.Select<ControllerType, IPortDevice>(p =>
{
switch (p)
{
case ControllerType.Gamepad:
return new Gamepad();
case ControllerType.Mouse:
return new Mouse();
default:
return new None();
}
}).ToArray();
Definition = ControllerDefinitionMerger.GetMerged(
_devices.Select(d => d.Definition),
out var tmp);
_cdums = tmp.ToArray();
Definition.Name = "PC-FX Controller";
Definition.BoolButtons.AddRange(_consoleButtons);
}
public uint[] GetData(IController c)
{
var ret = new uint[_devices.Length + 1];
for (int i = 0; i < _devices.Length; i++)
ret[i] = _devices[i].GetData(_cdums[i].UnMerge(c));
uint console = 0;
uint val = 1;
foreach (var s in _consoleButtons)
{
if (c.IsPressed(s))
console |= val;
val <<= 1;
}
ret[_devices.Length] = console;
return ret;
}
public ControllerDefinition Definition { get; }
private interface IPortDevice
{
ControllerDefinition Definition { get; }
uint GetData(IController c);
}
private class None : IPortDevice
{
private static readonly ControllerDefinition _definition = new ControllerDefinition();
public ControllerDefinition Definition => _definition;
public uint GetData(IController c)
{
return 0;
}
}
private class Gamepad : IPortDevice
{
private static readonly ControllerDefinition _definition;
static Gamepad()
{
_definition = new ControllerDefinition
{
BoolButtons = Buttons
.Where(s => s != null)
.Select((s, i) => new { s, i })
.OrderBy(a => ButtonOrders[a.i])
.Select(a => a.s)
.ToList()
};
}
private static readonly string[] Buttons =
{
"0I", "0II", "0III", "0IV", "0V", "0VI",
"0Select", "0Run",
"0Up", "0Right", "0Down", "0Left",
"0Mode 1", null, "0Mode 2"
};
private static readonly int[] ButtonOrders =
{
5, 6, 7, 8, 9, 10,
11, 12,
1, 2, 3, 4,
13, 14
};
public ControllerDefinition Definition => _definition;
public uint GetData(IController c)
{
uint ret = 0;
uint val = 1;
foreach (var s in Buttons)
{
if (s != null && c.IsPressed(s))
ret |= val;
val <<= 1;
}
return ret;
}
}
private class Mouse : IPortDevice
{
private static readonly ControllerDefinition _definition = new ControllerDefinition
{
BoolButtons = { "0Mouse Left", "0Mouse Right" },
AxisControls = { "0X", "0Y" },
AxisRanges = ControllerDefinition.CreateAxisRangePair(-127, 0, 127, ControllerDefinition.AxisPairOrientation.RightAndUp) //TODO verify direction against hardware
};
public ControllerDefinition Definition => _definition;
public uint GetData(IController c)
{
var dx = (byte)(int)c.AxisValue("0X");
var dy = (byte)(int)c.AxisValue("0Y");
uint ret = 0;
if (c.IsPressed("0Mouse Left"))
ret |= 0x10000;
if (c.IsPressed("0Mouse Right"))
ret |= 0x20000;
ret |= dx;
ret |= (uint)(dy << 8);
return ret;
}
}
}
}

View File

@ -83,21 +83,20 @@ namespace BizHawk.Emulation.Cores.Waterbox
foreach (var input in inputs)
{
var inputInfo = input;
var bitSize = (int)inputInfo.BitSize;
var bitOffset = (int)inputInfo.BitOffset;
if (input.Type == InputType.Padding)
continue;
var bitSize = (int)input.BitSize;
var bitOffset = (int)input.BitOffset;
var byteStart = devByteStart + bitOffset / 8;
bitOffset %= 8;
var baseName = inputInfo.Name;
var baseName = input.Name;
if (overrides.ContainsKey(baseName))
baseName = overrides[baseName];
var name = $"P{port + 1} {baseName}";
switch (inputInfo.Type)
switch (input.Type)
{
case InputType.Padding:
{
break;
}
case InputType.Button:
case InputType.ButtonCanRapid:
{
@ -114,7 +113,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
}
case InputType.Switch:
{
var data = inputInfo.Extra.AsSwitch();
var data = input.Extra.AsSwitch();
if (data.Positions.Count > 8)
throw new NotImplementedException("Need code changes to support Mdfn switch with more than 8 positions");
@ -160,7 +159,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
ret.AxisControls.Add(name);
ret.CategoryLabels[name] = category;
ret.AxisRanges.Add(new ControllerDefinition.AxisRange(
0, 0x8000, 0xffff, (inputInfo.Flags & AxisFlags.InvertCo) != 0
0, 0x8000, 0xffff, (input.Flags & AxisFlags.InvertCo) != 0
));
_thunks.Add((c, b) =>
{
@ -176,7 +175,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
ret.AxisControls.Add(name);
ret.CategoryLabels[name] = category;
ret.AxisRanges.Add(new ControllerDefinition.AxisRange(
-0x8000, 0, 0x7fff, (inputInfo.Flags & AxisFlags.InvertCo) != 0
-0x8000, 0, 0x7fff, (input.Flags & AxisFlags.InvertCo) != 0
));
_thunks.Add((c, b) =>
{
@ -205,7 +204,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
// TODO: wire up statuses to something (not controller, of course)
default:
{
throw new NotImplementedException($"Unimplemented button type {inputInfo.Type}");
throw new NotImplementedException($"Unimplemented button type {input.Type}");
}
}
}

@ -1 +1 @@
Subproject commit 10cc0a77301a11b740f6210626b00418bd83e1ee
Subproject commit 2e0a2568a07934e135c3323d784e8c6161cc2f01

59
waterbox/nyma/pcfx.cpp Normal file
View File

@ -0,0 +1,59 @@
#include "mednafen/src/types.h"
#include <src/pcfx/pcfx.h>
#include "nyma.h"
#include <emulibc.h>
#include <waterboxcore.h>
using namespace MDFN_IEN_PCFX;
extern Mednafen::MDFNGI EmulatedPCFX;
void SetupMDFNGameInfo()
{
Mednafen::MDFNGameInfo = &EmulatedPCFX;
}
namespace MDFN_IEN_PCFX
{
extern uint8 BackupRAM[0x8000];
extern uint8 ExBackupRAM[0x8000];
extern uint8 *BIOSROM; // 1MB
extern uint8 *RAM; // 2MB
extern uint8 *FXSCSIROM; // 512KiB
}
ECL_EXPORT void GetMemoryAreas(MemoryArea *m)
{
m[0].Data = BackupRAM;
m[0].Name = "Backup RAM";
m[0].Size = sizeof(BackupRAM);
m[0].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4 | MEMORYAREA_FLAGS_SAVERAMMABLE;
m[1].Data = ExBackupRAM;
m[1].Name = "Extra Backup RAM";
m[1].Size = sizeof(ExBackupRAM);
m[1].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4 | MEMORYAREA_FLAGS_SAVERAMMABLE;
m[2].Data = BIOSROM;
m[2].Name = "BIOS ROM";
m[2].Size = 1024 * 1024;
m[2].Flags = MEMORYAREA_FLAGS_WORDSIZE4;
m[3].Data = RAM;
m[3].Name = "Main RAM";
m[3].Size = 2 * 1024 * 1024;
m[3].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4 | MEMORYAREA_FLAGS_PRIMARY;
m[4].Data = FXSCSIROM;
m[4].Name = "Scsi Rom";
m[4].Size = 512 * 1024;
m[4].Flags = MEMORYAREA_FLAGS_WORDSIZE4;
for (int i = 0; i < 2; i++)
{
m[i + 5].Data = fx_vdc_chips[i]->VRAM;
m[i + 5].Name = i == 0 ? "VDC A VRAM" : "VDC B VRAM";
m[i + 5].Size = fx_vdc_chips[i]->VRAM_Size;
m[i + 5].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE2;
}
}

View File

@ -1,14 +1,11 @@
include common.mak
# $(filter-out %CDAFReader_SF.cpp,$(call cppdir,cdrom))
# $(call cdir,tremor)
# $(call cdir,mpcdec)
# mednafen/src/mthreading/MThreading_POSIX.cpp
SRCS += \
$(filter-out %debug.cpp,$(call cppdir,pcfx)) \
$(call cppdir,hw_cpu/v810) \
$(call cppdir,hw_video/huc6270) \
$(call cppdir,hw_sound/pce_psg)
$(call cppdir,hw_sound/pce_psg) \
$(CD_SRCS) \
pcfx.cpp
include ../common.mak