Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ cmake-build-debug/
CMakeLists.txt
*.wms
*.zip
.clangd
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ghcr.io/wiiu-env/devkitppc:20241128
FROM ghcr.io/wiiu-env/devkitppc:20260126

COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20250208 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:20250208 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20260126 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:20260126 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libmappedmemory:20230621 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libwupsbackend:20240425 /artifacts $DEVKITPRO
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ INCLUDES := source
#-------------------------------------------------------------------------------
# options for code generation
#-------------------------------------------------------------------------------
CFLAGS := -Wall -Wextra -Os -ffunction-sections -fdata-sections\
CFLAGS := -Wall -Wextra -Werror -Os -ffunction-sections -fdata-sections\
$(MACHDEP)

CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
Expand Down
22 changes: 11 additions & 11 deletions source/config/WUPSConfigAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
namespace WUPSConfigAPIBackend {

std::vector<std::unique_ptr<WUPSConfig>> sConfigs;
std::mutex sConfigsMutex;
std::recursive_mutex sConfigsMutex;

std::vector<std::unique_ptr<WUPSConfigCategory>> sConfigCategories;
std::mutex sConfigCategoryMutex;
std::recursive_mutex sConfigCategoryMutex;

std::vector<std::unique_ptr<WUPSConfigItem>> sConfigItems;
std::mutex sConfigItemsMutex;
std::recursive_mutex sConfigItemsMutex;

namespace Intern {
WUPSConfig *GetConfigByHandle(WUPSConfigHandle handle) {
Expand Down Expand Up @@ -201,7 +201,7 @@ namespace WUPSConfigAPIBackend {
return WUPSCONFIG_API_RESULT_SUCCESS;
}
}
DEBUG_FUNCTION_LINE_WARN("Failed to destroy WUPSConfigCategory (for handle: \"%08X\")", handle.handle);
DEBUG_FUNCTION_LINE_WARN("Failed to destroy WUPSConfigCategory (for handle: \"%p\")", handle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}
return WUPSCONFIG_API_RESULT_SUCCESS;
Expand All @@ -218,20 +218,20 @@ namespace WUPSConfigAPIBackend {
if (!parentCat) {
parentCat = Intern::GetCategoryByHandle(parentHandle);
if (!parentCat) {
DEBUG_FUNCTION_LINE_WARN("Failed to find parent for handle %08X", parentHandle.handle);
DEBUG_FUNCTION_LINE_WARN("Failed to find parent for handle %p", parentHandle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}
}

auto category = Intern::PopCategoryByHandle(categoryHandle);
if (!category) {
DEBUG_FUNCTION_LINE_WARN("Failed to find category. parentHandle: %08X categoryHandle: %08X", parentHandle.handle, categoryHandle.handle);
DEBUG_FUNCTION_LINE_WARN("Failed to find category. parentHandle: %p categoryHandle: %p", parentHandle.handle, categoryHandle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}

if (!parentCat->addCategory(category)) {
sConfigCategories.push_back(std::move(category));
DEBUG_FUNCTION_LINE_WARN("Failed to add category to parent. parentHandle: %08X categoryHandle: %08X", parentHandle.handle, categoryHandle.handle);
DEBUG_FUNCTION_LINE_WARN("Failed to add category to parent. parentHandle: %p categoryHandle: %p", parentHandle.handle, categoryHandle.handle);
return WUPSCONFIG_API_RESULT_UNKNOWN_ERROR; // TODO!!!
}
return WUPSCONFIG_API_RESULT_SUCCESS;
Expand All @@ -249,21 +249,21 @@ namespace WUPSConfigAPIBackend {
if (!parentCat) {
parentCat = Intern::GetCategoryByHandle(parentHandle, true);
if (!parentCat) {
DEBUG_FUNCTION_LINE_WARN("Failed to find parent for handle %08X", parentHandle.handle);
DEBUG_FUNCTION_LINE_WARN("Failed to find parent for handle %p", parentHandle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}
}

auto item = Intern::PopItemByHandle(itemHandle);
if (!item) {
DEBUG_FUNCTION_LINE_ERR("Failed to get item for handle %08X", itemHandle.handle);
DEBUG_FUNCTION_LINE_ERR("Failed to get item for handle %p", itemHandle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}

if (!parentCat->addItem(item)) {
std::lock_guard lockItems(sConfigItemsMutex);
sConfigItems.push_back(std::move(item));
DEBUG_FUNCTION_LINE_ERR("Failed to add item %08X to category %08X", itemHandle.handle, parentHandle.handle);
DEBUG_FUNCTION_LINE_ERR("Failed to add item %p to category %p", itemHandle.handle, parentHandle.handle);
return WUPSCONFIG_API_RESULT_UNKNOWN_ERROR; // TODO
}

Expand Down Expand Up @@ -305,7 +305,7 @@ namespace WUPSConfigAPIBackend {
}

if (!remove_locked_first_if(sConfigItemsMutex, sConfigItems, [&handle](auto &cur) { return cur.get() == handle; })) {
DEBUG_FUNCTION_LINE_WARN("Failed to destroy WUPSConfigItem (handle: \"%08X\")", handle);
DEBUG_FUNCTION_LINE_WARN("Failed to destroy WUPSConfigItem (handle: \"%p\")", handle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}
return WUPSCONFIG_API_RESULT_SUCCESS;
Expand Down
12 changes: 6 additions & 6 deletions source/config/WUPSConfigAPIDeprecated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int32_t WUPSConfig_GetName(void *handle, char *out_buf, int32_t out_len) {
}
auto config = WUPSConfigAPIBackend::Intern::GetConfigByHandle(WUPSConfigHandle(handle));
if (!config) {
DEBUG_FUNCTION_LINE_WARN("Failed to find WUPSConfig by handle %08X", handle);
DEBUG_FUNCTION_LINE_WARN("Failed to find WUPSConfig by handle %p", handle);
return -1;
}
snprintf(out_buf, out_len, "%s", config->getName().c_str());
Expand Down Expand Up @@ -117,7 +117,7 @@ int32_t WUPSConfigCategory_GetName(void *handle, char *out_buf, int32_t out_len)

auto *category = WUPSConfigAPIBackend::Intern::GetCategoryByHandle(WUPSConfigCategoryHandle(handle), true);
if (!category) {
DEBUG_FUNCTION_LINE_WARN("Failed to find existing category for handle %08X", handle);
DEBUG_FUNCTION_LINE_WARN("Failed to find existing category for handle %p", handle);
return -2;
}
snprintf(out_buf, out_len, "%s", category->getName().c_str());
Expand Down Expand Up @@ -176,7 +176,7 @@ int32_t WUPSConfigItem_SetDisplayName(void *handle, const char *displayName) {

auto *config = WUPSConfigAPIBackend::Intern::GetItemByHandle(WUPSConfigItemHandle(handle));
if (!config) {
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %08X", handle);
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %p", handle);
return -2;
}
config->setDisplayName(displayName);
Expand All @@ -190,7 +190,7 @@ int32_t WUPSConfigItem_GetDisplayName(void *handle, char *out_buf, int32_t out_l
}
auto *config = WUPSConfigAPIBackend::Intern::GetItemByHandle(WUPSConfigItemHandle(handle));
if (!config) {
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %08X", handle);
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %p", handle);
return -2;
}
snprintf(out_buf, out_len, "%s", config->getDisplayName().c_str());
Expand All @@ -205,7 +205,7 @@ int32_t WUPSConfigItem_SetConfigID(void *handle, const char *configId) {

auto *config = WUPSConfigAPIBackend::Intern::GetItemByHandle(WUPSConfigItemHandle(handle));
if (!config) {
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %08X", handle);
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %p", handle);
return -2;
}
config->setConfigId(configId);
Expand All @@ -219,7 +219,7 @@ int32_t WUPSConfigItem_GetConfigID(void *handle, char *out_buf, int32_t out_len)
}
auto *config = WUPSConfigAPIBackend::Intern::GetItemByHandle(WUPSConfigItemHandle(handle));
if (!config) {
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %08X", handle);
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %p", handle);
return -2;
}
snprintf(out_buf, out_len, "%s", config->getConfigId().c_str());
Expand Down
1 change: 1 addition & 0 deletions source/config/WUPSConfigCategory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <memory>
#include <string>
#include <string_view>
#include <vector>

namespace WUPSConfigAPIBackend {
Expand Down
2 changes: 2 additions & 0 deletions source/config/WUPSConfigItemV1.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <wups/config.h>

#include <string>
#include <string_view>

namespace WUPSConfigAPIBackend {
class WUPSConfigItemV1 final : public WUPSConfigItem {
public:
Expand Down
1 change: 1 addition & 0 deletions source/fs/FSUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <wut_types.h>

#include <string>
#include <string_view>
#include <vector>

class FSUtils {
Expand Down
2 changes: 1 addition & 1 deletion source/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ std::vector<PluginContainer> gLoadedPlugins;

std::set<std::shared_ptr<PluginData>, PluginDataSharedPtrComparator> gLoadedData;
std::vector<PluginLoadWrapper> gLoadOnNextLaunch;
std::mutex gLoadedDataMutex;
std::recursive_mutex gLoadedDataMutex;
std::map<std::string, OSDynLoad_Module> gUsedRPLs;
std::vector<void *> gAllocatedAddresses;

Expand Down
3 changes: 2 additions & 1 deletion source/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <map>
#include <memory>
#include <mutex>
#include <set>
#include <vector>

Expand All @@ -28,7 +29,7 @@ extern std::vector<PluginContainer> gLoadedPlugins;

extern std::set<std::shared_ptr<PluginData>, PluginDataSharedPtrComparator> gLoadedData;
extern std::vector<PluginLoadWrapper> gLoadOnNextLaunch;
extern std::mutex gLoadedDataMutex;
extern std::recursive_mutex gLoadedDataMutex;
extern std::map<std::string, OSDynLoad_Module> gUsedRPLs;
extern std::vector<void *> gAllocatedAddresses;

Expand Down
1 change: 1 addition & 0 deletions source/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void CallHook(const PluginContainer &plugin, const wups_loader_hook_type_t hook_
case WUPS_LOADER_HOOK_ACQUIRED_FOREGROUND:
case WUPS_LOADER_HOOK_APPLICATION_REQUESTS_EXIT:
case WUPS_LOADER_HOOK_APPLICATION_ENDS:
case WUPS_LOADER_HOOK_INIT_WUT_THREAD:
// clang-format off
((void(*)())((uint32_t *) func_ptr))();
// clang-format on
Expand Down
9 changes: 5 additions & 4 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ WUMS_INITIALIZE() {
DrawUtils::endDraw();
});
DEBUG_FUNCTION_LINE_INFO("Safe Mode activated!");
auto tobeIgnoredFilePath = getNonBaseAromaPluginFilenames(getPluginPath());
auto toBeIgnoredFilePath = getNonBaseAromaPluginFilenames(getPluginPath());
WUPSBackendSettings::LoadSettings();
std::set<std::string> inactivePlugins = WUPSBackendSettings::GetInactivePluginFilenames();

inactivePlugins.insert(tobeIgnoredFilePath.begin(), tobeIgnoredFilePath.end());
inactivePlugins.insert(toBeIgnoredFilePath.begin(), toBeIgnoredFilePath.end());
for (const auto &plugin : inactivePlugins) {
DEBUG_FUNCTION_LINE_INFO("safemode: %s will be deactivated", plugin.c_str());
}
Expand Down Expand Up @@ -172,7 +172,7 @@ WUMS_APPLICATION_STARTS() {
// If an allocated rpl was not released properly (e.g. if something else calls OSDynload_Acquire without releasing it) memory get leaked.
// Let's clean this up!
for (const auto &addr : gAllocatedAddresses) {
DEBUG_FUNCTION_LINE_WARN("Memory allocated by OSDynload was not freed properly, let's clean it up! (%08X)", addr);
DEBUG_FUNCTION_LINE_WARN("Memory allocated by OSDynload was not freed properly, let's clean it up! (%p)", addr);
free(addr);
}
gAllocatedAddresses.clear();
Expand Down Expand Up @@ -315,6 +315,7 @@ WUMS_APPLICATION_STARTS() {
CallHook(gLoadedPlugins, WUPS_LOADER_HOOK_INIT_WUT_MALLOC, needsInitsCheck);
CallHook(gLoadedPlugins, WUPS_LOADER_HOOK_INIT_WUT_NEWLIB, needsInitsCheck);
CallHook(gLoadedPlugins, WUPS_LOADER_HOOK_INIT_WUT_STDCPP, needsInitsCheck);
CallHook(gLoadedPlugins, WUPS_LOADER_HOOK_INIT_WUT_THREAD, needsInitsCheck);

CallHook(gLoadedPlugins, WUPS_LOADER_HOOK_INIT_WUT_DEVOPTAB);
CallHook(gLoadedPlugins, WUPS_LOADER_HOOK_INIT_WUT_SOCKETS);
Expand Down Expand Up @@ -391,7 +392,7 @@ void CheckCleanupCallbackUsage(const std::vector<PluginContainer> &plugins) {
while (t) {
const auto address = reinterpret_cast<uint32_t>(t->cleanupCallback);
if (address != 0 && address >= startAddress && address <= endAddress) {
OSReport("[WARN] PluginBackend: Thread 0x%08X is using a function from plugin %s for the threadCleanupCallback\n", t, pluginName);
OSReport("[WARN] PluginBackend: Thread 0x%p is using a function from plugin %s for the threadCleanupCallback\n", t, pluginName);
}
t = t->activeLink.next;
}
Expand Down
Loading