MobiFlight / MobiFlight-Connector

MobiFlight is an open source project that allows you to create your own home cockpit for your favorite flight simulator in a flexible, affordable and extremely user-friendly way.
https://mobiflight.com
MIT License
234 stars 104 forks source link

VJoy buttons don't work anymore #618

Closed pizman closed 2 years ago

pizman commented 2 years ago

Describe the bug When using vJoy as a InputAction, button events will throw an exception and potentiometers will not work with axis.

Steps To Reproduce

  1. Create a Input Config
  2. Select a button
  3. Assign a vJoy Joystick Input Action, including Button
  4. Save
  5. Run MobiFlight
  6. Open Game Controller Settings
  7. Open properties of the virtual Joystick
  8. Press the button

Expected result Button will show active in settings

Actual result Exception is raised.

Additional context Similar is true for the potentiometer.

tigert commented 2 years ago

I noticed generating VJoy button presses work for me now on 9.3.1.

Assigning a pot @ to a vjoy axis does not seem to work.

(Assigning a potentiometer to a VJoy axis might sound silly when you can assign the pot via simconnect, but actually you could have a single-arduino flight control device with input/output panel with switches and leds, and then have the primary flight controls exposed as vJoy axis, so you can calibrate them in the simulator.

A few observations

Setting a HID Joystick device axis to VJoy (to maybe do something with that in mobiflight, like disabling joystick input based on another condition) gives this error:

`************** Exception Text **************
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseUInt32(String value, NumberStyles options, NumberFormatInfo numfmt)
   at System.UInt16.Parse(String s, NumberStyles style, NumberFormatInfo info)
   at MobiFlight.InputConfig.VJoyInputAction.execute(FSUIPCCacheInterface fsuipcCache, SimConnectCacheInterface simConnectCache, MobiFlightCacheInterface moduleCache, InputEventArgs args, List`1 configRefs)
   at MobiFlight.InputConfig.AnalogInputConfig.execute(Fsuipc2Cache fsuipcCache, SimConnectCache simConnectCache, MobiFlightCache moduleCache, InputEventArgs args, List`1 configRefs)
   at MobiFlight.InputConfigItem.execute(Fsuipc2Cache fsuipcCache, SimConnectCache simConnectCache, MobiFlightCache moduleCache, InputEventArgs e, List`1 configRefs)
   at MobiFlight.ExecutionManager.mobiFlightCache_OnButtonPressed(Object sender, InputEventArgs e)
   at MobiFlight.JoystickManager.Js_OnButtonPressed(Object sender, InputEventArgs e)
   at MobiFlight.Joystick.UpdateAxis(JoystickState newState)
   at MobiFlight.Joystick.Update()
   at MobiFlight.JoystickManager.PollTimer_Tick(Object sender, EventArgs e)
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4470.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
MFConnector
    Assembly Version: 9.3.1.0
    Win32 Version: 9.3.1
    CodeBase: file:///C:/MobiFlight/MFConnector.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4488.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4488.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4395.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4341.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4470.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4455.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Numerics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
Newtonsoft.Json
    Assembly Version: 13.0.0.0
    Win32 Version: 13.0.1.25517
    CodeBase: file:///C:/MobiFlight/Newtonsoft.Json.DLL
----------------------------------------
System.Runtime.Serialization
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4455.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
Microsoft.ApplicationInsights
    Assembly Version: 2.17.0.146
    Win32 Version: 2.17.0.00146
    CodeBase: file:///C:/MobiFlight/Microsoft.ApplicationInsights.DLL
----------------------------------------
System.Diagnostics.DiagnosticSource
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0.20.51904
    CodeBase: file:///C:/MobiFlight/System.Diagnostics.DiagnosticSource.DLL
----------------------------------------
System.Xml.Linq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
Microsoft.AI.ServerTelemetryChannel
    Assembly Version: 2.17.0.146
    Win32 Version: 2.17.0.00146
    CodeBase: file:///C:/MobiFlight/Microsoft.AI.ServerTelemetryChannel.DLL
----------------------------------------
System.Web
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4465.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Web/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
FSUIPCClient
    Assembly Version: 3.1.25.341
    Win32 Version: 3.1.25.341
    CodeBase: file:///C:/MobiFlight/FSUIPCClient.DLL
----------------------------------------
ArcazeHid
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/MobiFlight/ArcazeHid.DLL
----------------------------------------
SharpDX.DirectInput
    Assembly Version: 4.2.0.0
    Win32 Version: 4.2.0
    CodeBase: file:///C:/MobiFlight/SharpDX.DirectInput.DLL
----------------------------------------
SharpDX
    Assembly Version: 4.2.0.0
    Win32 Version: 4.2.0
    CodeBase: file:///C:/MobiFlight/SharpDX.DLL
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
CommandMessenger
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/MobiFlight/CommandMessenger.DLL
----------------------------------------
Microsoft.FlightSimulator.SimConnect
    Assembly Version: 10.0.61259.0
    Win32 Version: 10.0.61637.0 (FSX-Xpack.20070926-1421)
    CodeBase: file:///C:/MobiFlight/Microsoft.FlightSimulator.SimConnect.DLL
----------------------------------------
msvcm80
    Assembly Version: 8.0.50727.9680
    Win32 Version: 8.00.50727.9680
    CodeBase: file:///C:/WINDOWS/WinSxS/x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.9680_none_d090cb7c44278b28/msvcm80.dll
----------------------------------------
vJoyInterfaceWrap
    Assembly Version: 0.2.1.6
    Win32 Version: 2.1.6.999
    CodeBase: file:///C:/MobiFlight/vJoyInterfaceWrap.DLL
----------------------------------------
NCalc
    Assembly Version: 1.3.8.0
    Win32 Version: 1.3.8.0
    CodeBase: file:///C:/MobiFlight/NCalc.DLL
----------------------------------------
System.Net.Http
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Net.Http/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Net.Http.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
DocMoebiuz commented 2 years ago

Encoders are linked with #208