From 2da412bb6538f89043ce9fa13b296e322d6f3fbb Mon Sep 17 00:00:00 2001 From: XargonWan Date: Tue, 18 Jun 2024 14:33:02 +0900 Subject: [PATCH] NETPLAY: improving roms search --- functions/netplay.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/netplay.sh b/functions/netplay.sh index e01790c9..301ae8eb 100755 --- a/functions/netplay.sh +++ b/functions/netplay.sh @@ -83,9 +83,11 @@ start_game() { fi done - # Find the game ROM in the specified directory + # Find the game ROM by name and then verify CRC found_rom="" - for rom in $(find "$roms_folder" -type f); do + candidates=($(find "$roms_folder" -type f -iname "*$(echo "$selected_game_name" | sed 's/[^a-zA-Z0-9]//g')*")) + + for rom in "${candidates[@]}"; do # Check the CRC of the ROM rom_crc=$(crc32 "$rom") if [ "$rom_crc" = "$selected_game_crc" ]; then