Recalbox 7.0

Syncing saves



  • Hi, I have retroarch on my android device too and I want to sync my savegames, I could use onedrive, google drive, dropbox, an own ftp online server, almost anything would be useful. What I need is to send the changed savegame and to download it too when started the recalbox or the game(it could be both).



  • @minze how skilled are you regarding linux ?



  • @Substring I'm studying informatics engineering at university, I'm almost sure I won't have problem ^^



  • @minze then the best would probably to add a custom init script that would sync at stop



  • Right now I'm trying to install syncthing but I can't install the package... is there any way? apt-get and things like that doesn't work


  • CRT Fan

    hi, i think you can use rsync in a script.
    To install new command you need to compil recalbox youself, there is no apt-get.
    rsync is already in recalbox.



  • @idarius Thanks, Im giving a look at it.



  • I have been able to sync saves to google drive thanks to rclone, which uses rsync. now what I need is to know how to activate an script everytime a game is closed


  • Banned

    @minze you should add a command launch in python script emulatorlauncher.py



  • @voljega Yeah, I figured out at midnight, the thing is that right now I think that I wasn't able to execute-it.
    this is my code for the .sh:

    #!/bin/bash
    rclone sync gdmedia:rpi /recalbox/share/saves/
    echo finished
    

    and this is for my emulatorlauncher.py

    [...]
    def main(args):
        subprocess.call('./syncFiles.sh')
        playersControllers = dict()
        if not args.demo:
    [...]
    

    what am I doing wrong?

    PS: As soon as I fix that I'll make a tutorial, because there is no one yet on how to sync files with drive/dropbox/etc


  • Banned

    @minze well first your script should be launched after the emulator was launched, you some to launch it before

    also I personnaly use os.popen to launch command :
    os.popen('cp -R '+whdFilespath+'/* '+mountPointWHDL)

    you can also look into utils/runner.py and Command.py for something a little more complicated, but perfectly tweakable.

    and keep your modifications backed up because all of that can be erased at each update



  • @voljega Well that was an script to see if it worked because it produces changes easy to see.
    And the script should be launched everytime a game is ran right? at least that's what I thought.
    Should I modify the script like that?
    edit:(I've modified the .sh to have an start argument)

    if __name__ == '__main__':
        signal.signal(signal.SIGINT, signal_handler)
    
        parser = argparse.ArgumentParser(description='emulator-launcher script')
        parser.add_argument("-p1index", help="player1 controller index", type=int, required=False)
        parser.add_argument("-p1guid", help="player1 controller SDL2 guid", type=str, required=False)
        parser.add_argument("-p1name", help="player1 controller name", type=str, required=False)
        parser.add_argument("-p1devicepath", help="player1 controller device", type=str, required=False)
        parser.add_argument("-p1nbaxes", help="player1 controller number of axes", type=str, required=False)
        parser.add_argument("-p2index", help="player2 controller index", type=int, required=False)
        parser.add_argument("-p2guid", help="player2 controller SDL2 guid", type=str, required=False)
        parser.add_argument("-p2name", help="player2 controller name", type=str, required=False)
        parser.add_argument("-p2devicepath", help="player2 controller device", type=str, required=False)
        parser.add_argument("-p2nbaxes", help="player2 controller number of axes", type=str, required=False)
        parser.add_argument("-p3index", help="player3 controller index", type=int, required=False)
        parser.add_argument("-p3guid", help="player3 controller SDL2 guid", type=str, required=False)
        parser.add_argument("-p3name", help="player3 controller name", type=str, required=False)
        parser.add_argument("-p3devicepath", help="player3 controller device", type=str, required=False)
        parser.add_argument("-p3nbaxes", help="player3 controller number of axes", type=str, required=False)
        parser.add_argument("-p4index", help="player4 controller index", type=int, required=False)
        parser.add_argument("-p4guid", help="player4 controller SDL2 guid", type=str, required=False)
        parser.add_argument("-p4name", help="player4 controller name", type=str, required=False)
        parser.add_argument("-p4devicepath", help="player4 controller device", type=str, required=False)
        parser.add_argument("-p4nbaxes", help="player4 controller number of axes", type=str, required=False)
        parser.add_argument("-p5index", help="player5 controller index", type=int, required=False)
        parser.add_argument("-p5guid", help="player5 controller SDL2 guid", type=str, required=False)
        parser.add_argument("-p5name", help="player5 controller name", type=str, required=False)
        parser.add_argument("-p5devicepath", help="player5 controller device", type=str, required=False)
        parser.add_argument("-p5nbaxes", help="player5 controller number of axes", type=str, required=False)
        parser.add_argument("-system", help="select the system to launch", type=str, required=True)
        parser.add_argument("-rom", help="rom absolute path", type=str, required=True)
        parser.add_argument("-emulator", help="force emulator", type=str, required=False)
        parser.add_argument("-core", help="force emulator core", type=str, required=False)
        parser.add_argument("-ratio", help="force game ratio", type=str, required=False)
        parser.add_argument("-demo", help="mode demo", type=bool, required=False)
        parser.add_argument("-netplay", help="host/client", type=str, required=False)
    
        args = parser.parse_args()
        command = './syncFiles.sh start'
        os.popen(command)
        exitcode = main(args)
        time.sleep(1)
        exit(exitcode)
        
    

  • Banned

    @minze there no way you're in the right folder when launching the script so either try to use the absolute path or move to it before launching it



  • @voljega Ooh, I thought that as I that script was in the same folder that the py, I could use that, yeah it makes sense that it doesn't make sense. Thanks ❤ i'll try it as soon as I arrive home.


  • Banned

    Cool hope it works

    @minze said in Syncing saves:

    PS: As soon as I fix that I'll make a tutorial, because there is no one yet on how to sync files with drive/dropbox/etc

    You can also work on official integration, because this is a feature that users regularly ask for 😉



  • @voljega Yeah, I'll take a look at it too



  • @minze your script is anyway launched before the emulator, i thought you wanted it right after ?



  • @substring Yeah I want to execute the script:

    1. On start, once wifi is enabled.
    2. When any game is launched.
    3. if possible, when any game is closed

Log in to reply
 

Want to support us ?

181
Online

79.2k
Users

20.4k
Topics

149.3k
Posts