From 785dbf7376a534774600b6c887acb3277cc64e6f Mon Sep 17 00:00:00 2001 From: chaoskagami Date: Wed, 1 Jun 2016 09:48:18 -0400 Subject: [PATCH] Convert relevant patches to bytecode (in headers) --- doc/bytecode.md | 9 +++++++-- external/loader/source/patch/block_cart_update.c | 8 ++++++++ external/loader/source/patch/block_eshop_update.c | 5 +++++ external/loader/source/patch/block_nim_update.c | 5 +++++ external/loader/source/patch/errdisp.c | 12 ++++++++++++ external/loader/source/patch/friends_ver.c | 6 ++++++ external/loader/source/patch/mset_str.c | 5 +++++ external/loader/source/patch/regionfree.c | 6 ++++++ external/loader/source/patch/ro_sigs.c | 11 +++++++++++ external/loader/source/patch/secinfo_sigs.c | 5 +++++ 10 files changed, 70 insertions(+), 2 deletions(-) diff --git a/doc/bytecode.md b/doc/bytecode.md index 3a74221..56839f4 100644 --- a/doc/bytecode.md +++ b/doc/bytecode.md @@ -5,6 +5,10 @@ Instructions are one byte and have a variable number of bytes afterwards. Unless otherwise noted, if an instruction doesn't succeed, it will abort. +nop : 1 byte : Opcode 0x00 + Does nothing. Not actually treated as an instruction, + rather just skipped over. This is mainly just for compatibility. + rel : 2 bytes : Opcode 0x01 Chooses firmware relativity. @@ -75,10 +79,11 @@ test : 2 bytes : opcode 0x06 Pattern to test. jmp : 3 bytes : opcode 0x07 - Jumps to within the bytecode, and resumes execution from there. + Jumps to the Nth instruction within the bytecode, and + resumes execution from there. : 2 bytes - Offset to jump to. + Index to jump to. rewind : 1 byte : opcode 0x08 Resets the location to the beginning of the space we're working off. diff --git a/external/loader/source/patch/block_cart_update.c b/external/loader/source/patch/block_cart_update.c index 9e19a9a..362a7d2 100644 --- a/external/loader/source/patch/block_cart_update.c +++ b/external/loader/source/patch/block_cart_update.c @@ -1,5 +1,13 @@ #include "patch.h" +/* + find 4, 0x0C, 0x18, 0xE1, 0xD8 + set 4, 0x0B, 0x18, 0x21, 0xC8 + + find 4, 0x0C, 0x18, 0xE1, 0xD8 + set 4, 0x0B, 0x18, 0x21, 0xC8 +*/ + void disable_cart_updates(u64 progId, u8* code, u32 size) { diff --git a/external/loader/source/patch/block_eshop_update.c b/external/loader/source/patch/block_eshop_update.c index 18ad438..b2894f6 100644 --- a/external/loader/source/patch/block_eshop_update.c +++ b/external/loader/source/patch/block_eshop_update.c @@ -1,5 +1,10 @@ #include "patch.h" +/* + find 4, 0x30, 0xB5, 0xF1, 0xB0 + set 6, 0x00, 0x20, 0x08, 0x60, 0x70, 0x47 + */ + void disable_eshop_updates(u64 progId, u8* code, u32 size) { diff --git a/external/loader/source/patch/block_nim_update.c b/external/loader/source/patch/block_nim_update.c index d765cbe..1e049a0 100644 --- a/external/loader/source/patch/block_nim_update.c +++ b/external/loader/source/patch/block_nim_update.c @@ -1,5 +1,10 @@ #include "patch.h" +/* + find 4, 0x25, 0x79, 0x0B, 0x99 + set 2, 0xE3, 0xA0 + */ + void disable_nim_updates(u64 progId, u8* code, u32 size) { diff --git a/external/loader/source/patch/errdisp.c b/external/loader/source/patch/errdisp.c index 8578d93..8446b8f 100644 --- a/external/loader/source/patch/errdisp.c +++ b/external/loader/source/patch/errdisp.c @@ -1,5 +1,17 @@ #include "patch.h" +/* + find 8, 0x14, 0x00, 0xD0, 0xE5, 0xDB, 0x9A, 0x9F, 0xED + set 4, 0x00, 0x00, 0xA0, 0xE3 + + find 8, 0x14, 0x00, 0xD0, 0xE5, 0x01, 0x00, 0x10, 0xE3 + set 4, 0x00, 0x00, 0xA0, 0xE3 + find 8, 0x14, 0x00, 0xD0, 0xE5, 0x01, 0x00, 0x10, 0xE3 + set 4, 0x00, 0x00, 0xA0, 0xE3 + find 8, 0x14, 0x00, 0xD0, 0xE5, 0x01, 0x00, 0x10, 0xE3 + set 4, 0x00, 0x00, 0xA0, 0xE3 + */ + void errdisp_devpatch(u64 progId, u8* code, u32 size) { static const u8 unitinfoCheckPattern1[] = {0x14, 0x00, 0xD0, 0xE5, 0xDB, 0x9A, 0x9F, 0xED}; static const u8 unitinfoCheckPattern2[] = {0x14, 0x00, 0xD0, 0xE5, 0x01, 0x00, 0x10, 0xE3} ; diff --git a/external/loader/source/patch/friends_ver.c b/external/loader/source/patch/friends_ver.c index 618cb7a..f24c228 100644 --- a/external/loader/source/patch/friends_ver.c +++ b/external/loader/source/patch/friends_ver.c @@ -1,5 +1,11 @@ #include "patch.h" +/* + find 8, 0xE0, 0x1E, 0xFF, 0x2F, 0xE1, 0x01, 0x01, 0x01 + fwd 9 + set 1, 0x06 + */ + void fake_friends_version(u64 progId, u8* code, u32 size) { diff --git a/external/loader/source/patch/mset_str.c b/external/loader/source/patch/mset_str.c index ee269bd..1569199 100644 --- a/external/loader/source/patch/mset_str.c +++ b/external/loader/source/patch/mset_str.c @@ -1,5 +1,10 @@ #include "patch.h" +/* + find 8, u"Ver." + set 8, u".hax" + */ + void settings_string(u64 progId, u8* code, u32 size) { diff --git a/external/loader/source/patch/regionfree.c b/external/loader/source/patch/regionfree.c index a7eca93..f8e677e 100644 --- a/external/loader/source/patch/regionfree.c +++ b/external/loader/source/patch/regionfree.c @@ -1,5 +1,11 @@ #include "patch.h" +/* + find 8, 0x00, 0x00, 0x55, 0xE3, 0x01, 0x10, 0xA0, 0xE3 + back 16 + set 8, 0x01, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1 + */ + void region_patch(u64 progId, u8* code, u32 size) { diff --git a/external/loader/source/patch/ro_sigs.c b/external/loader/source/patch/ro_sigs.c index 6e98d77..b44d821 100644 --- a/external/loader/source/patch/ro_sigs.c +++ b/external/loader/source/patch/ro_sigs.c @@ -1,5 +1,16 @@ #include "patch.h" +/* + find 8, 0x30, 0x40, 0x2D, 0xE9, 0x02, 0x50, 0xA0, 0xE1 + set 8, 0x00, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1 + + find 8, 0x30, 0x40, 0x2D, 0xE9, 0x24, 0xD0, 0x4D, 0xE2 + set 8, 0x00, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1 + + find 8, 0xF8, 0x4F, 0x2D, 0xE9, 0x01, 0x70, 0xA0, 0xE1 + set 8, 0x00, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1 + */ + void ro_sigpatch(u64 progId, u8* code, u32 size) { diff --git a/external/loader/source/patch/secinfo_sigs.c b/external/loader/source/patch/secinfo_sigs.c index 34f6225..525b386 100644 --- a/external/loader/source/patch/secinfo_sigs.c +++ b/external/loader/source/patch/secinfo_sigs.c @@ -1,5 +1,10 @@ #include "patch.h" +/* + find 5, 0x06, 0x46, 0x10, 0x48, 0xFC + set 2, 0x00, 0x26 + */ + void secureinfo_sigpatch(u64 progId, u8* code, u32 size) { -- 2.39.5