From 85d5c87d3d18a728281087bdf407c78f3f0763cd Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 4 Jun 2021 21:01:19 +0200 Subject: [PATCH] - Simplify MakeMemWrapBuffer - FCEUI_LoadGame - UNIFLoad and FDSLoad never use 'name' so pass NULL here --- src/fceu.c | 6 ++---- src/file.c | 10 +++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/fceu.c b/src/fceu.c index de3f21b..0d471b9 100644 --- a/src/fceu.c +++ b/src/fceu.c @@ -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"); diff --git a/src/file.c b/src/file.c index 07da9f8..fc05ea1 100644 --- a/src/file.c +++ b/src/file.c @@ -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);