gpgx: some audio settings and stuff. presumably fixes issue 584
This commit is contained in:
parent
bfece077b2
commit
c623933af1
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
using BizHawk.Common;
|
using BizHawk.Common;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
|
@ -20,9 +21,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
|
|
||||||
public bool PutSettings(GPGXSettings o)
|
public bool PutSettings(GPGXSettings o)
|
||||||
{
|
{
|
||||||
|
bool ret = GPGXSettings.NeedsReboot(_settings, o);
|
||||||
_settings = o;
|
_settings = o;
|
||||||
LibGPGX.gpgx_set_draw_mask(_settings.GetDrawMask());
|
LibGPGX.gpgx_set_draw_mask(_settings.GetDrawMask());
|
||||||
return false;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PutSyncSettings(GPGXSyncSettings o)
|
public bool PutSyncSettings(GPGXSyncSettings o)
|
||||||
|
@ -37,25 +39,75 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
|
|
||||||
public class GPGXSettings
|
public class GPGXSettings
|
||||||
{
|
{
|
||||||
|
[DeepEqualsIgnore]
|
||||||
|
[JsonIgnore]
|
||||||
|
private bool _DrawBGA;
|
||||||
|
|
||||||
[DisplayName("Background Layer A")]
|
[DisplayName("Background Layer A")]
|
||||||
[Description("True to draw BG layer A")]
|
[Description("True to draw BG layer A")]
|
||||||
[DefaultValue(true)]
|
[DefaultValue(true)]
|
||||||
public bool DrawBGA { get; set; }
|
public bool DrawBGA { get { return _DrawBGA; } set { _DrawBGA = value; } }
|
||||||
|
|
||||||
|
[DeepEqualsIgnore]
|
||||||
|
[JsonIgnore]
|
||||||
|
private bool _DrawBGB;
|
||||||
|
|
||||||
[DisplayName("Background Layer B")]
|
[DisplayName("Background Layer B")]
|
||||||
[Description("True to draw BG layer B")]
|
[Description("True to draw BG layer B")]
|
||||||
[DefaultValue(true)]
|
[DefaultValue(true)]
|
||||||
public bool DrawBGB { get; set; }
|
public bool DrawBGB { get { return _DrawBGB; } set { _DrawBGB = value; } }
|
||||||
|
|
||||||
|
[DeepEqualsIgnore]
|
||||||
|
[JsonIgnore]
|
||||||
|
private bool _DrawBGW;
|
||||||
|
|
||||||
[DisplayName("Background Layer W")]
|
[DisplayName("Background Layer W")]
|
||||||
[Description("True to draw BG layer W")]
|
[Description("True to draw BG layer W")]
|
||||||
[DefaultValue(true)]
|
[DefaultValue(true)]
|
||||||
public bool DrawBGW { get; set; }
|
public bool DrawBGW { get { return _DrawBGW; } set { _DrawBGW = value; } }
|
||||||
|
|
||||||
|
[DeepEqualsIgnore]
|
||||||
|
[JsonIgnore]
|
||||||
|
private bool _PadScreen320;
|
||||||
|
|
||||||
[DisplayName("Pad screen to 320")]
|
[DisplayName("Pad screen to 320")]
|
||||||
[Description("Set to True to pads the screen out to be 320 when in 256 wide video modes")]
|
[Description("Set to True to pads the screen out to be 320 when in 256 wide video modes")]
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool PadScreen320 { get; set; }
|
public bool PadScreen320 { get { return _PadScreen320; } set { _PadScreen320 = value; } }
|
||||||
|
|
||||||
|
[DisplayName("Audio Filter")]
|
||||||
|
[DefaultValue(LibGPGX.InitSettings.FilterType.LowPass)]
|
||||||
|
public LibGPGX.InitSettings.FilterType Filter { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Low Pass Range")]
|
||||||
|
[Description("Only active when filter type is lowpass")]
|
||||||
|
[DefaultValue((short)-26215)]
|
||||||
|
public short LowPassRange { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Three band low cutoff")]
|
||||||
|
[Description("Only active when filter type is three band")]
|
||||||
|
[DefaultValue((short)880)]
|
||||||
|
public short LowFreq { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Three band high cutoff")]
|
||||||
|
[Description("Only active when filter type is three band")]
|
||||||
|
[DefaultValue((short)5000)]
|
||||||
|
public short HighFreq { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Three band low gain")]
|
||||||
|
[Description("Only active when filter type is three band")]
|
||||||
|
[DefaultValue((short)1)]
|
||||||
|
public short LowGain { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Three band mid gain")]
|
||||||
|
[Description("Only active when filter type is three band")]
|
||||||
|
[DefaultValue((short)1)]
|
||||||
|
public short MidGain { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Three band high gain")]
|
||||||
|
[Description("Only active when filter type is three band")]
|
||||||
|
[DefaultValue((short)1)]
|
||||||
|
public short HighGain { get; set; }
|
||||||
|
|
||||||
public GPGXSettings()
|
public GPGXSettings()
|
||||||
{
|
{
|
||||||
|
@ -75,6 +127,25 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
if (DrawBGW) ret |= LibGPGX.DrawMask.BGW;
|
if (DrawBGW) ret |= LibGPGX.DrawMask.BGW;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool NeedsReboot(GPGXSettings x, GPGXSettings y)
|
||||||
|
{
|
||||||
|
return !DeepEquality.DeepEquals(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibGPGX.InitSettings GetNativeSettings()
|
||||||
|
{
|
||||||
|
return new LibGPGX.InitSettings
|
||||||
|
{
|
||||||
|
Filter = Filter,
|
||||||
|
LowPassRange = LowPassRange,
|
||||||
|
LowFreq = LowFreq,
|
||||||
|
HighFreq = HighFreq,
|
||||||
|
LowGain = LowGain,
|
||||||
|
MidGain = MidGain,
|
||||||
|
HighGain = HighGain
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GPGXSyncSettings
|
public class GPGXSyncSettings
|
||||||
|
|
|
@ -65,6 +65,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_syncSettings = (GPGXSyncSettings)SyncSettings ?? new GPGXSyncSettings();
|
_syncSettings = (GPGXSyncSettings)SyncSettings ?? new GPGXSyncSettings();
|
||||||
|
_settings = (GPGXSettings)Settings ?? new GPGXSettings();
|
||||||
|
|
||||||
CoreComm = comm;
|
CoreComm = comm;
|
||||||
if (AttachedCore != null)
|
if (AttachedCore != null)
|
||||||
|
@ -118,7 +119,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!LibGPGX.gpgx_init(romextension, LoadCallback, this._syncSettings.UseSixButton, system_a, system_b, this._syncSettings.Region))
|
if (!LibGPGX.gpgx_init(romextension, LoadCallback, _syncSettings.UseSixButton, system_a, system_b, _syncSettings.Region, _settings.GetNativeSettings()))
|
||||||
throw new Exception("gpgx_init() failed");
|
throw new Exception("gpgx_init() failed");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -154,7 +155,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
if (CD != null)
|
if (CD != null)
|
||||||
DriveLightEnabled = true;
|
DriveLightEnabled = true;
|
||||||
|
|
||||||
PutSettings((GPGXSettings)Settings ?? new GPGXSettings());
|
// process the non-init settings now
|
||||||
|
PutSettings(_settings);
|
||||||
|
|
||||||
//TODO - this hits performance, we need to make it controllable
|
//TODO - this hits performance, we need to make it controllable
|
||||||
CDCallback = new LibGPGX.CDCallback(CDCallbackProc);
|
CDCallback = new LibGPGX.CDCallback(CDCallbackProc);
|
||||||
|
|
|
@ -29,8 +29,26 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
Japan_PAL = 4
|
Japan_PAL = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public class InitSettings
|
||||||
|
{
|
||||||
|
public enum FilterType : byte
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
LowPass = 1,
|
||||||
|
ThreeBand = 2
|
||||||
|
}
|
||||||
|
public FilterType Filter;
|
||||||
|
public short LowPassRange;
|
||||||
|
public short LowFreq;
|
||||||
|
public short HighFreq;
|
||||||
|
public short LowGain;
|
||||||
|
public short MidGain;
|
||||||
|
public short HighGain;
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport("libgenplusgx.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("libgenplusgx.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool gpgx_init(string feromextension, load_archive_cb feload_archive_cb, bool sixbutton, INPUT_SYSTEM system_a, INPUT_SYSTEM system_b, Region region);
|
public static extern bool gpgx_init(string feromextension, load_archive_cb feload_archive_cb, bool sixbutton, INPUT_SYSTEM system_a, INPUT_SYSTEM system_b, Region region, [In]InitSettings settings);
|
||||||
|
|
||||||
[DllImport("libgenplusgx.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("libgenplusgx.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void gpgx_get_fps(ref int num, ref int den);
|
public static extern void gpgx_get_fps(ref int num, ref int den);
|
||||||
|
|
|
@ -483,7 +483,18 @@ GPGX_EX void gpgx_get_sram(void **area, int *size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GPGX_EX int gpgx_init(const char *feromextension, int (*feload_archive_cb)(const char *filename, unsigned char *buffer, int maxsize), int sixbutton, char system_a, char system_b, int region)
|
struct InitSettings
|
||||||
|
{
|
||||||
|
uint8_t Filter;
|
||||||
|
int16_t LowPassRange;
|
||||||
|
int16_t LowFreq;
|
||||||
|
int16_t HighFreq;
|
||||||
|
int16_t LowGain;
|
||||||
|
int16_t MidGain;
|
||||||
|
int16_t HighGain;
|
||||||
|
};
|
||||||
|
|
||||||
|
GPGX_EX int gpgx_init(const char *feromextension, int (*feload_archive_cb)(const char *filename, unsigned char *buffer, int maxsize), int sixbutton, char system_a, char system_b, int region, struct InitSettings *settings)
|
||||||
{
|
{
|
||||||
zap();
|
zap();
|
||||||
|
|
||||||
|
@ -505,14 +516,14 @@ GPGX_EX int gpgx_init(const char *feromextension, int (*feload_archive_cb)(const
|
||||||
config.fm_preamp= 100;
|
config.fm_preamp= 100;
|
||||||
config.hq_fm = 1; /* high-quality resampling */
|
config.hq_fm = 1; /* high-quality resampling */
|
||||||
config.psgBoostNoise = 1;
|
config.psgBoostNoise = 1;
|
||||||
config.filter= 0; /* no filter */
|
config.filter = settings->Filter; //0; /* no filter */
|
||||||
config.lp_range = 0x9999; /* 0.6 in 16.16 fixed point */
|
config.lp_range = settings->LowPassRange; //0x9999; /* 0.6 in 16.16 fixed point */
|
||||||
config.low_freq = 880;
|
config.low_freq = settings->LowFreq; //880;
|
||||||
config.high_freq= 5000;
|
config.high_freq = settings->HighFreq; //5000;
|
||||||
config.lg = 1.0;
|
config.lg = settings->LowGain; //1.0;
|
||||||
config.mg = 1.0;
|
config.mg = settings->MidGain; //1.0;
|
||||||
config.hg = 1.0;
|
config.hg = settings->HighGain; //1.0;
|
||||||
config.dac_bits = 14; /* MAX DEPTH */
|
config.dac_bits = 14; /* MAX DEPTH */
|
||||||
config.ym2413= 2; /* AUTO */
|
config.ym2413= 2; /* AUTO */
|
||||||
config.mono = 0; /* STEREO output */
|
config.mono = 0; /* STEREO output */
|
||||||
|
|
||||||
|
@ -520,17 +531,17 @@ GPGX_EX int gpgx_init(const char *feromextension, int (*feload_archive_cb)(const
|
||||||
config.system = 0; /* AUTO */
|
config.system = 0; /* AUTO */
|
||||||
config.region_detect = region; // see loadrom.c
|
config.region_detect = region; // see loadrom.c
|
||||||
config.vdp_mode = 0; /* AUTO */
|
config.vdp_mode = 0; /* AUTO */
|
||||||
config.master_clock= 0; /* AUTO */
|
config.master_clock = 0; /* AUTO */
|
||||||
config.force_dtack = 0;
|
config.force_dtack = 0;
|
||||||
config.addr_error = 1;
|
config.addr_error = 1;
|
||||||
config.bios = 0;
|
config.bios = 0;
|
||||||
config.lock_on = 0;
|
config.lock_on = 0;
|
||||||
|
|
||||||
/* video options */
|
/* video options */
|
||||||
config.overscan = 0;
|
config.overscan = 0;
|
||||||
config.gg_extra = 0;
|
config.gg_extra = 0;
|
||||||
config.ntsc = 0;
|
config.ntsc = 0;
|
||||||
config.render= 0;
|
config.render = 0;
|
||||||
|
|
||||||
// set overall input system type
|
// set overall input system type
|
||||||
// usual is MD GAMEPAD or NONE
|
// usual is MD GAMEPAD or NONE
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue