Atari800 Emulator - How to map functions keys (Start, Option, Select) to Joystick?
#1
I successfully put the Atari800/5200 emulator into operation and was so happy that finally my most favorite game of my childhood "Caverns of Mars" was appeearing on my tv within Kodi. I have a BT gamepad connected. 

In order to start the game I would have to press functions keys like "start" or "select" or "option" on orginal HW. 
Where are these keys mapped to? Or how can I create a respective mapping to unsused keys on my BT gamepad? 

Thx in advance, o.
Reply
#2
(2024-01-24, 14:22)olili Wrote: Where are these keys mapped to?

By default, we use the "retropad" abstraction offered by Libretro. However, Kodi supports the ability to provide some XML to customize input for the emulator.

I added a tool in v21 called the "Player Viewer". You can access the latest version of it by using the latest v21 nightly, or grabbing one of my v20/v21 test builds from here: https://github.com/garbear/xbmc/releases

Here's what input currently looks like for the atari800 emulator, which I assume you're using:

Image

You can see that Kodi doesn't know anything about atari800, so it simply passes through the default controller, and atari800 translates it here: https://github.com/libretro/libretro-ata....c#L45-L60

We'll need to modify the Ports bar to show Atari800 and Atari5200 controllers.

(2024-01-24, 14:22)olili Wrote: Or how can I create a respective mapping to unsused keys on my BT gamepad? 

I've never owned an Atari, so I need help customizing the input.

Reading the source of atari800, it looks like there is 4 controller ports, and each one can accept an Atari 800 controller or Atari 5200 controller.

The first step is to add these two controllers to the Controller Topology Project so they can be seen in Kodi. You can also try using the Controller Configuration Utility (settings -> system -> input -> configure controllers) to see if an existing controller can be used or tweaked for either of these.

Are you able to follow the templates in that repo and create these two controllers yourself? If not, can you describe the two controllers and link to pictures or documentation that describes the buttons?
RetroPlayer releases: https://github.com/garbear/xbmc/releases

Donations: eigendude.eth
Reply
#3
Additionally, I found an issue I forgot about that adds the XML for atari800 (though we still need add-ons for the Controller Topology Project): https://github.com/kodi-game/game.libret...800/pull/5
RetroPlayer releases: https://github.com/garbear/xbmc/releases

Donations: eigendude.eth
Reply
#4
Dear Garbear,

1st of all many thanks for your support. 
I'm not so fmailar with all this mapping at kosi, even understaanding the priciples behind. 
Maybe it is better that you will guide me a little bit. 

The ATRI800 Joystick is similar to the VCS2600 except the Hardware keys. 
Mapping libretto joystick codes to the  VCS2600 xml would lead to something like this :


 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<layout label="30000" image="layout.png" mask="mask.png">
<category name="face" label="35074">
<button name="RETRO_DEVICE_ID_JOYPAD_B" type="digital" label="30001"/>
<button name="RETRO_DEVICE_ID_JOYPAD_UP" type="digital" label="30002"/>
<button name="RETRO_DEVICE_ID_JOYPAD_RIGHT" type="digital" label="30003"/>
<button name="RETRO_DEVICE_ID_JOYPAD_DOWN" type="digital" label="30004"/>
<button name="RETRO_DEVICE_ID_JOYPAD_LEFT" type="digital" label="30005"/>
</category>
<category name="hardware" label="35107">
<button name="RETRO_DEVICE_ID_JOYPAD_SELECT" type="digital" label="30006"/>
<button name="RETRO_DEVICE_ID_JOYPAD_START" type="digital" label="30007"/>
</category>
</layout>

But I have no glue how to proceed. Can you help? O
Reply
#5
(2024-01-29, 21:07)olili Wrote: Mapping libretto joystick codes to the  VCS2600 xml would lead to something like this :

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<layout label="30000" image="layout.png" mask="mask.png">
<category name="face" label="35074">
<button name="RETRO_DEVICE_ID_JOYPAD_B" type="digital" label="30001"/>
<button name="RETRO_DEVICE_ID_JOYPAD_UP" type="digital" label="30002"/>
<button name="RETRO_DEVICE_ID_JOYPAD_RIGHT" type="digital" label="30003"/>
<button name="RETRO_DEVICE_ID_JOYPAD_DOWN" type="digital" label="30004"/>
<button name="RETRO_DEVICE_ID_JOYPAD_LEFT" type="digital" label="30005"/>
</category>
<category name="hardware" label="35107">
<button name="RETRO_DEVICE_ID_JOYPAD_SELECT" type="digital" label="30006"/>
<button name="RETRO_DEVICE_ID_JOYPAD_START" type="digital" label="30007"/>
</category>
</layout>

