From 15fd9b73ebb35dcbfe0cf4f49a43e5623ab624b1 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 14 Apr 2024 16:14:18 +0300 Subject: [PATCH] Check also normal ROM path for Munt ROMs. Keep checking other paths if first path existed but didn't have all required ROMs. --- midiemu.cpp | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/midiemu.cpp b/midiemu.cpp index cd6b55b0..8001a3a8 100644 --- a/midiemu.cpp +++ b/midiemu.cpp @@ -132,31 +132,36 @@ bool midi_emu_available(const TCHAR *id) return false; } - fetch_rompath(path, sizeof(path) / sizeof(TCHAR)); - _tcscat(path, _T("mt32-roms\\")); - if (!my_existsdir(path)) { - _tcscpy(path, _T("C:\\mt32-rom-data\\")); - } - if (!my_existsdir(path)) { - return false; - } - if (me == 1) { - if (!check_rom(path, _T("pcm_mt32")) && !check_rom(path, _T("mt32_pcm"))) { - if (!check_rom(path, _T("pcm_mt32_l")) || !check_rom(path, _T("pcm_mt32_h"))) { - return false; - } + for (int rc = 0; rc < 3; rc++) { + if (rc == 0) { + fetch_rompath(path, sizeof(path) / sizeof(TCHAR)); + } else if (rc == 1) { + fetch_rompath(path, sizeof(path) / sizeof(TCHAR)); + _tcscat(path, _T("mt32-roms\\")); + } else if (rc == 2) { + _tcscpy(path, _T("C:\\mt32-rom-data\\")); } - } else { - if (!check_rom(path, _T("pcm_cm32l")) && !check_rom(path, _T("cm32l_pcm"))) { - if (!check_rom(path, _T("pcm_mt32")) || !check_rom(path, _T("pcm_cm32l_h"))) { - return false; + if (!my_existsdir(path)) { + continue; + } + if (me == 1) { + if (!check_rom(path, _T("pcm_mt32")) && !check_rom(path, _T("mt32_pcm"))) { + if (!check_rom(path, _T("pcm_mt32_l")) || !check_rom(path, _T("pcm_mt32_h"))) { + continue; + } + } + } else { + if (!check_rom(path, _T("pcm_cm32l")) && !check_rom(path, _T("cm32l_pcm"))) { + if (!check_rom(path, _T("pcm_mt32")) || !check_rom(path, _T("pcm_cm32l_h"))) { + continue; + } } } - } - const TCHAR **ctl = me == 1 ? mt32ctl : cm32lctl; - for (int i = 0; ctl[i]; i++) { - if (check_rom(path, ctl[i])) { - return true; + const TCHAR **ctl = me == 1 ? mt32ctl : cm32lctl; + for (int i = 0; ctl[i]; i++) { + if (check_rom(path, ctl[i])) { + return true; + } } } return false; -- 2.47.3