Friends who have read the previous two issues already know the format of writing the game list of the Retroarch simulator, and can also manually write their own game list. However, this writing method is quite labor-intensive. Even if we copy and paste, it will take a lot of manp

Friends who have read the previous two issues already know the format of writing the game list of the Retroarch simulator, and can also manually write their own game list. However, this writing method is quite labor-intensive. Even if we copy and paste, it will take a lot of manpower and time. So is there an easier way? Of course there is! Let the game list be generated automatically!

When I first started to contact the Retroarch emulator, I spent time searching for related game list editors online, but unfortunately, no one in China seems to be doing this thing, and all I found are editors that have nothing to do with Retroarch.

However, a great master from abroad made a stand-alone web version. It is not very friendly. This editor edits the lpl file, so you must first make a list and then use it to edit the data inside.

After opening the editor, you can select the game name, game path and core name (prerequisite to ensure that there is no error in the lpl file code):

After editing the relevant information of the game, click "Save List" to select the emulator platform. The windows version can be selected according to the actual selection. The Android version selects /data/data/com.retroarch/cores/*_libretro_android.so

Another problem is that this editor has not been updated (I didn't find it), and the Retroarch emulator has always had version updates and core replacements. The existing core names and paths of this editor may not correspond to the current version of the emulator, resulting in the failure of the game running. Although you have a programming foundation to change the contents yourself, it is still not very friendly to the general public. Interested friends can search for "Retroarch emulator list editor" to study it.

After using this list editor for a few days, I started to think about writing one by myself. I originally wanted to use Python, but the syntax is simple and efficient. Later, I thought that it would be more convenient to use batch processing. The benefits of batch processing are here. As long as I have a computer at home, I don’t need to download the editor or programmatic foundation, I can use it!

We already know that writing a list is a repeated loop process, so just a simple batch processing can help us complete this work quickly.

code is as follows:

@echo off & setlocal EnableDelayedExpansionrem HuanYingGuanZhu JinRiTouTiao TuLeShidir *.* /bfilename1.tmpset name=%~n0set str="filename1.tmp"findstr /v %name% "filename1.tmp"filename2.tmpfindstr /v %str% "filename2.tmp"filename.tmp&del /s/q filename1.tmp filename2.tmpecho {"items":[liebiao1.tmp(for /f "delims=" %%a in (filename.tmp)do (echo {"path":"%%~fa","label":"%%%~na","core_path":"DETECT","core_name":"DETECE","crc32":"DETECT","db_name":"DETECT"},))liebiao1.tmp&del /s/q filename.tmp(for /f "delims=" %%x in (liebiao1.tmp) do (set "str=%%x"set "str=!str:\=/!"echo !str!))liebiao2.tmp&del /s/q liebiao1.tmpfor /f "delims= tokens=*" %%a in (liebiao2.tmp) do (echo;!var!set var=%%a)liebiao.txtfor /f "delims==" %%a in (liebiao2.tmp) do (set lastline=%%a)echo %lastline:~0,-1% liebiao.txtecho ]}liebiao.txtdel /s/q liebiao2.tmp

How to use:

1. Create a new txt text file on the computer (the file name is in English, the reason will be introduced later), double-click to open it and copy and paste the code in and save it as a cmd file (that is, change XXX.txt to XX.cmd). This "Retroarch emulator game list automatic generator" is completed! !

2. Copy the "List Auto Generator" to the folder where the game is stored and double-click to run.

Here, assuming there are 10 games in my computer's "D:\RetroArch\ROMS\PCE" folder. I need to make these 10 games into a list and copy the "Retroarch emulator game list automatic generator" to this folder and run it directly.

Note: The CMD file requires system administrator permission to run

After successful run, a liebiao.txt file is generated in the folder in seconds:

double-click to open it, and the game list code has been automatically generated inside.

But at this time it is a txt file, and it needs to be changed to the game list file format of the emulator.

3. Open the HBuiderX code editor, create a new blank HTML file into the emulator playlist folder according to the method of the previous two articles, and change it to xx.lpl, copy and paste the contents of the liebbiao.txt file and save it.

At this time, the game list of PCE folder is ready. Open the Retroarch emulator and select one of the games in the list and run it (the method of selecting core running is also introduced before)

After successful running, exit the Retroarch emulator, and then open PCE.lpl with HBuiderX, you will find that the game emulator you just ran has helped us fill in the core name and path (and the format has also been changed), and replace the core path and name of other games.

最后,说下为什么开始我们做的“Retroarch模拟器游戏列表自动生成器”要用英文名称,那是因为我在代码中引用了cmd文件本身的名称,而TXT文本默认保存编码为UTF-8,如果我们使用的是中文名称,在打开后会显示乱码。

We can choose the encoding method to ANSI when saving the file with Notepad, which comes with Windows, so that the Chinese name can be used.