Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch loader.elf to spit out less warnings when loading .rpx build with wut #33

Merged
merged 4 commits into from
Apr 25, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 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")
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 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
Expand All @@ -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 }}")
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ghcr.io/wiiu-env/devkitppc:20230621
FROM ghcr.io/wiiu-env/devkitppc:20240423

COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20230719 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20240424 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libkernel:20230621 /artifacts $DEVKITPRO

WORKDIR project
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WUMS_MODULE_EXPORT_NAME("homebrew_basemodule");
WUMS_MODULE_SKIP_INIT_FINI();
WUMS_DEPENDS_ON(homebrew_functionpatcher);

#define VERSION "v0.2.4"
#define VERSION "v0.2.5"

WUMS_INITIALIZE(args) {
initLogging();
Expand Down
10 changes: 10 additions & 0 deletions source/patches/patches.cpp
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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() {
Expand Down