Compare commits

..

28 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
Maschell
24013d147f Bump version to 0.2.1 2023-01-10 18:07:24 +01:00
Maschell
bd836ed3aa Update CI to use actions/checkout@v3 2023-01-06 20:42:21 +01:00
Maschell
e3a1c85c92 Update the CI to use a non-deprecated release action 2023-01-06 20:42:21 +01:00
Maschell
4803d90ddf Use WUMS 0.3.2 and latest libfunctionpatcher 2023-01-06 20:42:21 +01:00
Maschell
15c0971aae Update version string 2022-10-09 16:45:51 +02:00
20 changed files with 138 additions and 48 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@v2
- 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@v2
- uses: actions/checkout@v4
- name: create version.h
run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA")
@ -42,32 +42,18 @@ jobs:
run: |
echo REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//") >> $GITHUB_ENV
echo DATETIME=$(echo $(date '+%Y%m%d-%H%M%S')) >> $GITHUB_ENV
echo COMMIT_MESSAGES=$(echo "${{join(github.event.commits.*.message, '||END||') }}" | sed -e 's/||END||/\r\n/g') >> $GITHUB_ENV
- uses: actions/download-artifact@master
with:
name: binary
- name: zip artifact
run: zip -r ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip *.wms
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: "softprops/action-gh-release@v2"
with:
tag_name: ${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
release_name: Nightly-${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
draft: false
prerelease: true
body: |
Not a stable release:
${{ env.COMMIT_MESSAGES }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
asset_name: ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
asset_content_type: application/zip
generate_release_notes: true
name: Nightly-${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
files: |
./${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip

View File

@ -6,15 +6,15 @@ jobs:
clang-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- 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@v2
- 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@v2
- 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:20220917
FROM ghcr.io/wiiu-env/devkitppc:20241128
COPY --from=wiiuenv/libfunctionpatcher:20220904 /artifacts $DEVKITPRO
COPY --from=wiiuenv/wiiumodulesystem:20221005 /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) -T$(WUMS_ROOT)/share/libfunctionpatcher.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
@ -79,6 +79,7 @@ export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
DEFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.def)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#-------------------------------------------------------------------------------
@ -96,7 +97,7 @@ endif
#-------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES_SRC := $(DEFFILES:.def=.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
@ -145,6 +146,11 @@ $(OFILES_SRC) : $(HFILES_BIN)
#-------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
%.o: %.def
$(SILENTMSG) $(notdir $<)
$(SILENTCMD)rplimportgen $< $*.s $*.ld $(ERROR_FILTER)
$(SILENTCMD)$(CC) -x assembler-with-cpp $(ASFLAGS) -c $*.s -o $@ $(ERROR_FILTER)
-include $(DEPENDS)

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

@ -6,7 +6,8 @@
void initApplicationEndsHook() {
DEBUG_FUNCTION_LINE("Patch ApplicationEndsHook functions");
for (uint32_t i = 0; i < applicationendshook_function_replacements_size; i++) {
if (!FunctionPatcherPatchFunction(&applicationendshook_function_replacements[i], nullptr)) {
bool wasPatched = false;
if (FunctionPatcher_AddFunctionPatch(&applicationendshook_function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
OSFatal("AromaBaseModule: Failed to patch ApplicationEndsHook function");
}
}

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

@ -4,6 +4,8 @@
#include "logger.h"
#include <malloc.h>
extern "C" FunctionPatcherStatus FPAddFunctionPatch(function_replacement_data_t *function_data, PatchedFunctionHandle *outHandle, bool *outHasBeenPatched);
void initDynload() {
gLoadedRPLData = (LOADED_RPL *) malloc(sizeof(LOADED_RPL) * gModuleData->number_modules);
if (!gLoadedRPLData) {
@ -18,7 +20,9 @@ void initDynload() {
DEBUG_FUNCTION_LINE("Patch functions for dynload patches");
for (uint32_t i = 0; i < dynload_function_replacements_size; i++) {
if (!FunctionPatcherPatchFunction(&dynload_function_replacements[i], nullptr)) {
bool wasPatched = false;
// We need to use FPAddFunctionPatch because we can't use libfunctionpatcher yet. This patch enables it though.
if (FPAddFunctionPatch(&dynload_function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
OSFatal("AromaBaseModule: Failed to patch function for dynload patches");
}
}

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

@ -0,0 +1,4 @@
:NAME homebrew_functionpatcher
:TEXT
FPAddFunctionPatch

View File

@ -1,4 +1,5 @@
#include "dynload/loader_defines.h"
#include <function_patcher/fpatching_defines.h>
#include <wums.h>
extern module_information_t *gModuleData;

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

@ -6,12 +6,14 @@
#include "sdrefcount/refcount.h"
#include "symbolnamepatcher/symbolname.h"
#include "version.h"
#include <function_patcher/function_patching.h>
#include <wums.h>
WUMS_MODULE_EXPORT_NAME("homebrew_basemodule");
WUMS_MODULE_SKIP_INIT_FINI();
WUMS_DEPENDS_ON(homebrew_functionpatcher);
#define VERSION "v0.1.3"
#define VERSION "v0.2.6"
WUMS_INITIALIZE(args) {
initLogging();
@ -23,10 +25,18 @@ WUMS_INITIALIZE(args) {
OSFatal("AromaBaseModule: The module information struct version does not match.");
}
// First init Dynload to have proper OSDynLoad support!
initDynload();
// Now init the library so we can use it for the other patches.
if (FunctionPatcher_InitLibrary() != FUNCTION_PATCHER_RESULT_SUCCESS) {
OSFatal("homebrew_basemodule: FunctionPatcher_InitLibrary failed");
}
initApplicationEndsHook();
initSDRefCount();
initSymbolNamePatcher();
initDynload();
initCommonPatches();
deinitLogging();

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;
@ -21,11 +23,20 @@ void initCommonPatches() {
DEBUG_FUNCTION_LINE("Do common patches");
for (uint32_t i = 0; i < patches_function_replacements_size; i++) {
if (!FunctionPatcherPatchFunction(&patches_function_replacements[i], nullptr)) {
bool wasPatched = false;
if (FunctionPatcher_AddFunctionPatch(&patches_function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
OSFatal("AromaBaseModule: Failed apply common patches");
}
}
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

@ -21,7 +21,8 @@ void initSDRefCount() {
DEBUG_FUNCTION_LINE("Patch SDRefCount functions");
for (uint32_t i = 0; i < sdrefcount_function_replacements_size; i++) {
if (!FunctionPatcherPatchFunction(&sdrefcount_function_replacements[i], nullptr)) {
bool wasPatched = false;
if (FunctionPatcher_AddFunctionPatch(&sdrefcount_function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
OSFatal("AromaBaseModule: Failed to patch function for sd ref counting");
}
}

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) {

View File

@ -5,7 +5,8 @@
void initSymbolNamePatcher() {
DEBUG_FUNCTION_LINE("Patch SymbolNamePatcher functions");
for (uint32_t i = 0; i < symbolname_function_replacements_size; i++) {
if (!FunctionPatcherPatchFunction(&symbolname_function_replacements[i], nullptr)) {
bool wasPatched = false;
if (FunctionPatcher_AddFunctionPatch(&symbolname_function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
OSFatal("AromaBaseModule: Failed to patch SymbolNamePatcher function");
}
}