mcgurk / Arduino-USB-HID-RetroJoystickAdapter

Arduino joystick/gamepad/other USB-adapter
131 stars 35 forks source link

RetroJoystick #8

Open Denara68 opened 5 years ago

Denara68 commented 5 years ago

In RetroJoystickAdapter_Atari.ino:

How many fire buttons are defined? I see 6 pins for every joystick. So 4 for direction and 2 fire? (Pin A1,A2,3,4 are fire buttons?) //DB9 (8=GND): 1 2 3 4 5 6 7 8 9 const uint8_t inputPinsPort1[] = { 5, 6, 7, 8, A2, 0, 0, 0, 4}; const uint8_t inputPinsPort2[] = {10, 16, 14, 15, A1, 0, 0, 0, 3};

in code: Row 54 = 0x29, 0x01, / USAGE_MAXIMUM (Button 1) Row 56 = 0x25, 0x01, / LOGICAL_MAXIMUM (1) */ \ is it right for 2 fire buttons for every player? (I see Max = 1, but the fire buttons are 2) How is the max number of fire buttos?

Is this plug and play like a real gamepad?

Thanks

truglodite commented 4 years ago

How many fire buttons? Sorry I don't use the Atari code myself, but looking at those inputPinsPortX definitions, it looks like there are enough defines for 2 buttons already. Player 1 gets A2/D4, and Player 2 uses A1/D3?However, from the comments in code it isn't clear if the 2 button atari controllers are even implemented to work with stock 7800 controllers. Here is a link to the schematic of an atari 7800 controller (2 buttons): https://cdn.hackaday.io/images/6787181560388726692.jpg

Note that it reqires using pins 5 and 9, which according to the code comments 5 isn't even defined? Hopefully you can test or RE the code to verify it works, or what needs to be changed to fix if needed.

Max # of fire buttons? Atari didn't really make db9 controllers with more than 2 buttons (other than those video touch pads). So if you want more than 2 you will be talking about a custom circuit (and therefore likely it's no longer compatible with original Atari controlers... and that 3rd button won't be used by any atari games... a better search term for such devices would be the more general 'retro arcade control'). Note most folks doing that just use common zero delay usb arcade adapters. (again, we're talking more generally, not just Atari stuffs).

Plug-n-play? Yep, any joystick adapter made with a 32u4 using the keyboard libraries will automagically show up as a usb HID device (joystick) using native drivers (mac, windows, linux...). The only exception is with linux and dual joystick devices (2 joys 1 usb, which includes this code) need to use either usb quirks so it shows up as 2 joysticks (vs just 1), or change your arduino boards.txt to use a different usb VID/PID that fools linux into seeing it as a dual joystick (see readme). I personally flash all my joystick adapters with the custom VID/PID's, that way I can use them on a friend's system without them having to modify their bootup.

The only issue I've had with the VID/PID thing is in windows, using another code that works with atari paddles, the paddles always both show up as 1 player. So I have to edit emulator mappings to use a second player paddle. Otherwise, the 2 ports properly appear as 2 separate controllers.