notaz.gp2x.de
/
pcsx_rearmed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #642 from StormedBubbles/guncon
[pcsx_rearmed.git]
/
libpcsxcore
/
sio.c
diff --git
a/libpcsxcore/sio.c
b/libpcsxcore/sio.c
index
ae3e634
..
8392fd8
100644
(file)
--- a/
libpcsxcore/sio.c
+++ b/
libpcsxcore/sio.c
@@
-17,8
+17,6
@@
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
***************************************************************************/
* 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
***************************************************************************/
-#include <compat/fopen_utf8.h>
-
/*
* SIO functions.
*/
/*
* SIO functions.
*/
@@
-26,6
+24,10
@@
#include "sio.h"
#include <sys/stat.h>
#include "sio.h"
#include <sys/stat.h>
+#ifdef USE_LIBRETRO_VFS
+#include <streams/file_stream_transforms.h>
+#endif
+
// Status Flags
#define TX_RDY 0x0001
#define RX_RDY 0x0002
// Status Flags
#define TX_RDY 0x0001
#define RX_RDY 0x0002
@@
-438,11
+440,11
@@
void LoadMcd(int mcd, char *str) {
if (*str == 0)
return;
if (*str == 0)
return;
- f = fopen
_utf8
(str, "rb");
+ f = fopen(str, "rb");
if (f == NULL) {
SysPrintf(_("The memory card %s doesn't exist - creating it\n"), str);
CreateMcd(str);
if (f == NULL) {
SysPrintf(_("The memory card %s doesn't exist - creating it\n"), str);
CreateMcd(str);
- f = fopen
_utf8
(str, "rb");
+ f = fopen(str, "rb");
if (f != NULL) {
struct stat buf;
if (f != NULL) {
struct stat buf;
@@
-452,7
+454,12
@@
void LoadMcd(int mcd, char *str) {
else if(buf.st_size == MCD_SIZE + 3904)
fseek(f, 3904, SEEK_SET);
}
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
fclose(f);
}
else
@@
-467,7
+474,12
@@
void LoadMcd(int mcd, char *str) {
else if(buf.st_size == MCD_SIZE + 3904)
fseek(f, 3904, SEEK_SET);
}
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);
}
}
fclose(f);
}
}
@@
-483,7
+495,7
@@
void SaveMcd(char *mcd, char *data, uint32_t adr, int size) {
if (mcd == NULL || *mcd == 0 || strcmp(mcd, "none") == 0)
return;
if (mcd == NULL || *mcd == 0 || strcmp(mcd, "none") == 0)
return;
- f = fopen
_utf8
(mcd, "r+b");
+ f = fopen(mcd, "r+b");
if (f != NULL) {
struct stat buf;
if (f != NULL) {
struct stat buf;
@@
-520,7
+532,7
@@
void CreateMcd(char *mcd) {
int s = MCD_SIZE;
int i = 0, j;
int s = MCD_SIZE;
int i = 0, j;
- f = fopen
_utf8
(mcd, "wb");
+ f = fopen(mcd, "wb");
if (f == NULL)
return;
if (f == NULL)
return;