Bump PROFILEVER, old profiles are converted and have Lite Steer turned off

- Prints a message in the log file

  Profile 'PRFA' was converted from version 1 to version 2
This commit is contained in:
James R 2024-04-25 01:44:22 -07:00
parent 70b56bf973
commit a3a1579875
2 changed files with 19 additions and 1 deletions

View file

@ -412,6 +412,7 @@ void PR_LoadProfiles(void)
for (size_t i = 1; i < numprofiles; i++) for (size_t i = 1; i < numprofiles; i++)
{ {
bool converted = false;
auto& jsprof = js.profiles[i - 1]; auto& jsprof = js.profiles[i - 1];
profile_t* newprof = static_cast<profile_t*>(Z_Calloc(sizeof(profile_t), PU_STATIC, NULL)); profile_t* newprof = static_cast<profile_t*>(Z_Calloc(sizeof(profile_t), PU_STATIC, NULL));
profilesList[i] = newprof; profilesList[i] = newprof;
@ -467,6 +468,13 @@ void PR_LoadProfiles(void)
newprof->rumble = jsprof.preferences.rumble; newprof->rumble = jsprof.preferences.rumble;
newprof->fov = jsprof.preferences.fov; newprof->fov = jsprof.preferences.fov;
if (jsprof.version == 1)
{
// Version 1 -> 2: litesteer is now off by default, reset old profiles
newprof->litesteer = false;
converted = true;
}
try try
{ {
for (size_t j = 0; j < num_gamecontrols; j++) for (size_t j = 0; j < num_gamecontrols; j++)
@ -482,6 +490,12 @@ void PR_LoadProfiles(void)
I_Error("Profile '%s' controls are corrupt", jsprof.playername.c_str()); I_Error("Profile '%s' controls are corrupt", jsprof.playername.c_str());
return; return;
} }
if (converted)
{
CONS_Printf("Profile '%s' was converted from version %d to version %d\n",
newprof->profilename, jsprof.version, PROFILEVER);
}
} }
profilesList[PROFILE_GUEST] = dprofile; profilesList[PROFILE_GUEST] = dprofile;

View file

@ -109,7 +109,11 @@ extern "C" {
#define SKINNAMESIZE 16 #define SKINNAMESIZE 16
#define PROFILENAMELEN 6 #define PROFILENAMELEN 6
#define PROFILEVER 1 // Version history:
// 1 - first
// 2 - litesteer is off by default, old profiles litesteer
// option is reset to default
#define PROFILEVER 2
#define MAXPROFILES 16 #define MAXPROFILES 16
#define PROFILESFILE "ringprofiles.prf" #define PROFILESFILE "ringprofiles.prf"
#define PROFILE_GUEST 0 #define PROFILE_GUEST 0