Use MAX_PATH (4096) characters for save paths.
This commit is contained in:
parent
1566a9ea06
commit
ead0c5335a
|
@ -56,6 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define MAX_DESCRIPTION_LENGTH 512
|
#define MAX_DESCRIPTION_LENGTH 512
|
||||||
#define MAX_LINE_LENGTH 1024
|
#define MAX_LINE_LENGTH 1024
|
||||||
#define MAX_FILENAME_LENGTH 1024
|
#define MAX_FILENAME_LENGTH 1024
|
||||||
|
#define MAX_PATH_LENGTH 4096
|
||||||
|
|
||||||
#define NUM_TEXTURE_BUCKETS 32
|
#define NUM_TEXTURE_BUCKETS 32
|
||||||
#define NUM_ATLAS_BUCKETS 64
|
#define NUM_ATLAS_BUCKETS 64
|
||||||
|
|
|
@ -275,7 +275,7 @@ static void loadMetaInfo(void)
|
||||||
void loadGame(void)
|
void loadGame(void)
|
||||||
{
|
{
|
||||||
cJSON *root, *node, *statsJSON;
|
cJSON *root, *node, *statsJSON;
|
||||||
char *text, filename[MAX_FILENAME_LENGTH], *statName;
|
char *text, filename[MAX_PATH_LENGTH], *statName;
|
||||||
int i;
|
int i;
|
||||||
Tuple *t;
|
Tuple *t;
|
||||||
Trophy *trophy;
|
Trophy *trophy;
|
||||||
|
@ -344,7 +344,7 @@ void loadGame(void)
|
||||||
void saveGame(void)
|
void saveGame(void)
|
||||||
{
|
{
|
||||||
cJSON *root, *statsJSON, *keysJSON, *keyJSON, *missionsJSON, *missionJSON, *trophiesJSON, *trophyJSON;
|
cJSON *root, *statsJSON, *keysJSON, *keyJSON, *missionsJSON, *missionJSON, *trophiesJSON, *trophyJSON;
|
||||||
char filename[MAX_FILENAME_LENGTH], *out;
|
char filename[MAX_PATH_LENGTH], *out;
|
||||||
Tuple *t;
|
Tuple *t;
|
||||||
Trophy *trophy;
|
Trophy *trophy;
|
||||||
int i;
|
int i;
|
||||||
|
@ -416,7 +416,7 @@ void saveGame(void)
|
||||||
void restoreGameState(void)
|
void restoreGameState(void)
|
||||||
{
|
{
|
||||||
cJSON *root, *node, *statsJSON;
|
cJSON *root, *node, *statsJSON;
|
||||||
char *text, filename[MAX_FILENAME_LENGTH];
|
char *text, filename[MAX_PATH_LENGTH];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sprintf(filename, "%s/%d/game.json", app.saveDir, game.saveSlot);
|
sprintf(filename, "%s/%d/game.json", app.saveDir, game.saveSlot);
|
||||||
|
@ -455,7 +455,7 @@ void restoreGameState(void)
|
||||||
|
|
||||||
char *getSaveWidgetLabel(char *filename)
|
char *getSaveWidgetLabel(char *filename)
|
||||||
{
|
{
|
||||||
static char label[MAX_NAME_LENGTH];
|
static char label[MAX_PATH_LENGTH];
|
||||||
cJSON *root, *statsJSON;
|
cJSON *root, *statsJSON;
|
||||||
char *text, *statName;
|
char *text, *statName;
|
||||||
int i, gameDone, gameTotal, stats[STAT_MAX];
|
int i, gameDone, gameTotal, stats[STAT_MAX];
|
||||||
|
@ -497,7 +497,7 @@ char *getSaveWidgetLabel(char *filename)
|
||||||
void deleteSaveSlot(int slot)
|
void deleteSaveSlot(int slot)
|
||||||
{
|
{
|
||||||
int i, numFiles;
|
int i, numFiles;
|
||||||
char path[MAX_FILENAME_LENGTH], **filenames;
|
char path[MAX_PATH_LENGTH], **filenames;
|
||||||
|
|
||||||
sprintf(path, "%s/%d", app.saveDir, slot);
|
sprintf(path, "%s/%d", app.saveDir, slot);
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ static void draw(void)
|
||||||
|
|
||||||
static int getRecentSave(void)
|
static int getRecentSave(void)
|
||||||
{
|
{
|
||||||
char filename[MAX_FILENAME_LENGTH];
|
char filename[MAX_PATH_LENGTH];
|
||||||
int i, slot, curModTime, modTime;
|
int i, slot, curModTime, modTime;
|
||||||
|
|
||||||
slot = -1;
|
slot = -1;
|
||||||
|
@ -190,7 +190,7 @@ static int getRecentSave(void)
|
||||||
static void populateSaveSlotWidgets(void)
|
static void populateSaveSlotWidgets(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char name[MAX_NAME_LENGTH], filename[MAX_FILENAME_LENGTH];
|
char name[MAX_NAME_LENGTH], filename[MAX_PATH_LENGTH];
|
||||||
|
|
||||||
for (i = 0 ; i < MAX_SAVE_SLOTS ; i++)
|
for (i = 0 ; i < MAX_SAVE_SLOTS ; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ static void mkpath(const char *path);
|
||||||
void createSaveFolder(void)
|
void createSaveFolder(void)
|
||||||
{
|
{
|
||||||
char *userHome;
|
char *userHome;
|
||||||
char dir[MAX_FILENAME_LENGTH];
|
char dir[MAX_PATH_LENGTH];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
userHome = getenv("HOME");
|
userHome = getenv("HOME");
|
||||||
|
|
|
@ -25,7 +25,7 @@ static void mkpath(const char *path);
|
||||||
void createSaveFolder(void)
|
void createSaveFolder(void)
|
||||||
{
|
{
|
||||||
char *userHome;
|
char *userHome;
|
||||||
char dir[MAX_FILENAME_LENGTH];
|
char dir[MAX_PATH_LENGTH];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
userHome = getenv("USERPROFILE");
|
userHome = getenv("USERPROFILE");
|
||||||
|
|
|
@ -261,7 +261,7 @@ static void initColor(SDL_Color *c, int r, int g, int b)
|
||||||
|
|
||||||
void saveScreenshot(char *name)
|
void saveScreenshot(char *name)
|
||||||
{
|
{
|
||||||
char filename[MAX_FILENAME_LENGTH];
|
char filename[MAX_PATH_LENGTH];
|
||||||
SDL_Surface *screenshot;
|
SDL_Surface *screenshot;
|
||||||
|
|
||||||
if (name != NULL)
|
if (name != NULL)
|
||||||
|
|
|
@ -229,7 +229,7 @@ static void loadConfig(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
cJSON *root, *controlsJSON, *node;
|
cJSON *root, *controlsJSON, *node;
|
||||||
char *text, filename[MAX_FILENAME_LENGTH];
|
char *text, filename[MAX_PATH_LENGTH];
|
||||||
|
|
||||||
initDefaultConfig();
|
initDefaultConfig();
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ static void loadConfig(void)
|
||||||
void saveConfig(void)
|
void saveConfig(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *out, filename[MAX_FILENAME_LENGTH];
|
char *out, filename[MAX_PATH_LENGTH];
|
||||||
cJSON *root, *controlsJSON, *keysJSON, *joypadJSON;
|
cJSON *root, *controlsJSON, *keysJSON, *joypadJSON;
|
||||||
|
|
||||||
sprintf(filename, "%s/%s", app.saveDir, CONFIG_FILENAME);
|
sprintf(filename, "%s/%s", app.saveDir, CONFIG_FILENAME);
|
||||||
|
|
|
@ -29,7 +29,7 @@ static void loadObjectives(cJSON *root);
|
||||||
void loadWorld(char *id)
|
void loadWorld(char *id)
|
||||||
{
|
{
|
||||||
cJSON *root;
|
cJSON *root;
|
||||||
char *text, filename[MAX_FILENAME_LENGTH];
|
char *text, filename[MAX_PATH_LENGTH];
|
||||||
|
|
||||||
memset(&world, 0, sizeof(World));
|
memset(&world, 0, sizeof(World));
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ static int canPersistEntity(void);
|
||||||
void saveWorld(void)
|
void saveWorld(void)
|
||||||
{
|
{
|
||||||
cJSON *root;
|
cJSON *root;
|
||||||
char filename[MAX_FILENAME_LENGTH], *out;
|
char filename[MAX_PATH_LENGTH], *out;
|
||||||
|
|
||||||
sprintf(filename, "%s/%d/%s.json", app.saveDir, game.saveSlot, world.id);
|
sprintf(filename, "%s/%d/%s.json", app.saveDir, game.saveSlot, world.id);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue