Input: Added option to hide mouse cursor when a zapper is connected (e.g for the aimtrak light gun)

This commit is contained in:
Sour 2018-12-22 16:05:12 -05:00
parent 58d96c7971
commit 8bd292d8d5
16 changed files with 52 additions and 17 deletions

View file

@ -9,7 +9,7 @@ This section documents the Mesen-specific Lua API that is available in scripts v
## Changelog ##
The Lua is still a recent feature and not completely stable yet. To get a list of the major changes between different versions of Mesen, take a look at the [Changelog](/apireference/changelog.html).
Lua scripting is still a relatively recent feature and the API is not quite stable yet. To get a list of the major changes between different versions of Mesen, take a look at the [Changelog](/apireference/changelog.html).
## API References ##

View file

@ -51,9 +51,12 @@ You can also configure that controller's turbo buttons' speed with the `Turbo Sp
<span>Advanced Options</span>
</div></div>
**Hide mouse pointer when using zapper**: Hides the mouse pointer completely when a Zapper is connected. This is useful when using light guns (for PCs) that simulate a mouse.
### Display Controller Input ###
Use these options to display the controller input on the screen.
{{% notice warning %}}
This will be recorded by the [Video Recorder](/tools.html#video-recorder) - so make sure you turn it off if you do not want it to appear on the video.
{{% /notice %}}
{{% /notice %}}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View file

@ -137,6 +137,8 @@ namespace Mesen.GUI.Config
public InteropEmu.InputDisplayPosition DisplayInputPosition = InteropEmu.InputDisplayPosition.BottomRight;
public bool DisplayInputHorizontally = true;
public bool HideMousePointerForZapper = true;
[XmlElement(ElementName = "InputDevice")]
public List<ControllerInfo> Controllers = new List<ControllerInfo>();
public ZapperInfo Zapper = new ZapperInfo();

View file

@ -35,8 +35,15 @@ namespace Mesen.GUI
//Have not been able to find a reliable way to reproduce it yet
//This is a patch to prevent that bug from having any negative impact
if(!_mouseCaptured && _lastPosition != Cursor.Position) {
ShowMouse();
_lastPosition = Cursor.Position;
bool running = InteropEmu.IsRunning() && !InteropEmu.IsPaused();
if(running && ConfigManager.Config.InputInfo.HideMousePointerForZapper && CursorManager.IsLightGun) {
//Keep mouse hidden when using zapper if option to hide mouse is enabled
return;
}
ShowMouse();
}
}
@ -67,19 +74,14 @@ namespace Mesen.GUI
}
}
private static bool IsLightGun
{
get { return InteropEmu.HasZapper() || InteropEmu.GetExpansionDevice() == InteropEmu.ExpansionPortDevice.BandaiHyperShot; }
}
public static bool NeedMouseIcon
{
get {
switch(InteropEmu.GetExpansionDevice()) {
case InteropEmu.ExpansionPortDevice.OekaKidsTablet:
case InteropEmu.ExpansionPortDevice.BandaiHyperShot:
return true;
}
if(InteropEmu.HasZapper()) {
return true;
}
return false;
}
get { return CursorManager.IsLightGun || InteropEmu.GetExpansionDevice() == InteropEmu.ExpansionPortDevice.OekaKidsTablet; }
}
public static void OnMouseMove(Control ctrl)
@ -99,6 +101,10 @@ namespace Mesen.GUI
if(!InteropEmu.IsRunning() || InteropEmu.IsPaused()) {
ShowMouse();
} else if(ConfigManager.Config.InputInfo.HideMousePointerForZapper && CursorManager.IsLightGun) {
//Keep mouse hidden when using zapper if option to hide mouse is enabled
HideMouse();
return;
}
_tmrHideMouse.Stop();

View file

@ -217,6 +217,7 @@
<Control ID="chkDisplayPort4">Jugador 4</Control>
<Control ID="lblDisplayPosition">Posició de pantalla:</Control>
<Control ID="chkDisplayInputHorizontally">Mostra horitzontalment</Control>
<Control ID="chkHideMousePointerForZapper">Hide mouse pointer when using zapper</Control>
<Control ID="lblKeyBinding">Advertència: La vostra configuració actual conté assignacions conflictives - algunes tecles del vostre teclat o botons del comandament han estat assignats a múltiples botons al comandament de la NES. Si això no ha estat intencionat, us preguem que reviseu i corregiu les vostres assignacions.</Control>
</Form>

View file

@ -217,6 +217,7 @@
<Control ID="chkDisplayPort4">Port 4</Control>
<Control ID="lblDisplayPosition">Display Position:</Control>
<Control ID="chkDisplayInputHorizontally">Display horizontally</Control>
<Control ID="chkHideMousePointerForZapper">Hide mouse pointer when using zapper</Control>
<Control ID="lblKeyBinding">Warning: Your current configuration contains conflicting key bindings - some physical buttons on your keyboard or gamepad are mapped to multiple buttons on the NES controller. If this is not intentional, please review and correct your key bindings.</Control>
</Form>

View file

@ -216,6 +216,7 @@
<Control ID="chkDisplayPort4">Jugador 4</Control>
<Control ID="lblDisplayPosition">Posición de pantalla:</Control>
<Control ID="chkDisplayInputHorizontally">Mostrar horizontalmente</Control>
<Control ID="chkHideMousePointerForZapper">Hide mouse pointer when using zapper</Control>
<Control ID="lblKeyBinding">Advertencia: su configuración actual contiene asignaciones conflictivas - algunas teclas de su teclado o botones del mando se han asignado a varios botones del mando de la NES. Si esto no es intencionado, revise y corrija las asignaciones.</Control>
</Form>

View file

@ -217,6 +217,7 @@
<Control ID="chkDisplayPort4">Joueur 4</Control>
<Control ID="lblDisplayPosition">Position d'affichage :</Control>
<Control ID="chkDisplayInputHorizontally">Afficher horizontalement</Control>
<Control ID="chkHideMousePointerForZapper">Cacher la souris lorsqu'un zapper est connecté</Control>
<Control ID="lblKeyBinding">Attention: Votre configuration actuelle contient des conflits - certaines touches sur votre clavier ou manette sont mappées à plusieurs boutons sur la console. Veuillez réviser votre configuration et la corriger au besoin.</Control>
</Form>

View file

@ -218,6 +218,7 @@
<Control ID="chkDisplayPort4">プレーヤー4</Control>
<Control ID="lblDisplayPosition">表示位置:</Control>
<Control ID="chkDisplayInputHorizontally">水平表示</Control>
<Control ID="chkHideMousePointerForZapper">ガンが接続されている時にマウスポインターを隠す</Control>
<Control ID="lblKeyBinding">注意: 使っている設定の中には同じキーが複数のボタン―にマッピングされています。 間違いでこの設定にした場合は、設定を確認して直してください。</Control>
</Form>

View file

@ -217,6 +217,7 @@
<Control ID="chkDisplayPort4">Jogador 4</Control>
<Control ID="lblDisplayPosition">Posição da tela</Control>
<Control ID="chkDisplayInputHorizontally">Mostrar horizontalmente</Control>
<Control ID="chkHideMousePointerForZapper">Hide mouse pointer when using zapper</Control>
<Control ID="lblKeyBinding">Aviso: a configuração atual contém atribuições conflitantes - alguns botões físicos em seu teclado ou gamepad são mapeados para vários botões no controle NES. Se isso não for intencional, reveja e corrija suas atribuições.</Control>
</Form>

View file

@ -216,6 +216,7 @@
<Control ID="chkDisplayPort4">Порт 4</Control>
<Control ID="lblDisplayPosition">Позиция :</Control>
<Control ID="chkDisplayInputHorizontally">Отображать горизонтально</Control>
<Control ID="chkHideMousePointerForZapper">Hide mouse pointer when using zapper</Control>
<Control ID="lblKeyBinding">Warning: Your current configuration contains conflicting key bindings - some physical buttons on your keyboard or gamepad are mapped to multiple buttons on the NES controller. If this is not intentional, please review and correct your key bindings.</Control>
</Form>

View file

@ -216,6 +216,7 @@
<Control ID="chkDisplayPort4">Порт 4</Control>
<Control ID="lblDisplayPosition">Позиція :</Control>
<Control ID="chkDisplayInputHorizontally">Відображати горизонтально</Control>
<Control ID="chkHideMousePointerForZapper">Hide mouse pointer when using zapper</Control>
<Control ID="lblKeyBinding">Увага: Ваша поточна конфігурація містить конфліктуючі поєднання клавіш - деякі фізичні кнопки на вашому ключовому словнику або геймпадi відображаються на кількох кнопках на контролері NES. Якщо це не навмисне, перегляньте та виправте ключi.</Control>
</Form>

View file

@ -220,6 +220,7 @@
<Control ID="chkDisplayPort4">玩家 4</Control>
<Control ID="lblDisplayPosition">显示位置:</Control>
<Control ID="chkDisplayInputHorizontally">横向</Control>
<Control ID="chkHideMousePointerForZapper">Hide mouse pointer when using zapper</Control>
<Control ID="lblKeyBinding">警告:您当前的配置包含冲突的键绑定 - 键盘或游戏手柄上的某些物理按钮映射到NES控制器上的多个按钮.如果这不是故意的,请查看并更正您的按键绑定.</Control>
</Form>

View file

@ -70,6 +70,7 @@
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.tabMain.SuspendLayout();
this.tpgControllers.SuspendLayout();
this.tlpControllers.SuspendLayout();
@ -442,7 +443,7 @@
this.tpgAdvanced.Controls.Add(this.tableLayoutPanel2);
this.tpgAdvanced.Location = new System.Drawing.Point(4, 22);
this.tpgAdvanced.Name = "tpgAdvanced";
this.tpgAdvanced.Size = new System.Drawing.Size(362, 313);
this.tpgAdvanced.Size = new System.Drawing.Size(362, 216);
this.tpgAdvanced.TabIndex = 5;
this.tpgAdvanced.Text = "Advanced";
this.tpgAdvanced.UseVisualStyleBackColor = true;
@ -452,13 +453,15 @@
this.tableLayoutPanel2.ColumnCount = 1;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Controls.Add(this.grpDisplayInput, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.chkHideMousePointerForZapper, 0, 1);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 2;
this.tableLayoutPanel2.RowCount = 3;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(362, 313);
this.tableLayoutPanel2.Size = new System.Drawing.Size(362, 216);
this.tableLayoutPanel2.TabIndex = 0;
//
// grpDisplayInput
@ -583,6 +586,16 @@
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, 96);
this.chkHideMousePointerForZapper.Name = "chkHideMousePointerForZapper";
this.chkHideMousePointerForZapper.Size = new System.Drawing.Size(362, 23);
this.chkHideMousePointerForZapper.TabIndex = 2;
this.chkHideMousePointerForZapper.Text = "Hide mouse pointer when using zapper";
//
// frmInputConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -663,5 +676,6 @@
private System.Windows.Forms.Label lblCartridge;
private System.Windows.Forms.ComboBox cboCartridge;
private System.Windows.Forms.Button btnSetupCartridge;
private Controls.ctrlRiskyOption chkHideMousePointerForZapper;
}
}

View file

@ -43,6 +43,7 @@ namespace Mesen.GUI.Forms.Config
AddBinding("DisplayInputPort4", chkDisplayPort4);
AddBinding("DisplayInputPosition", cboDisplayInputPosition);
AddBinding("DisplayInputHorizontally", chkDisplayInputHorizontally);
AddBinding("HideMousePointerForZapper", chkHideMousePointerForZapper);
//Sort expansion port dropdown alphabetically, but keep the "None" option at the top
SortDropdown(cboExpansionPort, ResourceHelper.GetEnumText(InteropEmu.ExpansionPortDevice.None));