This project is read-only.

"Hat 0 Up" fix?

Sep 11, 2012 at 4:21 AM

I can't use my USB Twin USB controller on PCSX-R for Mac because whenever I click to configure a button, it gets set as Hat 0 Up automatically. How do I fix this? I even went so far as to download and compile the latest revision but that didn't solve it either.

I know some of you might suggest that this is a stuck button or something but I'm using this very same controller on PCSX-R on Windows via Bootcamp. No issues.

Anyone care to shed some light here?

Nov 4, 2012 at 3:07 PM

I'm still having this issue. Anybody?

Nov 6, 2012 at 11:27 AM
Edited Nov 6, 2012 at 11:32 AM

try removing this code in macosx/plugins/DFInput/macsrc/cfg.c (I did not test this when I wrote this code as I don't have a joystick with hat switches) and recompile:

            for (i = 0; i < SDL_JoystickNumHats(js); i++) {
                axis = SDL_JoystickGetHat(js, i);
                if (axis != SDL_HAT_CENTERED) {
                    g.cfg.PadDef[padnum].KeyDef[key].JoyEvType = HAT;

                    if (axis & SDL_HAT_UP) {
                        g.cfg.PadDef[padnum].KeyDef[key].J.Hat = ((i << 8) | SDL_HAT_UP);
                    } else if (axis & SDL_HAT_DOWN) {
                        g.cfg.PadDef[padnum].KeyDef[key].J.Hat = ((i << 8) | SDL_HAT_DOWN);
                    } else if (axis & SDL_HAT_LEFT) {
                        g.cfg.PadDef[padnum].KeyDef[key].J.Hat = ((i << 8) | SDL_HAT_LEFT);
                    } else if (axis & SDL_HAT_RIGHT) {
                        g.cfg.PadDef[padnum].KeyDef[key].J.Hat = ((i << 8) | SDL_HAT_RIGHT);

                    changed = 1;
                    goto end;

Nov 6, 2012 at 12:05 PM
Edited Nov 6, 2012 at 12:06 PM

Hi, I just realized, you were the one who authored DFInput (on the code comments). Awesome! However, I tried removing that piece of code (by commenting it out). And sure enough, it doesn't trigger the "Hat 0 Up" anymore, but now, when I match it with the buttons on my gamepad, it just gives me the keyboard keys I defined for certain buttons on the previous version of DFInput. For example, I made it so that the Up,Down,Left,Right is set to WASD. So when I try to set the Up arrow on this newly recompiled DFInput with the modified source, it shows me the old mapping Keyboard: W instead of Joystick: Hat 0 Up.

Anyway, I thought it was just a display problem caused by the edited source so I ignored it and pushed on. Then came when I have to set the analog sticks. When I try to set the analog sticks mapping, it again came with the "Hat 0 Up" thing automatically triggering. This is the case for both the analog sticks (left and right). As soon as I double click on their entry, it automatically sets it to "Hat 0 Up".

Image for reference: