I will commit the code as soon as I have the green light from the MAME devs. In the meanwhile, this is a glimpse of how the new template works (as I plan to describe it in messnew.txt)

Code:
Added support for a new template to -snapname to use software names for 
snapshots. It is now possible to use %d_XXXX to name snaps after the name
of the file mounted in the device XXXX, being XXXX the brief name of any
device. E.g. you can use "-snapname %d_cart" to use the name of the game 
mounted in the cartslot, or "-snapname %d_flop2" to use the name of the game 
mounted in the second floppy drive, etc. If you are loading software through 
software lists, its shortname will be used; if you are using the fullpath of 
the software, its filename is used. Any combination of the new template with 
the old "/", "%g" and "%i" templates is supported as well. Notice that if you 
specify an invalid device, or if you have no software mounted in the chosen 
device, MESS will revert to the default template "%g/%i".


In this way, in addition to the old system.png and system/0000.png, you can decide to name your snaps based on any of the software pieces you have loaded, be it a cart, one of the floppies or even an hard disk. an example: if you launch,

Code:
mess a500n -cart expansion.bin -flop1 OS.adf -flop2 my_game.adf


you can then use:
* "-snapname %g" to obtain a a500n.png snap
* "-snapname %d_flop2" to obtain a my_game.png snap
* "-snapname %d_flop1" to obtain a OS.png snap
* "-snapname %d_cart" to obtain a expansion.png snap

and of course you can combine the new "%d" with the old templates, using e.g. "-snapname %g/%d_flop2%i" to obtain a500n/my_game0000.png smile

it should be as flexible as anyone might ever need smile