diff --git a/Core/BaseControlDevice.h b/Core/BaseControlDevice.h index cef6763..f73218f 100644 --- a/Core/BaseControlDevice.h +++ b/Core/BaseControlDevice.h @@ -74,6 +74,7 @@ public: void SetRawState(ControlDeviceState state); ControlDeviceState GetRawState(); + virtual ControllerType GetControllerType() = 0; virtual uint8_t ReadRam(uint16_t addr) = 0; virtual void WriteRam(uint16_t addr, uint8_t value) = 0; diff --git a/Core/ControlDeviceState.h b/Core/ControlDeviceState.h index 1a4b0e1..bcc392e 100644 --- a/Core/ControlDeviceState.h +++ b/Core/ControlDeviceState.h @@ -1,6 +1,7 @@ #pragma once #include "stdafx.h" #include +#include "SettingTypes.h" struct ControlDeviceState { @@ -10,4 +11,10 @@ struct ControlDeviceState { return State.size() != other.State.size() || memcmp(State.data(), other.State.data(), State.size()) != 0; } +}; + +struct ControllerData +{ + ControllerType Type; + ControlDeviceState State; }; \ No newline at end of file diff --git a/Core/ControlManager.cpp b/Core/ControlManager.cpp index 181b5dd..fc9f94b 100644 --- a/Core/ControlManager.cpp +++ b/Core/ControlManager.cpp @@ -54,17 +54,17 @@ void ControlManager::UnregisterInputRecorder(IInputRecorder* provider) vec.erase(std::remove(vec.begin(), vec.end(), provider), vec.end()); } -vector ControlManager::GetPortStates() +vector ControlManager::GetPortStates() { auto lock = _deviceLock.AcquireSafe(); - vector states; - for(int i = 0; i < 4; i++) { + vector states; + for(int i = 0; i < 2; i++) { shared_ptr device = GetControlDevice(i); if(device) { - states.push_back(device->GetRawState()); + states.push_back({ device->GetControllerType(), device->GetRawState() }); } else { - states.push_back(ControlDeviceState()); + states.push_back({ ControllerType::None, ControlDeviceState()}); } } return states; diff --git a/Core/ControlManager.h b/Core/ControlManager.h index b8f1746..015c20b 100644 --- a/Core/ControlManager.h +++ b/Core/ControlManager.h @@ -10,7 +10,7 @@ class IInputRecorder; class IInputProvider; class Console; class SystemActionManager; -struct ControlDeviceState; +struct ControllerData; enum class ControllerType; enum class ExpansionPortDevice; @@ -49,7 +49,7 @@ public: void RegisterInputRecorder(IInputRecorder* recorder); void UnregisterInputRecorder(IInputRecorder* recorder); - vector GetPortStates(); + vector GetPortStates(); shared_ptr GetSystemActionManager(); shared_ptr GetControlDevice(uint8_t port); diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 467231b..341cbae 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -64,6 +64,7 @@ + @@ -219,6 +220,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 03fe398..2bf1d9c 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -413,6 +413,9 @@ Misc + + SNES\Input + @@ -671,6 +674,9 @@ Misc + + SNES\Input + diff --git a/Core/InputHud.cpp b/Core/InputHud.cpp new file mode 100644 index 0000000..5bf496d --- /dev/null +++ b/Core/InputHud.cpp @@ -0,0 +1,184 @@ +#include "stdafx.h" +#include "InputHud.h" +#include "BaseControlDevice.h" +#include "SnesController.h" +#include "Multitap.h" +#include "SnesMouse.h" +#include "SuperScope.h" +#include "Console.h" +#include "EmuSettings.h" +#include "DebugHud.h" +#include "ControlManager.h" + +static constexpr int color[2] = { 0x00111111, 0x00FFFFFF }; + +InputHud::InputHud(Console* console) +{ + _console = console; +} + +void InputHud::DrawController(int port, ControlDeviceState state, int x, int y, int frameNumber) +{ + + SnesController controller(_console, 0, KeyMappingSet()); + controller.SetRawState(state); + + shared_ptr hud = _console->GetDebugHud(); + hud->DrawRectangle(0 + x, 0 + y, 35, 14, 0x80CCCCCC, true, 1, frameNumber); + hud->DrawRectangle(0 + x, 0 + y, 35, 14, color[0], false, 1, frameNumber); + hud->DrawRectangle(5 + x, 3 + y, 3, 3, color[controller.IsPressed(SnesController::Buttons::Up)], true, 1, frameNumber); + hud->DrawRectangle(5 + x, 9 + y, 3, 3, color[controller.IsPressed(SnesController::Buttons::Down)], true, 1, frameNumber); + hud->DrawRectangle(2 + x, 6 + y, 3, 3, color[controller.IsPressed(SnesController::Buttons::Left)], true, 1, frameNumber); + hud->DrawRectangle(8 + x, 6 + y, 3, 3, color[controller.IsPressed(SnesController::Buttons::Right)], true, 1, frameNumber); + hud->DrawRectangle(5 + x, 6 + y, 3, 3, color[0], true, 1, frameNumber); + + hud->DrawRectangle(27 + x, 3 + y, 3, 3, color[controller.IsPressed(SnesController::Buttons::X)], true, 1, frameNumber); + hud->DrawRectangle(27 + x, 9 + y, 3, 3, color[controller.IsPressed(SnesController::Buttons::B)], true, 1, frameNumber); + hud->DrawRectangle(30 + x, 6 + y, 3, 3, color[controller.IsPressed(SnesController::Buttons::A)], true, 1, frameNumber); + hud->DrawRectangle(24 + x, 6 + y, 3, 3, color[controller.IsPressed(SnesController::Buttons::Y)], true, 1, frameNumber); + + hud->DrawRectangle(4 + x, 0 + y, 5, 2, color[controller.IsPressed(SnesController::Buttons::L)], true, 1, frameNumber); + hud->DrawRectangle(26 + x, 0 + y, 5, 2, color[controller.IsPressed(SnesController::Buttons::R)], true, 1, frameNumber); + + hud->DrawRectangle(13 + x, 9 + y, 4, 2, color[controller.IsPressed(SnesController::Buttons::Select)], true, 1, frameNumber); + hud->DrawRectangle(18 + x, 9 + y, 4, 2, color[controller.IsPressed(SnesController::Buttons::Start)], true, 1, frameNumber); + + switch(port) { + case 0: + //1 + hud->DrawLine(17 + x, 2 + y, 17 + x, 6 + y, color[0], 1, frameNumber); + hud->DrawLine(16 + x, 6 + y, 18 + x, 6 + y, color[0], 1, frameNumber); + hud->DrawPixel(16 + x, 3 + y, color[0], 1, frameNumber); + break; + + case 1: + //2 + hud->DrawLine(16 + x, 2 + y, 18 + x, 2 + y, color[0], 1, frameNumber); + hud->DrawPixel(18 + x, 3 + y, color[0], 1, frameNumber); + hud->DrawLine(16 + x, 4 + y, 18 + x, 4 + y, color[0], 1, frameNumber); + hud->DrawPixel(16 + x, 5 + y, color[0], 1, frameNumber); + hud->DrawLine(16 + x, 6 + y, 18 + x, 6 + y, color[0], 1, frameNumber); + break; + + case 2: + //3 + hud->DrawLine(16 + x, 2 + y, 18 + x, 2 + y, color[0], 1, frameNumber); + hud->DrawPixel(18 + x, 3 + y, color[0], 1, frameNumber); + hud->DrawLine(16 + x, 4 + y, 18 + x, 4 + y, color[0], 1, frameNumber); + hud->DrawPixel(18 + x, 5 + y, color[0], 1, frameNumber); + hud->DrawLine(16 + x, 6 + y, 18 + x, 6 + y, color[0], 1, frameNumber); + break; + + case 3: + //4 + hud->DrawLine(16 + x, 2 + y, 16 + x, 4 + y, color[0], 1, frameNumber); + hud->DrawLine(18 + x, 2 + y, 18 + x, 6 + y, color[0], 1, frameNumber); + hud->DrawLine(16 + x, 4 + y, 18 + x, 4 + y, color[0], 1, frameNumber); + break; + + case 4: + //5 + hud->DrawLine(16 + x, 2 + y, 18 + x, 2 + y, color[0], 1, frameNumber); + hud->DrawPixel(16 + x, 3 + y, color[0], 1, frameNumber); + hud->DrawLine(16 + x, 4 + y, 18 + x, 4 + y, color[0], 1, frameNumber); + hud->DrawPixel(18 + x, 5 + y, color[0], 1, frameNumber); + hud->DrawLine(16 + x, 6 + y, 18 + x, 6 + y, color[0], 1, frameNumber); + break; + } +} + +void InputHud::DrawControllers(OverscanDimensions overscan, int frameNumber) +{ + vector controllerData = _console->GetControlManager()->GetPortStates(); + InputConfig cfg = _console->GetSettings()->GetInputConfig(); + + int xStart; + int yStart; + int xOffset = cfg.DisplayInputHorizontally ? 38 : 0; + int yOffset = cfg.DisplayInputHorizontally ? 0 : 16; + + switch(cfg.DisplayInputPosition) { + default: + case InputDisplayPosition::TopLeft: + xStart = overscan.Left + 3; + yStart = overscan.Top + 3; + break; + case InputDisplayPosition::TopRight: + xStart = 256 - overscan.Right - 38; + yStart = overscan.Top + 3; + xOffset = -xOffset; + break; + case InputDisplayPosition::BottomLeft: + xStart = overscan.Left + 3; + yStart = 240 - overscan.Bottom - 18; + yOffset = -yOffset; + break; + case InputDisplayPosition::BottomRight: + xStart = 256 - overscan.Right - 38; + yStart = 240 - overscan.Bottom - 18; + xOffset = -xOffset; + yOffset = -yOffset; + break; + } + + for(int i = 0; i < controllerData.size(); i++) { + if(controllerData[i].Type == ControllerType::SnesController) { + if(cfg.DisplayInputPort[i]) { + DrawController(i, controllerData[i].State, xStart, yStart, frameNumber); + xStart += xOffset; + yStart += yOffset; + } + } else if(controllerData[i].Type == ControllerType::Multitap) { + uint64_t rawData = 0; + for(int j = (int)controllerData[i].State.State.size() - 1; j >= 0; j--) { + rawData <<= 8; + rawData |= controllerData[i].State.State[j]; + } + + ControlDeviceState controllers[4] = {}; + for(int j = 0; j < 4; j++) { + controllers[j].State.push_back(rawData & 0xFF); + controllers[j].State.push_back((rawData >> 8) & 0x0F); + rawData >>= 12; + } + + if(cfg.DisplayInputPort[i]) { + DrawController(i, controllers[0], xStart, yStart, frameNumber); + xStart += xOffset; + yStart += yOffset; + } + + for(int j = 1; j < 4; j++) { + if(cfg.DisplayInputPort[j + 1]) { + DrawController(j + 1, controllers[j], xStart, yStart, frameNumber); + xStart += xOffset; + yStart += yOffset; + } + } + } else if(controllerData[i].Type == ControllerType::SuperScope) { + if(cfg.DisplayInputPort[i]) { + SuperScope scope(_console, 0, KeyMappingSet()); + scope.SetRawState(controllerData[i].State); + MousePosition pos = scope.GetCoordinates(); + + shared_ptr hud = _console->GetDebugHud(); + hud->DrawRectangle(pos.X - 1, pos.Y - 1, 3, 3, 0x00111111, true, 1, frameNumber); + hud->DrawRectangle(pos.X - 1, pos.Y - 1, 3, 3, 0x80CCCCCC, false, 1, frameNumber); + } + } else if(controllerData[i].Type == ControllerType::SnesMouse) { + if(cfg.DisplayInputPort[i]) { + SnesMouse mouse(_console, 0); + mouse.SetRawState(controllerData[i].State); + + shared_ptr hud = _console->GetDebugHud(); + hud->DrawRectangle(xStart + 12, yStart, 11, 14, 0x00AAAAAA, true, 1, frameNumber); + hud->DrawRectangle(xStart + 12, yStart, 11, 14, color[0], false, 1, frameNumber); + hud->DrawRectangle(xStart + 13, yStart + 1, 4, 5, color[mouse.IsPressed(SnesMouse::Buttons::Left)], true, 1, frameNumber); + hud->DrawRectangle(xStart + 18, yStart + 1, 4, 5, color[mouse.IsPressed(SnesMouse::Buttons::Right)], true, 1, frameNumber); + + xStart += xOffset; + yStart += yOffset; + } + } + } +} diff --git a/Core/InputHud.h b/Core/InputHud.h new file mode 100644 index 0000000..fb3f2e0 --- /dev/null +++ b/Core/InputHud.h @@ -0,0 +1,19 @@ +#pragma once +#include "stdafx.h" +#include "SettingTypes.h" +#include "ControlDeviceState.h" + +class Console; + +class InputHud +{ +private: + Console* _console; + + void DrawController(int port, ControlDeviceState state, int x, int y, int frameNumber); + +public: + InputHud(Console *console); + + void DrawControllers(OverscanDimensions overscan, int frameNumber); +}; \ No newline at end of file diff --git a/Core/Multitap.h b/Core/Multitap.h index 5fb7632..fc76f50 100644 --- a/Core/Multitap.h +++ b/Core/Multitap.h @@ -86,6 +86,11 @@ public: _internalRegs = console->GetInternalRegisters().get(); } + ControllerType GetControllerType() override + { + return ControllerType::Multitap; + } + uint8_t ReadRam(uint16_t addr) override { uint8_t selectBit = 0x80 >> ((_port == 0) ? 1 : 0); diff --git a/Core/SettingTypes.h b/Core/SettingTypes.h index fe9c624..b60c142 100644 --- a/Core/SettingTypes.h +++ b/Core/SettingTypes.h @@ -232,11 +232,23 @@ struct ControllerConfig ControllerType Type = ControllerType::SnesController; }; +enum class InputDisplayPosition +{ + TopLeft = 0, + TopRight = 1, + BottomLeft = 2, + BottomRight = 3 +}; + struct InputConfig { ControllerConfig Controllers[5]; uint32_t ControllerDeadzoneSize = 2; uint32_t MouseSensitivity = 1; + + InputDisplayPosition DisplayInputPosition = InputDisplayPosition::TopLeft; + bool DisplayInputPort[5] = { false, false, false, false, false}; + bool DisplayInputHorizontally = true; }; enum class RamState diff --git a/Core/SnesController.cpp b/Core/SnesController.cpp index ca3ef11..e1c23e8 100644 --- a/Core/SnesController.cpp +++ b/Core/SnesController.cpp @@ -73,6 +73,11 @@ void SnesController::RefreshStateBuffer() _stateBuffer = (uint32_t)ToByte(); } +ControllerType SnesController::GetControllerType() +{ + return ControllerType::SnesController; +} + uint8_t SnesController::ReadRam(uint16_t addr) { uint8_t output = 0; diff --git a/Core/SnesController.h b/Core/SnesController.h index 94088e4..cd90fca 100644 --- a/Core/SnesController.h +++ b/Core/SnesController.h @@ -24,6 +24,7 @@ public: SnesController(Console* console, uint8_t port, KeyMappingSet keyMappings); + ControllerType GetControllerType() override; uint8_t ReadRam(uint16_t addr) override; void WriteRam(uint16_t addr, uint8_t value) override; }; \ No newline at end of file diff --git a/Core/SnesMouse.h b/Core/SnesMouse.h index f255335..608894a 100644 --- a/Core/SnesMouse.h +++ b/Core/SnesMouse.h @@ -16,8 +16,6 @@ private: protected: bool HasCoordinates() override { return true; } - enum Buttons { Left = 0, Right }; - void Serialize(Serializer &s) override { BaseControlDevice::Serialize(s); @@ -40,10 +38,17 @@ protected: } public: + enum Buttons { Left = 0, Right }; + SnesMouse(Console* console, uint8_t port) : BaseControlDevice(console, port) { } + ControllerType GetControllerType() override + { + return ControllerType::SnesMouse; + } + void WriteRam(uint16_t addr, uint8_t value) override { StrobeProcessWrite(value); diff --git a/Core/SuperScope.h b/Core/SuperScope.h index 0fc1486..f559a7e 100644 --- a/Core/SuperScope.h +++ b/Core/SuperScope.h @@ -98,6 +98,11 @@ public: _ppu = console->GetPpu().get(); } + ControllerType GetControllerType() override + { + return ControllerType::SuperScope; + } + uint8_t ReadRam(uint16_t addr) override { uint8_t output = 0; diff --git a/Core/SystemActionManager.h b/Core/SystemActionManager.h index 3d78a42..670b240 100644 --- a/Core/SystemActionManager.h +++ b/Core/SystemActionManager.h @@ -23,6 +23,11 @@ public: { } + ControllerType GetControllerType() override + { + return ControllerType::None; + } + uint8_t ReadRam(uint16_t addr) override { return 0; diff --git a/Core/VideoDecoder.cpp b/Core/VideoDecoder.cpp index ce0e12e..dba5d0e 100644 --- a/Core/VideoDecoder.cpp +++ b/Core/VideoDecoder.cpp @@ -12,6 +12,7 @@ #include "ScaleFilter.h" #include "Ppu.h" #include "DebugHud.h" +#include "InputHud.h" VideoDecoder::VideoDecoder(shared_ptr console) { @@ -22,6 +23,7 @@ VideoDecoder::VideoDecoder(shared_ptr console) _lastFrameInfo = _baseFrameInfo; UpdateVideoFilter(); _videoFilter->SetBaseFrameInfo(_baseFrameInfo); + _inputHud.reset(new InputHud(console.get())); } VideoDecoder::~VideoDecoder() @@ -98,6 +100,8 @@ void VideoDecoder::DecodeFrame(bool forRewind) uint32_t* outputBuffer = _videoFilter->GetOutputBuffer(); FrameInfo frameInfo = _videoFilter->GetFrameInfo(); + + _inputHud->DrawControllers(_videoFilter->GetOverscan(), _frameNumber); _console->GetDebugHud()->Draw(outputBuffer, _videoFilter->GetOverscan(), frameInfo.Width, _frameNumber); /* diff --git a/Core/VideoDecoder.h b/Core/VideoDecoder.h index 09c065d..47f10c0 100644 --- a/Core/VideoDecoder.h +++ b/Core/VideoDecoder.h @@ -8,7 +8,7 @@ class BaseVideoFilter; class ScaleFilter; //class RotateFilter; class IRenderingDevice; -//class VideoHud; +class InputHud; class Console; class VideoDecoder @@ -20,7 +20,7 @@ private: uint32_t _frameNumber = 0; unique_ptr _decodeThread; - //unique_ptr _hud; + unique_ptr _inputHud; AutoResetEvent _waitForFrame; diff --git a/Libretro/Makefile.common b/Libretro/Makefile.common index 6fc9043..992caa3 100644 --- a/Libretro/Makefile.common +++ b/Libretro/Makefile.common @@ -56,6 +56,7 @@ SOURCES_CXX := $(LIBRETRO_DIR)/libretro.cpp \ $(CORE_DIR)/Gsu.Instructions.cpp \ $(CORE_DIR)/GsuDisUtils.cpp \ $(CORE_DIR)/GsuDebugger.cpp \ + $(CORE_DIR)/InputHud.cpp \ $(CORE_DIR)/InternalRegisters.cpp \ $(CORE_DIR)/KeyManager.cpp \ $(CORE_DIR)/LabelManager.cpp \ diff --git a/UI/Config/InputConfig.cs b/UI/Config/InputConfig.cs index 3d64f9e..d6168e0 100644 --- a/UI/Config/InputConfig.cs +++ b/UI/Config/InputConfig.cs @@ -16,6 +16,14 @@ namespace Mesen.GUI.Config [MinMax(0, 4)] public UInt32 ControllerDeadzoneSize = 2; [MinMax(0, 3)] public UInt32 MouseSensitivity = 1; + public InputDisplayPosition DisplayInputPosition = InputDisplayPosition.BottomRight; + [MarshalAs(UnmanagedType.I1)] public bool DisplayInputPort1 = false; + [MarshalAs(UnmanagedType.I1)] public bool DisplayInputPort2 = false; + [MarshalAs(UnmanagedType.I1)] public bool DisplayInputPort3 = false; + [MarshalAs(UnmanagedType.I1)] public bool DisplayInputPort4 = false; + [MarshalAs(UnmanagedType.I1)] public bool DisplayInputPort5 = false; + [MarshalAs(UnmanagedType.I1)] public bool DisplayInputHorizontally = true; + public InputConfig() { } @@ -126,4 +134,12 @@ namespace Mesen.GUI.Config SuperScope = 3, Multitap = 4 } + + public enum InputDisplayPosition + { + TopLeft = 0, + TopRight = 1, + BottomLeft = 2, + BottomRight = 3 + } } diff --git a/UI/Forms/Config/frmInputConfig.Designer.cs b/UI/Forms/Config/frmInputConfig.Designer.cs index a53fe21..cce5a72 100644 --- a/UI/Forms/Config/frmInputConfig.Designer.cs +++ b/UI/Forms/Config/frmInputConfig.Designer.cs @@ -55,6 +55,26 @@ this.lblMultitap3 = new System.Windows.Forms.Label(); this.lblMultitap2 = new System.Windows.Forms.Label(); this.lblMultitap1 = new System.Windows.Forms.Label(); + this.tpgAdvanced = new System.Windows.Forms.TabPage(); + this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.grpDisplayInput = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); + this.chkDisplayPort1 = new System.Windows.Forms.CheckBox(); + this.chkDisplayPort2 = new System.Windows.Forms.CheckBox(); + this.chkDisplayPort3 = new System.Windows.Forms.CheckBox(); + this.chkDisplayPort4 = new System.Windows.Forms.CheckBox(); + this.chkDisplayInputHorizontally = new System.Windows.Forms.CheckBox(); + this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); + this.lblDisplayPosition = new System.Windows.Forms.Label(); + this.cboDisplayInputPosition = new System.Windows.Forms.ComboBox(); + this.chkHideMousePointerForZapper = new Mesen.GUI.Controls.ctrlRiskyOption(); + this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); + this.lblDeadzone = new System.Windows.Forms.Label(); + this.trkControllerDeadzoneSize = new System.Windows.Forms.TrackBar(); + this.lblSmall = new System.Windows.Forms.Label(); + this.lblLarge = new System.Windows.Forms.Label(); + this.chkDisplayPort5 = new System.Windows.Forms.CheckBox(); this.tabMain.SuspendLayout(); this.tpgControllers.SuspendLayout(); this.tlpControllers.SuspendLayout(); @@ -63,6 +83,14 @@ ((System.ComponentModel.ISupportInitialize)(this.picWarning)).BeginInit(); this.grpMultitap.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); + this.tpgAdvanced.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); + this.grpDisplayInput.SuspendLayout(); + this.tableLayoutPanel4.SuspendLayout(); + this.flowLayoutPanel2.SuspendLayout(); + this.flowLayoutPanel3.SuspendLayout(); + this.tableLayoutPanel5.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.trkControllerDeadzoneSize)).BeginInit(); this.SuspendLayout(); // // baseConfigPanel @@ -74,6 +102,7 @@ // tabMain // this.tabMain.Controls.Add(this.tpgControllers); + this.tabMain.Controls.Add(this.tpgAdvanced); this.tabMain.Dock = System.Windows.Forms.DockStyle.Fill; this.tabMain.Location = new System.Drawing.Point(0, 0); this.tabMain.Name = "tabMain"; @@ -403,6 +432,242 @@ this.lblMultitap1.TabIndex = 2; this.lblMultitap1.Text = "Player 2:"; // + // tpgAdvanced + // + this.tpgAdvanced.Controls.Add(this.tableLayoutPanel3); + this.tpgAdvanced.Location = new System.Drawing.Point(4, 22); + this.tpgAdvanced.Name = "tpgAdvanced"; + this.tpgAdvanced.Size = new System.Drawing.Size(374, 260); + this.tpgAdvanced.TabIndex = 4; + this.tpgAdvanced.Text = "Advanced"; + this.tpgAdvanced.UseVisualStyleBackColor = true; + // + // tableLayoutPanel3 + // + this.tableLayoutPanel3.ColumnCount = 1; + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Controls.Add(this.grpDisplayInput, 0, 0); + this.tableLayoutPanel3.Controls.Add(this.chkHideMousePointerForZapper, 0, 2); + this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel5, 0, 1); + this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel3.Name = "tableLayoutPanel3"; + this.tableLayoutPanel3.RowCount = 4; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Size = new System.Drawing.Size(374, 260); + this.tableLayoutPanel3.TabIndex = 1; + // + // grpDisplayInput + // + this.grpDisplayInput.Controls.Add(this.tableLayoutPanel4); + this.grpDisplayInput.Dock = System.Windows.Forms.DockStyle.Fill; + this.grpDisplayInput.Location = new System.Drawing.Point(3, 3); + this.grpDisplayInput.Name = "grpDisplayInput"; + this.grpDisplayInput.Size = new System.Drawing.Size(368, 90); + this.grpDisplayInput.TabIndex = 0; + this.grpDisplayInput.TabStop = false; + this.grpDisplayInput.Text = "Display Controller Input"; + // + // tableLayoutPanel4 + // + this.tableLayoutPanel4.ColumnCount = 1; + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Controls.Add(this.flowLayoutPanel2, 0, 0); + this.tableLayoutPanel4.Controls.Add(this.chkDisplayInputHorizontally, 0, 2); + this.tableLayoutPanel4.Controls.Add(this.flowLayoutPanel3, 0, 1); + this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 16); + this.tableLayoutPanel4.Name = "tableLayoutPanel4"; + this.tableLayoutPanel4.RowCount = 4; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Size = new System.Drawing.Size(362, 71); + this.tableLayoutPanel4.TabIndex = 0; + // + // flowLayoutPanel2 + // + this.flowLayoutPanel2.Controls.Add(this.chkDisplayPort1); + this.flowLayoutPanel2.Controls.Add(this.chkDisplayPort2); + this.flowLayoutPanel2.Controls.Add(this.chkDisplayPort3); + this.flowLayoutPanel2.Controls.Add(this.chkDisplayPort4); + this.flowLayoutPanel2.Controls.Add(this.chkDisplayPort5); + this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Top; + this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 0); + this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel2.Name = "flowLayoutPanel2"; + this.flowLayoutPanel2.Size = new System.Drawing.Size(362, 24); + this.flowLayoutPanel2.TabIndex = 0; + // + // chkDisplayPort1 + // + this.chkDisplayPort1.AutoSize = true; + this.chkDisplayPort1.Location = new System.Drawing.Point(3, 3); + this.chkDisplayPort1.Name = "chkDisplayPort1"; + this.chkDisplayPort1.Size = new System.Drawing.Size(54, 17); + this.chkDisplayPort1.TabIndex = 0; + this.chkDisplayPort1.Text = "Port 1"; + this.chkDisplayPort1.UseVisualStyleBackColor = true; + // + // chkDisplayPort2 + // + this.chkDisplayPort2.AutoSize = true; + this.chkDisplayPort2.Location = new System.Drawing.Point(63, 3); + this.chkDisplayPort2.Name = "chkDisplayPort2"; + this.chkDisplayPort2.Size = new System.Drawing.Size(54, 17); + this.chkDisplayPort2.TabIndex = 1; + this.chkDisplayPort2.Text = "Port 2"; + this.chkDisplayPort2.UseVisualStyleBackColor = true; + // + // chkDisplayPort3 + // + this.chkDisplayPort3.AutoSize = true; + this.chkDisplayPort3.Location = new System.Drawing.Point(123, 3); + this.chkDisplayPort3.Name = "chkDisplayPort3"; + this.chkDisplayPort3.Size = new System.Drawing.Size(54, 17); + this.chkDisplayPort3.TabIndex = 2; + this.chkDisplayPort3.Text = "Port 3"; + this.chkDisplayPort3.UseVisualStyleBackColor = true; + // + // chkDisplayPort4 + // + this.chkDisplayPort4.AutoSize = true; + this.chkDisplayPort4.Location = new System.Drawing.Point(183, 3); + this.chkDisplayPort4.Name = "chkDisplayPort4"; + this.chkDisplayPort4.Size = new System.Drawing.Size(54, 17); + this.chkDisplayPort4.TabIndex = 3; + this.chkDisplayPort4.Text = "Port 4"; + this.chkDisplayPort4.UseVisualStyleBackColor = true; + // + // chkDisplayInputHorizontally + // + this.chkDisplayInputHorizontally.AutoSize = true; + this.chkDisplayInputHorizontally.Location = new System.Drawing.Point(3, 54); + this.chkDisplayInputHorizontally.Name = "chkDisplayInputHorizontally"; + this.chkDisplayInputHorizontally.Size = new System.Drawing.Size(115, 17); + this.chkDisplayInputHorizontally.TabIndex = 1; + this.chkDisplayInputHorizontally.Text = "Display horizontally"; + this.chkDisplayInputHorizontally.UseVisualStyleBackColor = true; + // + // flowLayoutPanel3 + // + this.flowLayoutPanel3.Controls.Add(this.lblDisplayPosition); + this.flowLayoutPanel3.Controls.Add(this.cboDisplayInputPosition); + this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel3.Location = new System.Drawing.Point(0, 24); + this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel3.Name = "flowLayoutPanel3"; + this.flowLayoutPanel3.Size = new System.Drawing.Size(362, 27); + this.flowLayoutPanel3.TabIndex = 2; + // + // lblDisplayPosition + // + this.lblDisplayPosition.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblDisplayPosition.AutoSize = true; + this.lblDisplayPosition.Location = new System.Drawing.Point(3, 7); + this.lblDisplayPosition.Name = "lblDisplayPosition"; + this.lblDisplayPosition.Size = new System.Drawing.Size(84, 13); + this.lblDisplayPosition.TabIndex = 0; + this.lblDisplayPosition.Text = "Display Position:"; + // + // cboDisplayInputPosition + // + this.cboDisplayInputPosition.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cboDisplayInputPosition.FormattingEnabled = true; + this.cboDisplayInputPosition.Location = new System.Drawing.Point(93, 3); + this.cboDisplayInputPosition.Name = "cboDisplayInputPosition"; + this.cboDisplayInputPosition.Size = new System.Drawing.Size(121, 21); + this.cboDisplayInputPosition.TabIndex = 1; + // + // chkHideMousePointerForZapper + // + this.chkHideMousePointerForZapper.Checked = false; + this.chkHideMousePointerForZapper.Dock = System.Windows.Forms.DockStyle.Fill; + this.chkHideMousePointerForZapper.Location = new System.Drawing.Point(0, 151); + this.chkHideMousePointerForZapper.Name = "chkHideMousePointerForZapper"; + this.chkHideMousePointerForZapper.Size = new System.Drawing.Size(374, 23); + this.chkHideMousePointerForZapper.TabIndex = 2; + this.chkHideMousePointerForZapper.Text = "Hide mouse pointer when using zapper"; + this.chkHideMousePointerForZapper.Visible = false; + // + // tableLayoutPanel5 + // + this.tableLayoutPanel5.ColumnCount = 4; + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel5.Controls.Add(this.lblDeadzone, 0, 0); + this.tableLayoutPanel5.Controls.Add(this.trkControllerDeadzoneSize, 1, 0); + this.tableLayoutPanel5.Controls.Add(this.lblSmall, 1, 1); + this.tableLayoutPanel5.Controls.Add(this.lblLarge, 2, 1); + this.tableLayoutPanel5.Location = new System.Drawing.Point(0, 96); + this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel5.Name = "tableLayoutPanel5"; + this.tableLayoutPanel5.RowCount = 2; + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel5.Size = new System.Drawing.Size(356, 55); + this.tableLayoutPanel5.TabIndex = 3; + this.tableLayoutPanel5.Visible = false; + // + // lblDeadzone + // + this.lblDeadzone.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblDeadzone.AutoSize = true; + this.lblDeadzone.Location = new System.Drawing.Point(3, 11); + this.lblDeadzone.Name = "lblDeadzone"; + this.lblDeadzone.Size = new System.Drawing.Size(146, 13); + this.lblDeadzone.TabIndex = 0; + this.lblDeadzone.Text = "Controller axis deadzone size:"; + // + // trkControllerDeadzoneSize + // + this.trkControllerDeadzoneSize.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.tableLayoutPanel5.SetColumnSpan(this.trkControllerDeadzoneSize, 2); + this.trkControllerDeadzoneSize.LargeChange = 1; + this.trkControllerDeadzoneSize.Location = new System.Drawing.Point(155, 3); + this.trkControllerDeadzoneSize.Maximum = 4; + this.trkControllerDeadzoneSize.MaximumSize = new System.Drawing.Size(106, 29); + this.trkControllerDeadzoneSize.MinimumSize = new System.Drawing.Size(106, 29); + this.trkControllerDeadzoneSize.Name = "trkControllerDeadzoneSize"; + this.trkControllerDeadzoneSize.Size = new System.Drawing.Size(106, 29); + this.trkControllerDeadzoneSize.TabIndex = 1; + // + // lblSmall + // + this.lblSmall.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblSmall.AutoSize = true; + this.lblSmall.Location = new System.Drawing.Point(155, 38); + this.lblSmall.Name = "lblSmall"; + this.lblSmall.Size = new System.Drawing.Size(32, 13); + this.lblSmall.TabIndex = 2; + this.lblSmall.Text = "Small"; + // + // lblLarge + // + this.lblLarge.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.lblLarge.AutoSize = true; + this.lblLarge.Location = new System.Drawing.Point(227, 38); + this.lblLarge.Name = "lblLarge"; + this.lblLarge.Size = new System.Drawing.Size(34, 13); + this.lblLarge.TabIndex = 3; + this.lblLarge.Text = "Large"; + // + // chkDisplayPort5 + // + this.chkDisplayPort5.AutoSize = true; + this.chkDisplayPort5.Location = new System.Drawing.Point(243, 3); + this.chkDisplayPort5.Name = "chkDisplayPort5"; + this.chkDisplayPort5.Size = new System.Drawing.Size(54, 17); + this.chkDisplayPort5.TabIndex = 4; + this.chkDisplayPort5.Text = "Port 5"; + this.chkDisplayPort5.UseVisualStyleBackColor = true; + // // frmInputConfig // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -428,6 +693,18 @@ this.grpMultitap.ResumeLayout(false); this.tableLayoutPanel2.ResumeLayout(false); this.tableLayoutPanel2.PerformLayout(); + this.tpgAdvanced.ResumeLayout(false); + this.tableLayoutPanel3.ResumeLayout(false); + this.grpDisplayInput.ResumeLayout(false); + this.tableLayoutPanel4.ResumeLayout(false); + this.tableLayoutPanel4.PerformLayout(); + this.flowLayoutPanel2.ResumeLayout(false); + this.flowLayoutPanel2.PerformLayout(); + this.flowLayoutPanel3.ResumeLayout(false); + this.flowLayoutPanel3.PerformLayout(); + this.tableLayoutPanel5.ResumeLayout(false); + this.tableLayoutPanel5.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.trkControllerDeadzoneSize)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -462,5 +739,25 @@ private System.Windows.Forms.Button btnSetupMultitap4; private System.Windows.Forms.GroupBox grpMultitap; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.TabPage tpgAdvanced; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; + private System.Windows.Forms.GroupBox grpDisplayInput; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; + private System.Windows.Forms.CheckBox chkDisplayPort1; + private System.Windows.Forms.CheckBox chkDisplayPort2; + private System.Windows.Forms.CheckBox chkDisplayPort3; + private System.Windows.Forms.CheckBox chkDisplayPort4; + private System.Windows.Forms.CheckBox chkDisplayPort5; + private System.Windows.Forms.CheckBox chkDisplayInputHorizontally; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3; + private System.Windows.Forms.Label lblDisplayPosition; + private System.Windows.Forms.ComboBox cboDisplayInputPosition; + private Controls.ctrlRiskyOption chkHideMousePointerForZapper; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5; + private System.Windows.Forms.Label lblDeadzone; + private System.Windows.Forms.TrackBar trkControllerDeadzoneSize; + private System.Windows.Forms.Label lblSmall; + private System.Windows.Forms.Label lblLarge; } } \ No newline at end of file diff --git a/UI/Forms/Config/frmInputConfig.cs b/UI/Forms/Config/frmInputConfig.cs index 8f31f16..d2c8bf0 100644 --- a/UI/Forms/Config/frmInputConfig.cs +++ b/UI/Forms/Config/frmInputConfig.cs @@ -39,6 +39,14 @@ namespace Mesen.GUI.Forms.Config cboMultitap3.SetEnumValue(ControllerType.SnesController); cboMultitap4.SetEnumValue(ControllerType.SnesController); + AddBinding(nameof(InputConfig.DisplayInputPort1), chkDisplayPort1); + AddBinding(nameof(InputConfig.DisplayInputPort2), chkDisplayPort2); + AddBinding(nameof(InputConfig.DisplayInputPort3), chkDisplayPort3); + AddBinding(nameof(InputConfig.DisplayInputPort4), chkDisplayPort4); + AddBinding(nameof(InputConfig.DisplayInputPort5), chkDisplayPort5); + AddBinding(nameof(InputConfig.DisplayInputPosition), cboDisplayInputPosition); + AddBinding(nameof(InputConfig.DisplayInputHorizontally), chkDisplayInputHorizontally); + UpdateUiSections(); }