mirror of
https://github.com/wiiu-env/AromaBaseModule.git
synced 2025-04-21 15:51:24 +02:00
Compare commits
23 Commits
AromaBaseM
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
08ab912f9a | ||
![]() |
e67f5f9725 | ||
![]() |
c02aed1daa | ||
![]() |
df60ed4401 | ||
![]() |
2349cc1581 | ||
![]() |
db349f0178 | ||
![]() |
4ee72d785b | ||
![]() |
ed4edfc2db | ||
![]() |
2c5f1bb7e2 | ||
![]() |
68fbbf05d7 | ||
![]() |
e89efe1d31 | ||
![]() |
270cd1dabb | ||
![]() |
ca15b44a12 | ||
![]() |
ef42550673 | ||
![]() |
72ff59de95 | ||
![]() |
69a0e31081 | ||
![]() |
4fb8ca0713 | ||
![]() |
a5fb305b2f | ||
![]() |
efcbfefeca | ||
![]() |
7fc494df91 | ||
![]() |
52e9a80255 | ||
![]() |
07e2682f9b | ||
![]() |
1d00a414d2 |
10
.github/dependabot.yml
vendored
Normal file
10
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "docker"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -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
|
||||
|
8
.github/workflows/pr.yml
vendored
8
.github/workflows/pr.yml
vendored
@ -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
1
.gitignore
vendored
@ -8,3 +8,4 @@ build/
|
||||
cmake-build-debug/
|
||||
CMakeLists.txt
|
||||
*.wms
|
||||
*.zip
|
||||
|
@ -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
|
||||
|
4
Makefile
4
Makefile
@ -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
|
||||
|
@ -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`
|
@ -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];
|
||||
|
@ -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),
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user