@olili Thanks for the XML, this is something I can work with. If you can pattern-match your way from existing examples to what you just created, then you'll be a rockstar at getting input to work in Kodi. It's a large system with a lot of pieces but everything is backed by pure descriptive data in XML files.

A GitHub user greatly improved input in atari800: https://github.com/kodi-game/game.libret...800/pull/5 . Can you update game.libretro.atari800 to version 3.1.0.33 (on the mirrors in a few hours) and give input a test to see how we're doing?
(2024-01-29, 21:07)olili Wrote: I'm not so fmailar with all this mapping at kosi, even understaanding the priciples behind. 
Maybe it is better that you will guide me a little bit. 

Let's get your XML in action. I see you found the Controller Topology Project. Our first step is to create new add-ons in this repo. The add-ons will go in the folder addons/ with the other controllers.

The very first question is, what IDs should we give the new controllers?

This depends on how many controllers we want to create right now. Do the Atari 800 and Atari 5200 have two different controllers, or could we save work by combining them into a single controller?

What should we do for the keyboard and mouse? Use the default keyboard/mouse add-ons like DOSBox does? Or create a custom keyboard profile specific to the Atari? Does the Atari support a mouse?
(2024-01-29, 21:07)olili Wrote: The ATRI800 Joystick is similar to the VCS2600 except the Hardware keys.

Hardware keys are a little tricky. The problem is that libretro cores use the libretro API which doesn't have any concept of hardware input, unlike Kodi.

