- Simplify MakeMemWrapBuffer

- FCEUI_LoadGame - UNIFLoad and FDSLoad never use 'name' so pass
NULL here
This commit is contained in:
twinaphex
2021-06-04 21:01:19 +02:00
parent 597175043b
commit 85d5c87d3d
2 changed files with 7 additions and 9 deletions

View File

@@ -244,8 +244,6 @@ FCEUGI *FCEUI_LoadGame(const char *name, uint8_t *databuf, size_t databufsize)
GameInfo->inputfc = -1; GameInfo->inputfc = -1;
GameInfo->cspecial = 0; GameInfo->cspecial = 0;
FCEU_printf("Loading %s...\n\n", name);
GetFileBase(name); GetFileBase(name);
fp = FCEU_fopen(name, NULL, "rb", 0, databuf, databufsize); fp = FCEU_fopen(name, NULL, "rb", 0, databuf, databufsize);
@@ -259,9 +257,9 @@ FCEUGI *FCEUI_LoadGame(const char *name, uint8_t *databuf, size_t databufsize)
goto endlseq; goto endlseq;
if (NSFLoad(fp)) if (NSFLoad(fp))
goto endlseq; goto endlseq;
if (UNIFLoad(name, fp)) if (UNIFLoad(NULL, fp))
goto endlseq; goto endlseq;
if (FDSLoad(name, fp)) if (FDSLoad(NULL, fp))
goto endlseq; goto endlseq;
FCEU_PrintError("An error occurred while loading the file.\n"); FCEU_PrintError("An error occurred while loading the file.\n");

View File

@@ -63,7 +63,7 @@ doret:
return tmp; return tmp;
} }
static MEMWRAP *MakeMemWrapBuffer(const char *tz, int type, uint8 *buffer, size_t bufsize) static MEMWRAP *MakeMemWrapBuffer(uint8 *buffer, size_t bufsize)
{ {
MEMWRAP *tmp = (MEMWRAP*)FCEU_malloc(sizeof(MEMWRAP)); MEMWRAP *tmp = (MEMWRAP*)FCEU_malloc(sizeof(MEMWRAP));
@@ -84,7 +84,7 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn,
fceufp->type = 0; fceufp->type = 0;
if (buffer) if (buffer)
fceufp->fp = MakeMemWrapBuffer(path, 0, buffer, bufsize); fceufp->fp = MakeMemWrapBuffer(buffer, bufsize);
else else
{ {
void *t = fopen_utf8(path, mode); void *t = fopen_utf8(path, mode);