Dolphin, the GameCube and Wii emulator - Forums

Full Version: [Solved] XInput interface issue with minus axis value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

EmmanuelIstace

Hi,

I'm currently working on a project, bascially an arduino based interface for 2 Nes pads, 2 Snes pads, 4 N64 pads and 4 GC pads.
To accomplish that, I'.. hum wait, the next schema will me more clear :

[Image: Architecture.png]


So basically, my arduino send me through serial the pads status, a little client on the pc read the serial port and give that to a Feeder. vJoy allow me to emulate XInput pads and I have an SDK allowing me to control them. So, once I have the pad status on the computer I just feed the vJoy virtual pad which relly on the standard XInput HAL and on the emulator just see it as a classical XInput device so he can use it.

This is working for Nestopia, Zsnes and Project64 and working approximatively fine for Dolphin.
The buttons are ok and he can read the axis but only the positives ones !


Let's take an example with the X axis.
Dolphin XInput plugin correctly detect the X+ and X-. On the X+ axis everything work fine. But on the X- axis there's a problem, if I send -1 or -100 it's the same result, the joystick is considered as totally "down", no graduation.

For the moment I've used a workaround by mapping 4 axis per stick and only using the positive part of them, that work fine. The problem is I have a maximum of 8 Axis and the GC pad have 10 axis, 4 for the stick, 4 for the c-stick and 2 for L and R...

So I'm wondering if it's a known issue and if there's some workaround ?

If not I'm planning to develop my own input plugin, I've downloaded the source code and start to figure how it work, but is there some documentation about it ? Is there's a specific interface I just need to implement and drop the dll with the implementation in a plugin folder ?

Thank you in advance for all your answers ! I'm a bit desesperate :'(

Grtz from Belgium
EIS


EDIT
A little precision, it's on Dolphin 4.0 x64 - Build 23/09/2013 @ 20:20:40 and I'm in Windows 8.1 X64
Wild guess: are you sure it's not expecting floating point values instead of integer values?

EmmanuelIstace

I will check that, I'm actually trying to compile dolphin and put a break point to see what's the value required and received by dolphin and adapt it if needed.

But I can't on my side change that, I send integer with vJoy, I have the vJoy source but a lot of ASM and code is really complex and as I really don't have a good knowledge of the windows driver foundation I can't adapt it easily.

But if it's the case, why is it working for positive values ? (only negatives values "sucks")

EmmanuelIstace

HURRAY !

I think it's solved, it's a bit similar to an issue I had on the GC controller data reading.
So, If I'm right, they read the axis in a "strange way" will say.
So 0 is not 0, 0 is -MaxAxe. 0 = +MaxAxe/2.
For instance, -Y = 0, 0 = 12800, +Y = 25600
So just need to scale my value on that and it's working ! Big Grin

PErhap's related to vJoy or XInput or Dolphin, anyway, that seems to do the job and from my client point of view I can do that without consuming too many CPU cycles. (want to stay under 10ms latency per controller to have a total maximum latency of 40ms f 4 controllers plugged in) And will not impact the performances of the machine too (to keep resources for emulators, actually consuming 10% of one CPU Core, 15Mb of ram)

tidalwave41

I'm trying to make a similar project where I am basically building a custom GC controller and having it connect to my computer via USB through an Arduino. I have very little experience in programming and was wondering if you could give me any advice about where to start with regards to how to get the Arduino to communicate with Dolphin?