Hi,
Please find the attached patches.  The first just adds the config as
before, but with checks to allow for undefined buttons (with negative
indexes).
The second adds a "Remap joystick buttons" button to the sdl joystick
dialog.  This behaves like the existing "Define keys" button.  The
user is guided to press each of the 3 buttons, but can also press the
ESC key for none (which results in a value of -1 being stored and the
button being ignored).   The dialog looks like this:
--------------------------------
Press joystick button 1
or ESC for none...
(was: id 3)
--------------------------------
And then after pressing button 0 (but before releasing):
--------------------------------
Press joystick button 1
or ESC for none...
(now: id 0)
--------------------------------
So as I said, basically consistent with how "Define keys" currently works.
Does this look ok, and can the patches be included?  Obviously happy
to make any further tweaks or change the UI etc.  I should probably
have sent the proposal first, but I got carried away with the coding
and wanted to figure out how the dialogs worked :-)
Any feedback welcome!