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
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM ghcr.io/wiiu-env/devkitppc:20260126
FROM ghcr.io/wiiu-env/devkitppc:20260225

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
COPY --from=ghcr.io/wiiu-env/libnotifications:20240426 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libbuttoncombo:20250125-cb22627 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20260225 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:20260225 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20260208 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libmappedmemory:20260131 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libwupsbackend:20260131 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libnotifications:20260131 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libbuttoncombo:20260112 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libiopshell:20260318 /artifacts $DEVKITPRO

WORKDIR project
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ CXXFLAGS += -DDEBUG -DVERBOSE_DEBUG -g
CFLAGS += -DDEBUG -DVERBOSE_DEBUG -g
endif

LIBS := -lwums -lwups -lwut -lfunctionpatcher -lmappedmemory -lz -lnotifications -lbuttoncombo
LIBS := -lwums -lwups -lwut -lfunctionpatcher -lmappedmemory -lz -lnotifications -lbuttoncombo -liopshell

#-------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level
Expand Down
22 changes: 9 additions & 13 deletions source/PluginManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "plugin/PluginMetaInformationFactory.h"
#include "plugin/RelocationData.h"
#include "plugin/SectionInfo.h"
#include "plugin/TrackingPluginHeapMemoryAllocator.h"
#include "utils/ElfUtils.h"
#include "utils/StringTools.h"
#include "utils/logger.h"
Expand Down Expand Up @@ -42,10 +43,10 @@ PluginManagement::loadPlugins(const std::vector<PluginLoadWrapper> &pluginDataLi
DisplayErrorNotificationMessage(errMsg, 15.0f);
continue;
}
plugins.emplace_back(std::move(*metaInfo), std::move(*linkInfo), pluginDataWrapper.getPluginData());
plugins.emplace_back(std::move(*metaInfo), std::move(*linkInfo), pluginDataWrapper.getPluginData(), pluginDataWrapper.getHeapTrackingOptions());
} else {
DEBUG_FUNCTION_LINE_INFO("LOAD (INACTIVE) %s", metaInfo->getName().c_str());
plugins.emplace_back(std::move(*metaInfo), PluginLinkInformation::CreateStub(), pluginDataWrapper.getPluginData());
plugins.emplace_back(std::move(*metaInfo), PluginLinkInformation::CreateStub(), pluginDataWrapper.getPluginData(), std::nullopt);
}
} else {
auto errMsg = string_format("Failed to load plugin: %s", pluginDataWrapper.getPluginData()->getSource().c_str());
Expand All @@ -67,23 +68,18 @@ PluginManagement::loadPlugins(const std::vector<PluginLoadWrapper> &pluginDataLi

bool PluginManagement::doRelocation(const std::vector<RelocationData> &relocData,
std::span<relocation_trampoline_entry_t> trampData,
std::map<std::string, OSDynLoad_Module> &usedRPls) {
std::map<std::string, OSDynLoad_Module> &usedRPls,
const IPluginHeapMemoryAllocator &memory_allocator) {
for (auto const &cur : relocData) {
uint32_t functionAddress = 0;
auto &functionName = cur.getName();

if (functionName == "MEMAllocFromDefaultHeap") {
OSDynLoad_Module rplHandle;
OSDynLoad_Acquire("homebrew_memorymapping", &rplHandle);
OSDynLoad_FindExport(rplHandle, OS_DYNLOAD_EXPORT_DATA, "MEMAllocFromMappedMemory", (void **) &functionAddress);
functionAddress = reinterpret_cast<uint32_t>(memory_allocator.GetAllocFunctionAddress());
} else if (functionName == "MEMAllocFromDefaultHeapEx") {
OSDynLoad_Module rplHandle;
OSDynLoad_Acquire("homebrew_memorymapping", &rplHandle);
OSDynLoad_FindExport(rplHandle, OS_DYNLOAD_EXPORT_DATA, "MEMAllocFromMappedMemoryEx", (void **) &functionAddress);
functionAddress = reinterpret_cast<uint32_t>(memory_allocator.GetAllocExFunctionAddress());
} else if (functionName == "MEMFreeToDefaultHeap") {
OSDynLoad_Module rplHandle;
OSDynLoad_Acquire("homebrew_memorymapping", &rplHandle);
OSDynLoad_FindExport(rplHandle, OS_DYNLOAD_EXPORT_DATA, "MEMFreeToMappedMemory", (void **) &functionAddress);
functionAddress = reinterpret_cast<uint32_t>(memory_allocator.GetFreeFunctionAddress());
}

if (functionAddress == 0) {
Expand Down Expand Up @@ -160,7 +156,7 @@ bool PluginManagement::doRelocations(const std::vector<PluginContainer> &plugins
DEBUG_FUNCTION_LINE_VERBOSE("Doing relocations for plugin: %s", pluginContainer.getMetaInformation().getName().c_str());
if (!PluginManagement::doRelocation(pluginContainer.getPluginLinkInformation().getRelocationDataList(),
trampData,
usedRPls)) {
usedRPls, pluginContainer.getMemoryAllocator())) {
return false;
}
}
Expand Down
4 changes: 3 additions & 1 deletion source/PluginManagement.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <span>
#include <string>

class IPluginHeapMemoryAllocator;
class RelocationData;
class PluginLoadWrapper;
class PluginContainer;
Expand All @@ -25,7 +26,8 @@ class PluginManagement {

static bool doRelocation(const std::vector<RelocationData> &relocData,
std::span<relocation_trampoline_entry_t> trampData,
std::map<std::string, OSDynLoad_Module> &usedRPls);
std::map<std::string, OSDynLoad_Module> &usedRPls,
const IPluginHeapMemoryAllocator &);

static bool DoFunctionPatches(std::vector<PluginContainer> &plugins);

Expand Down
Loading
Loading