mirror of https://github.com/snes9xgit/snes9x.git
Remove ssnprintf function.
This commit is contained in:
parent
99c70cdfd6
commit
45252aaf93
12
controls.cpp
12
controls.cpp
|
@ -2282,11 +2282,11 @@ void S9xApplyCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
||||||
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
||||||
|
|
||||||
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
||||||
ssnprintf(filename, PATH_MAX + 1, "%s%s%s.%.*s", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, _MAX_EXT - 1, "oops");
|
snprintf(filename, PATH_MAX + 1, "%s%s%s.%.*s", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, _MAX_EXT - 1, "oops");
|
||||||
|
|
||||||
if (S9xUnfreezeGame(filename))
|
if (S9xUnfreezeGame(filename))
|
||||||
{
|
{
|
||||||
ssnprintf(buf, 256, "%s.%.*s loaded", def, _MAX_EXT - 1, "oops");
|
snprintf(buf, 256, "%s.%.*s loaded", def, _MAX_EXT - 1, "oops");
|
||||||
S9xSetInfoString (buf);
|
S9xSetInfoString (buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2319,11 +2319,11 @@ void S9xApplyCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
||||||
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
||||||
|
|
||||||
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
||||||
ssnprintf(filename, PATH_MAX + 1, "%s%s%s.%03d", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, i - QuickLoad000);
|
snprintf(filename, PATH_MAX + 1, "%s%s%s.%03d", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, i - QuickLoad000);
|
||||||
|
|
||||||
if (S9xUnfreezeGame(filename))
|
if (S9xUnfreezeGame(filename))
|
||||||
{
|
{
|
||||||
ssnprintf(buf, 256, "%s.%03d loaded", def, i - QuickLoad000);
|
snprintf(buf, 256, "%s.%03d loaded", def, i - QuickLoad000);
|
||||||
S9xSetInfoString(buf);
|
S9xSetInfoString(buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2348,9 +2348,9 @@ void S9xApplyCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
||||||
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
||||||
|
|
||||||
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
||||||
ssnprintf(filename, PATH_MAX + 1, "%s%s%s.%03d", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, i - QuickSave000);
|
snprintf(filename, PATH_MAX + 1, "%s%s%s.%03d", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, i - QuickSave000);
|
||||||
|
|
||||||
ssnprintf(buf, 256, "%s.%03d saved", def, i - QuickSave000);
|
snprintf(buf, 256, "%s.%03d saved", def, i - QuickSave000);
|
||||||
S9xSetInfoString(buf);
|
S9xSetInfoString(buf);
|
||||||
|
|
||||||
S9xFreezeGame(filename);
|
S9xFreezeGame(filename);
|
||||||
|
|
|
@ -124,7 +124,7 @@ S9xGetFilenameInc (const char *e, enum s9x_getdirtype dirtype)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ssnprintf (filename, PATH_MAX, "%s" SLASH_STR "%s%03d%s", d, fname, i, e);
|
snprintf (filename, PATH_MAX, "%s" SLASH_STR "%s%03d%s", d, fname, i, e);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
while (stat (filename, &buf) == 0 && i != 0); /* Overflow? ...riiight :-) */
|
while (stat (filename, &buf) == 0 && i != 0); /* Overflow? ...riiight :-) */
|
||||||
|
@ -211,7 +211,7 @@ S9xGetFilename (const char *ex, enum s9x_getdirtype dirtype)
|
||||||
|
|
||||||
_splitpath (Memory.ROMFilename, drive, dir, fname, ext);
|
_splitpath (Memory.ROMFilename, drive, dir, fname, ext);
|
||||||
|
|
||||||
ssnprintf (filename, sizeof (filename), "%s" SLASH_STR "%s%s",
|
snprintf (filename, sizeof (filename), "%s" SLASH_STR "%s%s",
|
||||||
S9xGetDirectory (dirtype), fname, ex);
|
S9xGetDirectory (dirtype), fname, ex);
|
||||||
|
|
||||||
return (filename);
|
return (filename);
|
||||||
|
@ -485,13 +485,13 @@ S9xQuickSaveSlot (int slot)
|
||||||
|
|
||||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||||
|
|
||||||
ssnprintf (filename, PATH_MAX, "%s%s%s.%03d",
|
snprintf (filename, PATH_MAX, "%s%s%s.%03d",
|
||||||
S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR, def,
|
S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR, def,
|
||||||
slot);
|
slot);
|
||||||
|
|
||||||
if (S9xFreezeGame (filename))
|
if (S9xFreezeGame (filename))
|
||||||
{
|
{
|
||||||
ssnprintf (buf, PATH_MAX, "%s.%03d saved", def, slot);
|
snprintf (buf, PATH_MAX, "%s.%03d saved", def, slot);
|
||||||
|
|
||||||
S9xSetInfoString (buf);
|
S9xSetInfoString (buf);
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ void S9xQuickLoadSlot (int slot)
|
||||||
|
|
||||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||||
|
|
||||||
ssnprintf (filename, PATH_MAX, "%s%s%s.%03d",
|
snprintf (filename, PATH_MAX, "%s%s%s.%03d",
|
||||||
S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR, def,
|
S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR, def,
|
||||||
slot);
|
slot);
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ void S9xQuickLoadSlot (int slot)
|
||||||
|
|
||||||
if (S9xUnfreezeGame (filename))
|
if (S9xUnfreezeGame (filename))
|
||||||
{
|
{
|
||||||
ssnprintf (buf, PATH_MAX, "%s.%03d loaded", def, slot);
|
snprintf (buf, PATH_MAX, "%s.%03d loaded", def, slot);
|
||||||
S9xSetInfoString (buf);
|
S9xSetInfoString (buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ void S9xQuickLoadSlot (int slot)
|
||||||
|
|
||||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||||
|
|
||||||
ssnprintf (filename, PATH_MAX, "%s%s%s.zs%c",
|
snprintf (filename, PATH_MAX, "%s%s%s.zs%c",
|
||||||
S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR,
|
S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR,
|
||||||
def, digits[slot]);
|
def, digits[slot]);
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@ void S9xQuickLoadSlot (int slot)
|
||||||
|
|
||||||
if (S9xUnfreezeGame (filename))
|
if (S9xUnfreezeGame (filename))
|
||||||
{
|
{
|
||||||
ssnprintf (buf, PATH_MAX,
|
snprintf (buf, PATH_MAX,
|
||||||
"Loaded ZSNES freeze file %s.zs%c",
|
"Loaded ZSNES freeze file %s.zs%c",
|
||||||
def, digits [slot]);
|
def, digits [slot]);
|
||||||
S9xSetInfoString (buf);
|
S9xSetInfoString (buf);
|
||||||
|
|
|
@ -859,7 +859,7 @@ Snes9xWindow::open_movie_dialog (bool readonly)
|
||||||
|
|
||||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||||
|
|
||||||
ssnprintf (default_name, PATH_MAX, "%s.smv", def);
|
snprintf (default_name, PATH_MAX, "%s.smv", def);
|
||||||
|
|
||||||
dialog = gtk_file_chooser_dialog_new (_("New SNES Movie"),
|
dialog = gtk_file_chooser_dialog_new (_("New SNES Movie"),
|
||||||
GTK_WINDOW (this->window),
|
GTK_WINDOW (this->window),
|
||||||
|
@ -1119,7 +1119,7 @@ Snes9xWindow::save_state_dialog ()
|
||||||
|
|
||||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||||
|
|
||||||
ssnprintf (default_name, PATH_MAX, "%s.sst", def);
|
snprintf (default_name, PATH_MAX, "%s.sst", def);
|
||||||
|
|
||||||
dialog = gtk_file_chooser_dialog_new (_("Save State"),
|
dialog = gtk_file_chooser_dialog_new (_("Save State"),
|
||||||
GTK_WINDOW (this->window),
|
GTK_WINDOW (this->window),
|
||||||
|
@ -1195,7 +1195,7 @@ Snes9xWindow::save_spc_dialog ()
|
||||||
|
|
||||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||||
|
|
||||||
ssnprintf (default_name, PATH_MAX, "%s.spc", def);
|
snprintf (default_name, PATH_MAX, "%s.spc", def);
|
||||||
|
|
||||||
dialog = gtk_file_chooser_dialog_new (_("Save SPC file..."),
|
dialog = gtk_file_chooser_dialog_new (_("Save SPC file..."),
|
||||||
GTK_WINDOW (this->window),
|
GTK_WINDOW (this->window),
|
||||||
|
|
9
port.h
9
port.h
|
@ -149,15 +149,6 @@ void SetInfoDlgColor(unsigned char, unsigned char, unsigned char);
|
||||||
#endif // __LIBRETRO__
|
#endif // __LIBRETRO__
|
||||||
#endif // __WIN32__
|
#endif // __WIN32__
|
||||||
|
|
||||||
inline void ssnprintf(char *dst, size_t size, const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
va_start(args, fmt);
|
|
||||||
if (vsnprintf(dst, size, fmt, args) >= (int) size)
|
|
||||||
dst[size - 1] = '\0';
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void sstrncpy(char *dst, const char *src, size_t size)
|
inline void sstrncpy(char *dst, const char *src, size_t size)
|
||||||
{
|
{
|
||||||
strncpy(dst, src, size - 1);
|
strncpy(dst, src, size - 1);
|
||||||
|
|
|
@ -1013,7 +1013,7 @@ void S9xResetSaveTimer (bool8 dontsave)
|
||||||
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
|
||||||
|
|
||||||
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
_splitpath(Memory.ROMFilename, drive, dir, def, ext);
|
||||||
ssnprintf(filename, PATH_MAX + 1, "%s%s%s.%.*s", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, _MAX_EXT - 1, "oops");
|
snprintf(filename, PATH_MAX + 1, "%s%s%s.%.*s", S9xGetDirectory(SNAPSHOT_DIR), SLASH_STR, def, _MAX_EXT - 1, "oops");
|
||||||
S9xMessage(S9X_INFO, S9X_FREEZE_FILE_INFO, SAVE_INFO_OOPS);
|
S9xMessage(S9X_INFO, S9X_FREEZE_FILE_INFO, SAVE_INFO_OOPS);
|
||||||
S9xFreezeGame(filename);
|
S9xFreezeGame(filename);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue