mirror of
https://github.com/wiiu-env/libwupsbackend.git
synced 2024-11-22 01:39:18 +01:00
WUPS 0.6.1 support
This commit is contained in:
parent
330fb36195
commit
bd10088784
@ -47,8 +47,8 @@ public:
|
|||||||
return this->description;
|
return this->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] const std::string &getId() const {
|
[[nodiscard]] const std::string &getStorageId() const {
|
||||||
return this->description;
|
return this->storageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] size_t getSize() const {
|
[[nodiscard]] size_t getSize() const {
|
||||||
@ -61,7 +61,7 @@ public:
|
|||||||
const std::string& license,
|
const std::string& license,
|
||||||
const std::string& buildtimestamp,
|
const std::string& buildtimestamp,
|
||||||
const std::string& description,
|
const std::string& description,
|
||||||
const std::string& id,
|
const std::string& storageId,
|
||||||
size_t size);
|
size_t size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -91,8 +91,8 @@ private:
|
|||||||
this->description = description_;
|
this->description = description_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setId(const std::string &id_) {
|
void setStorageId(const std::string &storageId_) {
|
||||||
this->id = id_;
|
this->storageId = storageId_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSize(size_t size_) {
|
void setSize(size_t size_) {
|
||||||
@ -105,6 +105,6 @@ private:
|
|||||||
std::string license;
|
std::string license;
|
||||||
std::string buildtimestamp;
|
std::string buildtimestamp;
|
||||||
std::string description;
|
std::string description;
|
||||||
std::string id;
|
std::string storageId;
|
||||||
size_t size{};
|
size_t size{};
|
||||||
};
|
};
|
||||||
|
@ -18,22 +18,25 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
typedef enum GetPluginInformationInputType {
|
typedef enum GetPluginInformationInputType {
|
||||||
PLUGIN_INFORMATION_INPUT_TYPE_PATH = 0,
|
PLUGIN_INFORMATION_INPUT_TYPE_PATH = 0,
|
||||||
PLUGIN_INFORMATION_INPUT_TYPE_BUFFER = 1,
|
PLUGIN_INFORMATION_INPUT_TYPE_BUFFER = 1,
|
||||||
} GetPluginInformationInputType;
|
} GetPluginInformationInputType;
|
||||||
|
|
||||||
typedef uint32_t plugin_container_handle;
|
typedef uint32_t plugin_container_handle;
|
||||||
typedef uint32_t plugin_data_handle;
|
typedef uint32_t plugin_data_handle;
|
||||||
|
|
||||||
|
#define PLUGIN_INFORMATION_VERSION 0x00000001
|
||||||
|
|
||||||
/* plugin_information message */
|
/* plugin_information message */
|
||||||
typedef struct __attribute__((__packed__)) plugin_information {
|
typedef struct __attribute__((__packed__)) plugin_information {
|
||||||
char id[256];
|
uint32_t plugin_information_version;
|
||||||
char name[256];
|
char name[256];
|
||||||
char author[256];
|
char author[256];
|
||||||
char buildTimestamp[256];
|
char buildTimestamp[256];
|
||||||
char description[256];
|
char description[256];
|
||||||
char license[256];
|
char license[256];
|
||||||
char version[256];
|
char version[256];
|
||||||
|
char storageId[256];
|
||||||
size_t size;
|
size_t size;
|
||||||
} plugin_information;
|
} plugin_information;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ PluginMetaInformation::PluginMetaInformation(const std::string& name_,
|
|||||||
const std::string& license_,
|
const std::string& license_,
|
||||||
const std::string& buildtimestamp_,
|
const std::string& buildtimestamp_,
|
||||||
const std::string& description_,
|
const std::string& description_,
|
||||||
const std::string& id_,
|
const std::string& storageId_,
|
||||||
size_t size_) {
|
size_t size_) {
|
||||||
this->name = name_;
|
this->name = name_;
|
||||||
this->author = author_;
|
this->author = author_;
|
||||||
@ -36,5 +36,5 @@ PluginMetaInformation::PluginMetaInformation(const std::string& name_,
|
|||||||
this->description = description_;
|
this->description = description_;
|
||||||
this->license = license_;
|
this->license = license_;
|
||||||
this->version = version_;
|
this->version = version_;
|
||||||
this->id = id_;
|
this->storageId = storageId_;
|
||||||
}
|
}
|
||||||
|
@ -28,13 +28,17 @@ std::optional<PluginMetaInformation> PluginUtils::getMetaInformationForBuffer(ch
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (info.plugin_information_version != PLUGIN_INFORMATION_VERSION) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
PluginMetaInformation metaInfo(info.name,
|
PluginMetaInformation metaInfo(info.name,
|
||||||
info.author,
|
info.author,
|
||||||
info.version,
|
info.version,
|
||||||
info.license,
|
info.license,
|
||||||
info.buildTimestamp,
|
info.buildTimestamp,
|
||||||
info.description,
|
info.description,
|
||||||
info.id,
|
info.storageId,
|
||||||
info.size);
|
info.size);
|
||||||
|
|
||||||
return metaInfo;
|
return metaInfo;
|
||||||
@ -47,13 +51,16 @@ std::optional<PluginMetaInformation> PluginUtils::getMetaInformationForPath(cons
|
|||||||
// DEBUG_FUNCTION_LINE("Failed to load meta infos for %s\n", path.c_str());
|
// DEBUG_FUNCTION_LINE("Failed to load meta infos for %s\n", path.c_str());
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
if (info.plugin_information_version != PLUGIN_INFORMATION_VERSION) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
PluginMetaInformation metaInfo(info.name,
|
PluginMetaInformation metaInfo(info.name,
|
||||||
info.author,
|
info.author,
|
||||||
info.version,
|
info.version,
|
||||||
info.license,
|
info.license,
|
||||||
info.buildTimestamp,
|
info.buildTimestamp,
|
||||||
info.description,
|
info.description,
|
||||||
info.id,
|
info.storageId,
|
||||||
info.size);
|
info.size);
|
||||||
return metaInfo;
|
return metaInfo;
|
||||||
}
|
}
|
||||||
@ -100,12 +107,14 @@ std::vector<PluginContainer> PluginUtils::getLoadedPlugins(uint32_t maxSize) {
|
|||||||
handles[i] = 0xFFFFFFFF;
|
handles[i] = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WUPSGetLoadedPlugins(handles, maxSize, &realSize) != PLUGIN_BACKEND_API_ERROR_NONE) {
|
uint32_t plugin_information_version = 0;
|
||||||
|
|
||||||
|
if (WUPSGetLoadedPlugins(handles, maxSize, &realSize, &plugin_information_version) != PLUGIN_BACKEND_API_ERROR_NONE) {
|
||||||
free(handles);
|
free(handles);
|
||||||
// DEBUG_FUNCTION_LINE("Failed");
|
// DEBUG_FUNCTION_LINE("Failed");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (realSize == 0) {
|
if (realSize == 0 || plugin_information_version != PLUGIN_INFORMATION_VERSION) {
|
||||||
free(handles);
|
free(handles);
|
||||||
// DEBUG_FUNCTION_LINE("realsize is 0");
|
// DEBUG_FUNCTION_LINE("realsize is 0");
|
||||||
return result;
|
return result;
|
||||||
@ -139,13 +148,16 @@ std::vector<PluginContainer> PluginUtils::getLoadedPlugins(uint32_t maxSize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < realSize; i++) {
|
for (uint32_t i = 0; i < realSize; i++) {
|
||||||
|
if (information[i].plugin_information_version != PLUGIN_INFORMATION_VERSION) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
PluginMetaInformation metaInfo(information[i].name,
|
PluginMetaInformation metaInfo(information[i].name,
|
||||||
information[i].author,
|
information[i].author,
|
||||||
information[i].version,
|
information[i].version,
|
||||||
information[i].license,
|
information[i].license,
|
||||||
information[i].buildTimestamp,
|
information[i].buildTimestamp,
|
||||||
information[i].description,
|
information[i].description,
|
||||||
information[i].id,
|
information[i].storageId,
|
||||||
information[i].size);
|
information[i].size);
|
||||||
PluginData pluginData((uint32_t) dataHandles[i]);
|
PluginData pluginData((uint32_t) dataHandles[i]);
|
||||||
result.emplace_back(pluginData, metaInfo, handles[i]);
|
result.emplace_back(pluginData, metaInfo, handles[i]);
|
||||||
|
@ -45,7 +45,7 @@ extern PluginBackendApiErrorType WUPSGetPluginDataForContainerHandles(const plug
|
|||||||
|
|
||||||
extern PluginBackendApiErrorType WUPSGetMetaInformation(const plugin_container_handle *plugin_container_handle_list, plugin_information *plugin_information_list, uint32_t buffer_size);
|
extern PluginBackendApiErrorType WUPSGetMetaInformation(const plugin_container_handle *plugin_container_handle_list, plugin_information *plugin_information_list, uint32_t buffer_size);
|
||||||
|
|
||||||
extern PluginBackendApiErrorType WUPSGetLoadedPlugins(const plugin_container_handle *io_handles, uint32_t buffer_size, uint32_t *outSize);
|
extern PluginBackendApiErrorType WUPSGetLoadedPlugins(const plugin_container_handle *io_handles, uint32_t buffer_size, uint32_t *outSize, uint32_t *plugin_information_version);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user