TSTHawk: Settings?
This commit is contained in:
parent
5978db7036
commit
ff58de56a1
|
@ -539,7 +539,8 @@ namespace BizHawk.Client.Common
|
|||
|
||||
break;
|
||||
case "PCFX":
|
||||
nextEmulator = new Tst(nextComm, new[] { disc });
|
||||
nextEmulator = new Tst(nextComm, new[] { disc },
|
||||
(Tst.Settings)GetCoreSettings<Tst>(), (Tst.SyncSettings)GetCoreSyncSettings<Tst>());
|
||||
break;
|
||||
case "PCE":
|
||||
case "PCECD":
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1774,6 +1774,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
virtualBoyToolStripMenuItem.Visible = false;
|
||||
sNESToolStripMenuItem.Visible = false;
|
||||
neoGeoPocketToolStripMenuItem.Visible = false;
|
||||
pCFXToolStripMenuItem.Visible = false;
|
||||
|
||||
switch (system)
|
||||
{
|
||||
|
@ -1861,6 +1862,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
case "NGP":
|
||||
neoGeoPocketToolStripMenuItem.Visible = true;
|
||||
break;
|
||||
case "PCFX":
|
||||
pCFXToolStripMenuItem.Visible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4294,6 +4298,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
GenericCoreConfig.DoDialog(this, "NeoPop Settings");
|
||||
}
|
||||
|
||||
private void preferencesToolStripMenuItem3_Click(object sender, EventArgs e)
|
||||
{
|
||||
GenericCoreConfig.DoDialog(this, "PC-FX Settings");
|
||||
}
|
||||
|
||||
private bool Rewind(ref bool runFrame, long currentTimestamp, out bool returnToRecording)
|
||||
{
|
||||
var isRewinding = false;
|
||||
|
|
|
@ -35,6 +35,22 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX
|
|||
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;
|
||||
}
|
||||
|
||||
[BizImport(CC)]
|
||||
public abstract void SetCDCallbacks(LibSaturnus.CDTOCCallback toccallback,
|
||||
LibSaturnus.CDSectorCallback sectorcallback);
|
||||
|
@ -44,5 +60,8 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX
|
|||
|
||||
[BizImport(CC)]
|
||||
public abstract void EnableLayers(Layers mask);
|
||||
|
||||
[BizImport(CC)]
|
||||
public abstract void PutSettingsBeforeInit(FrontendSettings s);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,16 @@ using System.Runtime.InteropServices;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using BizHawk.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX
|
||||
{
|
||||
[CoreAttributes("T. S. T.", "Mednafen Team", true, false, "0.9.44.1",
|
||||
"https://mednafen.github.io/releases/", false)]
|
||||
public class Tst : WaterboxCore, IDriveLight
|
||||
public class Tst : WaterboxCore, IDriveLight,
|
||||
ISettable<Tst.Settings, Tst.SyncSettings>
|
||||
{
|
||||
private static readonly DiscSectorReaderPolicy _diskPolicy = new DiscSectorReaderPolicy
|
||||
{
|
||||
|
@ -35,7 +39,7 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX
|
|||
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)
|
||||
public Tst(CoreComm comm, IEnumerable<Disc> disks, Settings settings, SyncSettings syncSettings)
|
||||
: base(comm, new Configuration
|
||||
{
|
||||
DefaultFpsNumerator = 7159091,
|
||||
|
@ -56,6 +60,9 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX
|
|||
_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 PeRunnerOptions
|
||||
{
|
||||
|
@ -68,14 +75,16 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX
|
|||
});
|
||||
|
||||
SetCdCallbacks();
|
||||
SetNativeSettingsBeforeInit();
|
||||
if (!_core.Init(_disks.Length, bios))
|
||||
throw new InvalidOperationException("Core rejected the CDs!");
|
||||
ClearCdCallbacks();
|
||||
|
||||
PostInit();
|
||||
SetCdCallbacks();
|
||||
_controllerDeck = new TstControllerDeck(new[] { ControllerType.Gamepad, ControllerType.Gamepad });
|
||||
_controllerDeck = new TstControllerDeck(new[] { _syncSettings.Port1, _syncSettings.Port2 });
|
||||
ControllerDefinition = _controllerDeck.Definition;
|
||||
SetLayerSettings();
|
||||
}
|
||||
|
||||
public override int VirtualWidth => VirtualHeight > 240 ? 586 : 293;
|
||||
|
@ -119,5 +128,228 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX
|
|||
|
||||
public bool DriveLightEnabled => true;
|
||||
public bool DriveLightOn { get; private set; }
|
||||
|
||||
#region ISettable
|
||||
|
||||
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
|
||||
{
|
||||
Fast = 256,
|
||||
Good = 341,
|
||||
Pedantic = 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 { return _showLayerBG0; } set { _showLayerBG0 = value; } }
|
||||
[DeepEqualsIgnore]
|
||||
private bool _showLayerBG0;
|
||||
|
||||
[Description("Show layer BG1")]
|
||||
[DefaultValue(true)]
|
||||
public bool ShowLayerBG1 { get { return _showLayerBG1; } set { _showLayerBG1 = value; } }
|
||||
[DeepEqualsIgnore]
|
||||
private bool _showLayerBG1;
|
||||
|
||||
[Description("Show layer BG2")]
|
||||
[DefaultValue(true)]
|
||||
public bool ShowLayerBG2 { get { return _showLayerBG2; } set { _showLayerBG2 = value; } }
|
||||
[DeepEqualsIgnore]
|
||||
private bool _showLayerBG2;
|
||||
|
||||
[Description("Show layer BG3")]
|
||||
[DefaultValue(true)]
|
||||
public bool ShowLayerBG3 { get { return _showLayerBG3; } set { _showLayerBG3 = value; } }
|
||||
[DeepEqualsIgnore]
|
||||
private bool _showLayerBG3;
|
||||
|
||||
[Description("Show layer VDC-A BG")]
|
||||
[DefaultValue(true)]
|
||||
public bool ShowLayerVDCABG { get { return _showLayerVDCABG; } set { _showLayerVDCABG = value; } }
|
||||
[DeepEqualsIgnore]
|
||||
private bool _showLayerVDCABG;
|
||||
|
||||
[Description("Show layer VDC-A SPR")]
|
||||
[DefaultValue(true)]
|
||||
public bool ShowLayerVDCASPR { get { return _showLayerVDCASPR; } set { _showLayerVDCASPR = value; } }
|
||||
[DeepEqualsIgnore]
|
||||
private bool _showLayerVDCASPR;
|
||||
|
||||
[Description("Show layer VDC-B BG")]
|
||||
[DefaultValue(true)]
|
||||
public bool ShowLayerVDCBBG { get { return _showLayerVDCBBG; } set { _showLayerVDCBBG = value; } }
|
||||
[DeepEqualsIgnore]
|
||||
private bool _showLayerVDCBBG;
|
||||
|
||||
[Description("Show layer VDC-B SPR")]
|
||||
[DefaultValue(true)]
|
||||
public bool ShowLayerVDCBSPR { get { return _showLayerVDCBSPR; } set { _showLayerVDCBSPR = value; } }
|
||||
[DeepEqualsIgnore]
|
||||
private bool _showLayerVDCBSPR;
|
||||
|
||||
[Description("Show layer RAINBOW")]
|
||||
[DefaultValue(true)]
|
||||
public bool ShowLayerRAINBOW { get { return _showLayerRAINBOW; } set { _showLayerRAINBOW = value; } }
|
||||
[DeepEqualsIgnore]
|
||||
private bool _showLayerRAINBOW;
|
||||
|
||||
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 bool PutSettings(Settings o)
|
||||
{
|
||||
var ret = Settings.NeedsReboot(_settings, o);
|
||||
_settings = o;
|
||||
SetLayerSettings();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public bool PutSyncSettings(SyncSettings o)
|
||||
{
|
||||
var ret = SyncSettings.NeedsReboot(_syncSettings, o);
|
||||
_syncSettings = o;
|
||||
return ret;
|
||||
}
|
||||
|
||||
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
|
||||
};
|
||||
_core.PutSettingsBeforeInit(s);
|
||||
}
|
||||
|
||||
private void SetLayerSettings()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
"editor.detectIndentation": false,
|
||||
"files.associations": {
|
||||
"*.inc": "cpp",
|
||||
"system_error": "cpp"
|
||||
"system_error": "cpp",
|
||||
"ios": "cpp",
|
||||
"xiosbase": "cpp"
|
||||
}
|
||||
}
|
|
@ -116,3 +116,5 @@ extern bool Setting_NoSpriteLimit;
|
|||
extern bool Setting_AdpcmBuggy;
|
||||
extern bool Setting_AdpcmNoClicks;
|
||||
extern bool Setting_ChromaInterpolate;
|
||||
|
||||
extern int Setting_PortDevice[2];
|
||||
|
|
|
@ -669,7 +669,7 @@ class MyCDIF : public CDIF
|
|||
static std::vector<CDIF *> CDInterfaces;
|
||||
static uint32_t InputData[8];
|
||||
|
||||
struct MyFrameInfo: public FrameInfo
|
||||
struct MyFrameInfo : public FrameInfo
|
||||
{
|
||||
uint32_t Buttons[3]; // port 1, port 2, console
|
||||
};
|
||||
|
@ -692,7 +692,7 @@ EXPORT bool Init(int numDisks, const uint8_t *bios)
|
|||
// multitap is experimental emulation for a never release peripheral, so let's ignore it for now
|
||||
FXINPUT_SetMultitap(false, false);
|
||||
for (int i = 0; i < 2; i++)
|
||||
FXINPUT_SetInput(i, 1, &InputData[i]); // FXIT_GAMEPAD
|
||||
FXINPUT_SetInput(i, Setting_PortDevice[i], &InputData[i]); // FXIT_GAMEPAD
|
||||
|
||||
PCFX_Power();
|
||||
Ess.pixels = FrameBuffer;
|
||||
|
@ -706,14 +706,14 @@ EXPORT bool Init(int numDisks, const uint8_t *bios)
|
|||
static int ActiveDisk;
|
||||
static uint32_t PrevConsoleButtons;
|
||||
|
||||
EXPORT void FrameAdvance(MyFrameInfo& f)
|
||||
EXPORT void FrameAdvance(MyFrameInfo &f)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
InputData[i] = f.Buttons[i];
|
||||
Lagged = true;
|
||||
uint32_t ConsoleButtons = f.Buttons[2];
|
||||
int NewActiveDisk = ActiveDisk;
|
||||
#define ROSE(n) ((ConsoleButtons & 1 << (n)) > (PrevConsoleButtons & 1 << (n)))
|
||||
#define ROSE(n) ((ConsoleButtons & 1 << (n)) > (PrevConsoleButtons & 1 << (n)))
|
||||
if (ROSE(0))
|
||||
PCFX_Power();
|
||||
if (ROSE(1))
|
||||
|
@ -722,7 +722,7 @@ EXPORT void FrameAdvance(MyFrameInfo& f)
|
|||
NewActiveDisk--;
|
||||
if (ROSE(3))
|
||||
NewActiveDisk++;
|
||||
#undef ROSE
|
||||
#undef ROSE
|
||||
NewActiveDisk = std::max(NewActiveDisk, -1);
|
||||
NewActiveDisk = std::min<int>(NewActiveDisk, CDInterfaces.size() - 1);
|
||||
if (NewActiveDisk != ActiveDisk)
|
||||
|
@ -738,8 +738,8 @@ EXPORT void FrameAdvance(MyFrameInfo& f)
|
|||
f.Samples = Ess.SoundBufSize;
|
||||
f.Lagged = Lagged;
|
||||
|
||||
const uint32_t* src = FrameBuffer;
|
||||
uint32_t* dst = f.VideoBuffer;
|
||||
const uint32_t *src = FrameBuffer;
|
||||
uint32_t *dst = f.VideoBuffer;
|
||||
const int srcp = 1024;
|
||||
const int dstp = Ess.w;
|
||||
src += Ess.y * srcp + Ess.x;
|
||||
|
@ -819,6 +819,37 @@ bool Setting_AdpcmBuggy = false;
|
|||
bool Setting_AdpcmNoClicks = true;
|
||||
bool Setting_ChromaInterpolate = false;
|
||||
|
||||
int Setting_PortDevice[2];
|
||||
|
||||
struct FrontendSettings
|
||||
{
|
||||
int32_t AdpcmEmulateBuggyCodec;
|
||||
int32_t AdpcmSuppressChannelResetClicks;
|
||||
int32_t HiResEmulation;
|
||||
int32_t DisableSpriteLimit;
|
||||
int32_t ChromaInterpolation;
|
||||
int32_t ScanlineStart;
|
||||
int32_t ScanlineEnd;
|
||||
int32_t CdSpeed;
|
||||
int32_t CpuEmulation;
|
||||
int32_t Port1;
|
||||
int32_t Port2;
|
||||
};
|
||||
|
||||
EXPORT void PutSettingsBeforeInit(const FrontendSettings &s)
|
||||
{
|
||||
Setting_AdpcmBuggy = s.AdpcmEmulateBuggyCodec;
|
||||
Setting_AdpcmNoClicks = s.AdpcmSuppressChannelResetClicks;
|
||||
Setting_HighDotclockWidth = s.HiResEmulation;
|
||||
Setting_NoSpriteLimit = s.DisableSpriteLimit;
|
||||
Setting_ChromaInterpolate = s.ChromaInterpolation;
|
||||
Setting_SlStart = s.ScanlineStart;
|
||||
Setting_SlEnd = s.ScanlineEnd;
|
||||
Setting_CdSpeed = s.CdSpeed;
|
||||
Setting_CpuEmulation = s.CpuEmulation;
|
||||
Setting_PortDevice[0] = s.Port1;
|
||||
Setting_PortDevice[1] = s.Port2;
|
||||
}
|
||||
|
||||
/*MDFNGI EmulatedPCFX =
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue