Skip to content

Commit

Permalink
bugfix: Improve CD32 default mapping (fixes #1237)
Browse files Browse the repository at this point in the history
Amiberry would check if the button exists on the controller, before assigning a default mapping to it (like WinUAE does). In that check, it would also see if the button was reported as an axis, and in that case it would exclude it.
However, with some controllers that ended up having buttons not having a mapping on them, like the "Retroflag Classic USB gamepad", which reported RShoulder as such a case.

To fix this, I'm removing the check for the "isrealbutton" and instead provide the mapping directly. If the button doesn't exist, the event will never get triggered anyway, so this should be safe to do.
  • Loading branch information
midwan committed May 3, 2024
1 parent 957ee04 commit dce1aa8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/osdep/amiberry_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1472,15 +1472,15 @@ int input_get_default_joystick(struct uae_input_device* uid, int i, int port, in
if (isrealbutton(did, SDL_CONTROLLER_BUTTON_B)) {
setid(uid, i, ID_BUTTON_OFFSET + SDL_CONTROLLER_BUTTON_B, 0, port, port ? INPUTEVENT_JOY2_CD32_BLUE : INPUTEVENT_JOY1_CD32_BLUE, gp);
}
if (isrealbutton(did, SDL_CONTROLLER_BUTTON_X))
//if (isrealbutton(did, SDL_CONTROLLER_BUTTON_X))
setid(uid, i, ID_BUTTON_OFFSET + SDL_CONTROLLER_BUTTON_X, 0, port, port ? INPUTEVENT_JOY2_CD32_GREEN : INPUTEVENT_JOY1_CD32_GREEN, gp);
if (isrealbutton(did, SDL_CONTROLLER_BUTTON_Y))
//if (isrealbutton(did, SDL_CONTROLLER_BUTTON_Y))
setid(uid, i, ID_BUTTON_OFFSET + SDL_CONTROLLER_BUTTON_Y, 0, port, port ? INPUTEVENT_JOY2_CD32_YELLOW : INPUTEVENT_JOY1_CD32_YELLOW, gp);
if (isrealbutton(did, SDL_CONTROLLER_BUTTON_LEFTSHOULDER))
//if (isrealbutton(did, SDL_CONTROLLER_BUTTON_LEFTSHOULDER))
setid(uid, i, ID_BUTTON_OFFSET + SDL_CONTROLLER_BUTTON_LEFTSHOULDER, 0, port, port ? INPUTEVENT_JOY2_CD32_RWD : INPUTEVENT_JOY1_CD32_RWD, gp);
if (isrealbutton(did, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER))
//if (isrealbutton(did, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER))
setid(uid, i, ID_BUTTON_OFFSET + SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, 0, port, port ? INPUTEVENT_JOY2_CD32_FFW : INPUTEVENT_JOY1_CD32_FFW, gp);
if (isrealbutton(did, SDL_CONTROLLER_BUTTON_START))
//if (isrealbutton(did, SDL_CONTROLLER_BUTTON_START))
setid(uid, i, ID_BUTTON_OFFSET + SDL_CONTROLLER_BUTTON_START, 0, port, port ? INPUTEVENT_JOY2_CD32_PLAY : INPUTEVENT_JOY1_CD32_PLAY, gp);
}

Expand Down

0 comments on commit dce1aa8

Please sign in to comment.