For the Atari 2600, I solved it by adding the hardware buttons to the controller profile (https://github.com/kodi-game/controller-...layout.xml ):
 
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<layout label="30000" image="layout.png" mask="mask.png">
  <category name="face" label="35074">
    <button name="fire" type="digital" label="30001"/>
    <button name="up" type="digital" label="30002"/>
    <button name="right" type="digital" label="30003"/>
    <button name="down" type="digital" label="30004"/>
    <button name="left" type="digital" label="30005"/>
  </category>
  <category name="hardware" label="35107">
    <button name="select" type="digital" label="30006"/>
    <button name="reset" type="digital" label="30007"/>
    <button name="color" type="digital" label="30008"/>
    <button name="bw" type="digital" label="30009"/>
    <button name="leftdifficultya" type="digital" label="30010"/>
    <button name="leftdifficultyb" type="digital" label="30011"/>
    <button name="rightdifficultya" type="digital" label="30012"/>
    <button name="rightdifficultyb" type="digital" label="30013"/>
  </category>
</layout>

Do I assume correctly in that an Atari 800 controller is basically the same as a 2600 controller but with different hardware buttons?
RetroPlayer releases: https://github.com/garbear/xbmc/releases

Donations: eigendude.eth
Reply
#6
Also, notice the difference in button names between your XML and mine. We do what your XML does, but in two steps. To handle all game controllers for all emulators we basically split mapping in two:

First joystick driver input is converted into a controller from the Controller Topology Project. Notice that it uses lowercase names for button IDs.

In the second step, these lowercase names are then mapped to libretro API buttons like RETRO_DEVICE_ID_JOYPAD_B. For example, see buttonmap.xml and topology.xml for how Stella maps the face button to RETRO_DEVICE_ID_JOYPAD_B: https://github.com/kodi-game/game.libret.../resources

The hard part is that this data usually has to come from the core's sourcecode: https://github.com/libretro/libretro-ata...core.c#L49 . But I can take care of this if you help with the controller profiles in the Controller Topology Project.
RetroPlayer releases: https://github.com/garbear/xbmc/releases

Donations: eigendude.eth
Reply
#7
Dear Garbear,

once again many thanks for your great support and engagement.

Yes, you are right: an Atari 800 controller is the same as a 2600 controller but with different hardware buttons. You can connect 4 Joysticks to Ataris400/800.

I have latest LibreElec for Raspi4 installed. This is not offering update of Addon to v3.1.0.33.
Do you have any hint where I can download the updated Addon for Raspi4/arm directly? 

O.
Reply
#8
(2024-02-02, 11:12)olili Wrote: Yes, you are right: an Atari 800 controller is the same as a 2600 controller but with different hardware buttons. You can connect 4 Joysticks to Ataris400/800.

I'll see if I can create an atari 800 controller add-on. Should it use the same picture as the 2600 controller?

Image

I discovered we already have a 5200 controller add-on. Is this what it looks like?

Image
(2024-02-02, 11:12)olili Wrote: I have latest LibreElec for Raspi4 installed. This is not offering update of Addon to v3.1.0.33.
Do you have any hint where I can download the updated Addon for Raspi4/arm directly? 

I sent a PR to LibreELEC that bumps atari800 to v3.1.0.33: https://github.com/LibreELEC/LibreELEC.tv/pull/8580 . I'll also see if I can backport to LibreELEC v11.
RetroPlayer releases: https://github.com/garbear/xbmc/releases

Donations: eigendude.eth
Reply
#9
sorry for being imprecise: I'm using LibreELEC 11 - latest released version. 

Atari5200 HW and Atari 800 are slightly different - One diferrence are joysticks.
Atari 800 is a Homecomputer with Keyboard (incl the Functionkeys Start, Option, Select, Reset) and 4 Joystick ports ala VCS2600 (4 Directions, 1Fire)   
Atari 5200 is a Game Console, supporting only cartridges, with the complex Joysticks you have shown. 

A nerdy ATARI-fan will only know and use Atari400/800. The Games for 5200 are moostly ported Atari800 roms. 

Can I somehow support you for solving my problem? 

Once again - BIG THANKS that you support me bringing back my childhood. 
O.
Reply
#10
(2024-02-03, 12:31)olili Wrote: sorry for being imprecise: I'm using LibreELEC 11 - latest released version. 

Roger, I'll backport the atari800 bump (and indeed all other game add-ons) to LE 11.

(2024-02-03, 12:31)olili Wrote: Atari5200 HW and Atari 800 are slightly different - One diferrence are joysticks.
Atari 800 is a Homecomputer with Keyboard (incl the Functionkeys Start, Option, Select, Reset) and 4 Joystick ports ala VCS2600 (4 Directions, 1Fire)   
Atari 5200 is a Game Console, supporting only cartridges, with the complex Joysticks you have shown. 

A nerdy ATARI-fan will only know and use Atari400/800. The Games for 5200 are moostly ported Atari800 roms. 

Very descriptive, thank you. As a millennial I started gaming by sneaking over to my friends house to play his SNES and genesis, so most older consoles are a mystery to me. But I love learning about them, and the education really draws me to this project.

I'll direct you to the Controller Configuration Utility (Settings -> System -> Input -> Configure attached controllers). My goal was for this to not just be useful, but educational as well. I've created small aphorisms for all controllers, with the goal of including the year they were introduced a quick tidbit about the controller, ideally something funny or entertaining. You can see my Atari 2600 and Atari 5200 work:


Image


Image


When you scroll through the controllers, you get an overview basically of the entire history of game controllers. I jokingly call the dialog my "Controller History Museum".
 
(2024-02-03, 12:31)olili Wrote: Can I somehow support you for solving my problem? 

I think I've got it from here. The next step is to go deep in the code and create an XML representation of how the atari800 emulator handles input for all possible cases. It's probably gonna be half a day of reading C code, not something most people would help with.

One way you could support is by hitting that "Get all" button in the controller configuration utility. This dialog is the best visualization of the entire Controller Topology Project. Any feedback, suggestions or additions can quickly and easily be integrated into the project and will show up in this window. Everything here is used downstream by all our emulators, so it really impacts our entire libretro ecosystem.

Specifically, think of any modification you'd make to improve the Atari experience in this window.
RetroPlayer releases: https://github.com/garbear/xbmc/releases

Donations: eigendude.eth
Reply
#11
(2024-02-04, 01:42)garbear Wrote: It's probably gonna be half a day of reading C code, not something most people would help with.

So it was more like a full day, but I've created an Atari 800 controller and updated the Atari 5200 controller, plus creating buttonmaps for both the atari800 and a5200 emulators.

You can see the work at https://github.com/kodi-game/controller-...t/pull/292 . Let me know if you have any feedback.

Here's the Atari 800 controller layout:
 
Code:
<layout label="30000" image="layout.png" mask="mask.png">
  <category name="face" label="35074">
    <button name="fire1" type="digital" label="30001"/>
    <button name="fire2" type="digital" label="30002"/>
  </category>
  <category name="joysticks" label="35073">
    <button name="up" type="digital" label="30003"/>
    <button name="right" type="digital" label="30004"/>
    <button name="down" type="digital" label="30005"/>
    <button name="left" type="digital" label="30006"/>
  </category>
  <category name="hardware" label="35108">
    <button name="start" type="digital" label="30007"/>
    <button name="select" type="digital" label="30008"/>
    <button name="option" type="digital" label="30009"/>
  </category>
  <category name="hardware" label="35150">
    <button name="space" type="digital" label="30010"/>
    <button name="return" type="digital" label="30011"/>
    <button name="escape" type="digital" label="30012"/>
    <button name="menu" type="digital" label="30013"/>
    <button name="help" type="digital" label="30014"/>
  </category>
  <category name="offscreen" label="10103">
    <button name="togglevkbd" type="digital" label="30015"/>
  </category>
</layout>

Here's the updated Atari 5200 controller layout:
 
Code:
<layout label="30000" image="layout.png" mask="mask.png">
  <category name="face" label="35074">
    <button name="fire1" type="digital" label="30017"/>
    <button name="fire2" type="digital" label="30018"/>
    <button name="start" type="digital" label="30013"/>
    <button name="pause" type="digital" label="30014"/>
    <!-- Note: Reset button is performed via Reset from the in-game OSD -->
  </category>
  <category name="joysticks" label="35073">
    <button name="up" type="digital" label="30019"/>
    <button name="right" type="digital" label="30020"/>
    <button name="down" type="digital" label="30021"/>
    <button name="left" type="digital" label="30022"/>
  </category>
  <category name="keypad" label="35109">
    <button name="num1" type="digital" label="30001"/>
    <button name="num2" type="digital" label="30002"/>
    <button name="num3" type="digital" label="30003"/>
    <button name="num4" type="digital" label="30004"/>
    <button name="num5" type="digital" label="30005"/>
    <button name="num6" type="digital" label="30006"/>
    <button name="num7" type="digital" label="30007"/>
    <button name="num8" type="digital" label="30008"/>
    <button name="num9" type="digital" label="30009"/>
    <button name="num0" type="digital" label="30010"/>
    <button name="star" type="digital" label="30011"/>
    <button name="pound" type="digital" label="30012"/>
  </category>
  <category name="offscreen" label="10103">
    <button name="togglevkbd" type="digital" label="30023"/>
  </category>
</layout>

I've also created libretro buttonmaps for atari800 and a5200:
 
Would you be able to help test? I'll create a build for you: latest LibreELEC v11 (11.0.6) for RPi 4, with the new controller layouts I created, and with the latest versions of atari800 and a5200 pre-installed including the new libretro buttonmaps.
RetroPlayer releases: https://github.com/garbear/xbmc/releases

Donations: eigendude.eth
Reply
#12
Sure, I'm willing to test.
But a stupid question: how can I update to the latest LibreELEC v11 (11.0.6) for RPi 4, with the new controller layouts?
Reply
#13
(2024-02-07, 00:40)olili Wrote: Sure, I'm willing to test.
But a stupid question: how can I update to the latest LibreELEC v11 (11.0.6) for RPi 4, with the new controller layouts?

The build I created is an image file. You can flash the SD card, but that will overwrite your existing settings. Instead, LibreELEC allows you to upload the file to the "Update" share, and when you reboot it'll extract the partition from the image file and flash your RPi.

There's more information online on how to flash or upgrade LibreELEC.

EDIT: If I forgot to post the link, you can find the image on my releases (link in my sig). Here's the release: https://github.com/garbear/xbmc/releases...c-20240205 . You can read the release notes to see what it contains.
RetroPlayer releases: https://github.com/garbear/xbmc/releases

Donations: eigendude.eth
Reply
#14
RPi 4: LibreELEC-RPi4.aarch64-11.0-retroplayer-20240205-fbe67c3d.img.gz seems not to be a RaspPI4 image.
Update failed with the comment of incompatibility. 

Any advice? 

O.
Reply
#15
Like a normal LE image on my end. I tried flashing my RPi 4 both ways. First I downloaded the img.gz file, flashed it to an SD card with Etcher, popped it in my PRi 4, and it booted into LE. Then I connected to LE via samba, copied the image to the Update folder, rebooted and it also successfully flashed the image. How did you get your error message?
RetroPlayer releases: https://github.com/garbear/xbmc/releases

Donations: eigendude.eth
Reply

Logout Mark Read Team Forum Stats Members Help
Atari800 Emulator - How to map functions keys (Start, Option, Select) to Joystick?0