Retroachievements: Custom sh script when returning from game?
-
Hi,
I'm wondering if there is a way to add a custom script to run each time a game is exited and returns to emulationstation.
Also if possible to do this would it be any variables like romfile full path to utilize?To illustrate:
ES => START/PLAY GAME => EXIT GAME => HERE I WANT TO RUN A CUSTOM "myscript.sh $ROMfile" SCRIPT => ES
Is this possible?
Either like described above with "myscript.sh $ROMfile" or maybe I need to add my code to an existing shell script like runcommand or something else?Any help really appriciated!
=========================================================
For those wondering further than my initial question:Reason for asking is that I am creating a retroachievements scraper for the game that was just played to create or update custom md_marquee images that will show latest earned achievements and/or next available achievements + points earned etc.
What this means in more details is that if I am able to run myscript.sh upon exiting game I can call retroachievements API to fetch updated achievements. (I have ra_gameID saved in gamelist.xml for each game respectively).
If there are any changes since last time API was fetched (saved in local database) I then fire up a php script that run my Imagick script to create a newly generated marquee image that will contain updated achievement information.
So, next time I highlight the game the marquee image will display the most recent achievements information of this game.
(all this is working when I fire the script manually, I just need to be able to fire the script like described in the top part of the script)
Once I have this up and running I will post some screenshots for those interested.
-
-
@BuZz Cheers.. How I missed that I do not know...!
-
Finally managed it! :)
Big area = md_image
Bottom right corner box (Achievements) = md_marqueethe md_marquee image (showing the achievement status) is generated using Imagicks and retroachievements API upon closing a game. Any eventual changes since last time is updated in the runcommand-onend.sh script before you re-enter the gamelist in Emulationstation.
marquee example:
The scripts and setup is a bit of a hack at the moment, but it works and I'm happy with that :D
Anyone have any thoughts about this?
-
@wimpy Great work! You've definitely taken what theming in ES can do to the next level with this. Pretty awesome.
-
@wimpy Ingenious ! Looks very nice.
-
@wimpy really great
-
Finally done with this for now :)
The gamelist.xml entries have either a default "no achievements for this game" default <marquee> or, if they indeed have achievements, will have a game-specific generated <marquee> image showing achievement-status.
These <marquee>imagesare generated each time a game is exited.The runcommand.onend.sh script fires a php script i've written that uses Imagick to generate the image and places it in the marquee-artworkfolder.
The solution is not yet "deployable" on others setups at the moment as it heavily custom to my setup (all my games and xtras/artwork etc are in my own custom synopsis system), but once I get this to v2 or v3 it might be possible to lift out of my system and into other setups.
My initial setup is to display 33 achievements. Up to 10 unlocked achivements + filling rest of spots with locked. Last unlocked achievement will be displayed focused (bigger).
Here are two examples of the <marquee> images:
###########################
Future updates I've planned:
- Different marquee images layouts
- Update script to also generate a custom ${system.name}-ra.png image to be shown on SYSTEM view to show x latest achievements unlocked across all games in specific system.
Any other inputs or tips for furthering this setup?
Quite happy with this so far and just wanted to update :D
-
Awesome work.
If you ever get this more generalised and deployable on other systems I'll be installing it pretty much immediately.
-
@stoo That is cool to hear and that is my "endgame"-goal with this project :)
-
Right now my system relies on me matching games one-by-one against the RA's gameid to my local gameid in my database.
Does anyone know if there is a way for me to read the gamehash retroachievement is using in retroarch inside the runcommand-onend.sh file?
(I know I can calculate the hash from "$3 - the full path to the rom file.", but if I understand retroachievements hash-system correctly it does not always use the hash of the romfile itself, but some calculated inside RA after reading the rom with/without header.. which might differ from a bash-calculated hash of the file itself..?)
If that is possible it might be possible for me to create a more general "hashlist=>retroachievement-gameid" list instead of having to rely on my personal synopsis system, which in turn makes this a more portable solution.
Here is an example of a 1:1 match that allows me to automatically match my rom file-hash against hashlists from RetroAchievements-Api..
However; With Super Mario Bros. for NES where one supported hash is 811b027eaf99c2def7b933c5208636de (check http://retroachievements.org/viewtopic.php?t=282) it does not match anything from the RetroAchievements-Api as it's using one of these inside RetroArch:
OLD RA Checksum: ff02b25112d3a3163db10e332841b02c
NEW RA Checksum: 8e3630186e35d477231bf8fd50e54cdd
These are not hashes I can calculate myself it seems.Why the API does not return the hash 811b027eaf99c2def7b933c5208636de I am yet to know, but I've made enquires as to why and/or if it can be fixed in the Api.. but if that does not pan out this would/could be fixed if I was able to get the "hash used inside retroarch for retroachievements"..
Hope someone understands my ramblings :D
-
For those interested Ive not updated this script to not only show retroachievements, but also any eventual savestates found for the game on the retropie system.
It also updates as soon as you exit a game.
-
reason the png looks like that is because i made to fit into my updated theme.
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.