es_systems.cfg multiple %ROM% references

Home Forums RetroPie Project Ideas for Further Enhancements es_systems.cfg multiple %ROM% references

RetroPie has a new website and forum. Please visit https://retropie.org.uk/ for the new site. The new forum is located at https://retropie.org.uk/forum/. This forum is left here as a read-only archive.

This topic contains 5 replies, has 2 voices, and was last updated by Profile photo of bobbyt bobbyt 2 years, 5 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #82291
    Profile photo of bobbyt
    bobbyt
    Participant

    I’m trying to do some custimizations for command calls which require multiple %ROM% references, but only the first reference gets replaced.

    It would be nice if these calls could be parsed to replace multiple occurrences when executed.

    #82301
    Profile photo of sselph
    sselph
    Participant

    This comes from emulationstation the code that does the replace only looks for a single %ROM% instance.

    This is the replace call:
    https://github.com/Aloshi/EmulationStation/blob/d89ab913abdd90e559e48a38a07fd571cbf8a607/es-app/src/SystemData.cpp#L114

    This is the replace code:
    https://github.com/Aloshi/EmulationStation/blob/d89ab913abdd90e559e48a38a07fd571cbf8a607/es-app/src/SystemData.cpp#L64

    You could send a pull request to alter the replace code to something like the following. I don’t write c++ so not sure if it is 100% correct.

    size_t pos = str.find(replace);
    
    while (pos != std::string::npos) {
        str.replace(pos, replace.length(), with.c_str(), with.length());
        pos = str.find(replace, pos + with.length());
    }
    return str;
    

    Auto-scraper: https://github.com/sselph/scraper

    • This reply was modified 2 years, 5 months ago by Profile photo of sselph sselph.
    #82333
    Profile photo of bobbyt
    bobbyt
    Participant

    I got an idea a few hours ago that command represents the linux command line. I’m wondering if I could combine a variable deceleration set it to %ROM% and then use that variable in the command…

    might just be wishful thinking but I will give it a try one of these days…

    #82334
    Profile photo of bobbyt
    bobbyt
    Participant

    I got around to testing it sooner than I thought…

    It actually worked but I ran into a separate snag…

    I had to use –appendconfig a 2nd time to ensure all 3 configs got loaded:

    –config [….]/all/retroarch.cfg
    –appendconfig [….]/snes/retroarch.cfg
    –appendconfig [….]/snes/GAMENAME.smc.cfg

    The problem is the first -appendconfig parameters are fully replaced by the second. Since I do have configs in that file, they are overridden…

    The only work around would be to create a custom config for EVERY ROM which I’m trying to avoid doing… My goal is to only create a couple custom configs and have the rest default to the default…

    Every step forward I seem to make I have to take another step back… It’s a bit frustrating…

    #82361
    Profile photo of sselph
    sselph
    Participant

    Could you create your own custom bash script that did something like:

    if [ -f […]/snes/$1.cfg ];
    then
    /opt/retropie/[…] –config [….]/all/retroarch.cfg –appendconfig [….]/snes/retroarch.cfg –appendconfig [….]/snes/$1.cfg $1
    else
    /opt/retropie/[…] –config [….]/all/retroarch.cfg –appendconfig [….]/snes/retroarch.cfg $1
    fi

    Then replace the entire command with /home/pi/myscript.sh %ROM%

    Auto-scraper: https://github.com/sselph/scraper

    #82381
    Profile photo of bobbyt
    bobbyt
    Participant

    Could you create your own custom bash script that did something like:

    if [ -f […]/snes/$1.cfg ];
    then
    /opt/retropie/[…] –config [….]/all/retroarch.cfg –appendconfig [….]/snes/retroarch.cfg –appendconfig [….]/snes/$1.cfg $1
    else
    /opt/retropie/[…] –config [….]/all/retroarch.cfg –appendconfig [….]/snes/retroarch.cfg $1
    fi

    Then replace the entire command with /home/pi/myscript.sh %ROM%

    This wouldn’t fix everything…

    The problem is that there are still 2 occurrences of –appendconfig in the top call, so one of those will have no effect…

    This would fix only ROM calls that don’t have a custom cfg…

    I came up with a separate alternative, but I’m holding off on using it…

    If I replace the first:
    –config [….]/all/retroarch.cfg
    With:
    –config [….]/snes/retroarch.cfg

    AND copy the contents of the all/retroarch.cfg & combine it with the snes/retroarch.cfg it works around the issue…

    I’m not real happy with this setup so I’ve held off on doing it…

Viewing 6 posts - 1 through 6 (of 6 total)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/

Skip to toolbar