From e3c97801edcb98cd63ecf230cc0d1de77bbd2fd9 Mon Sep 17 00:00:00 2001 From: icex2 Date: Thu, 15 Aug 2024 11:34:31 +0200 Subject: [PATCH] feat: Property (node) API impl with mxml To provide a unified backend for all games, no matter if they have AVS 2 available or now, use the property (node) abstraction for any means of configuration. This is somewhat annoying and a pain because the property API isn't amazing. However, the past has shown that having different means of providing and handling (structured) configuration data isn't great either. Thus, have a non AVS implementation that allows AVS independent applications/old games to use the same core bemanitools API. Summary: Test Plan: Summary: Test Plan: --- src/main/config/Module.mk | 1 + src/main/core/Module.mk | 2 +- src/main/core/property-mxml-internal.h | 33 + src/main/core/property-mxml.c | 240 ++++++ src/main/core/property-mxml.h | 8 + src/main/core/property-node-mxml.c | 1086 ++++++++++++++++++++++++ src/main/core/property-node-mxml.h | 10 + src/main/core/property-node.c | 6 + src/main/core/property-node.h | 5 +- src/main/core/property.c | 2 + src/main/core/property.h | 5 +- src/main/extiotest/Module.mk | 1 + src/main/iidxhook1/Module.mk | 1 + src/main/iidxhook2/Module.mk | 1 + src/main/iidxhook3/Module.mk | 1 + src/main/iidxhook4-cn/Module.mk | 1 + src/main/iidxhook4/Module.mk | 1 + src/main/iidxhook5-cn/Module.mk | 1 + src/main/iidxhook5/Module.mk | 1 + src/main/inject/Module.mk | 1 + 20 files changed, 1404 insertions(+), 3 deletions(-) create mode 100644 src/main/core/property-mxml-internal.h create mode 100644 src/main/core/property-mxml.c create mode 100644 src/main/core/property-mxml.h create mode 100644 src/main/core/property-node-mxml.c create mode 100644 src/main/core/property-node-mxml.h diff --git a/src/main/config/Module.mk b/src/main/config/Module.mk index e46e97e..6c7b757 100644 --- a/src/main/config/Module.mk +++ b/src/main/config/Module.mk @@ -11,6 +11,7 @@ libs_config := \ geninput \ util \ iface-core \ + mxml \ ldflags_config := \ -lcomctl32 \ diff --git a/src/main/core/Module.mk b/src/main/core/Module.mk index 2ddb34a..f86102c 100644 --- a/src/main/core/Module.mk +++ b/src/main/core/Module.mk @@ -18,8 +18,8 @@ src_core := \ log-sink-std.c \ property-ext.c \ property-mxml.c \ - property-mxml.c \ property-node-ext.c \ + property-node-mxml.c \ property-node-trace.c \ property-node.c \ property-trace.c \ diff --git a/src/main/core/property-mxml-internal.h b/src/main/core/property-mxml-internal.h new file mode 100644 index 0000000..ad29081 --- /dev/null +++ b/src/main/core/property-mxml-internal.h @@ -0,0 +1,33 @@ +#ifndef CORE_PROPERTY_MXML_INTERNAL_H +#define CORE_PROPERTY_MXML_INTERNAL_H + +#include + +#include "core/property.h" +#include "core/property-node.h" + +// As there is no need to have a fixed size allocated for properties with +// everything dynamically growing on the heap when necessary, just +// use this as a dummy value to be compatible with the property interface +#define CORE_PROPERTY_MXML_INTERNAL_FIXED_SIZE_DUMMY 573 + +typedef struct core_property_mxml_internal_property { + mxml_node_t *document; +} core_property_mxml_internal_property_t; + +_Static_assert( + sizeof(core_property_mxml_internal_property_t) <= sizeof(core_property_t), + "Not enough space for stack allocations"); + +typedef struct core_property_mxml_internal_property_node { + core_property_mxml_internal_property_t *property; + mxml_node_t *node; + // Used when node is being iterated to remember the root of the iteration + mxml_node_t *node_root_iter; +} core_property_mxml_internal_property_node_t; + +_Static_assert( + sizeof(core_property_mxml_internal_property_node_t) <= sizeof(core_property_node_t), + "Not enough space for stack allocations"); + +#endif \ No newline at end of file diff --git a/src/main/core/property-mxml.c b/src/main/core/property-mxml.c new file mode 100644 index 0000000..a567476 --- /dev/null +++ b/src/main/core/property-mxml.c @@ -0,0 +1,240 @@ +#define LOG_MODULE "core-property-mxml" + +#include + +#include +#include + +#include + +#include "core/property-mxml-internal.h" +#include "core/property-node-mxml.h" +#include "core/property-mxml.h" + +#include "iface-core/log.h" + +#include "util/fs.h" +#include "util/mem.h" + +static core_property_result_t +_core_property_mxml_create(size_t size, core_property_t **property_) +{ + mxml_node_t *node; + core_property_mxml_internal_property_t *property; + + // There is no need to use the size parameter here as everything's allocated + // dynamically on the heap and no initial fixed size is needed + node = mxmlNewXML(NULL); + + if (!node) { + return CORE_PROPERTY_RESULT_ERROR_ALLOC; + } + + property = xmalloc(sizeof(core_property_mxml_internal_property_t)); + + property->document = node; + + *property_ = (core_property_t *) property; + + return CORE_PROPERTY_RESULT_SUCCESS; +} + +static core_property_result_t +_core_property_mxml_file_load(const char *path, core_property_t **property_) +{ + mxml_node_t *node; + core_property_mxml_internal_property_t *property; + + // The return value NULL of the loading function + // doesn't distinguish file not found and loading error =| + if (!path_exists(path)) { + return CORE_PROPERTY_RESULT_NOT_FOUND; + } + + node = mxmlLoadFilename(NULL, NULL, path); + + if (!node) { + return CORE_PROPERTY_RESULT_ERROR_READ; + } + + property = xmalloc(sizeof(core_property_mxml_internal_property_t)); + + property->document = node; + + *property_ = (core_property_t *) property; + + return CORE_PROPERTY_RESULT_SUCCESS; +} + +static core_property_result_t +_core_property_mxml_str_load(const char *str, core_property_t **property_) +{ + mxml_node_t *node; + core_property_mxml_internal_property_t *property; + + node = mxmlLoadString(NULL, NULL, str); + + if (!node) { + return CORE_PROPERTY_RESULT_ERROR_READ; + } + + property = xmalloc(sizeof(core_property_mxml_internal_property_t)); + + property->document = node; + + *property_ = (core_property_t *) property; + + return CORE_PROPERTY_RESULT_SUCCESS; +} + +static core_property_result_t +_core_property_mxml_size(const core_property_t *property_, size_t *size) +{ + *size = CORE_PROPERTY_MXML_INTERNAL_FIXED_SIZE_DUMMY; + + return CORE_PROPERTY_RESULT_SUCCESS; +} + +static core_property_result_t _core_property_mxml_clone( + const core_property_t *property_, core_property_t **property_cloned_) +{ + const core_property_mxml_internal_property_t *property; + core_property_mxml_internal_property_t **property_cloned; + + char *str_copy; + mxml_node_t *node_cloned; + + property = (const core_property_mxml_internal_property_t*) property_; + property_cloned = (core_property_mxml_internal_property_t**) property_cloned_; + + // Ensure actual cloning by storing and loading this + // Just "adding it" to the other tree with mxml creates a reference only + + str_copy = mxmlSaveAllocString(property->document, NULL); + + if (str_copy == NULL) { + return CORE_PROPERTY_RESULT_ERROR_READ; + } + + node_cloned = mxmlLoadString(NULL, NULL, str_copy); + + if (node_cloned == NULL) { + return CORE_PROPERTY_RESULT_ERROR_WRITE; + } + + *property_cloned = xmalloc(sizeof(core_property_mxml_internal_property_t)); + + (*property_cloned)->document = node_cloned; + + return CORE_PROPERTY_RESULT_SUCCESS; +} + +static core_property_result_t _core_property_mxml_root_node_get( + const core_property_t *property_, core_property_node_t *node_) +{ + core_property_mxml_internal_property_t *property; + core_property_mxml_internal_property_node_t *node; + mxml_node_t *mxml_node; + mxml_type_t type; + + property = (core_property_mxml_internal_property_t *) property_; + node = (core_property_mxml_internal_property_node_t *) node_; + + memset(node, 0, sizeof(core_property_mxml_internal_property_node_t)); + + // Walk the nodes as the loaded xml node is the document root + // which can be the xml directive, or if missing, the first root + // element + for (mxml_node = property->document; + mxml_node != NULL; + mxml_node = mxmlWalkNext(mxml_node, property->document, MXML_DESCEND_FIRST)) + { + type = mxmlGetType(mxml_node); + // Consider the first element to be found the root element of the + // document. Having multiple roots isn't a valid XML document + // anyway + if (type == MXML_TYPE_ELEMENT) { + break; + } + } + + if (mxml_node == NULL) { + return CORE_PROPERTY_RESULT_NOT_FOUND; + } + + node->property = property; + // No difference for property vs. property_node + node->node = mxml_node; + + return CORE_PROPERTY_RESULT_SUCCESS; +} + +static core_property_result_t _core_property_mxml_other_node_insert( + core_property_t *property_, const core_property_node_t *node_) +{ + core_property_mxml_internal_property_t *property; + core_property_mxml_internal_property_node_t *node; + + char *str_copy; + mxml_node_t *node_cloned; + + property = (core_property_mxml_internal_property_t *) property_; + node = (core_property_mxml_internal_property_node_t *) node_; + + // Ensure actual cloning by storing and loading this + // Just "adding it" to the other tree with mxml creates a reference only + + str_copy = mxmlSaveAllocString(node->node, NULL); + + if (str_copy == NULL) { + return CORE_PROPERTY_RESULT_ERROR_READ; + } + + node_cloned = mxmlLoadString(NULL, NULL, str_copy); + + if (node_cloned == NULL) { + return CORE_PROPERTY_RESULT_ERROR_WRITE; + } + + // Hook the new node into the existing tree + + mxmlAdd(property->document, MXML_ADD_AFTER, NULL, node_cloned); + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static void _core_property_mxml_free(core_property_t **property_) +{ + core_property_mxml_internal_property_t *property; + + property = (core_property_mxml_internal_property_t *) (*property_); + + mxmlDelete(property->document); + + free(*property_); + *property_ = NULL; +} + +static void _core_property_mxml_core_api_get(core_property_api_t *api) +{ + log_assert(api); + + api->version = 1; + + api->v1.create = _core_property_mxml_create; + api->v1.file_load = _core_property_mxml_file_load; + api->v1.str_load = _core_property_mxml_str_load; + api->v1.size = _core_property_mxml_size; + api->v1.clone = _core_property_mxml_clone; + api->v1.root_node_get = _core_property_mxml_root_node_get; + api->v1.other_node_insert = _core_property_mxml_other_node_insert; + api->v1.free = _core_property_mxml_free; +} + +void core_property_mxml_core_api_set() +{ + core_property_api_t api; + + _core_property_mxml_core_api_get(&api); + core_property_api_set(&api); +} diff --git a/src/main/core/property-mxml.h b/src/main/core/property-mxml.h new file mode 100644 index 0000000..e061f49 --- /dev/null +++ b/src/main/core/property-mxml.h @@ -0,0 +1,8 @@ +#ifndef CORE_PROPERTY_MXML_H +#define CORE_PROPERTY_MXML_H + +#include "main/core/property.h" + +void core_property_mxml_core_api_set(); + +#endif \ No newline at end of file diff --git a/src/main/core/property-node-mxml.c b/src/main/core/property-node-mxml.c new file mode 100644 index 0000000..f2a25da --- /dev/null +++ b/src/main/core/property-node-mxml.c @@ -0,0 +1,1086 @@ +#define LOG_MODULE "core-property-node-mxml" + +#include +#include +#include +#include + +#include + +#include "core/property-mxml-internal.h" + +#include "iface-core/log.h" + +#include "util/hex.h" +#include "util/mem.h" +#include "util/str.h" + +static core_property_node_result_t _core_property_node_mxml_node_type_create( + const core_property_node_t *parent_node_, + core_property_node_t *node_out_, + const char *key, + const char *type, + const char *format, + ...) +{ + core_property_mxml_internal_property_node_t *parent_node; + core_property_mxml_internal_property_node_t *node_out; + mxml_node_t *node_new; + mxml_node_t *tmp; + va_list args; + char buffer[16384]; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + node_out = (core_property_mxml_internal_property_node_t *) node_out_; + + node_new = mxmlNewElement(parent_node->node, key); + + if (node_new == NULL) { + return CORE_PROPERTY_RESULT_ERROR_INTERNAL; + } + + // No return value + mxmlElementSetAttr(node_new, "__type", type); + + va_start(args, format); + vsnprintf(buffer, sizeof(buffer), format, args); + va_end(args); + + tmp = mxmlNewText(node_new, false, buffer); + + if (tmp == NULL) { + return CORE_PROPERTY_RESULT_ERROR_INTERNAL; + } + + if (node_out) { + memset(node_out, 0, sizeof(core_property_mxml_internal_property_node_t)); + + node_out->property = parent_node->property; + node_out->node = node_new; + } + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_name_get( + const core_property_node_t *node_, char *name, size_t len) +{ + core_property_mxml_internal_property_node_t *node; + const char *elem_name; + + node = (core_property_mxml_internal_property_node_t *) node_; + + elem_name = mxmlGetElement(node->node); + + if (elem_name == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + str_cpy(name, len, elem_name); + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t +_core_property_node_mxml_size(const core_property_node_t *node_, size_t *size) +{ + *size = CORE_PROPERTY_MXML_INTERNAL_FIXED_SIZE_DUMMY; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_search( + const core_property_node_t *node_, + const char *path, + core_property_node_t *node_out_) +{ + core_property_mxml_internal_property_node_t *node; + core_property_mxml_internal_property_node_t *node_out; + mxml_node_t *tmp; + + node = (core_property_mxml_internal_property_node_t *) node_; + node_out = (core_property_mxml_internal_property_node_t *) node_out_; + + memset(node_out, 0, sizeof(core_property_mxml_internal_property_node_t)); + + tmp = mxmlFindPath(node->node, path); + + if (!tmp) { + return CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND; + } + + node_out->property = node->property; + node_out->node = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_next_result_search( + const core_property_node_t *node_, core_property_node_t *node_out_) +{ + core_property_mxml_internal_property_node_t *node; + core_property_mxml_internal_property_node_t *node_out; + mxml_node_t *tmp; + const char *elem_name; + + node = (core_property_mxml_internal_property_node_t *) node_; + node_out = (core_property_mxml_internal_property_node_t *) node_out_; + + memset(node_out, 0, sizeof(core_property_mxml_internal_property_node_t)); + + elem_name = mxmlGetElement(node->node); + + if (elem_name == NULL) { + return CORE_PROPERTY_NODE_RESULT_ERROR_INTERNAL; + } + + tmp = mxmlFindElement(node->node, node->node, elem_name, NULL, NULL, MXML_DESCEND_NONE); + + if (tmp == NULL) { + return CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND; + } + + node_out->property = node->property; + node_out->node = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_child_get( + const core_property_node_t *node_, core_property_node_t *node_out_) +{ + core_property_mxml_internal_property_node_t *node; + core_property_mxml_internal_property_node_t *node_out; + mxml_node_t *tmp; + mxml_node_t *tree; + + node = (core_property_mxml_internal_property_node_t *) node_; + node_out = (core_property_mxml_internal_property_node_t *) node_out_; + + tree = node->node; + + tmp = mxmlFindElement(tree, tree, NULL, NULL, NULL, MXML_DESCEND_FIRST); + + if (!tmp) { + return CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND; + } + + memset(node_out, 0, sizeof(core_property_mxml_internal_property_node_t)); + + node_out->property = node->property; + node_out->node = tmp; + node_out->node_root_iter = tree; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_next_sibling_get( + const core_property_node_t *node_, core_property_node_t *node_out_) +{ + core_property_mxml_internal_property_node_t *node; + core_property_mxml_internal_property_node_t *node_out; + mxml_node_t *tmp; + + node = (core_property_mxml_internal_property_node_t *) node_; + node_out = (core_property_mxml_internal_property_node_t *) node_out_; + + log_assert(node->node_root_iter); + + tmp = mxmlFindElement(node->node, node->node_root_iter, NULL, NULL, NULL, MXML_DESCEND_NONE); + + if (!tmp) { + return CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND; + } + + memset(node_out, 0, sizeof(core_property_mxml_internal_property_node_t)); + + node_out->property = node->property; + node_out->node = tmp; + node_out->node_root_iter = node->node_root_iter; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_void_create( + const core_property_node_t *parent_node_, + const char *key, + core_property_node_t *node_out_) +{ + core_property_mxml_internal_property_node_t *parent_node; + core_property_mxml_internal_property_node_t *node_out; + mxml_node_t *tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + node_out = (core_property_mxml_internal_property_node_t *) node_out_; + + tmp = mxmlNewElement(parent_node->node, key); + + if (!tmp) { + return CORE_PROPERTY_NODE_RESULT_ERROR_INTERNAL; + } + + if (node_out) { + memset(node_out, 0, sizeof(core_property_mxml_internal_property_node_t)); + + node_out->property = parent_node->property; + node_out->node = tmp; + } + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_s8_create( + const core_property_node_t *parent_node_, + const char *key, + int8_t value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "s8", "%d", value); +} + +static core_property_node_result_t _core_property_node_mxml_u8_create( + const core_property_node_t *parent_node_, + const char *key, + uint8_t value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "u8", "%u", value); +} + +static core_property_node_result_t _core_property_node_mxml_s16_create( + const core_property_node_t *parent_node_, + const char *key, + int16_t value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "s16", "%d", value); +} + +static core_property_node_result_t _core_property_node_mxml_u16_create( + const core_property_node_t *parent_node_, + const char *key, + uint16_t value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "u16", "%u", value); +} + +static core_property_node_result_t _core_property_node_mxml_s32_create( + const core_property_node_t *parent_node_, + const char *key, + int32_t value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "s32", "%d", value); +} + +static core_property_node_result_t _core_property_node_mxml_u32_create( + const core_property_node_t *parent_node_, + const char *key, + uint32_t value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "u32", "%u", value); +} + +static core_property_node_result_t _core_property_node_mxml_s64_create( + const core_property_node_t *parent_node_, + const char *key, + int64_t value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "s64", "%lld", value); +} + +static core_property_node_result_t _core_property_node_mxml_u64_create( + const core_property_node_t *parent_node_, + const char *key, + uint64_t value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "u64", "%llu", value); +} + +static core_property_node_result_t _core_property_node_mxml_bin_create( + const core_property_node_t *parent_node_, + const char *key, + void *data, + size_t len, + core_property_node_t *node_out_) +{ + size_t size; + char *buffer; + core_property_node_result_t result; + + // Each byte needs 2 chars + null terminator at the end + size = len * 2 + 1; + buffer = xmalloc(size); + + hex_encode_uc(data, len, buffer, size); + + result = _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "bin", "%s", buffer); + + free(buffer); + + return result; +} + +static core_property_node_result_t _core_property_node_mxml_str_create( + const core_property_node_t *parent_node_, + const char *key, + const char *value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "str", "%s", value); +} + +static core_property_node_result_t _core_property_node_mxml_ipv4_create( + const core_property_node_t *parent_node_, + const char *key, + uint32_t value, + core_property_node_t *node_out_) +{ + char buffer[4 * 3 + 3 + 1]; + core_property_node_result_t result; + + str_format(buffer, sizeof(buffer), "%d.%d.%d.%d", + (value >> 24) & 0xFF, + (value >> 16) & 0xFF, + (value >> 8) & 0xFF, + value & 0xFF); + + result = _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "ip4", "%s", buffer); + + return result; +} + +static core_property_node_result_t _core_property_node_mxml_float_create( + const core_property_node_t *parent_node_, + const char *key, + float value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "float", "%f", value); +} + +static core_property_node_result_t _core_property_node_mxml_double_create( + const core_property_node_t *parent_node_, + const char *key, + double value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "double", "%f", value); +} + +static core_property_node_result_t _core_property_node_mxml_attr_create( + const core_property_node_t *parent_node_, + const char *key, + const char *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + // No return value + mxmlElementSetAttr(parent_node->node, key, value); + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_bool_create( + const core_property_node_t *parent_node_, + const char *key, + bool value, + core_property_node_t *node_out_) +{ + return _core_property_node_mxml_node_type_create(parent_node_, node_out_, key, "bool", "%d", value ? "1" : "0"); +} + +static core_property_node_result_t _core_property_node_mxml_s8_read( + const core_property_node_t *parent_node_, int8_t *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + int64_t tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "s8")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + errno = 0; + + tmp = strtoll(text, NULL, 10); + + if (errno != 0) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + if (tmp < INT8_MIN || tmp > INT8_MAX) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_u8_read( + const core_property_node_t *parent_node_, uint8_t *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + int64_t tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "u8")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + errno = 0; + + tmp = strtoll(text, NULL, 10); + + if (errno != 0) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + if (tmp < 0 || tmp > UINT8_MAX) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_s16_read( + const core_property_node_t *parent_node_, int16_t *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + int64_t tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "s16")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + errno = 0; + + tmp = strtoll(text, NULL, 10); + + if (errno != 0) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + if (tmp < INT16_MIN || tmp > INT16_MAX) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_u16_read( + const core_property_node_t *parent_node_, uint16_t *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + int64_t tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "u16")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + errno = 0; + + tmp = strtoll(text, NULL, 10); + + if (errno != 0) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + if (tmp < 0 || tmp > UINT16_MAX) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_s32_read( + const core_property_node_t *parent_node_, int32_t *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + int64_t tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "s32")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + errno = 0; + + tmp = strtoll(text, NULL, 10); + + if (errno != 0) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + if (tmp < INT32_MIN || tmp > INT32_MAX) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_u32_read( + const core_property_node_t *parent_node_, uint32_t *value) +{ +core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + int64_t tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "u32")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + errno = 0; + + tmp = strtoll(text, NULL, 10); + + if (errno != 0) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + if (tmp < 0 || tmp > UINT32_MAX) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_s64_read( + const core_property_node_t *parent_node_, int64_t *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + int64_t tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "s64")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + errno = 0; + + tmp = strtoll(text, NULL, 10); + + if (errno != 0) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_u64_read( + const core_property_node_t *parent_node_, uint64_t *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + uint64_t tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "u64")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + errno = 0; + + tmp = strtoull(text, NULL, 10); + + if (errno != 0) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_bin_read( + const core_property_node_t *parent_node_, void *value, size_t len) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "bin")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + if (!hex_decode(value, len, text, strlen(text))) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_str_read( + const core_property_node_t *parent_node_, char *value, size_t len) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "str")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + str_cpy(value, len, text); + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_ipv4_read( + const core_property_node_t *parent_node_, uint32_t *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + uint8_t *tmp; + int res; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "ip4")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = 0; + tmp = (uint8_t*) value; + + res = sscanf(text, "%u.%u.%u.%u", &tmp[3], &tmp[2], &tmp[1], &tmp[0]); + + if (res != 4) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_float_read( + const core_property_node_t *parent_node_, float *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + float tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "float")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + errno = 0; + + tmp = strtof(text, NULL); + + if (errno != 0) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_double_read( + const core_property_node_t *parent_node_, double *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + double tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "double")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + errno = 0; + + tmp = strtod(text, NULL); + + if (errno != 0) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = tmp; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_attr_read( + const core_property_node_t *parent_node_, const char *key, char *value, size_t len) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr = mxmlElementGetAttr(parent_node->node, key); + + if (attr == NULL) { + return CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND; + } + + str_cpy(value, len, attr); + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_bool_read( + const core_property_node_t *parent_node_, bool *value) +{ + core_property_mxml_internal_property_node_t *parent_node; + const char *attr_type; + const char *text; + int64_t tmp; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + attr_type = mxmlElementGetAttr(parent_node->node, "__type"); + + if (attr_type == NULL) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE; + } + + if (!str_eq(attr_type, "bool")) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE; + } + + text = mxmlGetText(parent_node->node, NULL); + + if (!text) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + errno = 0; + + tmp = strtoll(text, NULL, 10); + + if (errno != 0) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + if (tmp != 0 && tmp != 1) { + return CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA; + } + + *value = tmp > 0; + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t +_core_property_node_mxml_remove(const core_property_node_t *node_) +{ + core_property_mxml_internal_property_node_t *node; + + node = (core_property_mxml_internal_property_node_t *) node_; + + mxmlDelete(node->node); + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_attr_remove( + const core_property_node_t *parent_node_, const char *key) +{ + core_property_mxml_internal_property_node_t *parent_node; + + parent_node = (core_property_mxml_internal_property_node_t *) parent_node_; + + mxmlElementClearAttr(parent_node->node, key); + + return CORE_PROPERTY_NODE_RESULT_SUCCESS; +} + +static core_property_node_result_t _core_property_node_mxml_copy( + core_property_node_t *dst_node_, const core_property_node_t *src_node_) +{ + core_property_mxml_internal_property_node_t *dst_node; + const core_property_mxml_internal_property_node_t *src_node; + + dst_node = (core_property_mxml_internal_property_node_t *) dst_node_; + src_node = (const core_property_mxml_internal_property_node_t *) src_node_; + + char *str_copy; + mxml_node_t *node_cloned; + + // Ensure actual cloning by storing and loading this + // Just "adding it" to the other tree with mxml creates a reference only + + str_copy = mxmlSaveAllocString(src_node->node, NULL); + + if (str_copy == NULL) { + return CORE_PROPERTY_RESULT_ERROR_READ; + } + + node_cloned = mxmlLoadString(NULL, NULL, str_copy); + + if (node_cloned == NULL) { + return CORE_PROPERTY_RESULT_ERROR_WRITE; + } + + mxmlAdd(dst_node->node, MXML_ADD_AFTER, NULL, node_cloned); + + return CORE_PROPERTY_RESULT_SUCCESS; +} + +void core_property_node_mxml_core_api_get(core_property_node_api_t *api) +{ + log_assert(api); + + api->version = 1; + + api->v1.name_get = _core_property_node_mxml_name_get; + api->v1.size = _core_property_node_mxml_size; + api->v1.search = _core_property_node_mxml_search; + api->v1.next_result_search = _core_property_node_mxml_next_result_search; + api->v1.child_get = _core_property_node_mxml_child_get; + api->v1.next_sibling_get = _core_property_node_mxml_next_sibling_get; + api->v1.void_create = _core_property_node_mxml_void_create; + api->v1.s8_create = _core_property_node_mxml_s8_create; + api->v1.u8_create = _core_property_node_mxml_u8_create; + api->v1.s16_create = _core_property_node_mxml_s16_create; + api->v1.u16_create = _core_property_node_mxml_u16_create; + api->v1.s32_create = _core_property_node_mxml_s32_create; + api->v1.u32_create = _core_property_node_mxml_u32_create; + api->v1.s64_create = _core_property_node_mxml_s64_create; + api->v1.u64_create = _core_property_node_mxml_u64_create; + api->v1.bin_create = _core_property_node_mxml_bin_create; + api->v1.str_create = _core_property_node_mxml_str_create; + api->v1.ipv4_create = _core_property_node_mxml_ipv4_create; + api->v1.float_create = _core_property_node_mxml_float_create; + api->v1.double_create = _core_property_node_mxml_double_create; + api->v1.attr_create = _core_property_node_mxml_attr_create; + api->v1.bool_create = _core_property_node_mxml_bool_create; + api->v1.s8_read = _core_property_node_mxml_s8_read; + api->v1.u8_read = _core_property_node_mxml_u8_read; + api->v1.s16_read = _core_property_node_mxml_s16_read; + api->v1.u16_read = _core_property_node_mxml_u16_read; + api->v1.s32_read = _core_property_node_mxml_s32_read; + api->v1.u32_read = _core_property_node_mxml_u32_read; + api->v1.s64_read = _core_property_node_mxml_s64_read; + api->v1.u64_read = _core_property_node_mxml_u64_read; + api->v1.bin_read = _core_property_node_mxml_bin_read; + api->v1.str_read = _core_property_node_mxml_str_read; + api->v1.ipv4_read = _core_property_node_mxml_ipv4_read; + api->v1.float_read = _core_property_node_mxml_float_read; + api->v1.double_read = _core_property_node_mxml_double_read; + api->v1.attr_read = _core_property_node_mxml_attr_read; + api->v1.bool_read = _core_property_node_mxml_bool_read; + api->v1.remove = _core_property_node_mxml_remove; + api->v1.attr_remove = _core_property_node_mxml_attr_remove; + api->v1.copy = _core_property_node_mxml_copy; +} + +void core_property_node_mxml_core_api_set() +{ + core_property_node_api_t api; + + core_property_node_mxml_core_api_get(&api); + core_property_node_api_set(&api); +} diff --git a/src/main/core/property-node-mxml.h b/src/main/core/property-node-mxml.h new file mode 100644 index 0000000..c77fc63 --- /dev/null +++ b/src/main/core/property-node-mxml.h @@ -0,0 +1,10 @@ +#ifndef CORE_PROPERTY_NODE_MXML_H +#define CORE_PROPERTY_NODE_MXML_H + +#include "main/core/property-node.h" + +void core_property_node_mxml_core_api_get(core_property_node_api_t *api); + +void core_property_node_mxml_core_api_set(); + +#endif \ No newline at end of file diff --git a/src/main/core/property-node.c b/src/main/core/property-node.c index 970fcbd..d1d33ca 100644 --- a/src/main/core/property-node.c +++ b/src/main/core/property-node.c @@ -117,6 +117,12 @@ const char *core_property_node_result_to_str(core_property_node_result_t result) return "Internal"; case CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND: return "Node not found"; + case CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE: + return "Invalid node type"; + case CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE: + return "Invalid node structure"; + case CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA: + return "Invalid node data"; default: return "Undefined error"; } diff --git a/src/main/core/property-node.h b/src/main/core/property-node.h index fb52028..cb1083e 100644 --- a/src/main/core/property-node.h +++ b/src/main/core/property-node.h @@ -10,7 +10,7 @@ #include "main/core/property.h" #define CORE_PROPERTY_NODE_RESULT_IS_ERROR(x) \ - (x > CORE_PROPERTY_NODE_RESULT_SUCCESS) + (x != CORE_PROPERTY_NODE_RESULT_SUCCESS) // Based on actual AVS impl max size #define CORE_PROPERTY_NODE_NAME_SIZE_MAX 256 // Guestimate, should be enough, I hope? @@ -33,6 +33,9 @@ typedef enum core_property_node_result { CORE_PROPERTY_NODE_RESULT_SUCCESS = 0, CORE_PROPERTY_NODE_RESULT_ERROR_INTERNAL = 1, CORE_PROPERTY_NODE_RESULT_NODE_NOT_FOUND = 2, + CORE_PROPERTY_NODE_RESULT_INVALID_NODE_TYPE = 3, + CORE_PROPERTY_NODE_RESULT_INVALID_NODE_STRUCTURE = 4, + CORE_PROPERTY_NODE_RESULT_INVALID_NODE_DATA = 5, } core_property_node_result_t; typedef core_property_node_result_t (*core_property_node_name_get_t)( diff --git a/src/main/core/property.c b/src/main/core/property.c index 06ebe86..5864949 100644 --- a/src/main/core/property.c +++ b/src/main/core/property.c @@ -88,6 +88,8 @@ const char *core_property_result_to_str(core_property_result_t result) return "Permissions"; case CORE_PROPERTY_RESULT_ERROR_READ: return "Read error"; + case CORE_PROPERTY_RESULT_ERROR_WRITE: + return "Write error"; default: return "Undefined error"; } diff --git a/src/main/core/property.h b/src/main/core/property.h index 44d3d51..b8361ba 100644 --- a/src/main/core/property.h +++ b/src/main/core/property.h @@ -5,7 +5,8 @@ #include #include -#include "api/core/log.h" +#define CORE_PROPERTY_RESULT_IS_ERROR(x) \ + (x != CORE_PROPERTY_RESULT_SUCCESS) // Macro to allow inlining of the caller function and line numbers // to make debugging easier @@ -25,6 +26,7 @@ typedef struct core_property_node { // Have size known, but not contents, to allow for stack allocations void *v1; void *v2; + void *v3; } core_property_node_t; typedef enum core_property_result { @@ -34,6 +36,7 @@ typedef enum core_property_result { CORE_PROPERTY_RESULT_NOT_FOUND = 3, CORE_PROPERTY_RESULT_ERROR_PERMISSIONS = 4, CORE_PROPERTY_RESULT_ERROR_READ = 5, + CORE_PROPERTY_RESULT_ERROR_WRITE = 6, } core_property_result_t; typedef core_property_result_t (*core_property_create_t)( diff --git a/src/main/extiotest/Module.mk b/src/main/extiotest/Module.mk index bcb245f..e651570 100644 --- a/src/main/extiotest/Module.mk +++ b/src/main/extiotest/Module.mk @@ -6,6 +6,7 @@ libs_extiotest := \ core \ util \ iface-core \ + mxml \ src_extiotest := \ main.c \ diff --git a/src/main/iidxhook1/Module.mk b/src/main/iidxhook1/Module.mk index e6e813e..05e5e73 100644 --- a/src/main/iidxhook1/Module.mk +++ b/src/main/iidxhook1/Module.mk @@ -22,6 +22,7 @@ libs_iidxhook1 := \ iface-io \ iface-core \ util \ + mxml \ src_iidxhook1 := \ config-iidxhook1.c \ diff --git a/src/main/iidxhook2/Module.mk b/src/main/iidxhook2/Module.mk index 9fd9f6b..6c9022e 100644 --- a/src/main/iidxhook2/Module.mk +++ b/src/main/iidxhook2/Module.mk @@ -22,6 +22,7 @@ libs_iidxhook2 := \ iface-core \ module \ util \ + mxml \ src_iidxhook2 := \ config-iidxhook2.c \ diff --git a/src/main/iidxhook3/Module.mk b/src/main/iidxhook3/Module.mk index 7272d48..c15cc3b 100644 --- a/src/main/iidxhook3/Module.mk +++ b/src/main/iidxhook3/Module.mk @@ -26,6 +26,7 @@ libs_iidxhook3 := \ iface-core \ module \ util \ + mxml \ src_iidxhook3 := \ avs-boot.c \ diff --git a/src/main/iidxhook4-cn/Module.mk b/src/main/iidxhook4-cn/Module.mk index f20905d..5448bd4 100644 --- a/src/main/iidxhook4-cn/Module.mk +++ b/src/main/iidxhook4-cn/Module.mk @@ -28,6 +28,7 @@ libs_iidxhook4-cn := \ iface-core \ module \ util \ + mxml \ src_iidxhook4-cn := \ avs-boot.c \ diff --git a/src/main/iidxhook4/Module.mk b/src/main/iidxhook4/Module.mk index bffd153..9c26eb7 100644 --- a/src/main/iidxhook4/Module.mk +++ b/src/main/iidxhook4/Module.mk @@ -28,6 +28,7 @@ libs_iidxhook4 := \ iface-core \ module \ util \ + mxml \ src_iidxhook4 := \ dllmain.c \ diff --git a/src/main/iidxhook5-cn/Module.mk b/src/main/iidxhook5-cn/Module.mk index 5eaaeba..f776bf0 100644 --- a/src/main/iidxhook5-cn/Module.mk +++ b/src/main/iidxhook5-cn/Module.mk @@ -27,6 +27,7 @@ libs_iidxhook5-cn := \ iface-core \ module \ util \ + mxml \ src_iidxhook5-cn := \ avs-boot.c \ diff --git a/src/main/iidxhook5/Module.mk b/src/main/iidxhook5/Module.mk index f88ef25..1a3c40d 100644 --- a/src/main/iidxhook5/Module.mk +++ b/src/main/iidxhook5/Module.mk @@ -28,6 +28,7 @@ libs_iidxhook5 := \ iface-core \ module \ util \ + mxml \ src_iidxhook5 := \ dllmain.c \ diff --git a/src/main/inject/Module.mk b/src/main/inject/Module.mk index 4286960..55d44bd 100644 --- a/src/main/inject/Module.mk +++ b/src/main/inject/Module.mk @@ -11,6 +11,7 @@ libs_inject := \ util \ dwarfstack \ iface-core \ + mxml \ src_inject := \ main.c \