]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Fix weird ROM path if KS ROM is not found.
authorToni Wilen <twilen@winuae.net>
Wed, 22 Aug 2018 18:36:02 +0000 (21:36 +0300)
committerToni Wilen <twilen@winuae.net>
Wed, 22 Aug 2018 18:36:02 +0000 (21:36 +0300)
memory.cpp

index 2d184a4e08481d7b39eb79598ffb8bda330994d3..c9169ad9e87c7903c3dd3680cc8453d55d50e14a 100644 (file)
@@ -1673,30 +1673,32 @@ static struct zfile *get_kickstart_filehandle(struct uae_prefs *p)
 
        f = read_rom_name(p->romfile);
        _tcscpy(tmprom, p->romfile);
+       _tcscpy(tmprom2, p->romfile);
        if (f == NULL) {
                _stprintf(tmprom2, _T("%s%s"), start_path_data, p->romfile);
                f = rom_fopen(tmprom2, _T("rb"), ZFD_NORMAL);
                if (f == NULL) {
-                       _stprintf(p->romfile, _T("%sroms/kick.rom"), start_path_data);
-                       f = rom_fopen(p->romfile, _T("rb"), ZFD_NORMAL);
+                       _stprintf(tmprom2, _T("%sroms/kick.rom"), start_path_data);
+                       f = rom_fopen(tmprom2, _T("rb"), ZFD_NORMAL);
                        if (f == NULL) {
-                               _stprintf(p->romfile, _T("%skick.rom"), start_path_data);
-                               f = rom_fopen(p->romfile, _T("rb"), ZFD_NORMAL);
+                               _stprintf(tmprom2, _T("%skick.rom"), start_path_data);
+                               f = rom_fopen(tmprom2, _T("rb"), ZFD_NORMAL);
                                if (f == NULL) {
-                                       _stprintf(p->romfile, _T("%s../shared/rom/kick.rom"), start_path_data);
-                                       f = rom_fopen(p->romfile, _T("rb"), ZFD_NORMAL);
+                                       _stprintf(tmprom2, _T("%s../shared/rom/kick.rom"), start_path_data);
+                                       f = rom_fopen(tmprom2, _T("rb"), ZFD_NORMAL);
                                        if (f == NULL) {
-                                               _stprintf(p->romfile, _T("%s../System/rom/kick.rom"), start_path_data);
-                                               f = rom_fopen(p->romfile, _T("rb"), ZFD_NORMAL);
+                                               _stprintf(tmprom2, _T("%s../System/rom/kick.rom"), start_path_data);
+                                               f = rom_fopen(tmprom2, _T("rb"), ZFD_NORMAL);
                                                if (f == NULL)
                                                        f = read_rom_name_guess(tmprom);
                                        }
                                }
                        }
-               } else {
-                       _tcscpy(p->romfile, tmprom2);
                }
        }
+       if (f) {
+               _tcscpy(p->romfile, tmprom2);
+       }
        return f;
 }