C++11 compliant string literal concatenation

This commit is contained in:
xhainingx 2013-04-16 20:14:42 +00:00
parent 7abad425c5
commit 950d38e25d
3 changed files with 66 additions and 62 deletions

View File

@ -16,33 +16,33 @@ static char *aboutString = 0;
///returns a string suitable for use in an aboutbox ///returns a string suitable for use in an aboutbox
char *FCEUI_GetAboutString() { char *FCEUI_GetAboutString() {
const char *aboutTemplate = const char *aboutTemplate =
FCEU_NAME_AND_VERSION "\n\n\ "FCEU_NAME_AND_VERSION \n\n"
Administrators:\n\ "Administrators:\n"
zeromus, adelikat, AnS\n\n\ "zeromus, adelikat, AnS\n\n"
Current Contributors:\n\ "Current Contributors:\n"
punkrockguy318 (Lukas Sabota)\n\ "punkrockguy318 (Lukas Sabota)\n"
Plombo (Bryan Cain)\n\ "Plombo (Bryan Cain)\n"
qeed, QFox, Shinydoofy, ugetab\n\ "qeed, QFox, Shinydoofy, ugetab\n"
CaH4e3, gocha, Acmlm, DWEdit\n\ "CaH4e3, gocha, Acmlm, DWEdit\n"
\n\ "\n"
FCEUX 2.0:\n\ "FCEUX 2.0:\n"
mz, nitsujrehtona, Lukas Sabota,\n\ "mz, nitsujrehtona, Lukas Sabota,\n"
SP, Ugly Joe\n\ "SP, Ugly Joe\n"
\n\ "\n"
Previous versions:\n\ "Previous versions:\n"
FCE - Bero\n\ "FCE - Bero\n"
FCEU - Xodnizel\n\ "FCEU - Xodnizel\n"
FCEU XD - Bbitmaster & Parasyte\n\ "FCEU XD - Bbitmaster & Parasyte\n"
FCEU XD SP - Sebastian Porst\n\ "FCEU XD SP - Sebastian Porst\n"
FCEU MM - CaH4e3\n\ "FCEU MM - CaH4e3\n"
FCEU TAS - blip & nitsuja\n\ "FCEU TAS - blip & nitsuja\n"
FCEU TAS+ - Luke Gustafson\n\ "FCEU TAS+ - Luke Gustafson\n"
\n\ "\n"
FCEUX is dedicated to the fallen heroes\n\ "FCEUX is dedicated to the fallen heroes\n"
of NES emulation. In Memoriam --\n\ "of NES emulation. In Memoriam --\n"
ugetab\n\ "ugetab\n"
\n\ "\n"
"__TIME__" "__DATE__"\n"; __TIME__ " " __DATE__ "\n";
if(aboutString) return aboutString; if(aboutString) return aboutString;

View File

@ -271,6 +271,10 @@ static void DoFun(int frameskip)
static int fskipc = 0; static int fskipc = 0;
static int opause = 0; static int opause = 0;
//TODO peroidic saves, working on it right now
//if (FCEUD_GetTime() % 5000 == 0){
// FCEUI_SaveState(NULL);
//}
#ifdef FRAMESKIP #ifdef FRAMESKIP
fskipc = (fskipc + 1) % (frameskip + 1); fskipc = (fskipc + 1) % (frameskip + 1);
#endif #endif
@ -535,7 +539,7 @@ int main(int argc, char *argv[])
int error, frameskip; int error, frameskip;
FCEUD_Message("Starting "FCEU_NAME_AND_VERSION"...\n"); FCEUD_Message("Starting " FCEU_NAME_AND_VERSION "...\n");
#ifdef WIN32 #ifdef WIN32
/* Taken from win32 sdl_main.c */ /* Taken from win32 sdl_main.c */

View File

@ -148,7 +148,7 @@ end:
std::string FCEU_MakeIpsFilename(FileBaseInfo fbi) { std::string FCEU_MakeIpsFilename(FileBaseInfo fbi) {
char ret[FILENAME_MAX] = ""; char ret[FILENAME_MAX] = "";
sprintf(ret,"%s"PSS"%s%s.ips",fbi.filebasedirectory.c_str(),fbi.filebase.c_str(),fbi.ext.c_str()); sprintf(ret,"%s" PSS "%s%s.ips",fbi.filebasedirectory.c_str(),fbi.filebase.c_str(),fbi.ext.c_str());
return ret; return ret;
} }
@ -602,9 +602,9 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
struct stat fileInfo; struct stat fileInfo;
do { do {
if(odirs[FCEUIOD_MOVIES]) if(odirs[FCEUIOD_MOVIES])
sprintf(ret,"%s"PSS"%s-%d.fm2",odirs[FCEUIOD_MOVIES],FileBase, id1); sprintf(ret,"%s" PSS "%s-%d.fm2",odirs[FCEUIOD_MOVIES],FileBase, id1);
else else
sprintf(ret,"%s"PSS"movies"PSS"%s-%d.fm2",BaseDirectory.c_str(),FileBase, id1); sprintf(ret,"%s" PSS "movies" PSS "%s-%d.fm2",BaseDirectory.c_str(),FileBase, id1);
id1++; id1++;
} while (stat(ret, &fileInfo) == 0); } while (stat(ret, &fileInfo) == 0);
break; break;
@ -628,19 +628,19 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
if(odirs[FCEUIOD_STATES]) if(odirs[FCEUIOD_STATES])
{ {
sprintf(ret,"%s"PSS"%s%s.fc%d",odirs[FCEUIOD_STATES],FileBase,mfn,id1); sprintf(ret,"%s" PSS "%s%s.fc%d",odirs[FCEUIOD_STATES],FileBase,mfn,id1);
} else } else
{ {
sprintf(ret,"%s"PSS"fcs"PSS"%s%s.fc%d",BaseDirectory.c_str(),FileBase,mfn,id1); sprintf(ret,"%s" PSS "fcs" PSS "%s%s.fc%d",BaseDirectory.c_str(),FileBase,mfn,id1);
} }
if(stat(ret,&tmpstat)==-1) if(stat(ret,&tmpstat)==-1)
{ {
if(odirs[FCEUIOD_STATES]) if(odirs[FCEUIOD_STATES])
{ {
sprintf(ret,"%s"PSS"%s%s.fc%d",odirs[FCEUIOD_STATES],FileBase,mfn,id1); sprintf(ret,"%s" PSS "%s%s.fc%d",odirs[FCEUIOD_STATES],FileBase,mfn,id1);
} else } else
{ {
sprintf(ret,"%s"PSS"fcs"PSS"%s%s.fc%d",BaseDirectory.c_str(),FileBase,mfn,id1); sprintf(ret,"%s" PSS "fcs" PSS "%s%s.fc%d",BaseDirectory.c_str(),FileBase,mfn,id1);
} }
} }
} }
@ -649,46 +649,46 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
{ {
if(odirs[FCEUIOD_STATES]) if(odirs[FCEUIOD_STATES])
{ {
sprintf(ret,"%s"PSS"%s-resume.fcs",odirs[FCEUIOD_STATES],FileBase); sprintf(ret,"%s" PSS "%s-resume.fcs",odirs[FCEUIOD_STATES],FileBase);
} else } else
{ {
sprintf(ret,"%s"PSS"fcs"PSS"%s-resume.fcs",BaseDirectory.c_str(),FileBase); sprintf(ret,"%s" PSS "fcs" PSS "%s-resume.fcs",BaseDirectory.c_str(),FileBase);
} }
if(stat(ret,&tmpstat)==-1) if(stat(ret,&tmpstat)==-1)
{ {
if(odirs[FCEUIOD_STATES]) if(odirs[FCEUIOD_STATES])
{ {
sprintf(ret,"%s"PSS"%s-resume.fcs",odirs[FCEUIOD_STATES],FileBase); sprintf(ret,"%s" PSS "%s-resume.fcs",odirs[FCEUIOD_STATES],FileBase);
} else } else
{ {
sprintf(ret,"%s"PSS"fcs"PSS"%s-resume.fcs",BaseDirectory.c_str(),FileBase); sprintf(ret,"%s" PSS "fcs" PSS "%s-resume.fcs",BaseDirectory.c_str(),FileBase);
} }
} }
} }
break; break;
case FCEUMKF_SNAP: case FCEUMKF_SNAP:
if(odirs[FCEUIOD_SNAPS]) if(odirs[FCEUIOD_SNAPS])
sprintf(ret,"%s"PSS"%s-%d.%s",odirs[FCEUIOD_SNAPS],FileBase,id1,cd1); sprintf(ret,"%s" PSS "%s-%d.%s",odirs[FCEUIOD_SNAPS],FileBase,id1,cd1);
else else
sprintf(ret,"%s"PSS"snaps"PSS"%s-%d.%s",BaseDirectory.c_str(),FileBase,id1,cd1); sprintf(ret,"%s" PSS "snaps" PSS "%s-%d.%s",BaseDirectory.c_str(),FileBase,id1,cd1);
break; break;
case FCEUMKF_FDS: case FCEUMKF_FDS:
if(odirs[FCEUIOD_NV]) if(odirs[FCEUIOD_NV])
sprintf(ret,"%s"PSS"%s.fds",odirs[FCEUIOD_NV],FileBase); sprintf(ret,"%s" PSS "%s.fds",odirs[FCEUIOD_NV],FileBase);
else else
sprintf(ret,"%s"PSS"sav"PSS"%s.fds",BaseDirectory.c_str(),FileBase); sprintf(ret,"%s" PSS "sav" PSS "%s.fds",BaseDirectory.c_str(),FileBase);
break; break;
case FCEUMKF_SAV: case FCEUMKF_SAV:
if(odirs[FCEUIOD_NV]) if(odirs[FCEUIOD_NV])
sprintf(ret,"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1); sprintf(ret,"%s" PSS "%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
else else
sprintf(ret,"%s"PSS"sav"PSS"%s.%s",BaseDirectory.c_str(),FileBase,cd1); sprintf(ret,"%s" PSS "sav" PSS "%s.%s",BaseDirectory.c_str(),FileBase,cd1);
if(stat(ret,&tmpstat)==-1) if(stat(ret,&tmpstat)==-1)
{ {
if(odirs[FCEUIOD_NV]) if(odirs[FCEUIOD_NV])
sprintf(ret,"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1); sprintf(ret,"%s" PSS "%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
else else
sprintf(ret,"%s"PSS"sav"PSS"%s.%s",BaseDirectory.c_str(),FileBase,cd1); sprintf(ret,"%s" PSS "sav" PSS "%s.%s",BaseDirectory.c_str(),FileBase,cd1);
} }
break; break;
case FCEUMKF_AUTOSTATE: case FCEUMKF_AUTOSTATE:
@ -706,52 +706,52 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
if(odirs[FCEUIOD_STATES]) if(odirs[FCEUIOD_STATES])
{ {
sprintf(ret,"%s"PSS"%s%s-autosave%d.fcs",odirs[FCEUIOD_STATES],FileBase,mfn,id1); sprintf(ret,"%s" PSS "%s%s-autosave%d.fcs",odirs[FCEUIOD_STATES],FileBase,mfn,id1);
} else } else
{ {
sprintf(ret,"%s"PSS"fcs"PSS"%s%s-autosave%d.fcs",BaseDirectory.c_str(),FileBase,mfn,id1); sprintf(ret,"%s" PSS "fcs" PSS "%s%s-autosave%d.fcs",BaseDirectory.c_str(),FileBase,mfn,id1);
} }
if(stat(ret,&tmpstat)==-1) if(stat(ret,&tmpstat)==-1)
{ {
if(odirs[FCEUIOD_STATES]) if(odirs[FCEUIOD_STATES])
{ {
sprintf(ret,"%s"PSS"%s%s-autosave%d.fcs",odirs[FCEUIOD_STATES],FileBase,mfn,id1); sprintf(ret,"%s" PSS "%s%s-autosave%d.fcs",odirs[FCEUIOD_STATES],FileBase,mfn,id1);
} else } else
{ {
sprintf(ret,"%s"PSS"fcs"PSS"%s%s-autosave%d.fcs",BaseDirectory.c_str(),FileBase,mfn,id1); sprintf(ret,"%s" PSS "fcs" PSS "%s%s-autosave%d.fcs",BaseDirectory.c_str(),FileBase,mfn,id1);
} }
} }
break; break;
case FCEUMKF_CHEAT: case FCEUMKF_CHEAT:
if(odirs[FCEUIOD_CHEATS]) if(odirs[FCEUIOD_CHEATS])
sprintf(ret,"%s"PSS"%s.cht",odirs[FCEUIOD_CHEATS],FileBase); sprintf(ret,"%s" PSS "%s.cht",odirs[FCEUIOD_CHEATS],FileBase);
else else
sprintf(ret,"%s"PSS"cheats"PSS"%s.cht",BaseDirectory.c_str(),FileBase); sprintf(ret,"%s" PSS "cheats" PSS "%s.cht",BaseDirectory.c_str(),FileBase);
break; break;
case FCEUMKF_IPS: case FCEUMKF_IPS:
strcpy(ret,FCEU_MakeIpsFilename(CurrentFileBase()).c_str()); strcpy(ret,FCEU_MakeIpsFilename(CurrentFileBase()).c_str());
break; break;
case FCEUMKF_GGROM:sprintf(ret,"%s"PSS"gg.rom",BaseDirectory.c_str());break; case FCEUMKF_GGROM:sprintf(ret,"%s" PSS "gg.rom",BaseDirectory.c_str());break;
case FCEUMKF_FDSROM: case FCEUMKF_FDSROM:
if(odirs[FCEUIOD_FDSROM]) if(odirs[FCEUIOD_FDSROM])
sprintf(ret,"%s"PSS"disksys.rom",odirs[FCEUIOD_FDSROM]); sprintf(ret,"%s" PSS "disksys.rom",odirs[FCEUIOD_FDSROM]);
else else
sprintf(ret,"%s"PSS"disksys.rom",BaseDirectory.c_str()); sprintf(ret,"%s" PSS "disksys.rom",BaseDirectory.c_str());
break; break;
case FCEUMKF_PALETTE:sprintf(ret,"%s"PSS"%s.pal",BaseDirectory.c_str(),FileBase);break; case FCEUMKF_PALETTE:sprintf(ret,"%s" PSS "%s.pal",BaseDirectory.c_str(),FileBase);break;
case FCEUMKF_MOVIEGLOB: case FCEUMKF_MOVIEGLOB:
//these globs use ??? because we can load multiple formats //these globs use ??? because we can load multiple formats
if(odirs[FCEUIOD_MOVIES]) if(odirs[FCEUIOD_MOVIES])
sprintf(ret,"%s"PSS"*.???",odirs[FCEUIOD_MOVIES]); sprintf(ret,"%s" PSS "*.???",odirs[FCEUIOD_MOVIES]);
else else
sprintf(ret,"%s"PSS"movies"PSS"*.???",BaseDirectory.c_str()); sprintf(ret,"%s" PSS "movies" PSS "*.???",BaseDirectory.c_str());
break; break;
case FCEUMKF_MOVIEGLOB2:sprintf(ret,"%s"PSS"*.???",BaseDirectory.c_str());break; case FCEUMKF_MOVIEGLOB2:sprintf(ret,"%s" PSS "*.???",BaseDirectory.c_str());break;
case FCEUMKF_STATEGLOB: case FCEUMKF_STATEGLOB:
if(odirs[FCEUIOD_STATES]) if(odirs[FCEUIOD_STATES])
sprintf(ret,"%s"PSS"%s*.fc?",odirs[FCEUIOD_STATES],FileBase); sprintf(ret,"%s" PSS "%s*.fc?",odirs[FCEUIOD_STATES],FileBase);
else else
sprintf(ret,"%s"PSS"fcs"PSS"%s*.fc?",BaseDirectory.c_str(),FileBase); sprintf(ret,"%s" PSS "fcs" PSS "%s*.fc?",BaseDirectory.c_str(),FileBase);
break; break;
} }