- 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->cspecial = 0;
FCEU_printf("Loading %s...\n\n", name);
GetFileBase(name);
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;
if (NSFLoad(fp))
goto endlseq;
if (UNIFLoad(name, fp))
if (UNIFLoad(NULL, fp))
goto endlseq;
if (FDSLoad(name, fp))
if (FDSLoad(NULL, fp))
goto endlseq;
FCEU_PrintError("An error occurred while loading the file.\n");

View File

@@ -63,7 +63,7 @@ doret:
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));
@@ -71,8 +71,8 @@ static MEMWRAP *MakeMemWrapBuffer(const char *tz, int type, uint8 *buffer, size_
return NULL;
tmp->location = 0;
tmp->size = bufsize;
tmp->data = buffer;
tmp->size = bufsize;
tmp->data = buffer;
return tmp;
}
@@ -82,9 +82,9 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn,
{
FCEUFILE *fceufp = (FCEUFILE*)malloc(sizeof(FCEUFILE));
fceufp->type = 0;
fceufp->type = 0;
if (buffer)
fceufp->fp = MakeMemWrapBuffer(path, 0, buffer, bufsize);
fceufp->fp = MakeMemWrapBuffer(buffer, bufsize);
else
{
void *t = fopen_utf8(path, mode);