NFC enabled EmulationStation
-
@elbartome yeah. I'm pretty sure I can help with this. Maybe when I'm on my laptop on Monday, would that work?
Basically the fact that you're creating a new file data means that you're not using the current one that exists. As such it may be that it may replace the existing one in the favorites when you update its play count as there can only be one file data per path in ES.
If you're using collections, you can get the right file data by accessing the all games collection using the path as key.
Let me know if this helps or if you need more specifics, but that's my gut feeling. I can look into the code on Monday or so.
-
Sorry, just noticed I had left this waiting for a while now.
So, you have two options there.
Probably the easiest one for you, in this case, is after finding the right system, to get the in-memory FileData games in the system by running
const std::unordered_map<std::string, FileData*>& children = (*i)->getRootFolder()->getChildrenByFilename()
and then, depending on how they're keyed (I don't know off the top of my head) you can either iterate on them and compare the file name until you find the one that matches, and then use that to launch the game, or ideally you'd be able to access it by key:
bool found = children.find(temp.filename) != children.end(); if (found) { FileData* game = children.at(temp.filename); ViewController::get()->launch(game); }
but I'm not sure if the key is the filename only, or if it has the longer path.
Might be worth trying it or even logging the keys as you iterate, just to see what to expect.
Best.
-
@pjft
Thank you very much! Unfortunately work is keeping me busy and I wasn't able to modify the code.I will probably try that this weekend and get back to you if it works. I can step through the code and look at the keys!
Is going trough every game not going to cost a lot of time? Especially if you have 500+ games in one system.
-
@elbartome It shouldn't take that long, really. It's not ideal in concept, but it's not the end of the world.
-
@pjft
Thank you very much for your help. I never would have been able to figure that out!It works perfectly with your suggested changes! I will push the update to git after some cleanup in the code.
-
@elbartome Glad to hear! Out of curiosity, what was the solution you ended up pursuing?
I'm curious about what causes the delay in reading the cartridge and starting the game - is it the reading part, or is it actually launching the game in ES?
Either way, well done - and thanks for sharing!
-
@pjft I used the filename as a key. Works flawlessly. It is more or less your code 1:1.
The delay is caused by the NFC routines. I was able to shrink it down to about 5 seconds. I don't think I can go down much more, but I will look into the NFC routines when I have more time.
Launching the game in ES is really quick!
-
This might be cool with a coin door as well. Toss in a (round) NFC tag and attach a NFC reader inside... Like this!
-
@ElBartoME could you helpme to do the same with snes classic mini console with hakchi mod installed?
-
@esbat1 I don't think this is the right forum for your issue. The original poster hasn't been here in over 5 years, so I don't think you'll get an answer. Maybe try Reddit's forum for hakchi / snesmini mods ?
-
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.