Bump savegame name limits from 22 in memory and 19 in practice to 32 in memory and 30 in practice.

This bumps SV_MINOR_VER.

git-svn-id: https://svn.eduke32.com/eduke32@6529 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-12-01 06:19:09 +00:00
parent f808648079
commit 4313460da7
5 changed files with 15 additions and 26 deletions

View file

@ -4850,10 +4850,10 @@ FAKE_F3:
if (g_lastSaveSlot >= 0) if (g_lastSaveSlot >= 0)
{ {
// dirty hack... char 127 in last position indicates an auto-filled name // dirty hack... char 127 in last position indicates an auto-filled name
if (ud.savegame[g_lastSaveSlot][MAXSAVEGAMENAME-2] == 127) if (ud.savegame[g_lastSaveSlot][MAXSAVEGAMENAME] == 127)
{ {
Bstrncpy(&ud.savegame[g_lastSaveSlot][0], g_mapInfo[ud.volume_number * MAXLEVELS + ud.level_number].name, 19); Bstrncpy(&ud.savegame[g_lastSaveSlot][0], g_mapInfo[ud.volume_number * MAXLEVELS + ud.level_number].name, MAXSAVEGAMENAME);
ud.savegame[g_lastSaveSlot][MAXSAVEGAMENAME-2] = 127; ud.savegame[g_lastSaveSlot][MAXSAVEGAMENAME] = 127;
} }
G_SavePlayerMaybeMulti(g_lastSaveSlot); G_SavePlayerMaybeMulti(g_lastSaveSlot);

View file

@ -130,7 +130,8 @@ extern camera_t g_camera;
#define MAXRIDECULE 10 #define MAXRIDECULE 10
#define MAXRIDECULELENGTH 40 #define MAXRIDECULELENGTH 40
#define MAXSAVEGAMES 10 #define MAXSAVEGAMES 10
#define MAXSAVEGAMENAME 22 #define MAXSAVEGAMENAMESTRUCT 32
#define MAXSAVEGAMENAME (MAXSAVEGAMENAMESTRUCT-1)
#define MAXPWLOCKOUT 128 #define MAXPWLOCKOUT 128
#define MAXRTSNAME 128 #define MAXRTSNAME 128
@ -234,7 +235,7 @@ typedef struct {
char god,warp_on,cashman,eog,showallmap; char god,warp_on,cashman,eog,showallmap;
char show_help,scrollmode,noclip; char show_help,scrollmode,noclip;
char ridecule[MAXRIDECULE][MAXRIDECULELENGTH]; char ridecule[MAXRIDECULE][MAXRIDECULELENGTH];
char savegame[MAXSAVEGAMES][MAXSAVEGAMENAME]; char savegame[MAXSAVEGAMES][MAXSAVEGAMENAMESTRUCT];
char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME]; char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME];
char display_bonus_screen; char display_bonus_screen;
char show_level_text; char show_level_text;

View file

@ -3145,7 +3145,7 @@ static void Menu_EntryStringActivate(/*MenuEntry_t *entry*/)
{ {
case MENU_SAVE: case MENU_SAVE:
if (!save_xxh) if (!save_xxh)
save_xxh = XXH32((uint8_t *)&ud.savegame[M_SAVE.currentEntry][0], 19, 0xDEADBEEF); save_xxh = XXH32((uint8_t *)&ud.savegame[M_SAVE.currentEntry][0], MAXSAVEGAMENAME, 0xDEADBEEF);
if (ud.savegame[M_SAVE.currentEntry][0]) if (ud.savegame[M_SAVE.currentEntry][0])
Menu_Change(MENU_SAVEVERIFY); Menu_Change(MENU_SAVEVERIFY);
break; break;
@ -3167,18 +3167,18 @@ static int32_t Menu_EntryStringSubmit(MenuEntry_t *entry, char *input)
#ifdef __ANDROID__ #ifdef __ANDROID__
if (1) if (1)
#else #else
if (input[0] == 0 || (ud.savegame[M_SAVE.currentEntry][MAXSAVEGAMENAME-2] == 127 && if (input[0] == 0 || (ud.savegame[M_SAVE.currentEntry][MAXSAVEGAMENAME] == 127 &&
Bstrncmp(&ud.savegame[M_SAVE.currentEntry][0], input, MAXSAVEGAMENAME-3) == 0 && Bstrncmp(&ud.savegame[M_SAVE.currentEntry][0], input, MAXSAVEGAMENAME) == 0 &&
save_xxh == XXH32((uint8_t *)&ud.savegame[M_SAVE.currentEntry][0], MAXSAVEGAMENAME-3, 0xDEADBEEF))) save_xxh == XXH32((uint8_t *)&ud.savegame[M_SAVE.currentEntry][0], MAXSAVEGAMENAME, 0xDEADBEEF)))
#endif #endif
{ {
Bstrncpy(&ud.savegame[M_SAVE.currentEntry][0], g_mapInfo[ud.volume_number * MAXLEVELS + ud.level_number].name, MAXSAVEGAMENAME-3); Bstrncpy(&ud.savegame[M_SAVE.currentEntry][0], g_mapInfo[ud.volume_number * MAXLEVELS + ud.level_number].name, MAXSAVEGAMENAME);
ud.savegame[M_SAVE.currentEntry][MAXSAVEGAMENAME-2] = 127; ud.savegame[M_SAVE.currentEntry][MAXSAVEGAMENAME] = 127;
returnvar = -1; returnvar = -1;
} }
else else
{ {
ud.savegame[M_SAVE.currentEntry][MAXSAVEGAMENAME-2] = 0; ud.savegame[M_SAVE.currentEntry][MAXSAVEGAMENAME] = 0;
Bstrncpy(object->variable, input, object->maxlength); Bstrncpy(object->variable, input, object->maxlength);
} }

View file

@ -1277,8 +1277,6 @@ static void SV_AllocSnap(int32_t allocinit)
svdiff = (uint8_t *)Xmalloc(svdiffsiz); svdiff = (uint8_t *)Xmalloc(svdiffsiz);
} }
EDUKE32_STATIC_ASSERT(sizeof(savehead_t) == SAVEHEAD_SIZE);
// make snapshot only if spot < 0 (demo) // make snapshot only if spot < 0 (demo)
int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t diffcompress, int8_t synccompress) int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t diffcompress, int8_t synccompress)
{ {
@ -1416,8 +1414,6 @@ int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t
return 0; return 0;
} }
EDUKE32_STATIC_ASSERT(sizeof(savehead_t) == SAVEHEAD_SIZE);
// if file is not an EDuke32 savegame/demo, h->headerstr will be all zeros // if file is not an EDuke32 savegame/demo, h->headerstr will be all zeros
int32_t sv_loadheader(int32_t fil, int32_t spot, savehead_t *h) int32_t sv_loadheader(int32_t fil, int32_t spot, savehead_t *h)
{ {

View file

@ -34,7 +34,7 @@ extern "C" {
#else #else
# define SV_MAJOR_VER 1 # define SV_MAJOR_VER 1
#endif #endif
#define SV_MINOR_VER 3 #define SV_MINOR_VER 4
#pragma pack(push,1) #pragma pack(push,1)
typedef struct typedef struct
@ -51,7 +51,7 @@ typedef struct
int32_t reccnt, snapsiz; int32_t reccnt, snapsiz;
// 8 bytes // 8 bytes
char savename[MAXSAVEGAMENAME]; char savename[MAXSAVEGAMENAMESTRUCT];
uint8_t numplayers, volnum, levnum, skill; uint8_t numplayers, volnum, levnum, skill;
char boardfn[BMAX_PATH]; char boardfn[BMAX_PATH];
// 282 bytes // 282 bytes
@ -61,14 +61,6 @@ typedef struct
} savehead_t; } savehead_t;
#pragma pack(pop) #pragma pack(pop)
#ifdef __ANDROID__
#define SAVEHEAD_SIZE 374
#else
#define SAVEHEAD_SIZE 310
#endif
EDUKE32_STATIC_ASSERT(sizeof(savehead_t) == SAVEHEAD_SIZE);
int32_t sv_updatestate(int32_t frominit); int32_t sv_updatestate(int32_t frominit);
int32_t sv_readdiff(int32_t fil); int32_t sv_readdiff(int32_t fil);
uint32_t sv_writediff(FILE *fil); uint32_t sv_writediff(FILE *fil);