bizswan: support rotating the screen at playtime
This commit is contained in:
parent
5e2bd8a927
commit
019ab3efe0
|
@ -76,7 +76,7 @@ namespace BizHawk.Client.Common
|
|||
case "SAT":
|
||||
return "|.|.............|.............|";
|
||||
case "WSWAN":
|
||||
return "|....|....|...|";
|
||||
return "|....|....|.....|";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,6 +211,7 @@ namespace BizHawk.Client.Common
|
|||
new Tuple<string, char>("B", 'B'),
|
||||
new Tuple<string, char>("A", 'A'),
|
||||
new Tuple<string, char>("Power", 'P'),
|
||||
new Tuple<string, char>("Rotate", 'R'),
|
||||
new Tuple<string, char>(null, '|'),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -42,9 +42,10 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
/// <param name="surface">uint32 video output buffer</param>
|
||||
/// <param name="soundbuff">int16 sound output buffer</param>
|
||||
/// <param name="soundbuffsize">[In] max hold size of soundbuff [Out] number of samples actually deposited</param>
|
||||
/// <param name="IsRotated">(out) true if the screen is rotated left 90</param>
|
||||
/// <returns>true if lagged</returns>
|
||||
[DllImport(dd, CallingConvention = cc)]
|
||||
public static extern bool bizswan_advance(IntPtr core, Buttons buttons, bool novideo, int[] surface, short[] soundbuff, ref int soundbuffsize);
|
||||
public static extern bool bizswan_advance(IntPtr core, Buttons buttons, bool novideo, int[] surface, short[] soundbuff, ref int soundbuffsize, ref bool IsRotated);
|
||||
|
||||
/// <summary>
|
||||
/// load rom
|
||||
|
@ -170,6 +171,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
Start = 0x0100,
|
||||
A = 0x0200,
|
||||
B = 0x0400,
|
||||
Rotate = 0x8000,
|
||||
}
|
||||
|
||||
public enum Language : uint
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
public static readonly ControllerDefinition WonderSwanController = new ControllerDefinition
|
||||
{
|
||||
Name = "WonderSwan Controller",
|
||||
BoolButtons = { "Up X", "Down X", "Left X", "Right X", "Up Y", "Down Y", "Left Y", "Right Y", "Start", "B", "A", "Power" }
|
||||
BoolButtons = { "Up X", "Down X", "Left X", "Right X", "Up Y", "Down Y", "Left Y", "Right Y", "Start", "B", "A", "Power", "Rotate" }
|
||||
};
|
||||
public ControllerDefinition ControllerDefinition { get { return WonderSwanController; } }
|
||||
public IController Controller { get; set; }
|
||||
|
@ -38,6 +38,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
if (Controller["Start"]) ret |= BizSwan.Buttons.Start;
|
||||
if (Controller["B"]) ret |= BizSwan.Buttons.B;
|
||||
if (Controller["A"]) ret |= BizSwan.Buttons.A;
|
||||
if (Controller["Rotate"]) ret |= BizSwan.Buttons.Rotate;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -103,11 +104,13 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
if (Controller["Power"])
|
||||
BizSwan.bizswan_reset(Core);
|
||||
|
||||
bool rotate = false;
|
||||
int soundbuffsize = sbuff.Length;
|
||||
IsLagFrame = BizSwan.bizswan_advance(Core, GetButtons(), !render, vbuff, sbuff, ref soundbuffsize);
|
||||
IsLagFrame = BizSwan.bizswan_advance(Core, GetButtons(), !render, vbuff, sbuff, ref soundbuffsize, ref rotate);
|
||||
if (soundbuffsize == sbuff.Length)
|
||||
throw new Exception();
|
||||
sbuffcontains = soundbuffsize;
|
||||
InitVideo(rotate);
|
||||
|
||||
if (IsLagFrame)
|
||||
LagCount++;
|
||||
|
|
Binary file not shown.
|
@ -80,6 +80,10 @@ namespace MDFN_IEN_WSWAN
|
|||
|
||||
bool System::Advance(uint16 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int &soundbuffsize)
|
||||
{
|
||||
// we hijack the top bit of the buttons input and use it as a positive edge sensitive toggle to the rotate input
|
||||
rotate ^= (buttons & 0x8000) > (oldbuttons & 0x8000);
|
||||
oldbuttons = buttons;
|
||||
|
||||
memory.WSButtonStatus = rotate ? RotateButtons(buttons) : buttons;
|
||||
memory.Lagged = true;
|
||||
while (!gfx.ExecuteLine(surface, novideo))
|
||||
|
@ -306,6 +310,7 @@ namespace MDFN_IEN_WSWAN
|
|||
SSS(interrupt);
|
||||
|
||||
NSS(rotate);
|
||||
NSS(oldbuttons);
|
||||
}
|
||||
|
||||
void System::SaveRamClearHacky(const SyncSettings &s)
|
||||
|
@ -330,9 +335,11 @@ namespace MDFN_IEN_WSWAN
|
|||
s->Reset();
|
||||
}
|
||||
|
||||
EXPORT int bizswan_advance(System *s, uint16 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int *soundbuffsize)
|
||||
EXPORT int bizswan_advance(System *s, uint16 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int *soundbuffsize, int *IsRotated)
|
||||
{
|
||||
return s->Advance(buttons, novideo, surface, soundbuff, *soundbuffsize);
|
||||
int ret = s->Advance(buttons, novideo, surface, soundbuff, *soundbuffsize);
|
||||
*IsRotated = s->rotate;
|
||||
return ret;
|
||||
}
|
||||
|
||||
EXPORT int bizswan_load(System *s, const uint8 *data, int length, const SyncSettings *settings, int *IsRotated)
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
Interrupt interrupt;
|
||||
|
||||
bool rotate; // rotate screen and controls left 90
|
||||
uint16 oldbuttons;
|
||||
|
||||
template<bool isReader>void SyncState(NewState *ns);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue