I have redone the +Start Scummvm.sh script [1], sharing it here for discussion. It still contains development output and verbose comments.
I am not done with the libretro part, just removed/rewritten a python-less version.
once a svm file is found, scummvm should just be launching the game
Which requires a matching [section] in the scummvm.ini to identify the game path. This requires currently (upstream main branch) to run Add Game in the UI. Which IMHO creates a clutter in the roms/scummvm folder and would the libretro implementation to consult the non-libretro scummvm.ini.
Maybe it is advisable to move a step back and align about what a user must/should/could and may not do when deploying ScummVM games?
Some options:
a) The user MUST run Add Game or Mass Add... for the games.
b) The user MAY NOT manually edit any generated .svm files
-or-
c) The user MAY edit new/exisiting .svm files and uses as content c1) the game id (as in the ScummVM compability matrix, example bladerunner) or c2) the target as provided by Add Game or --add (example: bladerunnner-final-win) or c3) the content of the .svm file is irrelevant, the filename represents the target (=expected [section] in scummvm.ini)
d) The user MAY create empty .svm files to force automatic --add on launch.
e) The user MAY edit the section names in the scummvm.ini, but SHOULD keep the corresponding .svm aligned and vice versa.
The upstream implementation uses a), c3) and e). But misses d) which will cause an error when a bladerunnner-final-win.svm file is found but has no peer section in the ini. It has no "error correction" for e).
Apart from the envisioned interoperability with the libretro counterpart the suggested change uses: a), c1), d), and e). It comes with the price of a larger launcher script but strives to keep the launch dependency faultless even if the user does accidentally something wrong.
comparing the pre/post game lists [...]
I am using diff now which is sufficient.
.svm files should only be created after the launch is complete, not before. [...]
Unless the user provided an empty .svm I stick to your suggestion.
don't do symlinks in the roms folders [...]
Will adress that in the libretro part.
So in short before proceeding: What is the decision on user responsibilities and script capabilities?
[1] https://github.com/Gemba/RetroPie-Setup/blob/fb_scummvm_scriptmods_simplified/scriptmodules/emulators/scummvm.sh