Skip to content

Commit 1e84bff

Browse files
committed
Added XInputReporter project for reporting bugs visually.
1 parent d24669f commit 1e84bff

23 files changed

+1565
-0
lines changed

Binaries/XInputDemo.exe

0 Bytes
Binary file not shown.

Binaries/XInputDotNetPure.dll

0 Bytes
Binary file not shown.

Binaries/XInputInterface.dll

0 Bytes
Binary file not shown.

Binaries/XInputReporter.exe

434 KB
Binary file not shown.

XInputDotNetPure.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XInputInterface", "XInputIn
1010
EndProject
1111
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XInputDemo", "XInputDemo\XInputDemo.csproj", "{11D9E8F7-228D-4984-9E45-570AD26BE8A9}"
1212
EndProject
13+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XInputReporter", "XInputReporter\XInputReporter.csproj", "{AE527B52-7BE7-4BC2-8228-E475F65461A5}"
14+
EndProject
1315
Global
1416
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1517
Debug|Windows = Debug|Windows
@@ -28,6 +30,10 @@ Global
2830
{11D9E8F7-228D-4984-9E45-570AD26BE8A9}.Debug|Windows.Build.0 = Debug|Any CPU
2931
{11D9E8F7-228D-4984-9E45-570AD26BE8A9}.Release|Windows.ActiveCfg = Release|Any CPU
3032
{11D9E8F7-228D-4984-9E45-570AD26BE8A9}.Release|Windows.Build.0 = Release|Any CPU
33+
{AE527B52-7BE7-4BC2-8228-E475F65461A5}.Debug|Windows.ActiveCfg = Debug|Any CPU
34+
{AE527B52-7BE7-4BC2-8228-E475F65461A5}.Debug|Windows.Build.0 = Debug|Any CPU
35+
{AE527B52-7BE7-4BC2-8228-E475F65461A5}.Release|Windows.ActiveCfg = Release|Any CPU
36+
{AE527B52-7BE7-4BC2-8228-E475F65461A5}.Release|Windows.Build.0 = Release|Any CPU
3137
EndGlobalSection
3238
GlobalSection(SolutionProperties) = preSolution
3339
HideSolutionNode = FALSE

XInputReporter/MainForm.Designer.cs

Lines changed: 505 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

