hocclk: improve kip saving mechanism

This commit is contained in:
souldbminersmwc
2026-04-24 16:42:59 -04:00
parent cde560c4bd
commit 9ff9e315a0
2 changed files with 14 additions and 9 deletions

View File

@@ -71,6 +71,10 @@ MiscGui::MiscGui()
MiscGui::~MiscGui() MiscGui::~MiscGui()
{ {
if (shouldSaveKip) {
sendKipData();
shouldSaveKip = false;
}
if (s_kipThreadPending) { if (s_kipThreadPending) {
threadWaitForExit(&s_kipThread); threadWaitForExit(&s_kipThread);
threadClose(&s_kipThread); threadClose(&s_kipThread);
@@ -94,7 +98,7 @@ void MiscGui::addConfigToggle(HocClkConfigValue configVal, const char* altName,
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
} else if (kip) { } else if (kip) {
sendKipData(); shouldSaveKip = true;
} }
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
}); });
@@ -121,7 +125,7 @@ void MiscGui::addConfigTrackbar(HocClkConfigValue configVal, const char* altName
this->configList->values[configVal] = v; this->configList->values[configVal] = v;
Result rc = hocclkIpcSetConfigValues(this->configList); Result rc = hocclkIpcSetConfigValues(this->configList);
if (R_FAILED(rc)) FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc); if (R_FAILED(rc)) FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
if (kip) sendKipData(); if (kip) shouldSaveKip = true;
}); });
this->listElement->addItem(bar); this->listElement->addItem(bar);
} }
@@ -142,7 +146,7 @@ void MiscGui::addMappedConfigTrackbar(HocClkConfigValue configVal, const char* a
this->configList->values[configVal] = vals[idx]; this->configList->values[configVal] = vals[idx];
Result rc = hocclkIpcSetConfigValues(this->configList); Result rc = hocclkIpcSetConfigValues(this->configList);
if (R_FAILED(rc)) FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc); if (R_FAILED(rc)) FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
if (kip) sendKipData(); if (kip) shouldSaveKip = true;
}); });
this->listElement->addItem(bar); this->listElement->addItem(bar);
} }
@@ -218,7 +222,7 @@ void MiscGui::addConfigButton(HocClkConfigValue configVal,
return false; return false;
} }
if (kip) { if (kip) {
sendKipData(); shouldSaveKip = true;
} }
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
return true; return true;
@@ -243,7 +247,7 @@ void MiscGui::addConfigButton(HocClkConfigValue configVal,
return false; return false;
} }
if (kip) { if (kip) {
sendKipData(); shouldSaveKip = true;
} }
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
return true; return true;
@@ -336,7 +340,7 @@ void MiscGui::addConfigButtonS(HocClkConfigValue configVal,
return false; return false;
} }
if (kip) { if (kip) {
sendKipData(); shouldSaveKip = true;
} }
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
return true; return true;
@@ -361,7 +365,7 @@ void MiscGui::addConfigButtonS(HocClkConfigValue configVal,
return false; return false;
} }
if (kip) { if (kip) {
sendKipData(); shouldSaveKip = true;
} }
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
return true; return true;
@@ -1305,7 +1309,7 @@ protected:
FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
return false; return false;
} }
sendKipData(); shouldSaveKip = true;
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
return true; return true;
}, },
@@ -1365,7 +1369,7 @@ protected:
FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
return false; return false;
} }
sendKipData(); shouldSaveKip = true;
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
return true; return true;
}, },

View File

@@ -77,4 +77,5 @@ protected:
tsl::elm::ToggleListItem* enabledToggle; tsl::elm::ToggleListItem* enabledToggle;
u8 frameCounter = 60; u8 frameCounter = 60;
bool shouldSaveKip = false;
}; };