From a3a157987502cb35236fc60893f3df199405f67b Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 25 Apr 2024 01:44:22 -0700 Subject: [PATCH] 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 --- src/k_profiles.cpp | 14 ++++++++++++++ src/k_profiles.h | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/k_profiles.cpp b/src/k_profiles.cpp index ee4bf65f7..b55ac2a8b 100644 --- a/src/k_profiles.cpp +++ b/src/k_profiles.cpp @@ -412,6 +412,7 @@ void PR_LoadProfiles(void) for (size_t i = 1; i < numprofiles; i++) { + bool converted = false; auto& jsprof = js.profiles[i - 1]; profile_t* newprof = static_cast(Z_Calloc(sizeof(profile_t), PU_STATIC, NULL)); profilesList[i] = newprof; @@ -467,6 +468,13 @@ void PR_LoadProfiles(void) newprof->rumble = jsprof.preferences.rumble; 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 { 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()); 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; diff --git a/src/k_profiles.h b/src/k_profiles.h index 0d1c922bd..0870c5d5e 100644 --- a/src/k_profiles.h +++ b/src/k_profiles.h @@ -109,7 +109,11 @@ extern "C" { #define SKINNAMESIZE 16 #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 PROFILESFILE "ringprofiles.prf" #define PROFILE_GUEST 0