Advertisement
binkelderg

Untitled

Jan 24th, 2022
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. setlocal enableDelayedExpansion
  3.  
  4. :: Shifty's RetroArch Playlist Script
  5. ::
  6. :: This script will create per-system ROM playlists, the files used to display system columns in the RetroArch XMB UI
  7. :: It exists to work around the romset checksumming that is forced in the current (1.2.2 at time of writing) build of RetroArch
  8. :: Put simply, this will let you create playlists with ROMs that the Add Content > Scan Directory/File process would usually ignore
  9. ::
  10. :: WARNING: This script is not compatible with the Add Content > Scan Directory/File process
  11. :: It will erase existing playlists as part of the generation process, so make sure to back them up beforehand if necessary
  12.  
  13. :: Change these to point to your RetroArch and top-level ROM directories
  14. set RADir=D:\Emulators\retroarch
  15. set ROMDir=D:\ConsoleGames
  16.  
  17. :: For each RetroArch core, add one of these blocks below:
  18. :: set RomDirs[n]=
  19. :: set CoreLibs[n]=
  20. :: set CoreNames[n]=
  21. :: set PlaylistNames[n]=
  22. :: set SupportedExtensions[n]=
  23. ::
  24. :: The numbers in square brackets need to start at 0, and be incremented by 1 for each block added
  25. :: RomDirs[n] should be set to the ROM subdirectory for this core (ex. "SNES" will cause the script to scan ROMDir\SNES)
  26. :: CoreLibs[n] should be set to the core's DLL filename (in RetroArch\cores)
  27. :: CoreNames[n] should be set to the human-readable name of the RetroArch core (bracketed names in the RetroArch 'Load Core' menu)
  28. :: PlaylistNames[n] should be set to the RetroArch name of this core's platform (look at the icon filenames in RetroArch\assets\xmb\monochrome\png\)
  29. :: SupportedExtensions[n] should be set to the supported extensions for this core, prefixed with the wildcard (*) character (available in the RetroArch Information -> Core Info menu)
  30. ::
  31. :: Example Config
  32. :: The config below will create playlist files for SNES, MegaDrive/Genesis and Sega Master System ROMs
  33. ::
  34. :: set RomDirs[0]=SNES
  35. :: set CoreLibs[0]=snes9x_next_libretro.dll
  36. :: set CoreNames[0]=Snes9x Next
  37. :: set PlaylistNames[0]=Nintendo - Super Nintendo Entertainment System
  38. :: set SupportedExtensions[0]=*.smc *.fig *.sfc *.gd3 *.gd7 *.dx2 *.bsx *.swc
  39. ::
  40. :: set RomDirs[1]=MD
  41. :: set CoreLibs[1]=genesis_plus_gx_libretro.dll
  42. :: set CoreNames[1]=Genesis Plus GX
  43. :: set PlaylistNames[1]=Sega - Mega Drive - Genesis
  44. :: set SupportedExtensions[1]=*.md *.mdx *.gen *.sg *.bin
  45. ::
  46. :: set RomDirs[2]=SMS
  47. :: set CoreLibs[2]=genesis_plus_gx_libretro.dll
  48. :: set CoreNames[2]=Genesis Plus GX
  49. :: set PlaylistNames[2]=Sega - Master System - Mark III
  50. :: set SupportedExtensions[2]=*.sms *.bin
  51.  
  52. :: You can safely ignore everything below here.
  53. echo ============================================
  54. echo Shifty's RetroArch Playlist Script
  55. echo ============================================
  56. echo.
  57. echo Configured Playlists:
  58.  
  59. set "x=0"
  60. :InfoLoop
  61. if defined RomDirs[%x%] (
  62.     echo !PlaylistNames[%x%]!
  63.    
  64.     set /a "x+=1"
  65.     GOTO :InfoLoop
  66. )
  67.  
  68. echo.
  69.  
  70. PAUSE
  71.  
  72. echo.
  73.  
  74. set "x=0"
  75.  
  76. :MainLoop
  77. if defined RomDirs[%x%] (
  78.     echo ============================================
  79.     echo !PlaylistNames[%x%]!
  80.     echo ============================================
  81.  
  82.     del "%RADir%\playlists\!PlaylistNames[%x%]!.lpl";
  83.     echo Deleted %RADir%\playlists\!PlaylistNames[%x%]!.lpl
  84.     echo.
  85.  
  86.     echo Entering %ROMDir%\!RomDirs[%x%]!
  87.     echo.
  88.     echo Adding:
  89.    
  90.     pushd "%ROMDir%\!RomDirs[%x%]!"
  91.     for /R %%f in (!SupportedExtensions[%x%]!) do (
  92.         echo %%~nf%%~xf
  93.         (
  94.        
  95.         echo %%f
  96.         echo %%~nf
  97.         echo %RADir%\cores\!CoreLibs[%x%]!
  98.         echo !CoreNames[%x%]!
  99.         echo 0^|crc
  100.         call echo.
  101.         ) >> "%RADir%\playlists\!PlaylistNames[%x%]!.lpl"
  102.     )
  103.     popd
  104.    
  105.     echo.
  106.     echo Writing %RADir%\playlists\!PlaylistNames[%x%]!.lpl
  107.     echo. >> "%RADir%\playlists\!PlaylistNames[%x%]!.lpl"
  108.    
  109.     echo.
  110.    
  111.     set /a "x+=1"
  112.     GOTO :MainLoop
  113. )
  114.  
  115. PAUSE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement