thatman84 Posted April 27, 2017 Share Posted April 27, 2017 Some helpful Batch files and a customisable version to make all the text based config files you could ever want. lol I knew diddly squat about batch files until recently so these are crude but extremly helpful in saving me time. (I had a little help from a friend with this. He is yet to put his name to it until reviewed!) What it does 1. Create a text file of your chosen extension and content 2. One for ever file (rom) you have in a folder 3. Name the output files the same as the files in the folder 4. Insert the filename.ext into a specific point within the output files text Mainly for RetroArch and Android but probably handy for other things that need a romfile name injecting to and named after I use these to create .cmd MAME/MESS launching files, .uae Amiga launching files and .cfg RetroArch Overlay config files and override files. One limit is that ALL files in the source folder need to have the SAME extention. Duplicate names with different extentions will cause issues in the output text files. COPY THE TEXT between ____ lines TO NOTEPAD AND SAVE IT AS .bat Useage Quick Steps Point the script to your folder of named files Set your fixed content text Point it to an output folder Position the romname injection point Set your output files .extension CMD File script. (this was the original problem and the base for main script) Used to launch MESS based systems with RetroArch MAME core on Android without the need to name your roms as the software list xml files require **Edit the text in bold to match your local file paths, keep quotations around file paths" __________________________________________________________________________________________________ @ECHO off SET pcromfolder="INSERT YOUR file path to roms folder-example C:/ROMS/Atari 5200/" SET shieldrompath="/storage/emulated/0/roms/Atari 5200/" SET outpath="INSERT DISTINATION FOLDER-example C:/ROMS/CMD Launch Files" SET sysname=a5200 SET media=-cart CD /d %pcromfolder% FOR %%A IN (*.*) DO (ECHO %sysname% %media% "%shieldrompath:"=%%%~nxA") >> %outpath%/%%~nA.cmd __________________________________________________________________________________________________ UAE File Maker The above batch file evolved into this one for creating .uae Amiga config files THIS IS AN EXAMPLE FOR MY PC. The output file is below. See these notes for further details = TextConfigMakerNotes.txt Bold text is to highlight the main parts and user specific text __________________________________________________________________________________________________ @ECHO off SET romsfolder="E:/ROMS/4 To Sort/Commodore Amiga/[FINAL]/roms/Commodore Amiga/hdf/" SET readromname=hardfile=read-write,32,1,2,512,/storage/emulated/0/roms/Commodore Amiga/hdf/ SET outputfolder="E:/ROMS/4 To Sort/Commodore Amiga/[FINAL]/roms/Commodore Amiga/hdf/large games/config" SET line1=use_gui=no SET line2=show_leds=true SET line3=chipset=aga SET line4=cpu_type=68ec020 SET line5=chipmem_size=4 SET line6=fastmem_size=4 SET line7=gfx_center_vertical=simple SET line8=gfx_center_horizontal=simple SET line9=gfx_width=640 SET line10=gfx_height=480 SET line11=sound_channels=mixed SET line12=kickstart_rom_file=/storage/emulated/0/RetroArch/system/kick31.rom SET line13=hardfile=read-write,32,1,2,512,/storage/emulated/0/roms/Commodore Amiga/hdf/WHDLoad.hdf CD /d %romsfolder% FOR %%A IN (*.*) DO (ECHO %line1% & ECHO.%line2% & ECHO.%line3% & ECHO.%line4% & ECHO.%line5% & ECHO.%line6% & ECHO.%line7% & ECHO.%line8% & ECHO.%line9% & ECHO.%line10% & ECHO.%line11% & ECHO.%line12% & ECHO.%line13% & ECHO.%readromname:"=%%%~nxA) >> %outputfolder%/%%~nA.uae __________________________________________________________________________________________________ This is the output file = 1stDivisionManager_v1.0_1800.uae use_gui=no show_leds=true chipset=aga cpu_type=68ec020 chipmem_size=4 fastmem_size=4 gfx_center_vertical=simple gfx_center_horizontal=simple gfx_width=640 gfx_height=480 sound_channels=mixed kickstart_rom_file=/storage/emulated/0/RetroArch/system/kick31.rom hardfile=read-write,32,1,2,512,/storage/emulated/0/roms/Commodore Amiga/hdf/WHDLoad.hdf hardfile=read-write,32,1,2,512,/storage/emulated/0/roms/Commodore Amiga/hdf/1stDivisionManager_v1.0_1800.hdf __________________________________________________________________________________________________ RetroArch Overlay Override File Maker - Notes OverrideMaker.txt So I had to play around with the location of the quotation marks in bold for the below script to give the desired output text. I have also added the Line 1 code to make the additional text line after the override as an example of placement You can add more lines before or after if they are static its just a case of playing around Caution 1. ALL files in the image folder must be .png (no other files) _______________________________________________________________________________________________________________________________ @ECHO off SET romsfolder="H:/08 EMULATORS/Retroarch/Nightly 17th Feb/overlays/borders/Vectrex" SET outputfolder="H:/08 EMULATORS/Retroarch/Nightly 17th Feb/overlays/borders/Vectrex/test" SET readromname=:\overlays\borders\Vectrex\ SET override=input_overlay = SET line1=additional line CD /d %romsfolder% FOR %%A IN (*.*) DO (ECHO %override% "%readromname:"=%%%~nxA" & ECHO. %line1%) >> %outputfolder%/%%~nA.cfg __________________________________________________________________________________________________ Output Text input_overlay = ":\overlays\borders\Vectrex\2D_Narrow_Escape_Hack.png" additional line ____________________________________________________________________________________________________________________________________________________ RetroArch Overlay Config File Maker As above files I formatted this one to create a .cfg file to match all the .png overlays in a folder _____________________________________________________________________________________________________________________________________________________ @ECHO off SET romsfolder="H:/06 PROJECTS/RA Overlay Projects/_Source Files/_System Borders/NyNy77/crushed" SET readromname=overlay0_overlay = SET outputfolder="H:/06 PROJECTS/RA Overlay Projects/_Source Files/_System Borders/NyNy77/crushed" SET line1=overlays = 1 SET line2=overlay0_full_screen = true SET line3=overlay0_descs = 0 CD /d %romsfolder% FOR %%A IN (*.*) DO (ECHO %line1% & ECHO.%readromname:"=%%%~nxA & ECHO.%line2% & ECHO.%line3% ) >> %outputfolder%/%%~nA.cfg ________________________________________________________________________________________________________________________________________________________ Output Text overlays = 1 overlay0_overlay = Amstrad-nyny77.png overlay0_full_screen = true overlay0_descs = 0 Link to comment Share on other sites More sharing options...
thatman84 Posted May 10, 2017 Author Share Posted May 10, 2017 updated with RetroArch Overlay .cfg file maker Link to comment Share on other sites More sharing options...
EyMannMachHin Posted May 16, 2017 Share Posted May 16, 2017 Great job @thatman84. For the MAME core, I still need to setup the BIOS and the ini file though and point the MAME core there in addition to the rompath as specified in the setup guide? Is that correct? Link to comment Share on other sites More sharing options...
thatman84 Posted May 16, 2017 Author Share Posted May 16, 2017 4 minutes ago, EyMannMachHin said: Great job @thatman84. For the MAME core, I still need to setup the BIOS and the ini file though and point the MAME core there in addition to the rompath as specified in the setup guide? Is that correct? For mame consoles you don need to specify a BIOS folder when using the command files iirc. You have the bios zipped up with the games. So you i have a5200.zip alonside my .a52 games Your ini file would point to the folder containing the .cmd files For mame arcade games you have all the roms and bios files zipped like normal in one folder then setup a mame folder in your retroarch system/BIOS folder with with the normal mame folders for configs and what not. Although i think retroarch mame saves its config files to the saves directory for controllers and .cfg files and nvram Link to comment Share on other sites More sharing options...
thatman84 Posted March 11, 2018 Author Share Posted March 11, 2018 @Kondorito this may help you Link to comment Share on other sites More sharing options...
Kondorito Posted March 11, 2018 Share Posted March 11, 2018 1 hour ago, thatman84 said: @Kondorito this may help you Thank you! I will take a look at it later on. Link to comment Share on other sites More sharing options...
thatman84 Posted October 30, 2018 Author Share Posted October 30, 2018 I need to make a smarter config maker for an Amiga project.... I'm happy to do a manual method but wanted to explore "code" solutions before putting in the hours! Basically I need to edit a bunch of existing .uae config files. Replacing a "varible" filename with the actual name of the current file. In two places! Cant be done with Np++ as it cant read/insert the file name with find/replace regex. Example lines I need to edit below. There are many lines of text before and after.... File name = 1000_Miglia.uae _______________________________________ hardfile2=rw,DH0:/storage/emulated/0/[Project_Amiga]/amiga-data/Games_HDF/1000 Miglia.hdf,32,1,2,512,0,,uae0 uaehf0=hdf,rw,DH0:/storage/emulated/0/[Project_Amiga]/amiga-data/Games_HDF/1000 Miglia.hdf,32,1,2,512,0,,uae0 Need to replace the .hdf file name with the name of the file its located in. Everything either side of the file name ( 1000 Miglia) needs to stay the same. So the above example would become hardfile2=rw,DH0:/storage/emulated/0/[Project_Amiga]/amiga-data/Games_HDF/1000_Miglia.hdf,32,1,2,512,0,,uae0 uaehf0=hdf,rw,DH0:/storage/emulated/0/[Project_Amiga]/amiga-data/Games_HDF/1000_Miglia.hdf,32,1,2,512,0,,uae0 Any ideas welcome Link to comment Share on other sites More sharing options...
Kondorito Posted October 30, 2018 Share Posted October 30, 2018 Hey! Check this, might help you out in crafting something with notepad++ (like creating config files with only the game names inside, and batch adding the entire stuff around them with "Replace All'' by having all the documents opened at the same time): https://stackoverflow.com/questions/20479435/replacing-some-text-in-notepad-with-different-words-in-a-predefind-list Gotta go now, but if you can figure it out, I'll try to help you tomorrow in doing so. Link to comment Share on other sites More sharing options...
thatman84 Posted October 31, 2018 Author Share Posted October 31, 2018 @Kondorito cheers buddy. I now have a script to test out from one of the memebers here. Will update once i have tested Link to comment Share on other sites More sharing options...
wallmachine Posted November 1, 2018 Share Posted November 1, 2018 20 hours ago, thatman84 said: @Kondorito cheers buddy. I now have a script to test out from one of the memebers here. Will update once i have tested hopefully no more snags ? Link to comment Share on other sites More sharing options...
thatman84 Posted November 1, 2018 Author Share Posted November 1, 2018 1 hour ago, wallmachine said: hopefully no more snags ? Haha some people dont like the attention! I will test tonight and add it to the list of helpful batch's Thanks wallmachine Link to comment Share on other sites More sharing options...
streetmedic Posted November 5, 2018 Share Posted November 5, 2018 maybe this will help i have 2 poss solutions... The Diff Match and Patch libraries offer robust algorithms to perform the operations required for synchronizing plain text. Diff: Compare two blocks of plain text and efficiently return a list of differences. Diff Demo Match: Given a search string, find its best fuzzy match in a block of plain text. Weighted for both accuracy and location. Match Demo Patch: Apply a list of patches onto plain text. Use best-effort to apply patch even when the underlying text doesn't match. Patch Demo And maybe FART app I use it to mass change paths in hyperspin but it should work in any search and i also uploaded the text source files that listed above [App[licationn Source Files].rar Fart.rar Link to comment Share on other sites More sharing options...
streetmedic Posted November 5, 2018 Share Posted November 5, 2018 @echo on # CD %~dp0 for %%x in (ini ahk cfg xml ink lnk) do ( set extension=%%x call:reemplazar ) goto:fin :reemplazar for /r %%a in (*.%extension%) do ( fart -i "%%a" "S:\HS" "H:\HS" ) goto:eof :fin JUst change S:\HS" to become what your looking for and then H:\HS become what you want it to be ) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.