Cleanup cvars that are set on boot (#2863)

This commit is contained in:
Garrett Cox 2023-05-10 13:08:35 +00:00 committed by GitHub
commit 2ea72f835a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 194 additions and 102 deletions

View file

@ -110,7 +110,10 @@ std::vector<uint32_t> buttons = { BTN_A, BTN_B, BTN_CUP, BTN_CDOWN, BTN_CLEFT,
void DrawCheckTracker(bool& open) {
if (!open) {
CVarSetInteger("gCheckTrackerEnabled", 0);
if (CVarGetInteger("gCheckTrackerEnabled", 0)) {
CVarClear("gCheckTrackerEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -962,7 +965,10 @@ static const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down"
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
void DrawCheckTrackerOptions(bool& open) {
if (!open) {
CVarSetInteger("gCheckTrackerSettingsEnabled", 0);
if (CVarGetInteger("gCheckTrackerSettingsEnabled", 0)) {
CVarClear("gCheckTrackerSettingsEnabled");
LUS::RequestCvarSaveOnNextTick();
}
return;
}
@ -1023,8 +1029,8 @@ void DrawCheckTrackerOptions(bool& open) {
}
void InitCheckTracker() {
LUS::AddWindow("Randomizer", "Check Tracker", DrawCheckTracker, CVarGetInteger("gCheckTrackerEnabled", 0) == 1);
LUS::AddWindow("Randomizer", "Check Tracker Settings", DrawCheckTrackerOptions);
LUS::AddWindow("Randomizer", "Check Tracker", DrawCheckTracker, CVarGetInteger("gCheckTrackerEnabled", 0));
LUS::AddWindow("Randomizer", "Check Tracker Settings", DrawCheckTrackerOptions, CVarGetInteger("gCheckTrackerSettingsEnabled", 0));
Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default);
Color_Area_Incomplete_Main = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default);
Color_Area_Incomplete_Extra = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default);