X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fsio.c;h=44957d392847dcf4ef936d94aac9c60174cb8778;hb=1b591888c4aec568da64ea2897e9ad8bbf33cea1;hp=c2390bf06e36f5d5ae62a96a3f6b70369abbb8d8;hpb=28d1bea2e828cd079593abc8c97ea6ff4fd7d4f4;p=pcsx_rearmed.git diff --git a/libpcsxcore/sio.c b/libpcsxcore/sio.c index c2390bf0..44957d39 100644 --- a/libpcsxcore/sio.c +++ b/libpcsxcore/sio.c @@ -24,6 +24,10 @@ #include "sio.h" #include +#ifdef USE_LIBRETRO_VFS +#include +#endif + // Status Flags #define TX_RDY 0x0001 #define RX_RDY 0x0002 @@ -68,12 +72,10 @@ char Mcd1Data[MCD_SIZE], Mcd2Data[MCD_SIZE]; char McdDisable[2]; #define SIO_INT(eCycle) { \ - if (!Config.Sio) { \ - psxRegs.interrupt |= (1 << PSXINT_SIO); \ - psxRegs.intCycle[PSXINT_SIO].cycle = eCycle; \ - psxRegs.intCycle[PSXINT_SIO].sCycle = psxRegs.cycle; \ - new_dyna_set_event(PSXINT_SIO, eCycle); \ - } \ + psxRegs.interrupt |= (1 << PSXINT_SIO); \ + psxRegs.intCycle[PSXINT_SIO].cycle = eCycle; \ + psxRegs.intCycle[PSXINT_SIO].sCycle = psxRegs.cycle; \ + new_dyna_set_event(PSXINT_SIO, eCycle); \ } // clk cycle byte @@ -450,7 +452,12 @@ void LoadMcd(int mcd, char *str) { else if(buf.st_size == MCD_SIZE + 3904) fseek(f, 3904, SEEK_SET); } - fread(data, 1, MCD_SIZE, f); + if (fread(data, 1, MCD_SIZE, f) != MCD_SIZE) { +#ifndef NDEBUG + SysPrintf(_("File IO error in <%s:%s>.\n"), __FILE__, __func__); +#endif + memset(data, 0x00, MCD_SIZE); + } fclose(f); } else @@ -465,7 +472,12 @@ void LoadMcd(int mcd, char *str) { else if(buf.st_size == MCD_SIZE + 3904) fseek(f, 3904, SEEK_SET); } - fread(data, 1, MCD_SIZE, f); + if (fread(data, 1, MCD_SIZE, f) != MCD_SIZE) { +#ifndef NDEBUG + SysPrintf(_("File IO error in <%s:%s>.\n"), __FILE__, __func__); +#endif + memset(data, 0x00, MCD_SIZE); + } fclose(f); } } @@ -680,6 +692,7 @@ void ConvertMcd(char *mcd, char *data) { fclose(f); } f = fopen(mcd, "r+"); + if (f == NULL) return; s = s + 3904; fputc('1', f); s--; fputc('2', f); s--; @@ -714,6 +727,7 @@ void ConvertMcd(char *mcd, char *data) { fclose(f); } f = fopen(mcd, "r+"); + if (f == NULL) return; s = s + 64; fputc('V', f); s--; fputc('g', f); s--;