genesis: fix settings snafu. make mouse work; seems to be minimally functional in nobunga's ambition

This commit is contained in:
goyuken 2014-06-27 02:22:23 +00:00
parent 179a5c3bb4
commit 3ab7610da3
4 changed files with 22 additions and 15 deletions

View File

@ -220,7 +220,7 @@ namespace BizHawk.Client.Common
{
case "GEN":
var genesis = new GPGX(
nextComm, null, disc, "GEN", GetCoreSettings<GPGX>());
nextComm, null, disc, "GEN", GetCoreSyncSettings<GPGX>());
nextEmulator = genesis;
break;
case "SAT":

View File

@ -47,7 +47,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
Xea1p,
Activator,
Teamplayer,
Wayplay
Wayplay,
Mouse
};
public GPGX(CoreComm NextComm, byte[] romfile, DiscSystem.Disc CD, string romextension, object SyncSettings)
@ -64,7 +65,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
try
{
this.SyncSettings = (GPGXSyncSettings)SyncSettings ?? GPGXSyncSettings.GetDefaults();
this._SyncSettings = (GPGXSyncSettings)SyncSettings ?? GPGXSyncSettings.GetDefaults();
CoreComm = NextComm;
if (AttachedCore != null)
@ -82,7 +83,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
LibGPGX.INPUT_SYSTEM system_a = LibGPGX.INPUT_SYSTEM.SYSTEM_NONE;
LibGPGX.INPUT_SYSTEM system_b = LibGPGX.INPUT_SYSTEM.SYSTEM_NONE;
switch (this.SyncSettings.ControlType)
switch (this._SyncSettings.ControlType)
{
case ControlType.None:
default:
@ -109,10 +110,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
system_a = LibGPGX.INPUT_SYSTEM.SYSTEM_WAYPLAY;
system_b = LibGPGX.INPUT_SYSTEM.SYSTEM_WAYPLAY;
break;
case ControlType.Mouse:
system_a = LibGPGX.INPUT_SYSTEM.SYSTEM_MD_GAMEPAD;
system_b = LibGPGX.INPUT_SYSTEM.SYSTEM_MOUSE;
break;
}
if (!LibGPGX.gpgx_init(romextension, LoadCallback, this.SyncSettings.UseSixButton, system_a, system_b, this.SyncSettings.Region))
if (!LibGPGX.gpgx_init(romextension, LoadCallback, this._SyncSettings.UseSixButton, system_a, system_b, this._SyncSettings.Region))
throw new Exception("gpgx_init() failed");
{
@ -728,17 +733,17 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
#region Settings
GPGXSyncSettings SyncSettings;
GPGXSyncSettings _SyncSettings;
public object GetSettings() { return null; }
public object GetSyncSettings() { return SyncSettings.Clone(); }
public object GetSyncSettings() { return _SyncSettings.Clone(); }
public bool PutSettings(object o) { return false; }
public bool PutSyncSettings(object o)
{
bool ret;
var n = (GPGXSyncSettings)o;
ret = GPGXSyncSettings.NeedsReboot(SyncSettings, n);
SyncSettings = n;
ret = GPGXSyncSettings.NeedsReboot(_SyncSettings, n);
_SyncSettings = n;
return ret;
}

View File

@ -53,12 +53,13 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
static CName[] Mouse =
{
new CName("Left", LibGPGX.INPUT_KEYS.INPUT_MOUSE_LEFT),
new CName("Center", LibGPGX.INPUT_KEYS.INPUT_MOUSE_CENTER),
new CName("Right", LibGPGX.INPUT_KEYS.INPUT_MOUSE_RIGHT),
new CName("Left Button", LibGPGX.INPUT_KEYS.INPUT_MOUSE_LEFT),
new CName("Center Button", LibGPGX.INPUT_KEYS.INPUT_MOUSE_CENTER),
new CName("Right Button", LibGPGX.INPUT_KEYS.INPUT_MOUSE_RIGHT),
new CName("Start Button", LibGPGX.INPUT_KEYS.INPUT_MOUSE_START),
};
static ControllerDefinition.FloatRange FullShort = new ControllerDefinition.FloatRange(-32767, 0, 32767);
static ControllerDefinition.FloatRange MouseRange = new ControllerDefinition.FloatRange(-512, 0, 511);
LibGPGX.InputData target = null;
IController source = null;
@ -88,8 +89,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
string NY = string.Format("P{0} Y", player);
ControllerDef.FloatControls.Add(NX);
ControllerDef.FloatControls.Add(NY);
ControllerDef.FloatRanges.Add(FullShort);
ControllerDef.FloatRanges.Add(FullShort);
ControllerDef.FloatRanges.Add(MouseRange);
ControllerDef.FloatRanges.Add(MouseRange);
Converts.Add(delegate()
{
target.analog[(2 * idx) + 0] = (short)source.GetFloat(NX);

View File

@ -146,6 +146,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
INPUT_BUTTON1 = 0x0010,
/* Mega Mouse specific bitmask */
INPUT_MOUSE_START = 0x0080,
INPUT_MOUSE_CENTER = 0x0040,
INPUT_MOUSE_RIGHT = 0x0020,
INPUT_MOUSE_LEFT = 0x0010,