I used the following line, I think it's mostly correct now.
Code:
jscal -u 27,0,1,2,5,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,19,302,301,303,300,292,293,294,295,296,299,298,297,291,289,288,290,720,721,722 /dev/input/js0
Also edited buttonmap.cfg, keeping "1" as the button for jump and changing it to "10" for special.
For the people setting up their own controllers: keep in mind the menus and actual game use different codes. It's a mess.