repleace fopen to filestream_open
#include "libretro.h"
#include "libretro_params.h"
#include "libretro_core_options.h"
+#include "file_stream.h"
#include "compiler.h"//required to prevent missing type errors
#include "beep.h"
@@ -175,37 +176,16 @@ void setpredskindex(void){
}
/* end media swap support */
-#if defined(_WINDOWS)
-#define LR_NP2_FILEPATH_LENGTH 4096
-static char strSJIS[LR_NP2_FILEPATH_LENGTH];
-static char strUni[LR_NP2_FILEPATH_LENGTH];
-#endif /* _WINDOWS */
-
-FILE* fopen_jp(const char * restrict filename, const char * restrict mode) {
-#if defined(_WINDOWS)
- int iUniLen;
- if(GetACP() == 932) {
- iUniLen = MultiByteToWideChar(CP_UTF8, 0, filename, strlen(filename) + 1, strUni, LR_NP2_FILEPATH_LENGTH);
- WideCharToMultiByte(CP_ACP, 0, strUni, iUniLen, strSJIS, LR_NP2_FILEPATH_LENGTH, NULL, NULL);
- } else {
- strcpy(strSJIS, filename);
- }
- return fopen(strSJIS, mode);
-#else /* _WINDOWS */
- return fopen(filename, mode);
-#endif /* _WINDOWS */
-}
-
int loadcmdfile(char *argv)
{
int res=0;
- FILE *fp = fopen_jp(argv,"r");
+ RFILE *fp = filestream_open(argv, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
printf("lcmd:ready\n");
if( fp != NULL )
{
printf("lcmd:open\n");
- if ( fgets (CMDFILE , 512 , fp) != NULL )
+ if ( filestream_gets (fp, CMDFILE , 512) != NULL )
res=1;
fclose (fp);
}
@@ -262,12 +242,12 @@ static bool read_m3u(const char *file)
{
char line[MAX_PATH];
char name[MAX_PATH];
- FILE *f = fopen_jp(file, "r");
+ RFILE *f = filestream_open(file, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
if (!f)
return false;
- while (fgets(line, sizeof(line), f) && disk_images < sizeof(disk_paths) / sizeof(disk_paths[0]))
+ while (filestream_gets(f, line, sizeof(line)) && disk_images < sizeof(disk_paths) / sizeof(disk_paths[0]))
{
if (line[0] == '#')
continue;
