From d5fbbd40d3fcf4c3d3338ed9f9a0b2e133de14bc Mon Sep 17 00:00:00 2001 From: TotalJustice <47043333+ITotalJustice@users.noreply.github.com> Date: Sat, 27 May 2023 23:40:19 +0100 Subject: [PATCH] fix detecting if nifm ctest patch is already applied the patch itself always worked, however it failed to detect if the patch was already applied. this isn't a big issue, and the only one to notice was probably me ;) --- Makefile | 2 +- README.md | 1 + sysmod/src/main.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6a53e19..d0dec9d 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ MAKEFILES := sysmod overlay TARGETS := $(foreach dir,$(MAKEFILES),$(CURDIR)/$(dir)) # the below was taken from atmosphere + switch-examples makefile -export VERSION := 1.4.0 +export VERSION := 1.4.1 export GIT_BRANCH := $(shell git symbolic-ref --short HEAD) ifeq ($(strip $(shell git status --porcelain 2>/dev/null)),) diff --git a/README.md b/README.md index 20c133e..2d7a56c 100644 --- a/README.md +++ b/README.md @@ -101,3 +101,4 @@ Software is built on the shoulders of giants. This tool wouldn't be possible wit - DevkitPro (toolchain) - [minIni](https://github.com/compuphase/minIni) - [libtesla](https://github.com/WerWolv/libtesla) +- [Shoutout to the best switch cfw setup guide](https://rentry.org/SwitchHackingIsEasy) diff --git a/sysmod/src/main.cpp b/sysmod/src/main.cpp index bd3c0d3..4c983b3 100644 --- a/sysmod/src/main.cpp +++ b/sysmod/src/main.cpp @@ -176,14 +176,14 @@ constexpr auto bne_cond(u32 inst) -> bool { } constexpr auto ctest_cond(u32 inst) -> bool { - return true; // we overwrite the function so we don't care to check + return std::byteswap(0xF50301AA) == inst; // mov x21, x1 } // to view patches, use https://armconverter.com/?lock=arm64 constexpr PatchData ret0_patch_data{ "0xE0031F2A" }; constexpr PatchData nop_patch_data{ "0x1F2003D5" }; constexpr PatchData mov0_patch_data{ "0xE0031FAA" }; -constexpr PatchData ctest_patch_data{ "00309AD2001EA1F2610100D4E0031FAAC0035FD6" }; +constexpr PatchData ctest_patch_data{ "0x00309AD2001EA1F2610100D4E0031FAAC0035FD6" }; constexpr auto ret0_patch(u32 inst) -> PatchData { return ret0_patch_data; } constexpr auto nop_patch(u32 inst) -> PatchData { return nop_patch_data; } @@ -248,7 +248,7 @@ constinit Patterns es_patterns[] = { }; constinit Patterns nifm_patterns[] = { - { "ctest", "................F50301AAF40300AA....F30314AAE00314AA9F0201397F8E04F8", 0, 0, ctest_cond, ctest_patch, ctest_applied, true }, + { "ctest", "....................F40300AA....F30314AAE00314AA9F0201397F8E04F8", 16, -16, ctest_cond, ctest_patch, ctest_applied, true }, }; // NOTE: add system titles that you want to be patched to this table. @@ -338,7 +338,7 @@ void patcher(Handle handle, std::span data, u64 addr, std::span