Compare commits

...

23 Commits

Author SHA1 Message Date
Maschell
08ab912f9a Update Dockerfile 2025-02-08 14:30:40 +01:00
Maschell
e67f5f9725 Implement support for WUMS 0.3.3 2025-02-08 14:30:40 +01:00
Maschell
c02aed1daa Bump version 2025-02-08 14:30:40 +01:00
Maschell
df60ed4401 Update Dockerfile 2024-05-06 13:38:01 +02:00
Maschell
2349cc1581 Fix returning from System Transfer 2024-05-05 02:46:07 +02:00
Maschell
db349f0178 Bump version 2024-04-25 21:53:11 +02:00
Maschell
4ee72d785b Patch loader.elf to spit out less warnings when loading .rpx built with wut 2024-04-25 21:53:11 +02:00
Maschell
ed4edfc2db Update github actions 2024-04-25 21:53:11 +02:00
Maschell
2c5f1bb7e2 Update Dockerfile 2024-04-25 21:53:11 +02:00
dependabot[bot]
68fbbf05d7 Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-04 17:14:53 +02:00
Maschell
e89efe1d31 Bump version 2023-07-31 09:37:27 +02:00
Maschell
270cd1dabb Skip sACPLoadOnDone when exiting Othello 2023-07-30 14:44:40 +02:00
Maschell
ca15b44a12 Update .gitignore 2023-07-29 14:28:18 +02:00
Maschell
ef42550673 Improve detecting FSClients which have been added by homebrew 2023-07-29 14:28:18 +02:00
Maschell
72ff59de95 Always log message about faking FSGetClientNum result 2023-07-29 14:28:18 +02:00
Maschell
69a0e31081 Create dependabot.yml 2023-07-23 10:26:11 +02:00
Maschell
4fb8ca0713 Bump version 2023-07-19 18:36:01 +02:00
Maschell
a5fb305b2f Update Dockerfile 2023-07-19 16:19:33 +02:00
Maschell
efcbfefeca Update Dockerfile 2023-06-27 18:28:32 +02:00
Maschell
7fc494df91 Replace '/' with '|' in OSDynload_Acquire with name starts with '~' 2023-04-13 15:11:42 +02:00
Maschell
52e9a80255 Bump Version 2023-03-23 14:59:47 +01:00
Maschell
07e2682f9b Fix dereferencing null pointer 2023-03-23 14:54:48 +01:00
Maschell
1d00a414d2 Change docker registry to ghcr.io 2023-03-16 12:09:51 +01:00
14 changed files with 98 additions and 23 deletions

10
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

View File

@ -9,15 +9,15 @@ jobs:
clang-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source
docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./source
build-binary:
runs-on: ubuntu-22.04
needs: clang-format
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: create version.h
run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA")
@ -48,7 +48,7 @@ jobs:
- name: zip artifact
run: zip -r ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip *.wms
- name: Create Release
uses: "softprops/action-gh-release@v1"
uses: "softprops/action-gh-release@v2"
with:
tag_name: ${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
draft: false

View File

@ -6,15 +6,15 @@ jobs:
clang-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source
docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./source
check-build-with-logging:
runs-on: ubuntu-22.04
needs: clang-format
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: build binary with logging
run: |
docker build . -t builder
@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-22.04
needs: clang-format
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: create version.h
run: |
git_hash=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}")

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ build/
cmake-build-debug/
CMakeLists.txt
*.wms
*.zip

View File

@ -1,6 +1,7 @@
FROM wiiuenv/devkitppc:20221228
FROM ghcr.io/wiiu-env/devkitppc:20241128
COPY --from=wiiuenv/libfunctionpatcher:20230106 /artifacts $DEVKITPRO
COPY --from=wiiuenv/wiiumodulesystem:20230106 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20250208 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libkernel:20230621 /artifacts $DEVKITPRO
WORKDIR project

View File

