mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2026-08-20 00:34:37 -05:00
ConfigItems: Add configId to all item structs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "wups/config/WUPSConfigItemBoolean.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <wups.h>
|
||||
|
||||
void WUPSConfigItemBoolean_onDelete(void *context);
|
||||
@@ -58,7 +59,7 @@ void WUPSConfigItemBoolean_onSelected(void *context, bool isSelected) {
|
||||
}
|
||||
|
||||
extern "C" bool
|
||||
WUPSConfigItemBoolean_AddToCategoryEx(WUPSConfigCategoryHandle cat, const char *configID, const char *displayName, bool defaultValue, BooleanValueChangedCallback callback, const char *trueValue,
|
||||
WUPSConfigItemBoolean_AddToCategoryEx(WUPSConfigCategoryHandle cat, const char *configId, const char *displayName, bool defaultValue, BooleanValueChangedCallback callback, const char *trueValue,
|
||||
const char *falseValue) {
|
||||
if (cat == 0) {
|
||||
return false;
|
||||
@@ -68,6 +69,12 @@ WUPSConfigItemBoolean_AddToCategoryEx(WUPSConfigCategoryHandle cat, const char *
|
||||
return false;
|
||||
}
|
||||
|
||||
if (configId != nullptr) {
|
||||
item->configId = strdup(configId);
|
||||
} else {
|
||||
item->configId = nullptr;
|
||||
}
|
||||
|
||||
item->defaultValue = defaultValue;
|
||||
item->value = defaultValue;
|
||||
item->callback = (void *) callback;
|
||||
@@ -84,7 +91,7 @@ WUPSConfigItemBoolean_AddToCategoryEx(WUPSConfigCategoryHandle cat, const char *
|
||||
.onButtonPressed = &WUPSConfigItemBoolean_onButtonPressed,
|
||||
.onDelete = &WUPSConfigItemBoolean_onDelete};
|
||||
|
||||
if (WUPSConfigItem_Create(&item->handle, configID, displayName, callbacks, item) < 0) {
|
||||
if (WUPSConfigItem_Create(&item->handle, configId, displayName, callbacks, item) < 0) {
|
||||
free(item);
|
||||
return false;
|
||||
}
|
||||
@@ -98,6 +105,7 @@ WUPSConfigItemBoolean_AddToCategoryEx(WUPSConfigCategoryHandle cat, const char *
|
||||
|
||||
void WUPSConfigItemBoolean_onDelete(void *context) {
|
||||
auto *item = (ConfigItemBoolean *) context;
|
||||
free(item->configId);
|
||||
free(item);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user