Fix regression caused by #9361a5aa4fef73e06bc78b7c462eb28a7d12e3d0
[pcsx_rearmed.git] / libpcsxcore / psxmem.c
index 53edfab..2f427ac 100644 (file)
@@ -23,8 +23,6 @@
 
 // TODO: Implement caches & cycle penalty.
 
-#include <compat/fopen_utf8.h>
-
 #include "psxmem.h"
 #include "psxmem_map.h"
 #include "r3000a.h"
 
 #include "memmap.h"
 
+#ifdef USE_LIBRETRO_VFS
+#include <streams/file_stream_transforms.h>
+#endif
+
 #ifndef MAP_ANONYMOUS
 #define MAP_ANONYMOUS MAP_ANON
 #endif
 
+#ifndef NDEBUG
+#include "debug.h"
+#else
+void DebugCheckBP(u32 address, enum breakpoint_types type) {}
+#endif
+
 void *(*psxMapHook)(unsigned long addr, size_t size, int is_fixed,
                enum psxMapTag tag);
 void (*psxUnmapHook)(void *ptr, size_t size, enum psxMapTag tag);
@@ -217,20 +225,24 @@ void psxMemReset() {
        memset(psxM, 0, 0x00200000);
        memset(psxP, 0xff, 0x00010000);
 
+       Config.HLE = TRUE;
+
        if (strcmp(Config.Bios, "HLE") != 0) {
                sprintf(bios, "%s/%s", Config.BiosDir, Config.Bios);
-               f = fopen_utf8(bios, "rb");
+               f = fopen(bios, "rb");
 
                if (f == NULL) {
                        SysMessage(_("Could not open BIOS:\"%s\". Enabling HLE Bios!\n"), bios);
                        memset(psxR, 0, 0x80000);
-                       Config.HLE = TRUE;
                } else {
-                       fread(psxR, 1, 0x80000, f);
+                       if (fread(psxR, 1, 0x80000, f) == 0x80000) {
+                               Config.HLE = FALSE;
+                       } else {
+                               SysMessage(_("The selected BIOS:\"%s\" is of wrong size. Enabling HLE Bios!\n"), bios);
+                       }
                        fclose(f);
-                       Config.HLE = FALSE;
                }
-       } else Config.HLE = TRUE;
+       }
 }
 
 void psxMemShutdown() {