Skip to content

Improving zaparoo integration code #2043

Description

@asturur

After some good feedback we merged
#2028
That brings zaparoo integrated in the UI, that means you can create nfc tags from your game directly from emulation station menu.

Great.

This was done with keeping compatibility with windows system too, avoiding linux specific code like: batocera-services status

The key issue was knowing when zaparoo is active and well, so that we can enable the menu entries.
We did this pinging a health route on zaparoo web service, but this also requires to hardocode the zaparoo port and to avoid performance disruption we also do this only once and then if for some reason zaparoo was not active you are not going to see the entries untill you reboot.

@nadenislamarre pointed out that the cached status is suboptimal and so is the initial request.

Our goal at zaparoo is to have everyone happy with the code and the feature available, so we would like to improve the current code.

A proposal from @nadenislamarre was to create a /var/run/zaparoo when zaparoo is good and has a reader attached, and batocera check the existance of the file rather than calling /health and caching it.
That would work OK for batocera linux but not for windows retrobat.

I was thinking probably a good compromise would be this:

  • the feature needs to be resolved inside the batocera-emulationstation codebase with no ifdef batocera/retrobat
  • we stop calling /health
  • we stop caching the result of the availability
  • we modify zaparoo to make its own http requests with its own user agent that includes the word zaparoo
  • in the POST /launch api we check the user agent and if a game is launched with zaparoo user-agent we flag the feature as enabled, so menu entry appear.
  • we modify zaparoo ( batocera/retrobat only ) to trigger a call to POST /launch with an empty payload when you connect a reader/writer or at zaparoo boot.

This code should have no impact for who is not using the feature.
if you are a zaparoo user and you want to flash cards/tokens from the UI you can either:

  • disable/enable the service from the service menu ( batocera only )
  • disconnect/reconnect your reader to trigger the enabling
  • flash any card you have handy
  • if you don't have any ready card you can still probably use the phone app to trigger a load and that should enable the menu items

Another possibility would be that if there is some config file around we can have a button in the specific zaparoo package UI to change a config file value, users will read that the have to push that button to integrate with the UI properly, and we just switch a value in some ini/cfg file and that's it.

@fabricecaruso @lbrpdx Happy to improve the code if you have pointers.

@wizzomafizzo FYI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions