-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added topology.xml and buttonmap.xml #5
Conversation
Nice! The XML is meant to represent the "source of truth" of the cpp. This is because libretro doesn't have as extensive or consistent of an input API, so we have to extract a lot of the data by hand. In this case, the source is:
First, lets find the device map in the source. It is: https://github.com/libretro/libretro-atari800/blob/master/libretro/libretro-core.c#L26-L27 #define RETRO_DEVICE_ATARI_KEYBOARD RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_KEYBOARD, 0)
#define RETRO_DEVICE_ATARI_JOYSTICK RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1) This uses libretro's fundamental device abstraction. See https://github.com/libretro/RetroArch/blob/master/libretro-common/include/libretro.h#L86-L102. So the buttonmap should be: <controller id="game.controller.atari.2600" type="RETRO_DEVICE_JOYPAD" subclass="1">
<controller id="game.controller.keyboard" type="RETRO_DEVICE_KEYBOARD" subclass="0"> Then the topology. There are four ports: https://github.com/libretro/libretro-atari800/blob/master/libretro/libretro-core.c#L104-L110 static const struct retro_controller_info ports[] = {
{ p1_controllers, 2 }, // port 1
{ p2_controllers, 2 }, // port 2
{ p3_controllers, 2 }, // port 3
{ p4_controllers, 2 }, // port 4
{ NULL, 0 }
}; so topology.xml should have ports "3" and "4". The rest of the buttonmap is a little harder. The mapping is here: https://github.com/libretro/libretro-atari800/blob/master/libretro/core-mapper.c#L407 for (i = 0; i < (RETRO_DEVICE_ID_JOYPAD_R3+1); i++) It scans for every button on the retropad. So the buttonmap should have entries for all 16 buttons: https://github.com/libretro/RetroArch/blob/master/libretro-common/include/libretro.h#L188-L203 #define RETRO_DEVICE_ID_JOYPAD_B 0
#define RETRO_DEVICE_ID_JOYPAD_Y 1
#define RETRO_DEVICE_ID_JOYPAD_SELECT 2
#define RETRO_DEVICE_ID_JOYPAD_START 3
#define RETRO_DEVICE_ID_JOYPAD_UP 4
#define RETRO_DEVICE_ID_JOYPAD_DOWN 5
#define RETRO_DEVICE_ID_JOYPAD_LEFT 6
#define RETRO_DEVICE_ID_JOYPAD_RIGHT 7
#define RETRO_DEVICE_ID_JOYPAD_A 8
#define RETRO_DEVICE_ID_JOYPAD_X 9
#define RETRO_DEVICE_ID_JOYPAD_L 10
#define RETRO_DEVICE_ID_JOYPAD_R 11
#define RETRO_DEVICE_ID_JOYPAD_L2 12
#define RETRO_DEVICE_ID_JOYPAD_R2 13
#define RETRO_DEVICE_ID_JOYPAD_L3 14
#define RETRO_DEVICE_ID_JOYPAD_R3 15 The lower-case part of the buttonmap is the "feature name" found in the controller topology project: Those entries should be matched up in buttonmap.xml. If not everything fits, then game.controller.atari.2600 should be extended, or a new controller add-on introduced. Note that the emulator uses the analog sticks too, so those could be mapped as well: https://github.com/libretro/libretro-atari800/blob/master/libretro/core-mapper.c#L437-L439
Also, you could add mouse support: https://github.com/libretro/libretro-atari800/blob/master/libretro/core-mapper.c#L514C5-L521C5 mouse_wu = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_WHEELUP);
mouse_wd = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_WHEELDOWN);
mouse_x = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
mouse_y = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y);
mouse_l = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT);
mouse_r = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT); |
@garbear I have made some changes. I changed to However, I haven't figured out how to map the analog stick. In addition I', not sure about the mouse, especially |
@Heckie75 I found another user trying to get Atari 800 working: https://forum.kodi.tv/showthread.php?tid=376031 We need controller profiles for atari 800 and atari 5200 controllers. Can you link my any pictures or documentation of these? I've never actually used either. |
@garbear I pushed this merge request with bottonmap and topoloy months ago. Both work for me. Why hasn't it been merged yet? |
It would be nice if we had atari 800/5200 controllers instead of using game.default, but this fixes input, so I'll merge and we can improve later. |
Sorry it took so long to merge, totally forgot about this one until the forum atari800 user popped up and I rediscovered this. For future reference, I made the following changes (be0c949):
I'll do a release of atari800 so this change will go out on the mirrors. EDIT: Version 3.1.0.33 has the buttonmaps. |
@Heckie75 The forum user and I are working on Atari 800 controller profiles so the user can see the historic controller in the GUI attached to the Atari 800 instead of an anachronistic xbox controller: https://forum.kodi.tv/showthread.php?tid=376031&pid=3182024#pid3182024 Once we create the profiles would you be able to update the XML here to use the atari controllers? |
I got swamped with work and travel the last 3 months, but I'm now pushing out the best of our work so far to production servers. Testing will be possible on all platforms. New tracking issue here: kodi-game/controller-topology-project#303 |
Added topogogy.xml and buttonmap.xml especially in order to make special keys like
start
,select
andoption
work. See also #4@garbear