From ff7db156f637f2fd406d182ef9bda2a91a969b23 Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 12 May 2017 14:29:26 -0500 Subject: [PATCH] C64 - renamed C64.Input to C64.MotherboardInput since it is a partial class of Motherboard not C64 --- .../BizHawk.Emulation.Cores.csproj | 4 +- .../{C64.Input.cs => C64.MotherboardInput.cs} | 109 +++++++++--------- .../Commodore64/C64.MotherboardInterface.cs | 7 +- 3 files changed, 58 insertions(+), 62 deletions(-) rename BizHawk.Emulation.Cores/Computers/Commodore64/{C64.Input.cs => C64.MotherboardInput.cs} (97%) diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj index 3790384b99..b3f33ae1c3 100644 --- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj +++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj @@ -199,7 +199,7 @@ C64.cs - C64.cs + C64.cs C64.cs @@ -215,7 +215,7 @@ - + diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Input.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.MotherboardInput.cs similarity index 97% rename from BizHawk.Emulation.Cores/Computers/Commodore64/C64.Input.cs rename to BizHawk.Emulation.Cores/Computers/Commodore64/C64.MotherboardInput.cs index b98483e4f0..6d27551858 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.Input.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.MotherboardInput.cs @@ -1,54 +1,55 @@ -namespace BizHawk.Emulation.Cores.Computers.Commodore64 -{ - public sealed partial class Motherboard - { - private readonly bool[] _joystickPressed = new bool[10]; - private readonly bool[] _keyboardPressed = new bool[64]; - - private static readonly string[][] JoystickMatrix = { - new[] {"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button"}, - new[] {"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Button"} - }; - - private static readonly string[][] KeyboardMatrix = { - new[] { "Key Insert/Delete", "Key Return", "Key Cursor Left/Right", "Key F7", "Key F1", "Key F3", "Key F5", "Key Cursor Up/Down" }, - new[] { "Key 3", "Key W", "Key A", "Key 4", "Key Z", "Key S", "Key E", "Key Left Shift" }, - new[] { "Key 5", "Key R", "Key D", "Key 6", "Key C", "Key F", "Key T", "Key X" }, - new[] { "Key 7", "Key Y", "Key G", "Key 8", "Key B", "Key H", "Key U", "Key V" }, - new[] { "Key 9", "Key I", "Key J", "Key 0", "Key M", "Key K", "Key O", "Key N" }, - new[] { "Key Plus", "Key P", "Key L", "Key Minus", "Key Period", "Key Colon", "Key At", "Key Comma" }, - new[] { "Key Pound", "Key Asterisk", "Key Semicolon", "Key Clear/Home", "Key Right Shift", "Key Equal", "Key Up Arrow", "Key Slash" }, - new[] { "Key 1", "Key Left Arrow", "Key Control", "Key 2", "Key Space", "Key Commodore", "Key Q", "Key Run/Stop" } - }; - - [SaveState.DoNotSave] int _pollIndex; - private bool _restorePressed; - - public void PollInput() - { - _c64.InputCallbacks.Call(); - // scan joysticks - _pollIndex = 0; - for (var j = 0; j < 2; j++) - { - for (var i = 0; i < 5; i++) - { - _joystickPressed[_pollIndex] = Controller.IsPressed(JoystickMatrix[j][i]); - _pollIndex++; - } - } - - // scan keyboard - _pollIndex = 0; - for (var i = 0; i < 8; i++) - { - for (var j = 0; j < 8; j++) - { - _keyboardPressed[_pollIndex++] = Controller.IsPressed(KeyboardMatrix[i][j]); - } - } - - _restorePressed = Controller.IsPressed("Key Restore"); - } - } -} +namespace BizHawk.Emulation.Cores.Computers.Commodore64 +{ + public sealed partial class Motherboard + { + private readonly bool[] _joystickPressed = new bool[10]; + private readonly bool[] _keyboardPressed = new bool[64]; + + private static readonly string[][] JoystickMatrix = { + new[] {"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button"}, + new[] {"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Button"} + }; + + private static readonly string[][] KeyboardMatrix = { + new[] { "Key Insert/Delete", "Key Return", "Key Cursor Left/Right", "Key F7", "Key F1", "Key F3", "Key F5", "Key Cursor Up/Down" }, + new[] { "Key 3", "Key W", "Key A", "Key 4", "Key Z", "Key S", "Key E", "Key Left Shift" }, + new[] { "Key 5", "Key R", "Key D", "Key 6", "Key C", "Key F", "Key T", "Key X" }, + new[] { "Key 7", "Key Y", "Key G", "Key 8", "Key B", "Key H", "Key U", "Key V" }, + new[] { "Key 9", "Key I", "Key J", "Key 0", "Key M", "Key K", "Key O", "Key N" }, + new[] { "Key Plus", "Key P", "Key L", "Key Minus", "Key Period", "Key Colon", "Key At", "Key Comma" }, + new[] { "Key Pound", "Key Asterisk", "Key Semicolon", "Key Clear/Home", "Key Right Shift", "Key Equal", "Key Up Arrow", "Key Slash" }, + new[] { "Key 1", "Key Left Arrow", "Key Control", "Key 2", "Key Space", "Key Commodore", "Key Q", "Key Run/Stop" } + }; + + [SaveState.DoNotSave] int _pollIndex; + private bool _restorePressed; + + public void PollInput() + { + _c64.InputCallbacks.Call(); + + // scan joysticks + _pollIndex = 0; + for (var j = 0; j < 2; j++) + { + for (var i = 0; i < 5; i++) + { + _joystickPressed[_pollIndex] = Controller.IsPressed(JoystickMatrix[j][i]); + _pollIndex++; + } + } + + // scan keyboard + _pollIndex = 0; + for (var i = 0; i < 8; i++) + { + for (var j = 0; j < 8; j++) + { + _keyboardPressed[_pollIndex++] = Controller.IsPressed(KeyboardMatrix[i][j]); + } + } + + _restorePressed = Controller.IsPressed("Key Restore"); + } + } +} diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.MotherboardInterface.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.MotherboardInterface.cs index 9e38806f9b..e0f041cf27 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.MotherboardInterface.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.MotherboardInterface.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace BizHawk.Emulation.Cores.Computers.Commodore64 +namespace BizHawk.Emulation.Cores.Computers.Commodore64 { public sealed partial class Motherboard {