Use VFS layers for disc.cpp

This commit is contained in:
libretroadmin 2022-05-30 01:42:46 +02:00
parent ff23dafd7b
commit ccf701b7b7
2 changed files with 13 additions and 4 deletions

View File

@ -172,6 +172,7 @@ endif
ifneq ($(STATIC_LINKING), 1)
SOURCES_C += $(LIBRETRO_COMM_DIR)/streams/file_stream.c \
$(LIBRETRO_COMM_DIR)/streams/file_stream_transforms.c \
$(LIBRETRO_COMM_DIR)/file/file_path.c \
$(LIBRETRO_COMM_DIR)/file/retro_dirent.c \
$(LIBRETRO_COMM_DIR)/lists/dir_list.c \

View File

@ -1,6 +1,7 @@
#include "libretro.h"
#include <string/stdstring.h>
#include <streams/file_stream.h>
#include "mednafen/mednafen-types.h"
#include "mednafen/git.h"
@ -12,6 +13,13 @@
#include "mednafen/ss/cdb.h"
#include "mednafen/ss/smpc.h"
// Forward declarations
extern "C"{
RFILE* rfopen(const char *path, const char *mode);
char *rfgets(char *buffer, int maxCount, RFILE* stream);
int rfclose(RFILE* stream);
}
//------------------------------------------------------------------------------
// Locals
//------------------------------------------------------------------------------
@ -67,13 +75,13 @@ static void ReadM3U( std::vector<std::string> &file_list, std::string path, unsi
{
std::string dir_path;
char linebuf[ 2048 ];
FILE *fp = fopen(path.c_str(), "rb");
if (fp == NULL)
RFILE *fp = rfopen(path.c_str(), "rb");
if (!fp)
return;
MDFN_GetFilePathComponents(path, &dir_path);
while(fgets(linebuf, sizeof(linebuf), fp) != NULL)
while(rfgets(linebuf, sizeof(linebuf), fp) != NULL)
{
std::string efp;
@ -107,7 +115,7 @@ static void ReadM3U( std::vector<std::string> &file_list, std::string path, unsi
}
end:
fclose(fp);
rfclose(fp);
}
static bool IsSaturnDisc( const uint8* sa32k )