gpgx: support region override

This commit is contained in:
goyuken 2014-01-15 00:56:13 +00:00
parent c3a5d766e4
commit a54119db03
4 changed files with 35 additions and 16 deletions

View File

@ -97,7 +97,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
}
if (!LibGPGX.gpgx_init(romextension, LoadCallback, this.SyncSettings.UseSixButton, system_a, system_b))
if (!LibGPGX.gpgx_init(romextension, LoadCallback, this.SyncSettings.UseSixButton, system_a, system_b, this.SyncSettings.Region))
throw new Exception("gpgx_init() failed");
{
@ -643,10 +643,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
{
bool ret;
var n = (GPGXSyncSettings)o;
if (n.UseSixButton != SyncSettings.UseSixButton || n.ControlType != SyncSettings.ControlType)
ret = true;
else
ret = false;
ret = GPGXSyncSettings.NeedsReboot(SyncSettings, n);
SyncSettings = n;
return ret;
}
@ -654,23 +651,36 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
public class GPGXSyncSettings
{
[Description("Controls the type of any attached normal controllers; six button controllers are used if true, otherwise three button controllers. Some games don't work correctly with six button controllers. Not relevant if other controller types are connected.")]
[DefaultValue(true)]
public bool UseSixButton { get; set; }
[Description("Sets the type of controls that are plugged into the console. Some games will automatically load with a different control type.")]
[DefaultValue(ControlType.Normal)]
public ControlType ControlType { get; set; }
[Description("Sets the region of the emulated console. Many games can run on multiple regions and will behave differently on different ones. Some games may require a particular region.")]
[DefaultValue(LibGPGX.Region.Autodetect)]
public LibGPGX.Region Region { get; set; }
public GPGXSyncSettings()
{
UseSixButton = true;
ControlType = ControlType.Normal;
Region = LibGPGX.Region.Autodetect;
}
public static GPGXSyncSettings GetDefaults()
{
return new GPGXSyncSettings
{
UseSixButton = true,
ControlType = ControlType.Normal
};
return new GPGXSyncSettings();
}
public GPGXSyncSettings Clone()
{
return (GPGXSyncSettings)MemberwiseClone();
}
public static bool NeedsReboot(GPGXSyncSettings x, GPGXSyncSettings y)
{
return x.UseSixButton != y.UseSixButton || x.ControlType != y.ControlType || x.Region != y.Region;
}
}
}
}

View File

@ -20,8 +20,17 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
[DllImport("libgenplusgx.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void gpgx_advance();
public enum Region : int
{
Autodetect = 0,
USA = 1,
Europe = 2,
Japan_NTSC = 3,
Japan_PAL = 4
}
[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);
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);
[DllImport("libgenplusgx.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void gpgx_get_fps(ref int num, ref int den);

View File

@ -377,7 +377,7 @@ 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)
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)
{
zap();
@ -411,14 +411,14 @@ GPGX_EX int gpgx_init(const char *feromextension, int (*feload_archive_cb)(const
config.mono = 0; /* STEREO output */
/* system options */
config.system= 0; /* AUTO */
config.region_detect = 0; /* AUTO */
config.system = 0; /* AUTO */
config.region_detect = region; // see loadrom.c
config.vdp_mode = 0; /* AUTO */
config.master_clock= 0; /* AUTO */
config.force_dtack = 0;
config.addr_error = 1;
config.bios = 0;
config.lock_on = 0;
config.bios = 0;
config.lock_on = 0;
/* video options */
config.overscan = 0;

Binary file not shown.