]> Chaos Git - corbenik/corbenik.git/commitdiff
Since the patcher VM works now, rewrite known functional patches to be stubs (until...
authorchaoskagami <chaos.kagami@gmail.com>
Thu, 2 Jun 2016 10:50:22 +0000 (06:50 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Thu, 2 Jun 2016 10:50:22 +0000 (06:50 -0400)
19 files changed:
.gitignore
patch/aadowngrade.pco
patch/block_cart_update.pco
patch/block_eshop_update.pco
patch/block_nim_update.pco
patch/errdisp.pco
patch/friends_ver.pco
patch/memexec.pco
patch/mset_str.pco
patch/prot.pco
patch/regionfree.pco
patch/ro_sigs.pco
patch/secinfo_sigs.pco
patch/sig.pco
patch/unitinfo.pco
source/patch/aadowngrade.c
source/patch/base.c [deleted file]
source/patch/prot.c
source/patch/sig.c

index c199e7e659ffec61a657c028c4444a45f493b061..ca27f501db4216b5abc09007d9945c303e1e926c 100644 (file)
@@ -7,6 +7,6 @@ build
 *.o
 *.d
 *.elf
-*.bat
+*.vco
 input
 modules/template/src/symtab.h
index 9439f1099bd638ff30c9851cb43fde022c26b840..6fb4f713f810c0bd451320982ea130af3968d587 100644 (file)
@@ -4,6 +4,8 @@
 # $uuid 00
 # $flags require
 
+# Status: Working
+
 # Anti-anti-downgrade fix.
 
 # Relative to process9.
index 305e5b08cf6b6ac63ba03d15a5dd49921b430d75..50e427908b8b8408e36946541bc9daf1e22336bc 100644 (file)
@@ -4,6 +4,8 @@
 # $ver   01
 # $uuid  01
 
+# Status: needs loader
+
 find 0C18E1D8
 set  0B1821C8
 
index 1cd18c2002ca940f0cd73fcb1b0c2e6b79d3d446..303c357c8820e18e8fa9ce954c2f642cd9eab137 100644 (file)
@@ -4,5 +4,7 @@
 # $ver   01
 # $uuid  02
 
+# Status: needs loader
+
 find 30B5F1B0
 set  002008607047
index 19ecfceb0c244368318286d215d0097f4f6020be..f81587dc45f248bffa3ee8c8315623abd108b939 100644 (file)
@@ -4,5 +4,7 @@
 # $ver   01
 # $uuid  03
 
+# Status: needs loader
+
 find 25790B99
 set  E3A0
index 227bb9001910f16a00a2cd56d41e99e7ab4ed250..37e357d327a948fd0029df83c47670d740edd04c 100644 (file)
@@ -5,6 +5,8 @@
 # $uuid  04
 # $flags devmode
 
+# Status: needs loader
+
 find 1400D0E5DB9A9FED
 set  0000A0E3
 
index 42e8e6ffff34958c69a36dae99767709df411b54..942afc8bb74cb364f7583081df621f32bb29f47c 100644 (file)
@@ -5,6 +5,8 @@
 # $uuid  05
 # $flags noabort
 
+# Status: needs loader
+
 find E01EFF2FE1010101
 fwd  09
 set  06
index d863359bb3eaae0510f75413dcf9682ada6acf22..6226e98b29b14cf3b25127b36c818f4d6205af92 100644 (file)
@@ -4,6 +4,8 @@
 # $uuid 06
 # $flags devmode
 
+# Status: needs assembler to be fixed
+
 # Relative to NATIVE_FIRM, section index [1]
 rel native_s1
 
index a3f22193ad13955285722abaec96fd19b629f476..a1b3bb3274d54a50c54a38b442add0b24621880b 100644 (file)
@@ -4,6 +4,8 @@
 # $ver   01
 # $uuid  07
 
+# Status: needs loader
+
 # u"Ver."
 find 5600650072002e00
 
index 065520adc77414696311ba8929eeff9c4b02f32b..61b4ae01c220e960af806e2a82ebe6f623aa7e38 100644 (file)
@@ -4,6 +4,8 @@
 # $uuid 08
 # $flags require
 
+# Status: Working
+
 rel native_p9
 # String: 'exe:'
 find 6578653a
index 35e297e564db424f9ead66b95873ad56edc1297d..25f3e73d78cbd742b1286717d58f2f82d2cab06a 100644 (file)
@@ -4,6 +4,8 @@
 # $ver   01
 # $uuid  09
 
+# Status: needs loader
+
 find 000055E30110A0E3
 # 16
 back 11
index 47f0f689b71de7c747925cd6d65bbcbe4448cd88..69f283172ff1ebe317f618135fd016d926f3d72e 100644 (file)
@@ -4,6 +4,8 @@
 # $ver   01
 # $uuid  0a
 
+# Status: needs loader
+
 find 30402DE90250A0E1
 set  0000A0E31EFF2FE1
 
index 12a3dfee068f5af1e27e98882f8ca0b392e8e097..6fe262e380024522a1ea0179916b532cdcf36ba8 100644 (file)
@@ -4,5 +4,7 @@
 # $ver   01
 # $uuid  0b
 
+# Status: needs loader
+
 find 06461048FC
 set  0026
index b952980425d30f534ddd4b61b73cf874a3504025..0a8fc234822c56853774a3d53a3822137bb24233 100644 (file)
@@ -4,6 +4,8 @@
 # $uuid 0c
 # $flags require
 
+# Status: Working
+
 # Signature patch.
 
 # Relative to exefs.
index 7b9b40ca2ed5ac5bd90a91cfe3766f00638b6ddb..4738101a565c95b1839763368cbd21b701292ea2 100644 (file)
@@ -4,6 +4,8 @@
 # $uuid 0d
 # $flags devmode
 
+# Status: untested, but should work
+
 rel  native_s2
 find 0110A013
 fwd  03
index e4d9e41be8d5816540af1b7e096e64ab73f51339..f7aa638e7f53ebdeee3d1a55924e073861b9b44c 100644 (file)
@@ -1,30 +1,8 @@
 #include "patch_file.h"
 
-/*
-   rel p9_exefs
-   find 6, 0x89, 0x0a, 0x81, 0x42, 0x02, 0xD2
-   fwd 5
-   set 1, 0xE0
- */
-
-extern exefs_h* firm_p9_exefs;
-
 PATCH(aadowngrade)
 {
-    uint8_t* firm_mem = (uint8_t*)firm_p9_exefs + sizeof(exefs_h) +
-                        firm_p9_exefs->fileHeaders[0].offset;
-    uint32_t size = firm_p9_exefs->fileHeaders[0].size;
-
-       const uint8_t pattern[] = {0x89, 0x0A, 0x81, 0x42, 0x02, 0xD2};
-
-       uint8_t *off = memfind(firm_mem, size, pattern, 6);
-
-       if(off == NULL)
-               return 1; // Not found.
-
-       fprintf(stderr, "aadowngrade: %x\n", (uint32_t)off);
-
-       off[5] = 0xE0;
+       execb(PATH_PATCHES "/aadowngrade.vco");
 
-       return 0;
+    return 0;
 }
diff --git a/source/patch/base.c b/source/patch/base.c
deleted file mode 100644 (file)
index 847740a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "patch_file.h"
-
-// Do you like examples?
-
-PATCH(example)
-{
-    fprintf(stderr, "Testing, testing, 1, 2, 3, 4..\n");
-
-    return 0;
-}
index 544c7f9b9319f3f7feec1fdc650546a69ea0a548..47ebcf30a729faf46983e318fd8e44917a1413e0 100644 (file)
@@ -2,48 +2,9 @@
 
 // This patch applies the FIRM protection code needed for safe a9lh usage.
 
-/*
-  rel p9_exefs
-  find 4, "exe:"
-  back 0x1
-  back 0xff
-  find 4, 0x00, 0x28, 0x01, 0xDA
-  set 4, 0x00, 0x20, 0xC0, 0x46
- */
-
-extern exefs_h* firm_p9_exefs;
-
 PATCH(firmprot)
 {
-    uint8_t* firm_mem = (uint8_t*)firm_p9_exefs + sizeof(exefs_h) +
-                        firm_p9_exefs->fileHeaders[0].offset;
-    uint32_t size = firm_p9_exefs->fileHeaders[0].size;
-
-    // We look for 'exe:' first; this string is close to what we patch
-    uint8_t* off = memfind(firm_mem, size, (uint8_t*)"exe:", 4);
-
-    if (off == NULL) {
-        fprintf(stderr, "Couldn't find 'exe:' string.\n");
-        return 1;
-    }
-
-    fprintf(stderr, "Firmprot: 'exe:' string @ %x\n", (uint32_t)off);
-
-    uint8_t pattern[] = { 0x00, 0x28, 0x01, 0xDA };
-
-    uint8_t* firmprot = memfind(off - 0x100, 0x100, pattern, 4);
-
-    if (firmprot == NULL) {
-        fprintf(stderr, "Couldn't find firmprot code.\n");
-        return 2;
-    }
-
-    fprintf(stderr, "Firmprot: %x\n", (uint32_t)firmprot);
-
-    uint8_t patch[] = { 0x00, 0x20, 0xC0, 0x46 };
-    memcpy(firmprot, patch, 4);
-
-    fprintf(stderr, "Applied firmprot patch.\n");
+       execb(PATH_PATCHES "/prot.vco");
 
     return 0;
 }
index fda935c3d03a18b2acc9a8d40e14066b4a7dccc2..dbc46e56eaf2de32c68617995b7fa6779fb6c8cd 100644 (file)
@@ -2,57 +2,8 @@
 
 // This patch is responsible for fixing signature checks for the firmware.
 
-/*
-  rel  p9_exefs
-  find 4, 0xc0, 0x1c, 0x76, 0xe7
-  set  2, 0x00, 0x20
-  rewind
-  find 4, 0xb5, 0x22, 0x4d, 0x0c
-  set  4, 0x00, 0x20, 0x70, 0x47
- */
-
-extern exefs_h* firm_p9_exefs;
-
 PATCH(signatures)
 {
-/*
-    // Look for signature checks
-
-    uint8_t pat1[] = { 0xC0, 0x1C, 0x76, 0xE7 };
-    uint8_t pat2[] = { 0xB5, 0x22, 0x4D, 0x0C };
-
-    // The code segment.
-    uint8_t* firm_mem = (uint8_t*)firm_p9_exefs + sizeof(exefs_h) +
-                        firm_p9_exefs->fileHeaders[0].offset;
-    uint32_t size = firm_p9_exefs->fileHeaders[0].size;
-
-    uint8_t* off = memfind(firm_mem, size, pat1, 4);
-
-    // We're subbing one because the code goes back 1.
-    // Unique patterns, etc.
-    uint8_t* off2 = memfind(firm_mem, size, pat2, 4) - 1;
-
-    if (off == NULL) {
-        fprintf(stderr, "Signature patch failed on P0.\n");
-        return 1; // Failed to find sigpatch. Ugh.
-    }
-
-    if (off2 == NULL) {
-        fprintf(stderr, "Signature patch failed on P1.\n");
-        return 2; // Failed to find sigpatch. Ugh.
-    }
-
-    fprintf(stderr, "Signatures[0]: 0x%x\n", (uint32_t)off);
-    fprintf(stderr, "Signatures[1]: 0x%x\n", (uint32_t)off2);
-
-    // See asm/sigpatches.s for the code here
-    uint8_t sigpatch[] = { 0x00, 0x20, 0x70, 0x47 };
-
-    memcpy(off, sigpatch, 2);
-    memcpy(off2, sigpatch, 4);
-
-    fprintf(stderr, "Signature patch succeded.\n");
-*/
        execb(PATH_PATCHES "/sig.vco");
 
     return 0;