-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the config and storage API. Bump version to 0.6
- Loading branch information
Showing
34 changed files
with
28,162 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
FROM wiiuenv/devkitppc:20210917 | ||
FROM wiiuenv/devkitppc:20210920 | ||
|
||
COPY --from=wiiuenv/wiiumodulesystem:20210917 /artifacts $DEVKITPRO | ||
COPY --from=wiiuenv/wiiupluginsystem:20210917 /artifacts $DEVKITPRO | ||
COPY --from=wiiuenv/libfunctionpatcher:20210109 /artifacts $DEVKITPRO | ||
COPY --from=wiiuenv/wiiumodulesystem:20210924 /artifacts $DEVKITPRO | ||
COPY --from=wiiuenv/wiiupluginsystem:20210924 /artifacts $DEVKITPRO | ||
COPY --from=wiiuenv/libfunctionpatcher:20210924 /artifacts $DEVKITPRO | ||
COPY --from=wiiuenv/libmappedmemory:20210924 /artifacts $DEVKITPRO | ||
COPY --from=wiiuenv/libwupsbackend:20210924 /artifacts $DEVKITPRO | ||
|
||
WORKDIR project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/**************************************************************************** | ||
* Copyright (C) 2018-2021 Maschell | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <optional> | ||
#include <wups/config.h> | ||
#include "WUPSConfigCategory.h" | ||
#include "utils/logger.h" | ||
|
||
class WUPSConfig { | ||
public: | ||
explicit WUPSConfig(const std::string &name) { | ||
this->name = name; | ||
} | ||
|
||
~WUPSConfig() { | ||
for (auto &element : categories) { | ||
delete element; | ||
} | ||
} | ||
|
||
/** | ||
\return Returns the name of this WUPSConfig | ||
**/ | ||
std::string getName() { | ||
return this->name; | ||
} | ||
|
||
/** | ||
\brief Creates a new WUPSCategory add its to this WUPSConfig. | ||
The category will be added to the end of the list. | ||
This class holds responsibility for deleting the created instance. | ||
\param categoryName: The name of the category that will be created. | ||
\return On success, the created and inserted category will be returned. | ||
**/ | ||
std::optional<WUPSConfigCategory *> addCategory(const std::string &categoryName) { | ||
auto curCat = new WUPSConfigCategory(categoryName); | ||
if (curCat == nullptr) { | ||
return {}; | ||
} | ||
categories.push_back(curCat); | ||
return curCat; | ||
} | ||
|
||
/** | ||
\brief Adds a given WUPSConfigCategory to this WUPSConfig. | ||
The category will be added to the end of the list. | ||
This class holds responsibility for deleting the created instance. | ||
\param category: The category that will be added to this config. | ||
\return On success, the inserted category will be returned. | ||
On error NULL will be returned. In this case the caller still has the responsibility | ||
for deleting the WUPSConfigCategory instance. | ||
**/ | ||
WUPSConfigCategory *addCategory(WUPSConfigCategory *category) { | ||
categories.push_back(category); | ||
return category; | ||
} | ||
|
||
/** | ||
\return Returns a vector with all categories. | ||
**/ | ||
const std::vector<WUPSConfigCategory *> &getCategories() { | ||
return this->categories; | ||
} | ||
|
||
private: | ||
std::string name; | ||
std::vector<WUPSConfigCategory *> categories = {}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/**************************************************************************** | ||
* Copyright (C) 2018-2021 Maschell | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <wups/config.h> | ||
#include "WUPSConfigItem.h" | ||
|
||
class WUPSConfigCategory { | ||
public: | ||
explicit WUPSConfigCategory(const std::string &name) { | ||
this->name = name; | ||
} | ||
|
||
~WUPSConfigCategory() { | ||
for (auto &element : items) { | ||
delete element; | ||
} | ||
} | ||
|
||
/** | ||
\return Returns the name of this WUPSConfigCategory | ||
**/ | ||
[[nodiscard]] const std::string &getName() const { | ||
return this->name; | ||
} | ||
|
||
/** | ||
\brief Adds a given WUPSConfigItem to this WUPSConfigCategory. | ||
The item will be added to the end of the list. | ||
This class holds responsibility for deleting the created instance. | ||
\param item: The item that will be added to this config. | ||
\return On success, true will be returned. | ||
On error false will be returned. In this case the caller still has the responsibility | ||
for deleting the WUPSConfigItem instance. | ||
**/ | ||
[[nodiscard]] bool addItem(WUPSConfigItem *item) { | ||
if(item != nullptr){ | ||
items.push_back(item); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
\return Returns a vector with all items. | ||
**/ | ||
[[nodiscard]] const std::vector<WUPSConfigItem *> &getItems() const { | ||
return this->items; | ||
} | ||
|
||
private: | ||
std::string name; | ||
std::vector<WUPSConfigItem *> items{}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#include <wums.h> | ||
#include <wups/config.h> | ||
#include "WUPSConfigCategory.h" | ||
#include "../utils/logger.h" | ||
|
||
int32_t WUPSConfigCategory_Create(WUPSConfigCategoryHandle *out, const char *name) { | ||
if (name == nullptr || out == nullptr) { | ||
return -1; | ||
} | ||
|
||
*out = (WUPSConfigCategoryHandle) new WUPSConfigCategory(name); | ||
if (*out != 0) { | ||
return 0; | ||
} | ||
return -2; | ||
}; | ||
|
||
int32_t WUPSConfigCategory_Destroy(WUPSConfigCategoryHandle handle) { | ||
if (handle == 0) { | ||
return -1; | ||
} | ||
|
||
auto *config = reinterpret_cast<WUPSConfigCategory *>(handle); | ||
delete config; | ||
return 0; | ||
}; | ||
|
||
int32_t WUPSConfigCategory_GetName(WUPSConfigCategoryHandle handle, char *out_buf, int32_t out_len) { | ||
if (out_buf == nullptr) { | ||
return -1; | ||
} | ||
auto *config = reinterpret_cast<WUPSConfigCategory *>(handle); | ||
snprintf(out_buf, out_len, "%s", config->getName().c_str()); | ||
return 0; | ||
} | ||
|
||
int32_t WUPSConfigCategory_AddItem(WUPSConfigCategoryHandle handle, WUPSConfigItemHandle item_Handle) { | ||
if (handle == 0 || item_Handle == 0) { | ||
return -1; | ||
} | ||
auto *category = reinterpret_cast<WUPSConfigCategory *>(handle); | ||
auto *item = reinterpret_cast<WUPSConfigItem *>(item_Handle); | ||
if (category->addItem(item)) { | ||
return 0; | ||
} | ||
return -2; | ||
} | ||
/* | ||
int32_t WUPSConfigCategory_GetItemCount(WUPSConfigCategoryHandle handle, int32_t *item_count) { | ||
if (handle == 0 || item_count == nullptr) { | ||
return -1; | ||
} | ||
auto *config = reinterpret_cast<WUPSConfigCategory *>(handle); | ||
*item_count = config->getItems().size(); | ||
return 0; | ||
} | ||
int32_t WUPSConfigCategory_GetItems(WUPSConfigCategoryHandle handle, WUPSConfigItemHandle *items_out, int32_t items_out_size) { | ||
if (handle == 0 || items_out == nullptr || items_out_size == 0) { | ||
return -1; | ||
} | ||
auto *config = reinterpret_cast<WUPSConfigCategory *>(handle); | ||
auto items = config->getItems(); | ||
int32_t index = 0; | ||
for (auto const &item: items) { | ||
if (index >= items_out_size) { | ||
break; | ||
} | ||
items_out[index] = (WUPSConfigItemHandle) item; | ||
} | ||
return 0; | ||
}*/ | ||
|
||
WUMS_EXPORT_FUNCTION(WUPSConfigCategory_Create); | ||
WUMS_EXPORT_FUNCTION(WUPSConfigCategory_Destroy); | ||
WUMS_EXPORT_FUNCTION(WUPSConfigCategory_GetName); | ||
WUMS_EXPORT_FUNCTION(WUPSConfigCategory_AddItem); | ||
/* | ||
WUMS_EXPORT_FUNCTION(WUPSConfigCategory_GetItemCount); | ||
WUMS_EXPORT_FUNCTION(WUPSConfigCategory_GetItems);*/ |
Oops, something went wrong.