minimum framework to support loading ips files on top of already loaded roms
This commit is contained in:
parent
9d831d8b8b
commit
20d03d4434
|
@ -431,7 +431,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
|
|||
// currently there's only one situation:
|
||||
// the user clicked cancel form the open from archive dialog
|
||||
int userCancel = 0;
|
||||
fp = FCEU_fopen(name, 0, "rb", 0, -1, romextensions, &userCancel);
|
||||
fp = FCEU_fopen(name, LoadedRomFNamePatchToUse[0] ? LoadedRomFNamePatchToUse : nullptr, "rb", 0, -1, romextensions, &userCancel);
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
|
|
20
src/file.cpp
20
src/file.cpp
|
@ -69,7 +69,7 @@ void ApplyIPS(FILE *ips, FCEUFILE* fp)
|
|||
|
||||
if(!ips) return;
|
||||
|
||||
char* buf = (char*)FCEU_dmalloc(fp->size);
|
||||
char* buf = (char*)FCEU_malloc(fp->size);
|
||||
memcpy(buf,fp->EnsureMemorystream()->buf(),fp->size);
|
||||
|
||||
|
||||
|
@ -108,13 +108,7 @@ void ApplyIPS(FILE *ips, FCEUFILE* fp)
|
|||
if((offset+size)>(uint32)fp->size)
|
||||
{
|
||||
// Probably a little slow.
|
||||
char *newbuf=(char *)realloc(buf,offset+size);
|
||||
if(!newbuf)
|
||||
{
|
||||
free(buf); buf=NULL;
|
||||
FCEU_printf(" Oops. IPS patch %d(type RLE) goes beyond end of file. Could not allocate memory.\n",count);
|
||||
goto end;
|
||||
}
|
||||
char *newbuf=(char *)FCEU_realloc(buf,offset+size);
|
||||
buf=newbuf;
|
||||
memset(buf+fp->size,0,offset+size-fp->size);
|
||||
fp->size=offset+size;
|
||||
|
@ -133,13 +127,7 @@ void ApplyIPS(FILE *ips, FCEUFILE* fp)
|
|||
if((offset+size)>(uint32)fp->size)
|
||||
{
|
||||
// Probably a little slow.
|
||||
char *newbuf=(char *)realloc(buf,offset+size);
|
||||
if(!newbuf)
|
||||
{
|
||||
free(buf); buf=NULL;
|
||||
FCEU_printf(" Oops. IPS patch %d(type normal) goes beyond end of file. Could not allocate memory.\n",count);
|
||||
goto end;
|
||||
}
|
||||
char *newbuf=(char *)FCEU_realloc(buf,offset+size);
|
||||
buf=newbuf;
|
||||
memset(buf+fp->size,0,offset+size-fp->size);
|
||||
}
|
||||
|
@ -495,7 +483,7 @@ void FCEUI_SetDirOverride(int which, char *n)
|
|||
va_list ap;
|
||||
int ret;
|
||||
|
||||
if(!(*strp=(char*)FCEU_dmalloc(2048))) //mbg merge 7/17/06 cast to char*
|
||||
if(!(*strp=(char*)FCEU_malloc(2048))) //mbg merge 7/17/06 cast to char*
|
||||
return(0);
|
||||
va_start(ap,fmt);
|
||||
ret=vsnprintf(*strp,2048,fmt,ap);
|
||||
|
|
|
@ -58,6 +58,7 @@ uint8 MirroringAs2bits = 0;
|
|||
uint32 ROM_size = 0;
|
||||
uint32 VROM_size = 0;
|
||||
char LoadedRomFName[2048]; //mbg merge 7/17/06 added
|
||||
char LoadedRomFNamePatchToUse[2048];
|
||||
|
||||
static int CHRRAMSize = -1;
|
||||
static int iNES_Init(int num);
|
||||
|
|
|
@ -47,6 +47,7 @@ extern uint8 **VPageR;
|
|||
extern int iNesSave(void); //bbit Edited: line added
|
||||
extern int iNesSaveAs(const char* name);
|
||||
extern char LoadedRomFName[2048]; //bbit Edited: line added
|
||||
extern char LoadedRomFNamePatchToUse[2048];
|
||||
extern char *iNesShortFName(void);
|
||||
extern const TMasterRomInfo* MasterRomInfo;
|
||||
extern TMasterRomInfoParams MasterRomInfoParams;
|
||||
|
|
Loading…
Reference in New Issue