Replace direct file access with VFS routines

This commit is contained in:
jdgleaver
2021-10-20 16:31:45 +01:00
parent 5ad90107b6
commit 499f1c04de
44 changed files with 5853 additions and 575 deletions

View File

@@ -22,6 +22,9 @@
#include <stdlib.h>
#include <math.h>
#include <string/stdstring.h>
#include <streams/file_stream.h>
#include "fceu-types.h"
#include "fceu.h"
#include "general.h"
@@ -187,17 +190,22 @@ int ipalette = 0;
void FCEU_LoadGamePalette(void) {
uint8 ptmp[192];
FILE *fp;
char *fn;
RFILE *fp = NULL;
char *fn = NULL;
ipalette = 0;
fn = FCEU_MakeFName(FCEUMKF_PALETTE, 0, 0);
if ((fp = FCEUD_UTF8fopen(fn, "rb"))) {
if (!string_is_empty(fn))
fp = filestream_open(fn,
RETRO_VFS_FILE_ACCESS_READ,
RETRO_VFS_FILE_ACCESS_HINT_NONE);
if (fp) {
int x;
fread(ptmp, 1, 192, fp);
fclose(fp);
filestream_read(fp, ptmp, 192);
filestream_close(fp);
for (x = 0; x < 64; x++) {
palettei[x].r = ptmp[x + x + x];
palettei[x].g = ptmp[x + x + x + 1];