Fix profile versioning. Profile version 1 used protocol version 0. Move profile version up to 2 using protocol version 2 and keep them synchronized if a new protocol version is added

This commit is contained in:
Adam Honse 2021-03-28 01:40:48 -05:00
parent 8e1cb178ca
commit 827b75320c

View file

@ -9,7 +9,7 @@
#include <cstring>
#define OPENRGB_PROFILE_HEADER "OPENRGB_PROFILE"
#define OPENRGB_PROFILE_VERSION 1
#define OPENRGB_PROFILE_VERSION OPENRGB_SDK_PROTOCOL_VERSION
namespace fs = std::experimental::filesystem;
@ -155,6 +155,16 @@ std::vector<RGBController*> ProfileManager::LoadProfileToList
controller_file.read(profile_string, 16);
controller_file.read((char *)&profile_version, sizeof(unsigned int));
/*---------------------------------------------------------*\
| Profile version started at 1 and protocol version started |
| at 0. Version 1 profiles should use protocol 0, but 2 or |
| greater should be synchronized |
\*---------------------------------------------------------*/
if(profile_version == 1)
{
profile_version = 0;
}
controller_offset += 16 + sizeof(unsigned int);
controller_file.seekg(controller_offset);