@ -41,7 +41,7 @@ CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
CXXFLAGS := $(CFLAGS) -std=c++20
ASFLAGS := -g $(ARCH)
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -Tfunctionpatcher.ld $(WUMSSPECS)
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -Tfunctionpatcher.ld -T$(WUMS_ROOT)/share/libkernel.ld $(WUMSSPECS)
ifeq ($(DEBUG),1)
CXXFLAGS += -DDEBUG -g
@ -53,7 +53,7 @@ CXXFLAGS += -DDEBUG -DVERBOSE_DEBUG -g
CFLAGS += -DDEBUG -DVERBOSE_DEBUG -g
endif
LIBS := -lwums -lwut -lfunctionpatcher
LIBS := -lwums -lwut -lfunctionpatcher -lkernel
#-------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level

View File

@ -34,4 +34,4 @@ docker run -it --rm -v ${PWD}:/project aromabasemodule-builder make clean
## Format the code via docker
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source -i`
`docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./source -i`

View File

@ -62,6 +62,7 @@ DECL_FUNCTION(uint32_t, OSReceiveMessage, OSMessageQueue *queue, OSMessage *mess
if (message->args[0] == 0xD1E0D1E0) {
ZombiUFix();
CallHook(WUMS_HOOK_APPLICATION_REQUESTS_EXIT);
CallHook(WUMS_HOOK_ALL_APPLICATION_REQUESTS_EXIT_DONE);
}
}
lastData0 = message->args[0];

View File

@ -3,6 +3,8 @@
#include "loader_defines.h"
#include "logger.h"
#include <coreinit/dynload.h>
#include <coreinit/title.h>
#include <cstdio>
#include <cstring>
#include <wums.h>
@ -27,11 +29,21 @@ DECL_FUNCTION(OSDynLoad_Error, OSDynLoad_Acquire, char const *name, OSDynLoad_Mo
}
}
OSDynLoad_Error result = real_OSDynLoad_Acquire(name, outModule);
if (result == OS_DYNLOAD_OK) {
return OS_DYNLOAD_OK;
if (name != nullptr && name[0] == '~') {
char cpy[64] = {};
snprintf(cpy, sizeof(cpy), "%s", name);
char *curPtr = &cpy[1];
while (*curPtr != '\0') {
if (*curPtr == '/') {
*curPtr = '|';
}
curPtr++;
}
return real_OSDynLoad_Acquire(cpy, outModule);
}
OSDynLoad_Error result = real_OSDynLoad_Acquire(name, outModule);
return result;
}
@ -150,8 +162,21 @@ DECL_FUNCTION(int32_t, sCheckOne, LOADED_RPL *rpl) {
return real_sCheckOne(rpl);
}
DECL_FUNCTION(void, sACPLoadOnDone, void) {
if (OSGetTitleID() == 0x0005000010140900L) { // オセロ (Othello)
DEBUG_FUNCTION_LINE_INFO("Skip sACPLoadOnDone for オセロ (Othello) as it might slow down exiting.");
// For some unknown reason unloading the nn_acp.rpl after playing Othello
// takes 30-100 seconds when many plugins are loaded... We take the very hacky and lazy route
// and just stop calling it and pray this won't break anything.
return;
}
return real_sACPLoadOnDone();
}
function_replacement_data_t dynload_function_replacements[] = {
REPLACE_FUNCTION_VIA_ADDRESS(__OSDynLoad_InternalAcquire, 0x32029054, 0x101C400 + 0x0cc54),
REPLACE_FUNCTION_VIA_ADDRESS(sACPLoadOnDone, 0x3201C400 + 0x29de0, 0x101C400 + 0x29de0),
REPLACE_FUNCTION_VIA_ADDRESS(__OSDynLoad_InternalAcquire, 0x3201C400 + 0x0cc54, 0x101C400 + 0x0cc54),
REPLACE_FUNCTION_VIA_ADDRESS(LiFindRPLByName, 0x32004BC4, 0x01004bc4),
REPLACE_FUNCTION_VIA_ADDRESS(LiBinSearchExport, 0x320002f8, 0x010002f8),
REPLACE_FUNCTION_VIA_ADDRESS(sCheckOne, 0x32007294, 0x01007294),

View File

@ -41,6 +41,7 @@ extern "C" {
#define DEBUG_FUNCTION_LINE_WARN(FMT, ARGS...) LOG_EX_DEFAULT(WHBLogPrintf, "## WARN## ", "", FMT, ##ARGS)
#define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) LOG_EX_DEFAULT(WHBLogPrintf, "##ERROR## ", "", FMT, ##ARGS)
#define DEBUG_FUNCTION_LINE_INFO(FMT, ARGS...) LOG_EX_DEFAULT(WHBLogPrintf, "## INFO## ", "", FMT, ##ARGS)
#define DEBUG_FUNCTION_LINE_ERR_LAMBDA(FILENAME, FUNCTION, LINE, FMT, ARGS...) LOG_EX(FILENAME, FUNCTION, LINE, WHBLogPrintf, "##ERROR## ", "", FMT, ##ARGS);
@ -58,6 +59,7 @@ extern "C" {
#define DEBUG_FUNCTION_LINE_WARN(FMT, ARGS...) LOG_EX_DEFAULT(OSReport, "## WARN## ", "\n", FMT, ##ARGS)
#define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) LOG_EX_DEFAULT(OSReport, "##ERROR## ", "\n", FMT, ##ARGS)
#define DEBUG_FUNCTION_LINE_INFO(FMT, ARGS...) LOG_EX_DEFAULT(OSReport, "## INFO## ", "\n", FMT, ##ARGS)
#define DEBUG_FUNCTION_LINE_ERR_LAMBDA(FILENAME, FUNCTION, LINE, FMT, ARGS...) LOG_EX(FILENAME, FUNCTION, LINE, OSReport, "##ERROR## ", "\n", FMT, ##ARGS);

View File

@ -13,7 +13,7 @@ WUMS_MODULE_EXPORT_NAME("homebrew_basemodule");
WUMS_MODULE_SKIP_INIT_FINI();
WUMS_DEPENDS_ON(homebrew_functionpatcher);
#define VERSION "v0.2.1"
#define VERSION "v0.2.6"
WUMS_INITIALIZE(args) {
initLogging();

View File

@ -1,7 +1,9 @@
#include "globals.h"
#include "logger.h"
#include "patches_replacements.h"
#include <coreinit/cache.h>
#include <cstdlib>
#include <kernel/kernel.h>
// init is not called for this module. We need to make sure to init these values in initCommonPatches()
uint32_t gHeapMask;
@ -27,6 +29,14 @@ void initCommonPatches() {
}
}
DEBUG_FUNCTION_LINE("Common patches finished");
// Patch loader.elf to spit out less warnings when loading .rpx built with wut
KernelNOPAtPhysicalAddress(0x0100b770 - 0x01000000 + 0x32000000);
KernelNOPAtPhysicalAddress(0x0100b800 - 0x01000000 + 0x32000000);
KernelNOPAtPhysicalAddress(0x0100b7b8 - 0x01000000 + 0x32000000);
ICInvalidateRange(reinterpret_cast<void *>(0x0100b770), 0x04);
ICInvalidateRange(reinterpret_cast<void *>(0x0100b800), 0x04);
ICInvalidateRange(reinterpret_cast<void *>(0x0100b7b8), 0x04);
}
void commonPatchesStart() {

View File

@ -4,11 +4,19 @@
#include "patches.h"
#include <coreinit/filesystem_fsa.h>
#include <coreinit/title.h>
#include <sysapp/launch.h>
static inline bool IsInHardcodedHomebrewMemoryRegion(void *addr) {
if ((uint32_t) addr >= 0x00800000 && (uint32_t) addr < 0x01000000) {
return true;
}
return false;
}
DECL_FUNCTION(FSStatus, FSAddClient, FSClient *client, FSErrorFlag errorMask) {
auto res = real_FSAddClient(client, errorMask);
if (res == FS_STATUS_OK) {
if (((uint32_t) client & 0xF0000000) != gHeapMask) {
if (((uint32_t) client & 0xF0000000) != gHeapMask && !IsInHardcodedHomebrewMemoryRegion(client)) {
gNonHomebrewFSClientCount++;
}
}
@ -18,7 +26,7 @@ DECL_FUNCTION(FSStatus, FSAddClient, FSClient *client, FSErrorFlag errorMask) {
DECL_FUNCTION(FSStatus, FSDelClient, FSClient *client, FSErrorFlag errorMask) {
auto res = real_FSDelClient(client, errorMask);
if (res == FS_STATUS_OK) {
if (((uint32_t) client & 0xF0000000) != gHeapMask) {
if (((uint32_t) client & 0xF0000000) != gHeapMask && !IsInHardcodedHomebrewMemoryRegion(client)) {
gNonHomebrewFSClientCount--;
}
}
@ -42,15 +50,31 @@ DECL_FUNCTION(uint32_t, FSGetClientNum) {
titleID == 0x0005000010115D00 || // The Smurfs™ 2 EUR
titleID == 0x0005000010113300 // The Smurfs™ 2 USA
) {
DEBUG_FUNCTION_LINE("Fake FSGetClientNum num to %d instead of %d", gNonHomebrewFSClientCount, real_FSGetClientNum());
DEBUG_FUNCTION_LINE_INFO("Fake FSGetClientNum num to %d instead of %d", gNonHomebrewFSClientCount, real_FSGetClientNum());
return gNonHomebrewFSClientCount;
}
return real_FSGetClientNum();
}
DECL_FUNCTION(uint32_t, SYSReturnToCaller, void *args) {
// Fix jumping back to the System Settings when exiting the System Transfer
auto curTitleID = OSGetTitleID();
if (curTitleID == 0x0005001010062000L || curTitleID == 0x0005001010062100L || curTitleID == 0x0005001010062200L) {
SysAppSettingsArgs set_args{};
// Jump directly to the Transfer Menu
set_args.jumpTo = SYS_SETTINGS_JUMP_TO_SOFTWARE_TRANSFER;
_SYSLaunchSettings(&set_args);
return 0;
}
return real_SYSReturnToCaller(args);
}
function_replacement_data_t patches_function_replacements[] = {
REPLACE_FUNCTION(FSAddClient, LIBRARY_COREINIT, FSAddClient),
REPLACE_FUNCTION(FSDelClient, LIBRARY_COREINIT, FSDelClient),
REPLACE_FUNCTION(FSGetClientNum, LIBRARY_COREINIT, FSGetClientNum),
REPLACE_FUNCTION(SYSReturnToCaller, LIBRARY_SYSAPP, SYSReturnToCaller),
};
uint32_t patches_function_replacements_size = sizeof(patches_function_replacements) / sizeof(function_replacement_data_t);

View File

@ -286,7 +286,7 @@ void NWF_Fix() {
int state = OSDisableInterrupts();
OSThread *t = *((OSThread **) 0x100567F8);
while (t) {
if (std::string_view(t->name) == "PlatformInputAppStateListenerThread") {
if (t->name != nullptr && std::string_view(t->name) == "PlatformInputAppStateListenerThread") {
t->priority = 0x80;
OSReport("Set priority to %d for thread \"%s\" (%08X) to prevent it from running/crashing\n", t->priority, t->name, t);
}
@ -300,6 +300,7 @@ DECL_FUNCTION(void, __PPCExit, uint32_t u1) {
NWF_Fix();
CallHook(WUMS_HOOK_APPLICATION_ENDS);
CallHook(WUMS_HOOK_ALL_APPLICATION_ENDS_DONE);
CallHook(WUMS_HOOK_FINI_WUT_SOCKETS);
CallHook(WUMS_HOOK_FINI_WUT_DEVOPTAB);
if (gSDMountRefCount > 0) {