diff --git a/source/fceustate.cpp b/source/fceustate.cpp index 3dc1c03..d68edc1 100644 --- a/source/fceustate.cpp +++ b/source/fceustate.cpp @@ -42,7 +42,7 @@ bool SaveState (char * filepath, bool silent) char screenpath[1024]; strncpy(screenpath, filepath, 1024); screenpath[strlen(screenpath)-4] = 0; - sprintf(screenpath, "%s.png", screenpath); + strcat(screenpath, ".png"); SaveFile((char *)gameScreenPng, screenpath, gameScreenPngSize, silent); } @@ -125,7 +125,7 @@ bool SavePreviewImg (char * filepath, bool silent) char screenpath[1024]; strncpy(screenpath, filepath, 1024); screenpath[strlen(screenpath)] = 0; - sprintf(screenpath, "%s.png", screenpath); + strcat(screenpath, ".png"); SaveFile((char *)gameScreenPng, screenpath, gameScreenPngSize, silent); } diff --git a/source/filebrowser.cpp b/source/filebrowser.cpp index 50c53d5..818842d 100644 --- a/source/filebrowser.cpp +++ b/source/filebrowser.cpp @@ -237,7 +237,7 @@ int UpdateDirName() if ((strlen(browser.dir)+1+strlen(browserList[browser.selIndex].filename)) < MAXPATHLEN) { /* update current directory name */ - sprintf(browser.dir, "%s%s/",browser.dir, browserList[browser.selIndex].filename); + sprintf(browser.dir+strlen(browser.dir), "%s/", browserList[browser.selIndex].filename); return 1; } else