diff --git a/BizHawk.Client.Common/movie/MnemonicsGenerator.cs b/BizHawk.Client.Common/movie/MnemonicsGenerator.cs index 2ae68342b5..489aa02c9f 100644 --- a/BizHawk.Client.Common/movie/MnemonicsGenerator.cs +++ b/BizHawk.Client.Common/movie/MnemonicsGenerator.cs @@ -76,7 +76,7 @@ namespace BizHawk.Client.Common case "SAT": return "|.|.............|.............|"; case "WSWAN": - return "|....|....|.....|"; + return "|...........|...........|..|"; } } } diff --git a/BizHawk.Client.Common/movie/MovieMnemonics.cs b/BizHawk.Client.Common/movie/MovieMnemonics.cs index d0d44c77f5..48a2541f92 100644 --- a/BizHawk.Client.Common/movie/MovieMnemonics.cs +++ b/BizHawk.Client.Common/movie/MovieMnemonics.cs @@ -197,19 +197,30 @@ namespace BizHawk.Client.Common public static Tuple[] WSMnemonic = new[] { new Tuple(null, '|'), - new Tuple("Up X", 'U'), - new Tuple("Down X", 'D'), - new Tuple("Left X", 'L'), - new Tuple("Right X", 'R'), + new Tuple("P1 Up X", 'U'), + new Tuple("P1 Down X", 'D'), + new Tuple("P1 Left X", 'L'), + new Tuple("P1 Right X", 'R'), + new Tuple("P1 Up Y", 'U'), + new Tuple("P1 Down Y", 'D'), + new Tuple("P1 Left Y", 'L'), + new Tuple("P1 Right Y", 'R'), + new Tuple("P1 Start", 'S'), + new Tuple("P1 B", 'B'), + new Tuple("P1 A", 'A'), new Tuple(null, '|'), - new Tuple("Up Y", 'U'), - new Tuple("Down Y", 'D'), - new Tuple("Left Y", 'L'), - new Tuple("Right Y", 'R'), + new Tuple("P2 Up X", 'U'), + new Tuple("P2 Down X", 'D'), + new Tuple("P2 Left X", 'L'), + new Tuple("P2 Right X", 'R'), + new Tuple("P2 Up Y", 'U'), + new Tuple("P2 Down Y", 'D'), + new Tuple("P2 Left Y", 'L'), + new Tuple("P2 Right Y", 'R'), + new Tuple("P2 Start", 'S'), + new Tuple("P2 B", 'B'), + new Tuple("P2 A", 'A'), new Tuple(null, '|'), - new Tuple("Start", 'S'), - new Tuple("B", 'B'), - new Tuple("A", 'A'), new Tuple("Power", 'P'), new Tuple("Rotate", 'R'), new Tuple(null, '|'), diff --git a/BizHawk.Client.EmuHawk/config/ControllerConfig.cs b/BizHawk.Client.EmuHawk/config/ControllerConfig.cs index 799c6d7799..68d114af88 100644 --- a/BizHawk.Client.EmuHawk/config/ControllerConfig.cs +++ b/BizHawk.Client.EmuHawk/config/ControllerConfig.cs @@ -129,7 +129,8 @@ namespace BizHawk.Client.EmuHawk { if (buckets[i].Count > 0) { - tt.TabPages.Add("Player " + i); + string tabname = Global.Emulator.SystemId == "WSWAN" ? i == 1 ? "Normal" : "Rotated" : "Player " + i; // hack + tt.TabPages.Add(tabname); tt.TabPages[pageidx].Controls.Add(createpanel(settings, buckets[i], tt.Size)); pageidx++; } @@ -137,7 +138,8 @@ namespace BizHawk.Client.EmuHawk if (buckets[0].Count > 0) { - tt.TabPages.Add(Global.Emulator.SystemId == "C64" ? "Keyboard" : "Console"); + string tabname = Global.Emulator.SystemId == "C64" ? "Keyboard" : "Console"; // hack + tt.TabPages.Add(tabname); tt.TabPages[pageidx].Controls.Add(createpanel(settings, buckets[0], tt.Size)); } } diff --git a/BizHawk.Emulation.Cores/Consoles/WonderSwan/BizSwan.cs b/BizHawk.Emulation.Cores/Consoles/WonderSwan/BizSwan.cs index e9fee26375..7b02df92e8 100644 --- a/BizHawk.Emulation.Cores/Consoles/WonderSwan/BizSwan.cs +++ b/BizHawk.Emulation.Cores/Consoles/WonderSwan/BizSwan.cs @@ -158,20 +158,33 @@ namespace BizHawk.Emulation.Cores.WonderSwan }; [Flags] - public enum Buttons : ushort + public enum Buttons : uint { - UpX = 0x0001, - RightX = 0x0002, - DownX = 0x0004, - LeftX = 0x0008, - UpY = 0x0010, - RightY = 0x0020, - DownY = 0x0040, - LeftY = 0x0080, - Start = 0x0100, - A = 0x0200, - B = 0x0400, - Rotate = 0x8000, + UpX = 0x00000001, + RightX = 0x00000002, + DownX = 0x00000004, + LeftX = 0x00000008, + UpY = 0x00000010, + RightY = 0x00000020, + DownY = 0x00000040, + LeftY = 0x00000080, + Start = 0x00000100, + A = 0x00000200, + B = 0x00000400, + + R_UpX = 0x00010000, + R_RightX = 0x00020000, + R_DownX = 0x00040000, + R_LeftX = 0x00080000, + R_UpY = 0x00100000, + R_RightY = 0x00200000, + R_DownY = 0x00400000, + R_LeftY = 0x00800000, + R_Start = 0x01000000, + R_A = 0x02000000, + R_B = 0x04000000, + + Rotate = 0x80000000, } public enum Language : uint diff --git a/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs b/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs index 0894f7ac55..5b3d403dc2 100644 --- a/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs +++ b/BizHawk.Emulation.Cores/Consoles/WonderSwan/WonderSwan.cs @@ -19,7 +19,35 @@ 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", "Rotate" } + BoolButtons = + { + "P1 Up X", + "P1 Down X", + "P1 Left X", + "P1 Right X", + "P1 Up Y", + "P1 Down Y", + "P1 Left Y", + "P1 Right Y", + "P1 Start", + "P1 B", + "P1 A", + + "P2 Up X", + "P2 Down X", + "P2 Left X", + "P2 Right X", + "P2 Up Y", + "P2 Down Y", + "P2 Left Y", + "P2 Right Y", + "P2 Start", + "P2 B", + "P2 A", + + "Power", + "Rotate" + } }; public ControllerDefinition ControllerDefinition { get { return WonderSwanController; } } public IController Controller { get; set; } @@ -27,17 +55,30 @@ namespace BizHawk.Emulation.Cores.WonderSwan BizSwan.Buttons GetButtons() { BizSwan.Buttons ret = 0; - if (Controller["Up X"]) ret |= BizSwan.Buttons.UpX; - if (Controller["Down X"]) ret |= BizSwan.Buttons.DownX; - if (Controller["Left X"]) ret |= BizSwan.Buttons.LeftX; - if (Controller["Right X"]) ret |= BizSwan.Buttons.RightX; - if (Controller["Up Y"]) ret |= BizSwan.Buttons.UpY; - if (Controller["Down Y"]) ret |= BizSwan.Buttons.DownY; - if (Controller["Left Y"]) ret |= BizSwan.Buttons.LeftY; - if (Controller["Right Y"]) ret |= BizSwan.Buttons.RightY; - if (Controller["Start"]) ret |= BizSwan.Buttons.Start; - if (Controller["B"]) ret |= BizSwan.Buttons.B; - if (Controller["A"]) ret |= BizSwan.Buttons.A; + if (Controller["P1 Up X"]) ret |= BizSwan.Buttons.UpX; + if (Controller["P1 Down X"]) ret |= BizSwan.Buttons.DownX; + if (Controller["P1 Left X"]) ret |= BizSwan.Buttons.LeftX; + if (Controller["P1 Right X"]) ret |= BizSwan.Buttons.RightX; + if (Controller["P1 Up Y"]) ret |= BizSwan.Buttons.UpY; + if (Controller["P1 Down Y"]) ret |= BizSwan.Buttons.DownY; + if (Controller["P1 Left Y"]) ret |= BizSwan.Buttons.LeftY; + if (Controller["P1 Right Y"]) ret |= BizSwan.Buttons.RightY; + if (Controller["P1 Start"]) ret |= BizSwan.Buttons.Start; + if (Controller["P1 B"]) ret |= BizSwan.Buttons.B; + if (Controller["P1 A"]) ret |= BizSwan.Buttons.A; + + if (Controller["P2 Up X"]) ret |= BizSwan.Buttons.R_UpX; + if (Controller["P2 Down X"]) ret |= BizSwan.Buttons.R_DownX; + if (Controller["P2 Left X"]) ret |= BizSwan.Buttons.R_LeftX; + if (Controller["P2 Right X"]) ret |= BizSwan.Buttons.R_RightX; + if (Controller["P2 Up Y"]) ret |= BizSwan.Buttons.R_UpY; + if (Controller["P2 Down Y"]) ret |= BizSwan.Buttons.R_DownY; + if (Controller["P2 Left Y"]) ret |= BizSwan.Buttons.R_LeftY; + if (Controller["P2 Right Y"]) ret |= BizSwan.Buttons.R_RightY; + if (Controller["P2 Start"]) ret |= BizSwan.Buttons.R_Start; + if (Controller["P2 B"]) ret |= BizSwan.Buttons.R_B; + if (Controller["P2 A"]) ret |= BizSwan.Buttons.R_A; + if (Controller["Rotate"]) ret |= BizSwan.Buttons.Rotate; return ret; } diff --git a/output/defctrl.json b/output/defctrl.json index f7ff06bf88..a7fb541d32 100644 --- a/output/defctrl.json +++ b/output/defctrl.json @@ -558,17 +558,30 @@ "Reset": "" }, "WonderSwan Controller": { - "Up X": "UpArrow, J1 POV1U, X1 DpadUp, X1 LStickUp", - "Down X": "DownArrow, J1 POV1D, X1 DpadDown, X1 LStickDown", - "Left X": "LeftArrow, J1 POV1L, X1 DpadLeft, X1 LStickLeft", - "Right X": "RightArrow, J1 POV1R, X1 DpadRight, X1 LStickRight", - "Up Y": "NumberPad8, J1 RotationZ-, X1 RStickUp", - "Down Y": "NumberPad2, J1 RotationZ+, X1 RStickDown", - "Left Y": "NumberPad4, J1 Z-, X1 RStickLeft", - "Right Y": "NumberPad6, J1 Z+, X1 RStickRight", - "Start": "Return, J1 B10, X1 Start", - "B": "Z, J1 B1, X1 X", - "A": "X, J1 B2, X1 A", + "P1 Up X": "UpArrow, J1 POV1U, X1 DpadUp, X1 LStickUp", + "P1 Down X": "DownArrow, J1 POV1D, X1 DpadDown, X1 LStickDown", + "P1 Left X": "LeftArrow, J1 POV1L, X1 DpadLeft, X1 LStickLeft", + "P1 Right X": "RightArrow, J1 POV1R, X1 DpadRight, X1 LStickRight", + "P1 Up Y": "NumberPad8, J1 RotationZ-, X1 RStickUp", + "P1 Down Y": "NumberPad2, J1 RotationZ+, X1 RStickDown", + "P1 Left Y": "NumberPad4, J1 Z-, X1 RStickLeft", + "P1 Right Y": "NumberPad6, J1 Z+, X1 RStickRight", + "P1 Start": "Return, J1 B10, X1 Start", + "P1 B": "Z, J1 B1, X1 X", + "P1 A": "X, J1 B2, X1 A", + + "P2 Up X": "", + "P2 Down X": "X, J1 B2, X1 A", + "P2 Left X": "Z, J1 B1, X1 X", + "P2 Right X": "", + "P2 Up Y": "LeftArrow, J1 POV1L, X1 DpadLeft, X1 LStickLeft", + "P2 Down Y": "RightArrow, J1 POV1R, X1 DpadRight, X1 LStickRight", + "P2 Left Y": "DownArrow, J1 POV1D, X1 DpadDown, X1 LStickDown", + "P2 Right Y": "UpArrow, J1 POV1U, X1 DpadUp, X1 LStickUp", + "P2 Start": "Return, J1 B10, X1 Start", + "P2 B": "", + "P2 A": "", + "Power": "" } }, @@ -736,17 +749,10 @@ "Power": "" }, "WonderSwan Controller": { - "Up X": "", - "Down X": "", - "Left X": "", - "Right X": "", - "Up Y": "", - "Down Y": "", - "Left Y": "", - "Right Y": "", - "Start": "", - "B": "A, J1 B4, X1 Y", - "A": "S, J1 B3, X1 B", + "P1 B": "A, J1 B4, X1 Y", + "P1 A": "S, J1 B3, X1 B", + "P2 Left X": "A, J1 B4, X1 Y", + "P2 Down X": "S, J1 B3, X1 B", "Power": "" } }, diff --git a/output/dll/bizswan.dll b/output/dll/bizswan.dll index 1da87c81a5..baf1af5707 100644 Binary files a/output/dll/bizswan.dll and b/output/dll/bizswan.dll differ diff --git a/wonderswan/system.cpp b/wonderswan/system.cpp index 5b46cae4ec..18af564154 100644 --- a/wonderswan/system.cpp +++ b/wonderswan/system.cpp @@ -64,27 +64,14 @@ namespace MDFN_IEN_WSWAN cpu.set_reg(NEC_SS,0); cpu.set_reg(NEC_SP,0x2000); } - - static uint16 RotateButtons(uint16 input) - { - int groupx = input & 0xf; - groupx <<= 1; - groupx |= groupx >> 4; - groupx &= 0x0f; - int groupy = input & 0xf0; - groupy <<= 1; - groupy |= groupy >> 4; - groupy &= 0xf0; - return input & 0xff00 | groupx | groupy; - } - bool System::Advance(uint16 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int &soundbuffsize) + bool System::Advance(uint32 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); + rotate ^= (buttons & 0x80000000) > (oldbuttons & 0x80000000); oldbuttons = buttons; - memory.WSButtonStatus = rotate ? RotateButtons(buttons) : buttons; + memory.WSButtonStatus = rotate ? buttons >> 16 : buttons; memory.WSButtonStatus &= 0x7ff; // mask out "rotate" bit and other unused bits memory.Lagged = true; while (!gfx.ExecuteLine(surface, novideo)) @@ -336,7 +323,7 @@ namespace MDFN_IEN_WSWAN s->Reset(); } - EXPORT int bizswan_advance(System *s, uint16 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int *soundbuffsize, int *IsRotated) + EXPORT int bizswan_advance(System *s, uint32 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int *soundbuffsize, int *IsRotated) { int ret = s->Advance(buttons, novideo, surface, soundbuff, *soundbuffsize); *IsRotated = s->rotate; diff --git a/wonderswan/system.h b/wonderswan/system.h index fb92d91bfe..beeffe27ff 100644 --- a/wonderswan/system.h +++ b/wonderswan/system.h @@ -33,7 +33,7 @@ public: static void* operator new(std::size_t size); void Reset(); - bool Advance(uint16 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int &soundbuffsize); + bool Advance(uint32 buttons, bool novideo, uint32 *surface, int16 *soundbuff, int &soundbuffsize); bool Load(const uint8 *data, int length, const SyncSettings &s); void PutSettings(const Settings &s); @@ -57,7 +57,7 @@ public: Interrupt interrupt; bool rotate; // rotate screen and controls left 90 - uint16 oldbuttons; + uint32 oldbuttons; templatevoid SyncState(NewState *ns); };