Move all settings to settings.vvv

The game previously did this dumb thing where it lumped in all its
settings with its file that tracked your records and unlocks,
`unlock.vvv`. It wasn't really an issue, until 2.3 came along and added
a few settings, suddenly making a problem where 2.3 settings would be
reset by chance if you decided to touch 2.2.

The solution to this is to move all settings to a new file,
`settings.vvv`. However, for compatibility with 2.2, settings will still
be written to `unlock.vvv`.

The game will prioritize reading from `settings.vvv` instead of
`unlock.vvv`, so if there's a setting that's missing from `unlock.vvv`,
no worries there. But if `settings.vvv` is missing, then it'll read
settings from `unlock.vvv`. As well, if `unlock.vvv` is missing, then
`settings.vvv` will be read from instead (I explicitly tested for this,
and found that I had to write special code to handle this case,
otherwise the game would overwrite the existing `settings.vvv` before
reading from it; kids, make sure to always test your code!).

Closes #373 fully.
This commit is contained in:
Misa
2020-11-03 23:11:21 -08:00
committed by Ethan Lee
parent 9e1ba97f63
commit 5aa8b99113
6 changed files with 144 additions and 27 deletions

View File

@@ -6,7 +6,11 @@
#include <vector>
// Forward decl without including all of <tinyxml2.h>
namespace tinyxml2 { class XMLDocument; }
namespace tinyxml2
{
class XMLDocument;
class XMLElement;
}
struct MenuOption
{
@@ -126,10 +130,20 @@ public:
void loadstats(int *width, int *height, bool *vsync);
void savestats();
void savestats(const bool stats_only = false);
void deletestats();
void deserializesettings(tinyxml2::XMLElement* dataNode, int* width, int* height, bool* vsync);
void serializesettings(tinyxml2::XMLElement* dataNode);
void loadsettings(int* width, int* height, bool* vsync);
void savesettings();
void deletesettings();
void deletequick();
bool savetele();