Fix warnings

This commit is contained in:
Maschell 2026-01-15 16:50:01 +01:00
parent 58a3963ce8
commit 3d4f22ec00
11 changed files with 35 additions and 34 deletions

View File

@ -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) {
@ -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;
@ -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;
@ -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
}
@ -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;

View File

@ -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());
@ -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());
@ -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);
@ -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());
@ -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);
@ -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());

View File

@ -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());
}
@ -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();
@ -391,7 +391,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;
}

View File

@ -497,7 +497,7 @@ WUPSButtonCombo_Error ButtonComboManager::RemoveButtonCombo(const WUPSButtonComb
// Destructor removes it from the button combo module
return WUPS_BUTTON_COMBO_ERROR_SUCCESS;
}
DEBUG_FUNCTION_LINE_WARN("Could not remove button combo: not found! %08X", handle);
DEBUG_FUNCTION_LINE_WARN("Could not remove button combo: not found! %p", handle.handle);
return WUPS_BUTTON_COMBO_ERROR_NOT_FOUND;
}

View File

@ -70,7 +70,7 @@ bool FunctionData::AddPatch() {
}};
if (FunctionPatcher_AddFunctionPatch(&functionData, &mHandle, nullptr) != FUNCTION_PATCHER_RESULT_SUCCESS) {
DEBUG_FUNCTION_LINE_ERR("Failed to add patch for function (\"%s\" PA:%08X VA:%08X)", this->mName.c_str(), this->mPAddress, this->mVAddress);
DEBUG_FUNCTION_LINE_ERR("Failed to add patch for function (\"%s\" PA:%p VA:%p)", this->mName.c_str(), this->mPAddress, this->mVAddress);
return false;
}
} else {

View File

@ -162,7 +162,7 @@ PluginLinkInformationFactory::load(const PluginData &pluginData) {
// Lets create a shared memory pool for both of them
HeapMemoryFixedSizePool textAndTrampDataPool({text_size, trampDataSize});
if (!textAndTrampDataPool) {
DEBUG_FUNCTION_LINE_ERR("Failed to alloc memory for the .text section (%d bytes) and tramp data", text_size, trampDataSize);
DEBUG_FUNCTION_LINE_ERR("Failed to alloc memory for the .text section (%d bytes) and tramp data (%d bytes)", text_size, trampDataSize);
return std::nullopt;
}
// Segment 0 is the .text data
@ -235,7 +235,7 @@ PluginLinkInformationFactory::load(const PluginData &pluginData) {
DEBUG_FUNCTION_LINE_VERBOSE("memset section %s %08X to 0 (%d bytes)", psec->get_name().c_str(), destination, sectionSize);
memset((void *) destination, 0, sectionSize);
} else if (psec->get_type() == SHT_PROGBITS) {
DEBUG_FUNCTION_LINE_VERBOSE("Copy section %s %08X -> %08X (%d bytes)", psec->get_name().c_str(), p, destination, sectionSize);
DEBUG_FUNCTION_LINE_VERBOSE("Copy section %s %p -> %08X (%d bytes)", psec->get_name().c_str(), p, destination, sectionSize);
memcpy((void *) destination, p, sectionSize);
}
pluginInfo.addSectionInfo(SectionInfo(psec->get_name(), destination, sectionSize));
@ -252,7 +252,7 @@ PluginLinkInformationFactory::load(const PluginData &pluginData) {
for (uint32_t i = 0; i < sec_num; ++i) {
section *psec = reader.sections[i];
if (psec && (psec->get_type() == SHT_PROGBITS || psec->get_type() == SHT_NOBITS) && (psec->get_flags() & SHF_ALLOC)) {
DEBUG_FUNCTION_LINE_VERBOSE("Linking (%d)... %s at %08X", i, psec->get_name().c_str(), destinations[psec->get_index()]);
DEBUG_FUNCTION_LINE_VERBOSE("Linking (%d)... %s at %p", i, psec->get_name().c_str(), destinations[psec->get_index()]);
if (!linkSection(reader, psec->get_index(), (uint32_t) destinations[psec->get_index()], (uint32_t) text_data.data(), (uint32_t) data_data.data(), trampolineList)) {
DEBUG_FUNCTION_LINE_ERR("linkSection failed");
@ -278,7 +278,7 @@ PluginLinkInformationFactory::load(const PluginData &pluginData) {
if (entries != nullptr) {
for (size_t j = 0; j < entries_count; j++) {
wups_loader_hook_t *hook = &entries[j];
DEBUG_FUNCTION_LINE_VERBOSE("Saving hook of plugin Type: %08X, target: %08X", hook->type, (void *) hook->target);
DEBUG_FUNCTION_LINE_VERBOSE("Saving hook of plugin Type: %08X, target: %p", hook->type, (void *) hook->target);
pluginInfo.addHookData(HookData((void *) hook->target, hook->type));
}
}
@ -291,7 +291,7 @@ PluginLinkInformationFactory::load(const PluginData &pluginData) {
if (entries != nullptr) {
for (size_t j = 0; j < entries_count; j++) {
wups_loader_entry_t *cur_function = &entries[j];
DEBUG_FUNCTION_LINE_VERBOSE("Saving function \"%s\" of plugin . PA:%08X VA:%08X Library: %08X, target: %08X, call_addr: %08X",
DEBUG_FUNCTION_LINE_VERBOSE("Saving function \"%s\" of plugin . PA:%p VA:%p Library: %08X, target: %p, call_addr: %p",
cur_function->_function.name /*,mPluginData->getPluginInformation()->getName().c_str()*/,
cur_function->_function.physical_address, cur_function->_function.virtual_address, cur_function->_function.library, cur_function->_function.target,
(void *) cur_function->_function.call_addr);
@ -407,7 +407,7 @@ bool PluginLinkInformationFactory::addImportRelocationData(PluginLinkInformation
uint32_t section_index = psec->get_info();
if (!infoMap.contains(sym_section_index)) {
DEBUG_FUNCTION_LINE_ERR("Relocation is referencing a unknown section. %d destination: %08X sym_name %s", section_index, destinations[section_index], sym_name.c_str());
DEBUG_FUNCTION_LINE_ERR("Relocation is referencing a unknown section. %d destination: %p sym_name %s", section_index, destinations[section_index], sym_name.c_str());
return false;
}

View File

@ -63,7 +63,7 @@ HeapMemoryFixedSizePool::operator bool() const {
HeapMemoryFixedSizePool::MemorySegmentInfo HeapMemoryFixedSizePool::operator[](const int idx) const {
if (idx < 0 || idx >= static_cast<int>(mSegmentInfos.size())) {
DEBUG_FUNCTION_LINE_ERR("Out of bounce access (tried to access index %d; size is", idx, mSegmentInfos.size());
DEBUG_FUNCTION_LINE_ERR("Out of bounce access (tried to access index %d; size is %d", idx, mSegmentInfos.size());
}
return mSegmentInfos[idx];
}

View File

@ -100,7 +100,7 @@ void ConfigUtils::displayMenu() {
WUPSConfigAPIStatus callbackResult = configData->CallMenuOpenedCallback(configHandleOpt.value());
config = WUPSConfigAPIBackend::Intern::PopConfigByHandle(configHandleOpt.value());
if (!config) {
DEBUG_FUNCTION_LINE_ERR("Failed to get config for handle: %08X", configHandleOpt.value().handle);
DEBUG_FUNCTION_LINE_ERR("Failed to get config for handle: %p", configHandleOpt.value().handle);
} else if (callbackResult != WUPSCONFIG_API_RESULT_SUCCESS) {
DEBUG_FUNCTION_LINE_ERR("Callback failed for %s: %s", info.name.c_str(), WUPSConfigAPI_GetStatusStr(callbackResult));
config.reset();
@ -122,7 +122,7 @@ void ConfigUtils::displayMenu() {
}
config = WUPSConfigAPIBackend::Intern::PopConfigByHandle(WUPSConfigHandle(cur_config_handle));
if (!config) {
DEBUG_FUNCTION_LINE_ERR("Failed to find config for handle: %08X", cur_config_handle);
DEBUG_FUNCTION_LINE_ERR("Failed to find config for handle: %p", cur_config_handle);
}
break;
}

View File

@ -1,5 +1,6 @@
#pragma once
#include <coreinit/debug.h>
#include <string.h>
#include <whb/log.h>

View File

@ -404,7 +404,7 @@ namespace StorageUtils {
// TODO: handle write error?
if (!remove_first_if(gStorage, [&root](auto &cur) { return cur.getHandle() == reinterpret_cast<uint32_t>(root); })) {
DEBUG_FUNCTION_LINE_WARN("Failed to close storage: Not opened (\"%08X\")", root);
DEBUG_FUNCTION_LINE_WARN("Failed to close storage: Not opened (\"%pX\")", root);
return WUPS_STORAGE_ERROR_NOT_FOUND;
}
return res;

View File

@ -61,7 +61,7 @@ void dumpHex(const void *data, const size_t size) {
char ascii[17];
size_t i, j;
ascii[16] = '\0';
DEBUG_FUNCTION_LINE("0x%08X (0x0000): ", data);
DEBUG_FUNCTION_LINE("0x%p (0x0000): ", data);
for (i = 0; i < size; ++i) {
WHBLogWritef("%02X ", ((unsigned char *) data)[i]);
if (((unsigned char *) data)[i] >= ' ' && ((unsigned char *) data)[i] <= '~') {