saturn: controls. fuck boilerplate
This commit is contained in:
parent
ba7e99ea20
commit
8b029d9eb1
|
@ -8,6 +8,44 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn
|
|||
{
|
||||
public static class LibYabause
|
||||
{
|
||||
/// <summary>
|
||||
/// A,B,C,Start,DPad
|
||||
/// </summary>
|
||||
public enum Buttons1 : byte
|
||||
{
|
||||
B = 0x01,
|
||||
C = 0x02,
|
||||
A = 0x04,
|
||||
S = 0x08,
|
||||
U = 0x10,
|
||||
D = 0x20,
|
||||
L = 0x40,
|
||||
R = 0x80
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// X,Y,Z,Shoulders
|
||||
/// </summary>
|
||||
public enum Buttons2 : byte
|
||||
{
|
||||
L = 0x08,
|
||||
Z = 0x10,
|
||||
Y = 0x20,
|
||||
X = 0x40,
|
||||
R = 0x80
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="p11">player1</param>
|
||||
/// <param name="p12">player1</param>
|
||||
/// <param name="p21">player2</param>
|
||||
/// <param name="p22">player2</param>
|
||||
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void libyabause_setpads(Buttons1 p11, Buttons2 p12, Buttons1 p21, Buttons2 p22);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// set video buffer
|
||||
/// </summary>
|
||||
|
|
|
@ -12,8 +12,10 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn
|
|||
{
|
||||
Name = "Saturn Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"Up", "Down", "Left", "Right", "Start", "Z", "Y", "X", "B", "A", "L", "R"
|
||||
{
|
||||
"Power", "Reset",
|
||||
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Start", "P1 Z", "P1 Y", "P1 X", "P1 C", "P1 B", "P1 A", "P1 L", "P1 R",
|
||||
"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Start", "P2 Z", "P2 Y", "P2 X", "P2 C", "P2 B", "P2 A", "P2 L", "P2 R",
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -78,6 +80,76 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn
|
|||
public void FrameAdvance(bool render, bool rendersound = true)
|
||||
{
|
||||
int w, h, nsamp;
|
||||
|
||||
LibYabause.Buttons1 p11 = (LibYabause.Buttons1)0xff;
|
||||
LibYabause.Buttons2 p12 = (LibYabause.Buttons2)0xff;
|
||||
LibYabause.Buttons1 p21 = (LibYabause.Buttons1)0xff;
|
||||
LibYabause.Buttons2 p22 = (LibYabause.Buttons2)0xff;
|
||||
|
||||
if (Controller["P1 A"])
|
||||
p11 &= ~LibYabause.Buttons1.A;
|
||||
if (Controller["P1 B"])
|
||||
p11 &= ~LibYabause.Buttons1.B;
|
||||
if (Controller["P1 C"])
|
||||
p11 &= ~LibYabause.Buttons1.C;
|
||||
if (Controller["P1 Start"])
|
||||
p11 &= ~LibYabause.Buttons1.S;
|
||||
if (Controller["P1 Left"])
|
||||
p11 &= ~LibYabause.Buttons1.L;
|
||||
if (Controller["P1 Right"])
|
||||
p11 &= ~LibYabause.Buttons1.R;
|
||||
if (Controller["P1 Up"])
|
||||
p11 &= ~LibYabause.Buttons1.U;
|
||||
if (Controller["P1 Down"])
|
||||
p11 &= ~LibYabause.Buttons1.D;
|
||||
if (Controller["P1 L"])
|
||||
p12 &= ~LibYabause.Buttons2.L;
|
||||
if (Controller["P1 R"])
|
||||
p12 &= ~LibYabause.Buttons2.R;
|
||||
if (Controller["P1 X"])
|
||||
p12 &= ~LibYabause.Buttons2.X;
|
||||
if (Controller["P1 Y"])
|
||||
p12 &= ~LibYabause.Buttons2.Y;
|
||||
if (Controller["P1 Z"])
|
||||
p12 &= ~LibYabause.Buttons2.Z;
|
||||
|
||||
if (Controller["P2 A"])
|
||||
p21 &= ~LibYabause.Buttons1.A;
|
||||
if (Controller["P2 B"])
|
||||
p21 &= ~LibYabause.Buttons1.B;
|
||||
if (Controller["P2 C"])
|
||||
p21 &= ~LibYabause.Buttons1.C;
|
||||
if (Controller["P2 Start"])
|
||||
p21 &= ~LibYabause.Buttons1.S;
|
||||
if (Controller["P2 Left"])
|
||||
p21 &= ~LibYabause.Buttons1.L;
|
||||
if (Controller["P2 Right"])
|
||||
p21 &= ~LibYabause.Buttons1.R;
|
||||
if (Controller["P2 Up"])
|
||||
p21 &= ~LibYabause.Buttons1.U;
|
||||
if (Controller["P2 Down"])
|
||||
p21 &= ~LibYabause.Buttons1.D;
|
||||
if (Controller["P2 L"])
|
||||
p22 &= ~LibYabause.Buttons2.L;
|
||||
if (Controller["P2 R"])
|
||||
p22 &= ~LibYabause.Buttons2.R;
|
||||
if (Controller["P2 X"])
|
||||
p22 &= ~LibYabause.Buttons2.X;
|
||||
if (Controller["P2 Y"])
|
||||
p22 &= ~LibYabause.Buttons2.Y;
|
||||
if (Controller["P2 Z"])
|
||||
p22 &= ~LibYabause.Buttons2.Z;
|
||||
|
||||
|
||||
if (Controller["Reset"])
|
||||
LibYabause.libyabause_softreset();
|
||||
if (Controller["Power"])
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
LibYabause.libyabause_setpads(p11, p12, p21, p22);
|
||||
|
||||
LibYabause.libyabause_frameadvance(out w, out h, out nsamp);
|
||||
BufferWidth = w;
|
||||
BufferHeight = h;
|
||||
|
|
|
@ -34,6 +34,12 @@ namespace BizHawk.MultiClient
|
|||
GenesisController[0] = new GenControllerTemplate(true);
|
||||
GenesisAutoController[0] = new GenControllerTemplate(false);
|
||||
|
||||
SaturnController[0] = new SaturnControllerTemplate(true);
|
||||
SaturnController[1] = new SaturnControllerTemplate(false);
|
||||
|
||||
SaturnAutoController[0] = new SaturnControllerTemplate(false);
|
||||
SaturnAutoController[1] = new SaturnControllerTemplate(false);
|
||||
|
||||
Atari2600Controller[0] = new SingleButtonJoyStickTemplate(true);
|
||||
Atari2600Controller[1] = new SingleButtonJoyStickTemplate(false);
|
||||
Atari2600AutoController[0] = new SingleButtonJoyStickTemplate(false);
|
||||
|
@ -811,6 +817,11 @@ namespace BizHawk.MultiClient
|
|||
public GBAControllerTemplate[] GBAController = new GBAControllerTemplate[1];
|
||||
public GBAControllerTemplate[] GBAAutoController = new GBAControllerTemplate[1];
|
||||
|
||||
//Saturn
|
||||
public SaturnControllerTemplate[] SaturnController = new SaturnControllerTemplate[2];
|
||||
public SaturnControllerTemplate[] SaturnAutoController = new SaturnControllerTemplate[2];
|
||||
public SaturnConsoleButtonTemplate[] SaturnConsoleButtons = new SaturnConsoleButtonTemplate[1];
|
||||
|
||||
//Commodore 64 Settings
|
||||
public SingleButtonJoyStickTemplate[] C64Joysticks = new SingleButtonJoyStickTemplate[2];
|
||||
public SingleButtonJoyStickTemplate[] C64AutoJoysticks = new SingleButtonJoyStickTemplate[2];
|
||||
|
@ -883,6 +894,19 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
public class SaturnConsoleButtonTemplate : iControllerConfigObject
|
||||
{
|
||||
public string Reset = "";
|
||||
public string Power = "";
|
||||
|
||||
public void SetDefaults()
|
||||
{
|
||||
Reset = "";
|
||||
Power = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class GenConsoleButtonTemplate : iControllerConfigObject
|
||||
{
|
||||
public string Reset = "";
|
||||
|
@ -1166,6 +1190,37 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
public class SaturnControllerTemplate : iControllerConfigObject
|
||||
{
|
||||
public string Up = "";
|
||||
public string Down = "";
|
||||
public string Left = "";
|
||||
public string Right = "";
|
||||
public string A = "";
|
||||
public string B = "";
|
||||
public string C = "";
|
||||
public string X = "";
|
||||
public string Y = "";
|
||||
public string Z = "";
|
||||
public string L = "";
|
||||
public string R = "";
|
||||
public string Start = "";
|
||||
public bool Enabled;
|
||||
|
||||
public SaturnControllerTemplate() { }
|
||||
public SaturnControllerTemplate(bool defaults)
|
||||
{
|
||||
if (defaults)
|
||||
{
|
||||
SetDefaults();
|
||||
}
|
||||
}
|
||||
public void SetDefaults()
|
||||
{
|
||||
Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public class GenControllerTemplate : iControllerConfigObject
|
||||
{
|
||||
public string Up = "";
|
||||
|
|
|
@ -64,6 +64,9 @@ namespace BizHawk.MultiClient
|
|||
public static Controller ColecoControls;
|
||||
public static AutofireController AutofireColecoControls;
|
||||
|
||||
public static Controller SaturnControls;
|
||||
public static AutofireController AutofireSaturnControls;
|
||||
|
||||
public static Controller IntellivisionControls;
|
||||
public static AutofireController AutofireIntellivisionControls;
|
||||
|
||||
|
|
|
@ -1037,6 +1037,64 @@ namespace BizHawk.MultiClient
|
|||
agbaControls.BindMulti("Power", Global.Config.GBAAutoController[0].Power);
|
||||
Global.AutofireGBAControls = agbaControls;
|
||||
|
||||
var satControls = new Controller(Emulation.Consoles.Sega.Saturn.Yabause.SaturnController);
|
||||
satControls.BindMulti("P1 Up", Global.Config.SaturnController[0].Up);
|
||||
satControls.BindMulti("P1 Down", Global.Config.SaturnController[0].Down);
|
||||
satControls.BindMulti("P1 Left", Global.Config.SaturnController[0].Left);
|
||||
satControls.BindMulti("P1 Right", Global.Config.SaturnController[0].Right);
|
||||
satControls.BindMulti("P1 A", Global.Config.SaturnController[0].A);
|
||||
satControls.BindMulti("P1 B", Global.Config.SaturnController[0].B);
|
||||
satControls.BindMulti("P1 C", Global.Config.SaturnController[0].C);
|
||||
satControls.BindMulti("P1 X", Global.Config.SaturnController[0].X);
|
||||
satControls.BindMulti("P1 Y", Global.Config.SaturnController[0].Y);
|
||||
satControls.BindMulti("P1 Z", Global.Config.SaturnController[0].Z);
|
||||
satControls.BindMulti("P1 L", Global.Config.SaturnController[0].L);
|
||||
satControls.BindMulti("P1 R", Global.Config.SaturnController[0].R);
|
||||
satControls.BindMulti("P1 Start", Global.Config.SaturnController[0].Start);
|
||||
satControls.BindMulti("P2 Up", Global.Config.SaturnController[1].Up);
|
||||
satControls.BindMulti("P2 Down", Global.Config.SaturnController[1].Down);
|
||||
satControls.BindMulti("P2 Left", Global.Config.SaturnController[1].Left);
|
||||
satControls.BindMulti("P2 Right", Global.Config.SaturnController[1].Right);
|
||||
satControls.BindMulti("P2 A", Global.Config.SaturnController[1].A);
|
||||
satControls.BindMulti("P2 B", Global.Config.SaturnController[1].B);
|
||||
satControls.BindMulti("P2 C", Global.Config.SaturnController[1].C);
|
||||
satControls.BindMulti("P2 X", Global.Config.SaturnController[1].X);
|
||||
satControls.BindMulti("P2 Y", Global.Config.SaturnController[1].Y);
|
||||
satControls.BindMulti("P2 Z", Global.Config.SaturnController[1].Z);
|
||||
satControls.BindMulti("P2 L", Global.Config.SaturnController[1].L);
|
||||
satControls.BindMulti("P2 R", Global.Config.SaturnController[1].R);
|
||||
satControls.BindMulti("P2 Start", Global.Config.SaturnController[1].Start);
|
||||
Global.SaturnControls = satControls;
|
||||
|
||||
var asatControls = new AutofireController(Emulation.Consoles.Sega.Saturn.Yabause.SaturnController);
|
||||
asatControls.BindMulti("P1 Up", Global.Config.SaturnAutoController[0].Up);
|
||||
asatControls.BindMulti("P1 Down", Global.Config.SaturnAutoController[0].Down);
|
||||
asatControls.BindMulti("P1 Left", Global.Config.SaturnAutoController[0].Left);
|
||||
asatControls.BindMulti("P1 Right", Global.Config.SaturnAutoController[0].Right);
|
||||
asatControls.BindMulti("P1 A", Global.Config.SaturnAutoController[0].A);
|
||||
asatControls.BindMulti("P1 B", Global.Config.SaturnAutoController[0].B);
|
||||
asatControls.BindMulti("P1 C", Global.Config.SaturnAutoController[0].C);
|
||||
asatControls.BindMulti("P1 X", Global.Config.SaturnAutoController[0].X);
|
||||
asatControls.BindMulti("P1 Y", Global.Config.SaturnAutoController[0].Y);
|
||||
asatControls.BindMulti("P1 Z", Global.Config.SaturnAutoController[0].Z);
|
||||
asatControls.BindMulti("P1 L", Global.Config.SaturnAutoController[0].L);
|
||||
asatControls.BindMulti("P1 R", Global.Config.SaturnAutoController[0].R);
|
||||
asatControls.BindMulti("P1 Start", Global.Config.SaturnAutoController[0].Start);
|
||||
asatControls.BindMulti("P2 Up", Global.Config.SaturnAutoController[1].Up);
|
||||
asatControls.BindMulti("P2 Down", Global.Config.SaturnAutoController[1].Down);
|
||||
asatControls.BindMulti("P2 Left", Global.Config.SaturnAutoController[1].Left);
|
||||
asatControls.BindMulti("P2 Right", Global.Config.SaturnAutoController[1].Right);
|
||||
asatControls.BindMulti("P2 A", Global.Config.SaturnAutoController[1].A);
|
||||
asatControls.BindMulti("P2 B", Global.Config.SaturnAutoController[1].B);
|
||||
asatControls.BindMulti("P2 C", Global.Config.SaturnAutoController[1].C);
|
||||
asatControls.BindMulti("P2 X", Global.Config.SaturnAutoController[1].X);
|
||||
asatControls.BindMulti("P2 Y", Global.Config.SaturnAutoController[1].Y);
|
||||
asatControls.BindMulti("P2 Z", Global.Config.SaturnAutoController[1].Z);
|
||||
asatControls.BindMulti("P2 L", Global.Config.SaturnAutoController[1].L);
|
||||
asatControls.BindMulti("P2 R", Global.Config.SaturnAutoController[1].R);
|
||||
asatControls.BindMulti("P2 Start", Global.Config.SaturnAutoController[1].Start);
|
||||
Global.AutofireSaturnControls = asatControls;
|
||||
|
||||
var genControls = new Controller(Genesis.GenesisController);
|
||||
genControls.BindMulti("P1 Up", Global.Config.GenesisController[0].Up);
|
||||
genControls.BindMulti("P1 Left", Global.Config.GenesisController[0].Left);
|
||||
|
@ -1744,6 +1802,10 @@ namespace BizHawk.MultiClient
|
|||
Global.ActiveController = Global.ColecoControls;
|
||||
Global.AutoFireController = Global.AutofireColecoControls;
|
||||
break;
|
||||
case "SAT":
|
||||
Global.ActiveController = Global.SaturnControls;
|
||||
Global.AutoFireController = Global.AutofireSaturnControls;
|
||||
break;
|
||||
case "C64":
|
||||
Global.ActiveController = Global.Commodore64Controls;
|
||||
Global.AutoFireController = Global.AutofireCommodore64Controls;
|
||||
|
|
Binary file not shown.
|
@ -106,6 +106,9 @@ s16 *sndbuff = NULL;
|
|||
int sndbuffpos = 0;
|
||||
u32 *vidbuff = NULL;
|
||||
|
||||
PerPad_struct *ctrl1;
|
||||
PerPad_struct *ctrl2;
|
||||
|
||||
extern "C" int vdp2height;
|
||||
extern "C" int vdp2width;
|
||||
|
||||
|
@ -187,6 +190,14 @@ extern "C" __declspec(dllexport) void libyabause_deinit()
|
|||
YabauseDeInit();
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void libyabause_setpads(u8 p11, u8 p12, u8 p21, u8 p22)
|
||||
{
|
||||
ctrl1->padbits[0] = p11;
|
||||
ctrl1->padbits[1] = p12;
|
||||
ctrl2->padbits[0] = p21;
|
||||
ctrl2->padbits[1] = p22;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) int libyabause_init(CDInterface *_CD)
|
||||
{
|
||||
FECD.DeInit = _CD->DeInit;
|
||||
|
@ -228,5 +239,8 @@ extern "C" __declspec(dllexport) int libyabause_init(CDInterface *_CD)
|
|||
DisableAutoFrameSkip();
|
||||
ScspSetFrameAccurate(1);
|
||||
|
||||
ctrl1 = PerPadAdd(&PORTDATA1);
|
||||
ctrl2 = PerPadAdd(&PORTDATA2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue