Scan directory feature in 1.2.2

darkludx: like Tatsuya79 wrote comment out lines you don’t want in the section with RegExReplace commands. But remember that some game names include characters that Windows forbids in filenames so if you keep those characters (comment out first datname1 RegExReplace command) you may not be able to display boxart for that game because you can’t save a png with the exact same name.

Tatsuya79: Good modification. I’ve added the ismodification check and also a check that skips any file that has isbios, and isdevice too. Even with those automatic skip checks the line with the comment “;add non game zip file names to skip” could I guess still be used when someone wants to include e.g. clonegame.zip that depend on files in originalgame.zip but doesn’t want the original in the playlist so I’ll leave it in.

;AUTOHOTKEY SCRIPT TO GENERATE MAME.lpl FOR RETROARCH
;### SETUP, ADD YOUR PATHS HERE

content = 
;### MAME ROMs folder
;### example: C:\RA\RetroArch_1.2.2\content\arcade

cores = 
;### cores folder
;### C:\RA\RetroArch_1.2.2\cores

dat = 
;### path to a MAME ROM database file
;### example C:\files\MAME - ROMs (v0.164_XML).dat
;### get dat here http://www.emulab.it/rommanager/datfiles.php

FileDelete, %A_ScriptDir%\MAME.lpl  ;clear old file
FileRead, dat, %dat%

Loop, %content%\*.zip
{
if A_LoopFileName in neogeo.zip,awbios.zip,cpzn2.zip
 continue 
;### you can add names of zip files in the folder to skip in the list above

name := SubStr(A_LoopFileName,1,-4) ;trim .zip

needle2 = <game name=.%name%. (isbios|isdevice)
if RegExMatch(dat, needle2) 
 continue

needle = <game name=.%name%.(?:| ismechanical=.*)(?:| cloneof=.*)(?:| romof=.*)>\R\s*<description>(.*)</description>
RegExMatch(dat, needle, datname)
if !datname1
 datname1 := name ;fallback to filename

datname1 := RegExReplace(datname1, "[/\?<>\\:*\|]","") ;replace win forbidden chars  
datname1 := RegExReplace(datname1, "'","'")  ;may need more replace like this
datname1 := RegExReplace(datname1, "&","&") 
datname1 := RegExReplace(datname1, " \(.*","")        ;trim stuff like "(World version 2.2)"
datname1 := RegExReplace(datname1, "\.$","") 
;list = %xx%`n%datname1% ;for troubleshooting

i := A_index&lt;10 ? "000" A_index : A_index&lt;100 ? "00" A_index : A_index&lt;1000 ? "0" A_index : A_index
;the above line was modified to correctly number up to 9999 items in a playlist
;### Next section assigns cores to games. 
;### Edit filenames and corenames to what works for you
;### To use same core for all remove all lines
;### in the section below except core = fb_alpha_libretro.dll
if A_LoopFileName in asteroid.zip,dkongjr.zip,dkong.zip        
 core = mame_libretro.dll
else if in mslugx.zip
 core = fba_libretro.dll
else
 core = fb_alpha_libretro.dll

a =
(
%A_LoopFileFullPath%
%datname1%
%cores%\%core%
_
%i%|CRC

)
if (a_index == 1)
 FileAppend, %a%, %A_ScriptDir%\MAME.lpl
else
 FileAppend, `n%a%, %A_ScriptDir%\MAME.lpl
}
;msgbox % list  ;for troubleshooting

It is cool that we can make multi system playlists like darkludx has shown but I’d like to also make playlists that launch other stuff. For example I have a bunch of winuae amiga game configurations. I’d like to make a playlist with similar structure as for the available cores (game path, game name, core …) but for other files (e.g. path to amiga game file or config, game name, path to winuae.exe ) and launch those games from within RetroArch. Similarly for the Dolphin gamecube/wii emulator.

Thanks, I wasn’t sure how to do that as I’m not familiar with this script language.

Since I want the whole name, I comment this line <datname1 := RegExReplace(datname1, " (.*","")> and replace “:” by “-” in your script and the result was this: 1941- Counter Attack (World 900227) Your script to generate MAME.lpl and your script to import boxart, are working very well. You saved me a lot of work, thank you very much!!! :slight_smile:

Hello roldemort!! I want make a MAME.lpl playlist using a text file rather than one folder with zipped roms. I have the text file neogeo.txt, inside are some neogeo games like this:

2020bb 3countb alpham2 androdun

I edited a little bit this part of your script and look as follow:

Loop, read, neogeo.txt
{
name := A_LoopReadLine

needle2 = <game name=.%name%. (isbios|isdevice)
if RegExMatch(dat, needle2) 
 continue

needle = <game name=.%name%.(?:| ismechanical=.*)(?:| cloneof=.*)(?:| romof=.*)>\R\s*<description>(.*)</description>
RegExMatch(dat, needle, datname)
if !datname1
 datname1 := name ;fallback to filename

datname1 is not receiving data from RegExMatch(dat, needle, datname), see the result:

(path to roms folder) \2020bb.zip 2020bb (path to cores folder) \mame_libretro.dll _ 0001|CRC

Do you know what is wrong?, Can you help me?

darkludx, that looks correct. Is neogeo.txt in the same folder as the script? If not add its path. You can also as a test add a messagebox to see what value the script assigns to the variable name and remove that later when it works. Also check if there are any spaces before or after the names in the textfile and remove them.

 Loop, read, C:\another directory
eogeo.txt { 
name := A_LoopReadLine
msgbox % name

Yes, the neogeo.txt file is in the same folder of the script. I added the msgbox that you suggested in some parts of the script and I find the error. I can’t believe it, the problem was a wrong dat path. Because Retroarch playlists “only” support 999 games in the lists, at least playlists manually added, is a good idea that you open Catlist.ini and copy the games that you want to a text file and then make a MAME.lpl playlist with them. Thanks for your help roldemort.

Good that it works now.

I don’t understand. If there is a limit to the number of games RA supports in playlists how would making a playlist through textfiles make a difference? BTW I now see that one line in my script should be changed from

i := A_index < 10 ? "000" A_index : "00" A_index

to

i := A_index<10 ? "000" A_index : A_index<100 ? "00" A_index : A_index<1000 ? "0" A_index : A_index

which would correctly number up to 9999 games in a playlist. If Retroarch can correctly handle that number of entries or not I do not know.

I will edit in this change in the latest version of the code above.

Hello roldemort, RetroArch v1.2.2 only allow 999 roms in one single lpl playlist, in both “Add content” option or one lpl playlist manually added. This is not a bad thing, since we can make a few lpl playlists for MAME roms from a text file like Catver.ini and we will have the games arranged by category.

As of at least nightly 2015-09-20, and probably earlier, there is a change in Retroarch that breaks boxart import script for MAME. The change is that the “(_)” part at the end of the MAME boxart filenames should now not be included. I have updated the code in my post above.

Badass Regex…

I’m a bit lost with the playlist: I would like to find/create a playlist for MAME or CSP1,2, or 3 for example, in order to see it in the main menu of RA. How to do it? Hunterk told me already that some script was existing for this… But I can’t find it. Any idea guys?

I am also a little lost over here. It seems that the “script” is on this very thread on an earlier post.

Can someone post their own script VERBATIM. Sorry to all caps the issue I am having is I am not sure how I change the script lines to conform to my file paths/ etc.

I believe with the script posted earlier that explains what you are suppose to be changing and looking at someones actual CHANGED textfiles I can do some detective work and get it going.

btw: I am not a coder or linux guy in any way… in the last two weeks I have not slept and learned alot thanks to all you guys that made this project happen.

I have everything setup so smooth I have amazed even myself. Like 10 systems and 20,000 games. The very last part I need is to get this mame playlist as the games all work when I “load content”

If someone could really healp me with this playlist I will forever be grateful.

Thanks and long live LAkka! great work everyone

This is the last one I used, you can try it:

;AUTOHOTKEY SCRIPT TO GENERATE MAME.lpl FOR RETROARCH
;### SETUP, ADD YOUR PATHS HERE

content = E:\Roms\Arcade-MAME
;### MAME ROMs folder
;### example: C:\RA\RetroArch_1.2.2\content\arcade

cores = E:\Emulateurs\RetroArch64\cores
;### cores folder
;### C:\RA\RetroArch_1.2.2\cores

dat = E:\Emulateurs\RetroArch64\database\MAME - ROMs (v0.164_XML).dat
;### path to a MAME ROM database file
;### example C:\files\MAME - ROMs (v0.164_XML).dat
;### get dat here http://www.emulab.it/rommanager/datfiles.php

FileDelete, %A_ScriptDir%\MAME.lpl  ;clear old file
FileRead, dat, %dat%

Loop, %content%\*.zip
{
if A_LoopFileName in neogeo.zip,awbios.zip,cpzn2.zip
 continue 
;### you can add names of zip files in the folder to skip in the list above

name := SubStr(A_LoopFileName,1,-4) ;trim .zip

needle2 = <game name=.%name%. (isbios|isdevice)
if RegExMatch(dat, needle2) 
 continue

needle = <game name=.%name%.(?:| ismechanical=.*)(?:| cloneof=.*)(?:| romof=.*)>\R\s*<description>(.*)</description>
RegExMatch(dat, needle, datname)
if !datname1
 datname1 := name ;fallback to filename

datname1 := RegExReplace(datname1, "[/\?<>\\:*\|]","") ;replace win forbidden chars  
datname1 := RegExReplace(datname1, "'","'")  ;may need more replace like this
datname1 := RegExReplace(datname1, "&","&") 
;### datname1 := RegExReplace(datname1, " \(.*","")        ;trim stuff like "(World version 2.2)"
datname1 := RegExReplace(datname1, "\.$","") 
;list = %xx%`n%datname1% ;for troubleshooting

i := i := A_index&lt;10 ? "00000" A_index : A_index&lt;100 ? "0000" A_index : A_index&lt;1000 ? "000" A_index : A_index&lt;10000 ? "00" A_index : A_index&lt;100000 ? "0" A_index : A_index

;### Next section assigns cores to games. 
;### Edit filenames and corenames to what works for you
;### To use same core for all remove all lines
;### in the section below except core = fb_alpha_libretro.dll
;###if A_LoopFileName in asteroid.zip,dkongjr.zip,dkong.zip        
 core = mame_libretro.dll
;### else if in mslugx.zip
;###  core = fba_libretro.dll
;### else
;###  core = fb_alpha_libretro.dll

a =
(
%A_LoopFileFullPath%
%datname1%
%cores%\%core%
DETECT
%i%|CRC
MAME.lpl
)
if (a_index == 1)
 FileAppend, %a%, %A_ScriptDir%\MAME.lpl
else
 FileAppend, `n%a%, %A_ScriptDir%\MAME.lpl
}
;msgbox % list  ;for troubleshooting

Just change the paths and perhaps the mame_libretro.dll part to mame2014_libretro.dll if you use that.

EDIT: I noticed 1 rom is wrongly listed without its path. It makes problem for other roms. That’s wingwar, so search for it and insert the path\wingwar.zip in the 1st of those 6 lines needed. Not sure why that happens.

Thanks Tatsuya for the fast reply.

heres where its getting funky for me. I am running lakka live off of a flash drive. I have all the roms on there and have configured controllers per core, so everything is looking and running beautiful.

My goal is to have an all in one flash drive and then make copys to give to a couple of gamer friends for christmas. I have booted it up in plenty of computers and it runs perfect. Except for the audio not going out through hdmi (but this is for another day)

I added the roms onto the flash drive, and do any other editing to config files running linux to read the flash drive and do all my work. Slitaz is working great for this believe it or not.

Now im trying to figure out if the script can be run outside of the lakka environment… and will the pathnames transfer over correctly once I live boot. Or do I have to run this script while lakka is powered on.

Im not sure if this is making any sense. It was another long night last night :slight_smile:

Will experiment abit and report on what happenes.

That’s an autohotkey script, so it needs to run in Windows via autohotkey. The resulting lpl file should work anywhere, though, I think. You’ll also need to change the *.dll entries to *.so, since that’s the extension for dynamic libraries in linux. You should do some testing, though, as I don’t know how that script (or lpl playlists in general) will handle / vs \ in the paths.

I’m just using it with Windows so, yeah, can’t say anything about Linux.

If you make it on windows I would tell you to use Notepad++ to edit your lpl playlist and replace all paths to a relative path that works with your flash drive (“Search” -> “Replace” or Ctrl+H in Notepad++, change the path, chose “Replace all”).

I got the playlist going guys! at least listed anyway…

I still cant get it to actually launch the games, but that is because I cannot find the path to the mame core in linux. I am still on the hunt though.

Again this is on lakka and is my last step in finally being able to relax for the holidays and play the oldies with family.

Hi guys,

I love the playlist thing, could someone direct me to a way to create entries myself, as it seems, it doesnt work properly for pc-engine (few games recognized) and even worse for pce cd games (doesnt see cue files). Also, I only wanna use the supergrafx core for pce and pce-cd games, and dont see an easy way to do so (works fine using emulation station). Also, i want relative paths everywhere, is there a way to do that ?

Thanks

As of 2015-11-24 nightly versions of Retroarch changed the handling of boxart. The boxart png are now expected to be in per game system subfolders in the boxarts root directory. Details on that are here. I have updated the post earlier in this thread with a new version of my boxart script that works with the new subfolder format. http://libretro.com/forums/showthread.php?t=3599&p=26704&viewfull=1#post26704

[QUOTE=Tatsuya79;32348]This is the last one I used, you can try it:

;AUTOHOTKEY SCRIPT TO GENERATE MAME.lpl FOR RETROARCH
;### SETUP, ADD YOUR PATHS HERE

content = E:\Roms\Arcade-MAME
;### MAME ROMs folder
;### example: C:\RA\RetroArch_1.2.2\content\arcade

cores = E:\Emulateurs\RetroArch64\cores
;### cores folder
;### C:\RA\RetroArch_1.2.2\cores

dat = E:\Emulateurs\RetroArch64\database\MAME - ROMs (v0.164_XML).dat
;### path to a MAME ROM database file
;### example C:\files\MAME - ROMs (v0.164_XML).dat
;### get dat here http://www.emulab.it/rommanager/datfiles.php

FileDelete, %A_ScriptDir%\MAME.lpl  ;clear old file
FileRead, dat, %dat%

Loop, %content%\*.zip
{
if A_LoopFileName in neogeo.zip,awbios.zip,cpzn2.zip
 continue 
;### you can add names of zip files in the folder to skip in the list above

name := SubStr(A_LoopFileName,1,-4) ;trim .zip

needle2 = <game name=.%name%. (isbios|isdevice)
if RegExMatch(dat, needle2) 
 continue

needle = <game name=.%name%.(?:| ismechanical=.*)(?:| cloneof=.*)(?:| romof=.*)>\R\s*<description>(.*)</description>
RegExMatch(dat, needle, datname)
if !datname1
 datname1 := name ;fallback to filename

datname1 := RegExReplace(datname1, "[/\?<>\\:*\|]","") ;replace win forbidden chars  
datname1 := RegExReplace(datname1, "'","'")  ;may need more replace like this
datname1 := RegExReplace(datname1, "&","&") 
;### datname1 := RegExReplace(datname1, " \(.*","")        ;trim stuff like "(World version 2.2)"
datname1 := RegExReplace(datname1, "\.$","") 
;list = %xx%`n%datname1% ;for troubleshooting

i := i := A_index&lt;10 ? "00000" A_index : A_index&lt;100 ? "0000" A_index : A_index&lt;1000 ? "000" A_index : A_index&lt;10000 ? "00" A_index : A_index&lt;100000 ? "0" A_index : A_index

;### Next section assigns cores to games. 
;### Edit filenames and corenames to what works for you
;### To use same core for all remove all lines
;### in the section below except core = fb_alpha_libretro.dll
;###if A_LoopFileName in asteroid.zip,dkongjr.zip,dkong.zip        
 core = mame_libretro.dll
;### else if in mslugx.zip
;###  core = fba_libretro.dll
;### else
;###  core = fb_alpha_libretro.dll

a =
(
%A_LoopFileFullPath%
%datname1%
%cores%\%core%
DETECT
%i%|CRC
MAME.lpl
)
if (a_index == 1)
 FileAppend, %a%, %A_ScriptDir%\MAME.lpl
else
 FileAppend, `n%a%, %A_ScriptDir%\MAME.lpl
}
;msgbox % list  ;for troubleshooting

Just change the paths and perhaps the mame_libretro.dll part to mame2014_libretro.dll if you use that.[/QUOTE]

Sorry, I’m not lazy, I just ask: why not create generic playlist for the full set of Mame, NeoGeo, CPS1/2/3 etc…? It would be easier! Like the XML file in Hyperspin.