]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Check also normal ROM path for Munt ROMs. Keep checking other paths if first path...
authorToni Wilen <twilen@winuae.net>
Sun, 14 Apr 2024 13:14:18 +0000 (16:14 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 14 Apr 2024 13:14:18 +0000 (16:14 +0300)
midiemu.cpp

index cd6b55b0c7b62888dd1dd3fced44f910e6ff23c5..8001a3a8fa139e5f9d7fc0cd482ae4fec3bb5bb1 100644 (file)
@@ -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;