mirror of
https://github.com/dborth/fceugx.git
synced 2024-11-01 06:55:05 +01:00
sync to FCEUX svn, other minor fixes
This commit is contained in:
parent
1e98f458ad
commit
ec93d4f2b3
@ -30,12 +30,8 @@
|
|||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "cart.h"
|
#include "cart.h"
|
||||||
#ifdef GEKKO
|
|
||||||
#include <string.h>
|
|
||||||
#else
|
|
||||||
#include "memory.h"
|
|
||||||
#endif
|
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
|
#include "utils/memory.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -166,7 +162,7 @@ static void CheatMemErr(void)
|
|||||||
int AddCheatEntry(char *name, uint32 addr, uint8 val, int compare, int status, int type)
|
int AddCheatEntry(char *name, uint32 addr, uint8 val, int compare, int status, int type)
|
||||||
{
|
{
|
||||||
struct CHEATF *temp;
|
struct CHEATF *temp;
|
||||||
if(!(temp=(struct CHEATF *)malloc(sizeof(struct CHEATF))))
|
if(!(temp=(struct CHEATF *)FCEU_dmalloc(sizeof(struct CHEATF))))
|
||||||
{
|
{
|
||||||
CheatMemErr();
|
CheatMemErr();
|
||||||
return(0);
|
return(0);
|
||||||
@ -251,7 +247,8 @@ void FCEU_LoadGameCheats(FILE *override)
|
|||||||
char *neo=&tbuf[4+2+2+1+1+1];
|
char *neo=&tbuf[4+2+2+1+1+1];
|
||||||
if(sscanf(tbuf,"%04x%*[:]%02x%*[:]%02x",&addr,&val,&compare)!=3)
|
if(sscanf(tbuf,"%04x%*[:]%02x%*[:]%02x",&addr,&val,&compare)!=3)
|
||||||
continue;
|
continue;
|
||||||
namebuf=(char *)malloc(strlen(neo)+1);
|
if (!(namebuf=(char *)FCEU_dmalloc(strlen(neo)+1)))
|
||||||
|
return;
|
||||||
strcpy(namebuf,neo);
|
strcpy(namebuf,neo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -259,7 +256,8 @@ void FCEU_LoadGameCheats(FILE *override)
|
|||||||
char *neo=&tbuf[4+2+1+1];
|
char *neo=&tbuf[4+2+1+1];
|
||||||
if(sscanf(tbuf,"%04x%*[:]%02x",&addr,&val)!=2)
|
if(sscanf(tbuf,"%04x%*[:]%02x",&addr,&val)!=2)
|
||||||
continue;
|
continue;
|
||||||
namebuf=(char *)malloc(strlen(neo)+1);
|
if (!(namebuf=(char *)FCEU_dmalloc(strlen(neo)+1)))
|
||||||
|
return;
|
||||||
strcpy(namebuf,neo);
|
strcpy(namebuf,neo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +365,7 @@ int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int ty
|
|||||||
{
|
{
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
if(!(t=(char *)malloc(strlen(name)+1)))
|
if(!(t=(char *)FCEU_dmalloc(strlen(name)+1)))
|
||||||
{
|
{
|
||||||
CheatMemErr();
|
CheatMemErr();
|
||||||
return(0);
|
return(0);
|
||||||
@ -663,7 +661,7 @@ static int InitCheatComp(void)
|
|||||||
{
|
{
|
||||||
uint32 x;
|
uint32 x;
|
||||||
|
|
||||||
CheatComp=(uint16*)malloc(65536*sizeof(uint16));
|
CheatComp=(uint16*)FCEU_dmalloc(65536*sizeof(uint16));
|
||||||
if(!CheatComp)
|
if(!CheatComp)
|
||||||
{
|
{
|
||||||
CheatMemErr();
|
CheatMemErr();
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "conddebug.h"
|
#include "conddebug.h"
|
||||||
|
#include "types.h"
|
||||||
|
#include "utils/memory.h"
|
||||||
|
|
||||||
// Next non-whitespace character in string
|
// Next non-whitespace character in string
|
||||||
char next;
|
char next;
|
||||||
@ -93,7 +95,9 @@ Condition* InfixOperator(const char** str, Condition(*nextPart(const char**)), i
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mid = (Condition*)malloc(sizeof(Condition));
|
mid = (Condition*)FCEU_dmalloc(sizeof(Condition));
|
||||||
|
if (!mid)
|
||||||
|
return NULL;
|
||||||
memset(mid, 0, sizeof(Condition));
|
memset(mid, 0, sizeof(Condition));
|
||||||
|
|
||||||
mid->lhs = t;
|
mid->lhs = t;
|
||||||
@ -317,10 +321,14 @@ Condition* Primitive(const char** str, Condition* c)
|
|||||||
/* Handle * and / operators */
|
/* Handle * and / operators */
|
||||||
Condition* Term(const char** str)
|
Condition* Term(const char** str)
|
||||||
{
|
{
|
||||||
Condition* t = (Condition*)malloc(sizeof(Condition));
|
Condition* t;
|
||||||
Condition* t1;
|
Condition* t1;
|
||||||
Condition* mid;
|
Condition* mid;
|
||||||
|
|
||||||
|
t = (Condition*)FCEU_dmalloc(sizeof(Condition));
|
||||||
|
if (!t)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
memset(t, 0, sizeof(Condition));
|
memset(t, 0, sizeof(Condition));
|
||||||
|
|
||||||
if (!Primitive(str, t))
|
if (!Primitive(str, t))
|
||||||
@ -335,7 +343,9 @@ Condition* Term(const char** str)
|
|||||||
|
|
||||||
scan(str);
|
scan(str);
|
||||||
|
|
||||||
t1 = (Condition*)malloc(sizeof(Condition));
|
if (!(t1 = (Condition*)FCEU_dmalloc(sizeof(Condition))))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
memset(t1, 0, sizeof(Condition));
|
memset(t1, 0, sizeof(Condition));
|
||||||
|
|
||||||
if (!Primitive(str, t1))
|
if (!Primitive(str, t1))
|
||||||
@ -345,7 +355,9 @@ Condition* Term(const char** str)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mid = (Condition*)malloc(sizeof(Condition));
|
if (!(mid = (Condition*)FCEU_dmalloc(sizeof(Condition))))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
memset(mid, 0, sizeof(Condition));
|
memset(mid, 0, sizeof(Condition));
|
||||||
|
|
||||||
mid->lhs = t;
|
mid->lhs = t;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "fceu.h"
|
#include "fceu.h"
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
|
#include "utils/memory.h"
|
||||||
|
|
||||||
static char *aboutString = 0;
|
static char *aboutString = 0;
|
||||||
|
|
||||||
@ -43,7 +44,9 @@ FCEU TAS+ - Luke Gustafson\n\
|
|||||||
const char *compilerString = FCEUD_GetCompilerString();
|
const char *compilerString = FCEUD_GetCompilerString();
|
||||||
|
|
||||||
//allocate the string and concatenate the template with the compiler string
|
//allocate the string and concatenate the template with the compiler string
|
||||||
aboutString = (char*)malloc(strlen(aboutTemplate) + strlen(compilerString) + 1);
|
if (!(aboutString = (char*)FCEU_dmalloc(strlen(aboutTemplate) + strlen(compilerString) + 1)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
sprintf(aboutString,"%s%s",aboutTemplate,compilerString);
|
sprintf(aboutString,"%s%s",aboutTemplate,compilerString);
|
||||||
return aboutString;
|
return aboutString;
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,8 @@ int checkCondition(const char* condition, int num)
|
|||||||
{
|
{
|
||||||
watchpoint[num].cond = c;
|
watchpoint[num].cond = c;
|
||||||
watchpoint[num].condText = (char*)malloc(strlen(condition) + 1);
|
watchpoint[num].condText = (char*)malloc(strlen(condition) + 1);
|
||||||
|
if (!watchpoint[num].condText)
|
||||||
|
return 0;
|
||||||
strcpy(watchpoint[num].condText, condition);
|
strcpy(watchpoint[num].condText, condition);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -115,7 +115,7 @@ public:
|
|||||||
vec->resize(preallocate);
|
vec->resize(preallocate);
|
||||||
len = preallocate;
|
len = preallocate;
|
||||||
}
|
}
|
||||||
EMUFILE_MEMORY() : vec(new std::vector<u8>()), ownvec(true), pos(0), len(0) { vec->reserve(1024); }
|
EMUFILE_MEMORY() : vec(new std::vector<u8>()), ownvec(true), pos(0), len(0) { vec->reserve(8192); }
|
||||||
EMUFILE_MEMORY(void* buf, s32 size) : vec(new std::vector<u8>()), ownvec(true), pos(0), len(size) {
|
EMUFILE_MEMORY(void* buf, s32 size) : vec(new std::vector<u8>()), ownvec(true), pos(0), len(size) {
|
||||||
vec->resize(size);
|
vec->resize(size);
|
||||||
if(size != 0)
|
if(size != 0)
|
||||||
@ -139,9 +139,14 @@ public:
|
|||||||
//we dont generate straight into the buffer because it will null terminate (one more byte than we want)
|
//we dont generate straight into the buffer because it will null terminate (one more byte than we want)
|
||||||
int amt = vsnprintf(0,0,format,argptr);
|
int amt = vsnprintf(0,0,format,argptr);
|
||||||
char* tempbuf = new char[amt+1];
|
char* tempbuf = new char[amt+1];
|
||||||
|
|
||||||
|
va_end(argptr);
|
||||||
|
va_start(argptr, format);
|
||||||
vsprintf(tempbuf,format,argptr);
|
vsprintf(tempbuf,format,argptr);
|
||||||
|
|
||||||
fwrite(tempbuf,amt);
|
fwrite(tempbuf,amt);
|
||||||
delete[] tempbuf;
|
delete[] tempbuf;
|
||||||
|
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
return amt;
|
return amt;
|
||||||
};
|
};
|
||||||
|
@ -446,7 +446,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode)
|
|||||||
ResetGameLoaded();
|
ResetGameLoaded();
|
||||||
|
|
||||||
if (!AutosaveStatus)
|
if (!AutosaveStatus)
|
||||||
AutosaveStatus = (int*)malloc(sizeof(int)*AutosaveQty);
|
AutosaveStatus = (int*)FCEU_dmalloc(sizeof(int)*AutosaveQty);
|
||||||
for (AutosaveIndex=0; AutosaveIndex<AutosaveQty; ++AutosaveIndex)
|
for (AutosaveIndex=0; AutosaveIndex<AutosaveQty; ++AutosaveIndex)
|
||||||
AutosaveStatus[AutosaveIndex] = 0;
|
AutosaveStatus[AutosaveIndex] = 0;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ void ApplyIPS(FILE *ips, FCEUFILE* fp)
|
|||||||
|
|
||||||
if(!ips) return;
|
if(!ips) return;
|
||||||
|
|
||||||
char* buf = (char*)malloc(fp->size);
|
char* buf = (char*)FCEU_dmalloc(fp->size);
|
||||||
memcpy(buf,fp->EnsureMemorystream()->buf(),fp->size);
|
memcpy(buf,fp->EnsureMemorystream()->buf(),fp->size);
|
||||||
|
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
|
|||||||
{
|
{
|
||||||
//if the archive contained no files, try to open it the old fashioned way
|
//if the archive contained no files, try to open it the old fashioned way
|
||||||
EMUFILE_FILE* fp = FCEUD_UTF8_fstream(fileToOpen,mode);
|
EMUFILE_FILE* fp = FCEUD_UTF8_fstream(fileToOpen,mode);
|
||||||
if(!fp)
|
if(!fp || (fp->get_fp() == NULL))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -471,7 +471,7 @@ void FCEUI_SetDirOverride(int which, char *n)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
va_start(ap,fmt);
|
va_start(ap,fmt);
|
||||||
if(!(*strp=(char*)malloc(2048))) //mbg merge 7/17/06 cast to char*
|
if(!(*strp=(char*)FCEU_dmalloc(2048))) //mbg merge 7/17/06 cast to char*
|
||||||
return(0);
|
return(0);
|
||||||
ret=vsnprintf(*strp,2048,fmt,ap);
|
ret=vsnprintf(*strp,2048,fmt,ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
@ -1508,7 +1508,7 @@ static int NewiNES_Init(int num)
|
|||||||
{
|
{
|
||||||
CloseHandle(mapVROM);
|
CloseHandle(mapVROM);
|
||||||
mapVROM = NULL;
|
mapVROM = NULL;
|
||||||
if((VROM = (uint8 *)malloc(CHRRAMSize)) == NULL) return 0;
|
if((VROM = (uint8 *)FCEU_dmalloc(CHRRAMSize)) == NULL) return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1516,11 +1516,11 @@ static int NewiNES_Init(int num)
|
|||||||
{
|
{
|
||||||
CloseHandle(mapVROM);
|
CloseHandle(mapVROM);
|
||||||
mapVROM = NULL;
|
mapVROM = NULL;
|
||||||
if((VROM = (uint8 *)malloc(CHRRAMSize)) == NULL) return 0;
|
if((VROM = (uint8 *)FCEU_dmalloc(CHRRAMSize)) == NULL) return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if((VROM = (uint8 *)malloc(CHRRAMSize)) == NULL) return 0;
|
if((VROM = (uint8 *)FCEU_dmalloc(CHRRAMSize)) == NULL) return 0;
|
||||||
#endif
|
#endif
|
||||||
UNIFchrrama=VROM;
|
UNIFchrrama=VROM;
|
||||||
SetupCartCHRMapping(0,VROM,CHRRAMSize,1);
|
SetupCartCHRMapping(0,VROM,CHRRAMSize,1);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "share.h"
|
#include "share.h"
|
||||||
|
|
||||||
static int seq,ptr,bit,cnt,have;
|
static int seq,ptr,bit,cnt,have;
|
||||||
static uint8 bdata[20];
|
static uint8 bdata[32];
|
||||||
|
|
||||||
|
|
||||||
static uint8 Read(int w, uint8 ret)
|
static uint8 Read(int w, uint8 ret)
|
||||||
@ -60,8 +60,8 @@ static void Update(void *data, int arg)
|
|||||||
*(uint8 *)data=0;
|
*(uint8 *)data=0;
|
||||||
seq=ptr=0;
|
seq=ptr=0;
|
||||||
have=1;
|
have=1;
|
||||||
strcpy((char*)bdata,(char *)data+1); //mbg merge 7/17/06 added casts
|
strcpy((char*) bdata, (char*) data + 1); // mbg merge 7/17/06
|
||||||
strcpy((char*)&bdata[13],"SUNSOFT"); //mbg merge 7/17/06 added cast
|
strcpy((char*) bdata + 13, "SUNSOFT"); // mbg merge 0/17/06
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "cheat.h"
|
#include "cheat.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
|
#include "utils/memory.h"
|
||||||
|
|
||||||
int FCEUnetplay=0;
|
int FCEUnetplay=0;
|
||||||
|
|
||||||
@ -120,11 +121,11 @@ int FCEUNET_SendFile(uint8 cmd, char *fn)
|
|||||||
|
|
||||||
fstat(fileno(fp),&sb);
|
fstat(fileno(fp),&sb);
|
||||||
len = sb.st_size;
|
len = sb.st_size;
|
||||||
buf = (char*)malloc(len); //mbg merge 7/17/06 added cast
|
buf = (char*)FCEU_dmalloc(len); //mbg merge 7/17/06 added cast
|
||||||
fread(buf, 1, len, fp);
|
fread(buf, 1, len, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
cbuf = (char*)malloc(4 + len + len / 1000 + 12); //mbg merge 7/17/06 added cast
|
cbuf = (char*)FCEU_dmalloc(4 + len + len / 1000 + 12); //mbg merge 7/17/06 added cast
|
||||||
FCEU_en32lsb((uint8*)cbuf, len); //mbg merge 7/17/06 added cast
|
FCEU_en32lsb((uint8*)cbuf, len); //mbg merge 7/17/06 added cast
|
||||||
compress2((uint8*)cbuf + 4, &clen, (uint8*)buf, len, 7); //mbg merge 7/17/06 added casts
|
compress2((uint8*)cbuf + 4, &clen, (uint8*)buf, len, 7); //mbg merge 7/17/06 added casts
|
||||||
free(buf);
|
free(buf);
|
||||||
@ -164,9 +165,9 @@ static FILE *FetchFile(uint32 remlen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//printf("Receiving file: %d...\n",clen);
|
//printf("Receiving file: %d...\n",clen);
|
||||||
if(fp = tmpfile())
|
if((fp = tmpfile()))
|
||||||
{
|
{
|
||||||
cbuf = (char *)malloc(clen); //mbg merge 7/17/06 added cast
|
cbuf = (char *)FCEU_dmalloc(clen); //mbg merge 7/17/06 added cast
|
||||||
if(!FCEUD_RecvData(cbuf, clen))
|
if(!FCEUD_RecvData(cbuf, clen))
|
||||||
{
|
{
|
||||||
NetError();
|
NetError();
|
||||||
@ -183,7 +184,7 @@ static FILE *FetchFile(uint32 remlen)
|
|||||||
free(cbuf);
|
free(cbuf);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
buf = (char *)malloc(len); //mbg merge 7/17/06 added cast
|
buf = (char *)FCEU_dmalloc(len); //mbg merge 7/17/06 added cast
|
||||||
uncompress((uint8*)buf, &len, (uint8*)cbuf + 4, clen - 4); //mbg merge 7/17/06 added casts
|
uncompress((uint8*)buf, &len, (uint8*)cbuf + 4, clen - 4); //mbg merge 7/17/06 added casts
|
||||||
|
|
||||||
fwrite(buf, 1, len, fp);
|
fwrite(buf, 1, len, fp);
|
||||||
|
@ -775,16 +775,17 @@ static void RDoTriangle(void)
|
|||||||
|
|
||||||
if(!lengthcount[2] || !TriCount)
|
if(!lengthcount[2] || !TriCount)
|
||||||
{ /* Counter is halted, but we still need to output. */
|
{ /* Counter is halted, but we still need to output. */
|
||||||
int32 *start = &WaveHi[ChannelBC[2]];
|
/*int32 *start = &WaveHi[ChannelBC[2]];
|
||||||
int32 count = SOUNDTS - ChannelBC[2];
|
int32 count = SOUNDTS - ChannelBC[2];
|
||||||
while(count--)
|
while(count--)
|
||||||
{
|
{
|
||||||
//Modify volume based on channel volume modifiers
|
//Modify volume based on channel volume modifiers
|
||||||
*start += (tcout/256*FSettings.TriangleVolume)&(~0xFFFF); // TODO OPTIMIZE ME NOW DAMMIT!
|
*start += (tcout/256*FSettings.TriangleVolume)&(~0xFFFF); // TODO OPTIMIZE ME NOW DAMMIT!
|
||||||
start++;
|
start++;
|
||||||
}
|
}*/
|
||||||
//for(V=ChannelBC[2];V<SOUNDTS;V++)
|
int32 cout = (tcout/256*FSettings.TriangleVolume)&(~0xFFFF);
|
||||||
// WaveHi[V]+=tcout;
|
for(V=ChannelBC[2];V<SOUNDTS;V++)
|
||||||
|
WaveHi[V]+=cout;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for(V=ChannelBC[2];V<SOUNDTS;V++)
|
for(V=ChannelBC[2];V<SOUNDTS;V++)
|
||||||
|
@ -474,7 +474,7 @@ void FCEUSS_Save(const char *fname)
|
|||||||
st = FCEUD_UTF8_fstream(fn,"wb");
|
st = FCEUD_UTF8_fstream(fn,"wb");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(st == NULL)
|
if(st == NULL || st->get_fp() == NULL)
|
||||||
{
|
{
|
||||||
FCEU_DispMessage("State %d save error.",0,CurrentState);
|
FCEU_DispMessage("State %d save error.",0,CurrentState);
|
||||||
return;
|
return;
|
||||||
@ -723,9 +723,9 @@ bool FCEUSS_Load(const char *fname)
|
|||||||
strcpy(lastLoadstateMade,fn);
|
strcpy(lastLoadstateMade,fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(st == NULL)
|
if(st == NULL || (st->get_fp() == NULL))
|
||||||
{
|
{
|
||||||
FCEU_DispMessage("State %d load error.",0,CurrentState);
|
FCEU_DispMessage("State %d load error. Filename: %s",0,CurrentState, fn);
|
||||||
SaveStateStatus[CurrentState]=0;
|
SaveStateStatus[CurrentState]=0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -739,11 +739,11 @@ bool FCEUSS_Load(const char *fname)
|
|||||||
{
|
{
|
||||||
char szFilename[260]={0};
|
char szFilename[260]={0};
|
||||||
splitpath(fname, 0, 0, szFilename, 0);
|
splitpath(fname, 0, 0, szFilename, 0);
|
||||||
FCEU_DispMessage("State %s loaded.",0,szFilename);
|
FCEU_DispMessage("State %s loaded. Filename: %s",0,szFilename, fn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FCEU_DispMessage("State %d loaded.",0,CurrentState);
|
FCEU_DispMessage("State %d loaded. Filename: %s",0,CurrentState, fn);
|
||||||
SaveStateStatus[CurrentState]=1;
|
SaveStateStatus[CurrentState]=1;
|
||||||
}
|
}
|
||||||
delete st;
|
delete st;
|
||||||
@ -786,7 +786,7 @@ bool FCEUSS_Load(const char *fname)
|
|||||||
{
|
{
|
||||||
SaveStateStatus[CurrentState]=1;
|
SaveStateStatus[CurrentState]=1;
|
||||||
}
|
}
|
||||||
FCEU_DispMessage("Error(s) reading state %d!",0,CurrentState);
|
FCEU_DispMessage("Error(s) reading state %d! Filename: %s",0,CurrentState, fn);
|
||||||
delete st;
|
delete st;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -76,3 +76,13 @@ void FCEU_free(void *ptr) // Might do something with this and FCEU_malloc lat
|
|||||||
{
|
{
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *FCEU_dmalloc(uint32 size)
|
||||||
|
{
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FCEU_dfree(void *ptr)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
@ -29,3 +29,8 @@ void *FCEU_gmalloc(uint32 size);
|
|||||||
void FCEU_gfree(void *ptr);
|
void FCEU_gfree(void *ptr);
|
||||||
void FCEU_free(void *ptr);
|
void FCEU_free(void *ptr);
|
||||||
void FCEU_memmove(void *d, void *s, uint32 l);
|
void FCEU_memmove(void *d, void *s, uint32 l);
|
||||||
|
|
||||||
|
// wrapper for debugging when its needed, otherwise act like
|
||||||
|
// normal malloc/free
|
||||||
|
void *FCEU_dmalloc(uint32 size);
|
||||||
|
void FCEU_dfree(void *ptr);
|
||||||
|
@ -628,7 +628,7 @@ int SaveSnapshot(void)
|
|||||||
uint8 *tmp=XBuf+FSettings.FirstSLine*256;
|
uint8 *tmp=XBuf+FSettings.FirstSLine*256;
|
||||||
uint8 *dest,*mal,*mork;
|
uint8 *dest,*mal,*mork;
|
||||||
|
|
||||||
if(!(mal=mork=dest=(uint8 *)malloc((totallines<<8)+totallines)))
|
if(!(mal=mork=dest=(uint8 *)FCEU_dmalloc((totallines<<8)+totallines)))
|
||||||
goto PNGerr;
|
goto PNGerr;
|
||||||
// mork=dest=XBuf;
|
// mork=dest=XBuf;
|
||||||
|
|
||||||
@ -723,7 +723,7 @@ int SaveSnapshot(char fileName[512])
|
|||||||
uint8 *tmp=XBuf+FSettings.FirstSLine*256;
|
uint8 *tmp=XBuf+FSettings.FirstSLine*256;
|
||||||
uint8 *dest,*mal,*mork;
|
uint8 *dest,*mal,*mork;
|
||||||
|
|
||||||
if(!(mal=mork=dest=(uint8 *)malloc((totallines<<8)+totallines)))
|
if(!(mal=mork=dest=(uint8 *)FCEU_dmalloc((totallines<<8)+totallines)))
|
||||||
goto PNGerr;
|
goto PNGerr;
|
||||||
// mork=dest=XBuf;
|
// mork=dest=XBuf;
|
||||||
|
|
||||||
|
@ -875,7 +875,7 @@ class GuiKeyboard : public GuiWindow
|
|||||||
|
|
||||||
typedef struct _optionlist {
|
typedef struct _optionlist {
|
||||||
int length;
|
int length;
|
||||||
char name[MAX_OPTIONS][50];
|
char name[MAX_OPTIONS][100];
|
||||||
char value[MAX_OPTIONS][50];
|
char value[MAX_OPTIONS][50];
|
||||||
} OptionList;
|
} OptionList;
|
||||||
|
|
||||||
|
@ -79,10 +79,12 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l)
|
|||||||
optionTxt[i] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff});
|
optionTxt[i] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff});
|
||||||
optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
optionTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
optionTxt[i]->SetPosition(8,0);
|
optionTxt[i]->SetPosition(8,0);
|
||||||
|
optionTxt[i]->SetMaxWidth(230);
|
||||||
|
|
||||||
optionVal[i] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff});
|
optionVal[i] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff});
|
||||||
optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
optionVal[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
optionVal[i]->SetPosition(250,0);
|
optionVal[i]->SetPosition(250,0);
|
||||||
|
optionVal[i]->SetMaxWidth(230);
|
||||||
|
|
||||||
optionBg[i] = new GuiImage(bgOptionsEntry);
|
optionBg[i] = new GuiImage(bgOptionsEntry);
|
||||||
|
|
||||||
|
@ -2006,8 +2006,10 @@ static int MenuGameCheats()
|
|||||||
|
|
||||||
for(i=0; i < numcheats; i++)
|
for(i=0; i < numcheats; i++)
|
||||||
{
|
{
|
||||||
FCEUI_GetCheat(i,&name,NULL,NULL,NULL,&status,NULL);
|
if(!FCEUI_GetCheat(i,&name,NULL,NULL,NULL,&status,NULL))
|
||||||
sprintf (options.name[i], "%s", name);
|
break;
|
||||||
|
|
||||||
|
snprintf (options.name[i], 100, "%s", name);
|
||||||
sprintf (options.value[i], status ? "On" : "Off");
|
sprintf (options.value[i], status ? "On" : "Off");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user