XInputReporter/MainForm.cs

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.Windows.Forms;
4+
using XInputDotNetPure;
5+
using System.Drawing;
6+
7+
namespace XInputReporter
8+
{
9+
public partial class MainForm : Form
10+
{
11+
private ReporterState reporterState = new ReporterState();
12+
private Control[] controllerControls;
13+
private Control[] stickControls;
14+
private Point[] stickControlPositions;
15+
16+
public MainForm()
17+
{
18+
InitializeComponent();
19+
20+
controllerControls = new Control[] {
21+
picController1,
22+
picController2,
23+
picController3,
24+
picController4
25+
};
26+
stickControls = new Control[] {
27+
picStickLeft,
28+
picStickRight
29+
};
30+
stickControlPositions = new Point[] {
31+
picStickLeft.Location,
32+
picStickRight.Location
33+
};
34+
}
35+
36+
private void pollingWorker_DoWork(object sender, DoWorkEventArgs e)
37+
{
38+
while (!e.Cancel)
39+
{
40+
if (reporterState.Poll())
41+
{
42+
Invoke(new Action(UpdateState));
43+
}
44+
}
45+
}
46+
47+
private void MainForm_Load(object sender, EventArgs e)
48+
{
49+
comboDeadZone.Items.AddRange(Enum.GetNames(typeof(GamePadDeadZone)));
50+
comboDeadZone.SelectedItem = reporterState.DeadZone.ToString();
51+
52+
pollingWorker.RunWorkerAsync();
53+
}
54+
55+
private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
56+
{
57+
pollingWorker.CancelAsync();
58+
}
59+
60+
private static string FormatFloat(float v)
61+
{
62+
return string.Format("{0:F3}", v);
63+
}
64+
65+
private static void PositionStickControl(Control control, Point location, GamePadThumbSticks.StickValue value)
66+
{
67+
var deltaX = value.X * control.Width * 0.5f;
68+
var deltaY = value.Y * control.Height * -0.5f;
69+
70+
control.Location = new Point(location.X + (int)deltaX, location.Y + (int)deltaY);
71+
control.Refresh();
72+
}
73+
74+
private void UpdateState()
75+
{
76+
checkA.Checked = reporterState.LastActiveState.Buttons.A == XInputDotNetPure.ButtonState.Pressed;
77+
checkB.Checked = reporterState.LastActiveState.Buttons.B == XInputDotNetPure.ButtonState.Pressed;
78+
checkX.Checked = reporterState.LastActiveState.Buttons.X == XInputDotNetPure.ButtonState.Pressed;
79+
checkY.Checked = reporterState.LastActiveState.Buttons.Y == XInputDotNetPure.ButtonState.Pressed;
80+
checkStart.Checked = reporterState.LastActiveState.Buttons.Start == XInputDotNetPure.ButtonState.Pressed;
81+
checkBack.Checked = reporterState.LastActiveState.Buttons.Back == XInputDotNetPure.ButtonState.Pressed;
82+
checkStickLeft.Checked = reporterState.LastActiveState.Buttons.LeftStick == XInputDotNetPure.ButtonState.Pressed;
83+
checkStickRight.Checked = reporterState.LastActiveState.Buttons.RightStick == XInputDotNetPure.ButtonState.Pressed;
84+
checkShoulderLeft.Checked = reporterState.LastActiveState.Buttons.LeftShoulder == XInputDotNetPure.ButtonState.Pressed;
85+
checkShoulderRight.Checked = reporterState.LastActiveState.Buttons.RightShoulder == XInputDotNetPure.ButtonState.Pressed;
86+
87+
checkDPadUp.Checked = reporterState.LastActiveState.DPad.Up == XInputDotNetPure.ButtonState.Pressed;
88+
checkDPadRight.Checked = reporterState.LastActiveState.DPad.Right == XInputDotNetPure.ButtonState.Pressed;
89+
checkDPadDown.Checked = reporterState.LastActiveState.DPad.Down == XInputDotNetPure.ButtonState.Pressed;
90+
checkDPadLeft.Checked = reporterState.LastActiveState.DPad.Left == XInputDotNetPure.ButtonState.Pressed;
91+
92+
labelTriggerLeft.Text = FormatFloat(reporterState.LastActiveState.Triggers.Left);
93+
labelTriggerRight.Text = FormatFloat(reporterState.LastActiveState.Triggers.Right);
94+
95+
labelStickLeftX.Text = FormatFloat(reporterState.LastActiveState.ThumbSticks.Left.X);
96+
labelStickLeftY.Text = FormatFloat(reporterState.LastActiveState.ThumbSticks.Left.Y);
97+
labelStickRightX.Text = FormatFloat(reporterState.LastActiveState.ThumbSticks.Right.X);
98+
labelStickRightY.Text = FormatFloat(reporterState.LastActiveState.ThumbSticks.Right.Y);
99+
100+
if (reporterState.LastActiveState.Buttons.Start == XInputDotNetPure.ButtonState.Pressed)
101+
{
102+
timerStart.Start();
103+
}
104+
else
105+
{
106+
timerStart.Stop();
107+
}
108+
if (reporterState.LastActiveState.Buttons.Back == XInputDotNetPure.ButtonState.Pressed)
109+
{
110+
timerBack.Start();
111+
}
112+
else
113+
{
114+
timerBack.Stop();
115+
}
116+
117+
for (int i = 0; i < 4; i++)
118+
{
119+
controllerControls[i].Visible = i == reporterState.LastActiveIndex && reporterState.LastActiveState.IsConnected;
120+
}
121+
122+
PositionStickControl(stickControls[0], stickControlPositions[0], reporterState.LastActiveState.ThumbSticks.Left);
123+
PositionStickControl(stickControls[1], stickControlPositions[1], reporterState.LastActiveState.ThumbSticks.Right);
124+
}
125+
126+
private void checkLink_CheckedChanged(object sender, EventArgs e)
127+
{
128+
reporterState.LinkTriggersToVibration = checkLink.Checked;
129+
}
130+
131+
private void comboDeadZone_SelectedValueChanged(object sender, EventArgs e)
132+
{
133+
reporterState.DeadZone = (GamePadDeadZone)Enum.Parse(typeof(GamePadDeadZone), comboDeadZone.SelectedItem as string);
134+
}
135+
136+
private void timerStart_Tick(object sender, EventArgs e)
137+
{
138+
var deadZoneInt = (int)reporterState.DeadZone;
139+
deadZoneInt = (deadZoneInt + 1) % Enum.GetValues(typeof(GamePadDeadZone)).Length;
140+
comboDeadZone.SelectedItem = ((GamePadDeadZone)deadZoneInt).ToString();
141+
timerStart.Stop();
142+
}
143+
144+
private void timerBack_Tick(object sender, EventArgs e)
145+
{
146+
checkLink.Checked = !checkLink.Checked;
147+
timerBack.Stop();
148+
}
149+
}
150+
}

XInputReporter/MainForm.resx

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
<metadata name="pollingWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121+
<value>17, 17</value>
122+
</metadata>
123+
<metadata name="timerBack.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124+
<value>146, 17</value>
125+
</metadata>
126+
<metadata name="timerStart.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
127+
<value>251, 17</value>
128+
</metadata>
129+
</root>

XInputReporter/Program.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Windows.Forms;
5+
6+
namespace XInputReporter
7+
{
8+
static class Program
9+
{
10+
/// <summary>
11+
/// The main entry point for the application.
12+
/// </summary>
13+
[STAThread]
14+
static void Main()
15+
{
16+
Application.EnableVisualStyles();
17+
Application.SetCompatibleTextRenderingDefault(false);
18+
Application.Run(new MainForm());
19+
}
20+
}
21+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("XInputReporter")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("XInputReporter")]
13+
[assembly: AssemblyCopyright("Copyright © 2013")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("4c8fcac7-489f-47f9-8ea4-3be32ccec711")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)