mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-12-26 19:21:50 +01:00
Merge pull request #779 from bladeoner/codecleanup
Backport Remove ssnprintf function.
This commit is contained in:
commit
d92174f82b
@ -2283,11 +2283,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
|
||||||
@ -2320,11 +2320,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
|
||||||
@ -2349,9 +2349,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);
|
||||||
|
@ -150,14 +150,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);
|
||||||
|
@ -1014,7 +1014,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
Block a user