Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Change to Joystick Axis Handling  (Read 3929 times)

mweb

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Change to Joystick Axis Handling
« on: August 10, 2006, 01:26:44 AM »

I got a Logitech Dual Action Gamepad and it worked almost good with OIS. The problem is the axis mapping. I got the axis 0 for the first analog controler with X and Y values. But the second analog controller is seperated to the axis 1 and 2 and to make it even worse the digital pad is seperated on the axis 1 and 3. I'm using it on linux.
When i took a look at the source code i saw why, because you need a proper mapping for the axis. Woudn't it be simpler to have a seperate axis every direction of a joystick? This way we woudn't need such a mapping and there woudn't be any problem with other joysticks.
I have seen that on windows we just get the joystick information with the axis joint like in OIS now, but i think it would be simpler to split thows in seperate axis then to have a correct mapping for all joysticks on linux.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Change to Joystick Axis Handling
« Reply #1 on: August 10, 2006, 07:51:49 AM »

Axis are combined into the most obvious pairs as that is what makes sense. However, maybe there is some issue though, and it is not perfect.

If you could post a screenshot of your controller (perhaps labling the axis), and the OIS mapping that you see on Windows, and the ones you see under Linux, I could better understand what you are seeing.
Logged

mweb

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Change to Joystick Axis Handling
« Reply #2 on: August 10, 2006, 11:28:35 AM »



For the axis 0 i got the green one's combined.In the axis 1 the orange two are combined and the red one is the axis 2. On the axis 3 i got the blue one. I hope this helps to show the strange mapping i got.

I know that the idea is to combine the axis in the most obvious way. But woudn't it be simpler to not combine them? this way it would be simple to use the axis as seperate inputs. For example if I want to use the green X axis as throttle and the red axis for steering it would be simpler if i just have each as a seperate one. This is the way i'm used to do it, since it is this way in SDL.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Change to Joystick Axis Handling
« Reply #3 on: August 11, 2006, 11:43:08 AM »

Hmm, that is kindof strange how it maps that way. Do you have access to windows to show what it maps there for your controller under OIS?
Logged

mweb

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Change to Joystick Axis Handling
« Reply #4 on: August 12, 2006, 01:39:46 AM »

Not yet, i have to get everything working first on windows. But I think it will be fine on windows, since this mapping will be done via direct input and the driver from Logitech.

Just to ask again, why do you try to write a config file with the mappings of the joysticks on Linux, why not just split them up on both systems, so we woudn't need to worry about axis mapping on Linux. Just let the input listener handle this them self.
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Change to Joystick Axis Handling
« Reply #5 on: August 12, 2006, 01:44:20 AM »

I have to admit that personally I would prefer to have each axis listed by index number with no directions tied to each other as is, just allows far more control...
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Change to Joystick Axis Handling
« Reply #6 on: August 12, 2006, 07:35:18 AM »

Quote from: "mweb"
Not yet, i have to get everything working first on windows. But I think it will be fine on windows, since this mapping will be done via direct input and the driver from Logitech.

Just to ask again, why do you try to write a config file with the mappings of the joysticks on Linux, why not just split them up on both systems, so we woudn't need to worry about axis mapping on Linux. Just let the input listener handle this them self.


I don't write a config file on linux. Everythng is in code ;) As for why, because that is what directX gives OIS, so to be consistant, I emulated it. Of course, it may be a good idea to look at having each axis be seperated. I'll will look at this in the up coming v1 release.
Logged

mweb

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Change to Joystick Axis Handling
« Reply #7 on: August 13, 2006, 01:00:24 AM »

I know that there is no config file needed yet, but i read in the source commentary that you may do it with config files in the future.

Since you will have look at it in the next release, i'm looking forward to it. Thanks.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Change to Joystick Axis Handling
« Reply #8 on: August 30, 2006, 12:47:11 PM »

I'm seriously considering that all axis values for Joysticks will no longer be paired up. This will be realtively simple in Linux. ALthough, I'm not so sure how I will handle it in windows - but, it will be pretty easy. This will work better for action mapping, as the user could then have the same stick do different things for each axis on it. Plus, it will alliviate the issue of mixed combinations (which, is really a problem under Linux, as there is no standard for what to assign axes with in your drivers, unlike DX which is usually a bit more standardized).

As a side note, I just fixed a button mapping problem under Linux. Now, buttons will be mapped at runtime during the enumeration of buttons, so buttons will not be screwed up if the driver uses wired button values. Although, the device will not be recognised as a joystick if they do not use at least on of the joystick button defines in input/linux.h, as that is the only way I can tell a mouse from a keyboard from a joystick event ;)
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Change to Joystick Axis Handling
« Reply #9 on: August 30, 2006, 04:11:30 PM »

Ok CVS head has been updated for linux only atm, and only the Console demo. Axis is now seperated out :)

Also, I tried to add some simple rescaling code for axes which are not in the -32k to 32k range. As, it does not appear to be possible to cange the min/max values via the Event API (you can sort of, but not really). Let me know of any issues with this please :)

I will sort out the Windows port in a bit.
Logged

mweb

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Change to Joystick Axis Handling
« Reply #10 on: September 03, 2006, 03:25:03 AM »

thanks this sounds just as what i needed. I will have a look at it when i get back to work. I will be away for two more weeks.
Logged

mweb

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Change to Joystick Axis Handling
« Reply #11 on: September 24, 2006, 02:59:50 AM »

I did some testing with the new axis mapping and it looks good for me. also the scaling worked fine in my case.
thx.
You may add the Logiatech Dual Action Joypad to the working joysticks, since it works flawless now (at least on linux, since i coudn't test it on windows yet)
Logged

Nelson

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 1
    • View Profile
Change to Joystick Axis Handling
« Reply #12 on: October 15, 2006, 06:11:15 AM »

I have a similar problem and might go back to 0.7.x instead of 1.0

For me (on Windows using a Logitech Dual Action joystick)

      x1 = arg.state.mAxes[0].abs;
      y1 = arg.state.mAxes[1].abs;
      x2 = arg.state.mAxes[2].abs;
      y2 = arg.state.mAxes[3].abs;

The left joystick map to [x1,y1] - just like 0.7.x - great!

but the second joystick only triggers x2 (axis "2") - in the previous versions it mapa to absZ of the other axes. Anybody have this problem. I embedded the source directly into my project to see what DirectX is doing... it seems fine except something isn't mapped because I have to disable this exception:

#ifdef _DEBUG
   else
   // OIS_EXCEPT(E_General, "Debugging Information: JoyStick Action item not found!");
#endif

P.S Found the "issue" - not sure where this is happening. This fails

std::map<int, int>::iterator it = mAxisMapping.find( diBuff.dwOfs );

because diBuff.dwOfs is "20" when the second joystick Y is used. If I hack it to be "12" (the value of the axis as set in DIEnumDeviceObjectsCallback) then all is well with this specific joystick

   //Loop through all the events
   for(unsigned int i = 0; i < entries; ++i)
   {
      if(diBuff.dwOfs == 20)
      {
         diBuff.dwOfs = 12;
      }


Of course this is not a real fix, but might be okay with my fixed/pre-defined system.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Change to Joystick Axis Handling
« Reply #13 on: October 15, 2006, 07:59:20 AM »

Hmm, I don't know why the enumeration and the capture would report different values. The code there in 1.0 is a big difference from 0.7.x, so it is still slightly experiemental. I may have made some bad assumptions about those values.

Although, it works fine with my joystick here, so is hard to dublicate this :/

Patches are welcome of course.
Logged