mirror of
https://github.com/wiiu-env/SwipSwapMe.git
synced 2024-11-22 12:39:16 +01:00
Only update storage at application end if the value actually changed
This commit is contained in:
parent
5f3604abff
commit
2b9091a220
24
src/main.cpp
24
src/main.cpp
@ -89,20 +89,28 @@ DEINITIALIZE_PLUGIN() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SwipSwapAudioMode sAudioModeAtStart;
|
||||||
|
bool sDoSwapAtStart;
|
||||||
|
|
||||||
// Called whenever an application was started.
|
// Called whenever an application was started.
|
||||||
ON_APPLICATION_START() {
|
ON_APPLICATION_START() {
|
||||||
initLogging();
|
initLogging();
|
||||||
|
sAudioModeAtStart = gCurAudioMode;
|
||||||
|
sDoSwapAtStart = gDoScreenSwap;
|
||||||
}
|
}
|
||||||
|
|
||||||
ON_APPLICATION_REQUESTS_EXIT() {
|
ON_APPLICATION_REQUESTS_EXIT() {
|
||||||
if (WUPSStorageAPI::Store(AUDIO_MODE_CONFIG_STRING, gCurAudioMode) != WUPS_STORAGE_ERROR_SUCCESS) {
|
if (sAudioModeAtStart != gCurAudioMode || sDoSwapAtStart != gDoScreenSwap) {
|
||||||
DEBUG_FUNCTION_LINE_ERR("Failed to store screen mode to storage");
|
if (WUPSStorageAPI::Store(AUDIO_MODE_CONFIG_STRING, gCurAudioMode) != WUPS_STORAGE_ERROR_SUCCESS) {
|
||||||
}
|
DEBUG_FUNCTION_LINE_ERR("Failed to store screen mode to storage");
|
||||||
if (WUPSStorageAPI::Store(SWAP_SCREENS_CONFIG_STRING, gDoScreenSwap) != WUPS_STORAGE_ERROR_SUCCESS) {
|
}
|
||||||
DEBUG_FUNCTION_LINE_ERR("Failed to store screen mode to storage");
|
|
||||||
}
|
if (WUPSStorageAPI::Store(SWAP_SCREENS_CONFIG_STRING, gDoScreenSwap) != WUPS_STORAGE_ERROR_SUCCESS) {
|
||||||
if (WUPSStorageAPI::SaveStorage() != WUPS_STORAGE_ERROR_SUCCESS) {
|
DEBUG_FUNCTION_LINE_ERR("Failed to store screen mode to storage");
|
||||||
DEBUG_FUNCTION_LINE_ERR("Failed to save storage");
|
}
|
||||||
|
if (WUPSStorageAPI::SaveStorage() != WUPS_STORAGE_ERROR_SUCCESS) {
|
||||||
|
DEBUG_FUNCTION_LINE_ERR("Failed to save storage");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deinitLogging();
|
deinitLogging();
|
||||||
|
Loading…
Reference in New Issue
Block a user