Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://pastebin.com/44vJWEBq
- Add a joystick to 'The C64' or modify one.
- o==========o
- | Contents |
- o==========o
- A. Determine numbers
- B. gamecontrollerdb.txt
- C. Examples
- THEC64 joystick
- iBuffalo SNES controller clone
- Monster Joysticks converter
- X. References
- o======================o
- | A. Determine numbers |
- o======================o
- 1. Linux: use 'dmesg'. Example for the Monsterjoysticks DB9 to USB converter (for my Atari 2600 joystick) [1]:
- hid-generic 0003:16C0:27DC.000D: input,hidraw5: USB HID v1.01 Joystick [Monster Joysticks MJ2DB9]
- Example iBuffalo gamepad clone of SNES controller:
- hid-generic 0003:0583:2060.000F: input,hidraw5: USB HID v1.10 Joystick [USB,2-axis 8-button gamepad ]
- Example THEC64 joystick:
- hid-generic 0003:1C59:0024.0011: input,hidraw5: USB HID v1.10 Joystick [ THEC64 Joystick THEC64 Joystick ]
- 2. Info from the THEC64 using X-Windows mod (in hex) for the Monster Joysticks MJ2DB9:
- Input driver version: 1.0.1
- Input device ID: bus: 3, vendor: 16C0, product: 27DC, version: 101
- So the fourth number (000D_hex) isn't used...
- 3. Use in Linux:
- jstest /dev/input/js0
- to determine the numbers of the axis and the buttons.
- o=========================o
- | B. gamecontrollerdb.txt |
- o=========================o
- 1. Start THEC64 w/ X-Windows mod [2].
- 2. Backup
- /usr/share/the64/ui/data/gamecontrollerdb.txt
- to the USB stick.
- Wait a minute. Appears to be the folder (?!):
- /media/the64/ui/data/gamecontrollerdb.txt
- 3. Edit this file. You must make an SDL2 mapping for this joystick because there is none in the world yet...
- 4. The entries beginning with an "a" are axis and those with a "b" are buttons. The Atari has an X and a Y axis (a0 and a1) and one Fire button (b0). In Linux one can determine these w/ "jstest /dev/input/js0".
- 5. Now determine the UID of the controller. Dmesg in Linux gave us for the ID's:
- 0003:16C0:27DC.000D
- The ID's in gamecontrollerdb.txt are in lowbyte/highbyte form. So, for instance, the hexadecimal number 16C0 becomes C016 in gamecontrollerdb.txt.
- 6. The lowbyte/highbyte numbers are followed by four zero's. The file 'gamecontrollerdb.txt' uses the first 3 hex numbers from Dmesg (i.e. bus ID, vendor ID and product ID's) and as a forth the HID version/input driver version (in this case 0101), also followed by 4 0's. The fourth ID from Dmesg (in this case 000D) is discarded.
- 7. So we now have:
- 0003:16C0:27DC 0101 --> 0300 0000 C016 0000 DC27 0000 0101 0000
- = 03000000C0160000DC27000001010000 (32 numbers)
- 8. I advise to use the SDL2 terms "lefttrigger" or "leftshoulder" for the Fire button (this is why the SNES controller uses a weird mapping) and "leftx" or "dpleft" for the stick. See examples below. Should work...
- 9. So now we have:
- 03000000c0160000dc27000001010000,Monster Joysticks MJ2DB9,a:b1,b:b4,back:b6,leftx:a0,lefty:a1,leftshoulder:b0,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Linux,
- 10. Note: the file is CaSe SeNsItIvE!!!!
- 11. Should work now.
- o=============o
- | C. Examples |
- o=============o
- THEC64 joystick
- ~~~~~~~~~~~~~~~
- ID in gamecontrollerdb.txt: 03000000591c00002300000010010000
- a:b4,b:b5,back:b6,lefttrigger:b0,leftx:a0,lefty:a1,righttrigger:b1,start:b7,x:b3,y:b2
- ________________________________________________________________
- gamecontrollerdb: Linux: The C64 joystick:
- ________________________________________________________________
- leftx a0 Joy x-axis
- lefty a1 Joy y-axis
- lefttrigger b0 Left fire button (!)
- righttrigger b1 Right fire button (!)
- a,b b4, b5 Little round button 1 and 2 (a & b)
- (= Folder up & Run in C64 menu)
- back b6 Little round button 3 (= c)
- (= Fast Loader disable in C64 menu)
- start b7 Little round button 4 (= d)
- (= Menu/return in C64 menu)
- x, y b3, b2 Right & Left little triangle
- _______________________________________________________________
- Remark: on the The C64 joystick the big round fire buttons are
- actually shoulder (trigger) buttons!
- The C64 fire button may be called "lefttrigger" or "leftshoulder". They are probably terms from SDL2. Possibilities appear to be (source code 'The C64' firmware):
- static tsf_input_name_t input_name_map[] = {
- { INPUT_X, 1, "x"},
- { INPUT_Y, 1, "y"},
- { INPUT_A, 1, "a"},
- { INPUT_B, 1, "b"},
- { INPUT_BACK, 4, "back"},
- { INPUT_GUIDE, 5, "guide"},
- { INPUT_START, 5, "start"},
- { INPUT_DIG_LEFT, 6, "dpleft"},
- { INPUT_DIG_RIGHT, 7, "dpright"},
- { INPUT_DIG_UP, 4, "dpup"},
- { INPUT_DIG_DOWN, 6, "dpdown"},
- { INPUT_SHLD_LEFT, 12, "leftshoulder"},
- { INPUT_TRIG_LEFT, 11, "lefttrigger"},
- { INPUT_SHLD_RIGHT, 13, "rightshoulder"},
- { INPUT_TRIG_RIGHT, 12, "righttrigger"},
- { INPUT_STICK_LEFT, 9, "leftstick"},
- { INPUT_STICK_RIGHT, 10, "rightstick"},
- { INPUT_AXIS_LEFT_X, 5, "leftx"},
- { INPUT_AXIS_LEFT_Y, 5, "lefty"},
- { INPUT_AXIS_RIGHT_X, 6, "rightx"},
- { INPUT_AXIS_RIGHT_Y, 6, "righty"}
- iBuffalo SNES controller clone
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ID in gamecontrollerdb.txt: 03000000830500006020000010010000
- a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2
- ________________________________________________________
- gamecontrollerdb: iBuffalo controller: Linux:
- ________________________________________________________
- leftshoulder Left shoulder b4
- rightshoulder Right shoulder b5
- a,b B, A (!) b1, b0
- x, y X, Y b2, b3
- back (= c) Select b6
- start (= d) Start b7
- dpleft & R D-Pad L & R -a0, +a0
- dpup & D D-Pad U & D
- ________________________________________________________
- Remark: so the shoulder buttons of the iBuffalo are mapped to the fire button in a Commodore computer (which sucks!).
- Monster Joysticks converter
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 03000000c0160000dc27000001010000,Monster Joysticks MJ2DB9,a:b1,b:b4,back:b6,leftx:a0,lefty:a1,leftshoulder:b0,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Linux,
- o===============o
- | X. References |
- o===============o
- [1] Determine joystick particulars:
- https://thec64community.online/thread/4/modding-thec64-mini?page=1&scrollTo=8
- [2] About X-Windows mod:
- https://thec64community.online/thread/487/thec64-windows-mod
- [3] Forum entry 'bout terms to use in gamecontrollerdb.txt:
- https://thec64community.online/thread/470/db9-adapter-problem-after-upgrade?page=2
- [4] Joystick bugs and quirks:
- https://thec64community.online/thread/840/joystick-bugs-quirks
- [5] My Lemon64 forum post:
- https://www.lemon64.com/forum/viewtopic.php?t=75792&hilit=monster+joysticks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement