]> Chaos Git - corbenik/corbenik.git/commitdiff
Changes here:
authorchaoskagami <chaos.kagami@gmail.com>
Wed, 8 Jun 2016 23:15:15 +0000 (19:15 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Wed, 8 Jun 2016 23:17:56 +0000 (19:17 -0400)
 * Split agb bootscreen from the signature fix
 * Merge twl patches for o3ds and n3ds
 * Automatically disable EmuNAND on AGB reboot to keep saves
 * Improve a few messages on langemu for debugging

README.txt
external/loader/source/patcher.c
patch/agb_biosscreen.pco [new file with mode: 0644]
patch/agb_sig.pco
patch/twl_fix.pco [new file with mode: 0644]
patch/twl_fix_new.pco [deleted file]
patch/twl_fix_old.pco [deleted file]
source/main.c

index 13d67d065b7ed77c0526d5998502f5625770f599..4cbd54c6e41bc96d232c415e3ec35e51b06edd20 100644 (file)
@@ -64,11 +64,14 @@ won't work - and other applications that do JIT also won't work.
 If you need to use an EmuNAND, you'll want to enable `EmuNAND` in options. If
 you've been using multiple EmuNANDs you can also select the index while you're
 there with A to increase and X to decrease. This supports both Gateway-style
-(first sector at back) and standard copied NAND (RedNAND)
+(first sector at back) and standard copied NANDs (RedNAND)
 
 While you're there, you can enable `Autoboot` if you'd like, including
 `silent mode` if you're using something like BootAnim9.
 
+If you plan to use TWL/AGB patches or have an O3DS, you should enable
+`Reboot Hook` in options.
+
 You'll also want to go into `Patches` and enable the usual bits, which includes:
 
  * Signature Fix
@@ -82,6 +85,11 @@ You'll also want these patches, which are done by loader and therefore require i
  * Region free HOME
  * RO signature fix
 
+If you're using the reboot hook, you might want these:
+
+ * AGB Patches
+ * TWL Patches
+
 If you're on 11.0, you also want these:
 
  * Title Downgrade Fix (Only enable with 11.0 firmware - others will fail)
index 8eeb5e8321b9b844db4a3f9f1b7cc656975adbfb..2e6fb50919daf9678675571f3464127d5f1399dd 100644 (file)
@@ -123,6 +123,9 @@ loadTitleLocaleConfig(u64 progId, u8 *regionId, u8 *languageId)
         for (u32 i = 0; i < 7; i++) {
             if (memcmp(buf, regions[i], 3) == 0) {
                 *regionId = (u8)i;
+                               logstr("  localeemu region - ");
+                               logstr(regions[i]);
+                               logstr("\n");
                 break;
             }
         }
@@ -130,11 +133,14 @@ loadTitleLocaleConfig(u64 progId, u8 *regionId, u8 *languageId)
         for (u32 i = 0; i < 12; i++) {
             if (memcmp(buf + 4, languages[i], 2) == 0) {
                 *languageId = (u8)i;
+                               logstr("  localeemu lang - ");
+                               logstr(languages[i]);
+                               logstr("\n");
                 break;
             }
         }
 
-        logstr("  langemu cfg applied\n  ");
+        logstr("  localeemu read for ");
         logstr(path);
         logstr("\n");
     }
@@ -219,7 +225,7 @@ patchCfgGetLanguage(u8 *code, u32 size, u8 languageId, u8 *CFGU_GetConfigInfoBlk
                         *((u32 *)instr + 1) = 0xE3B00000; // (1 or 2 instructions)         => movs
                                                           // r0, 0             (result code)
 
-                        logstr("  patched language\n");
+                        logstr("  patched cfggetlanguage\n");
 
                         // We're done
                         return;
@@ -251,7 +257,7 @@ patchCfgGetRegion(u8 *code, u32 size, u8 regionId, u32 CFGUHandleOffset)
         }
     }
 
-    logstr("  patched region\n");
+    logstr("  patched cfggetregion\n");
 }
 
 static void
@@ -276,6 +282,8 @@ adjust_cpu_settings(u64 progId, u8 *code, u32 size)
             }
         }
     }
+
+    logstr("  patched cpu\n");
 }
 
 void
diff --git a/patch/agb_biosscreen.pco b/patch/agb_biosscreen.pco
new file mode 100644 (file)
index 0000000..31b745f
--- /dev/null
@@ -0,0 +1,33 @@
+# $name  AGB Bootscreen
+# $desc  Force usage of GBA bios in AGB_FIRM.
+# $ver   01
+# $uuid  35
+
+# TODO - Make dynamic.
+#        This is also terribly inconvienent without labels.
+
+# Note - The bootscreen patch literally boots the GBA BIOS,
+#        so games have to pass the Nintendo logo check. If
+#        they don't, they'll fail like on a real GBA.
+
+rel agb
+
+# #############################
+
+# Bootscreen (1)
+seek  000D8B8A
+test  01
+jmpne 6
+set   26
+
+jmp   8
+
+#########################
+
+# OLD3ds bootscreen (6)
+seek  000D7A12
+set   26
+
+# #######################
+
+# End (8)
index 869164eb31b35e088c1e13f537d2e959107df172..654600c1f3e06f628846a8003d8686b30c84e61a 100644 (file)
@@ -1,7 +1,7 @@
-# $name  AGB Patches
-# $desc  Patches signatures and bootscreen in AGB firm
+# $name  AGB Siganture fix
+# $desc  Patches signatures in AGB_FIRM
 # $ver   01
-# $uuid  35
+# $uuid  39
 
 # TODO - Make dynamic.
 #        This is also terribly inconvienent without labels.
@@ -13,24 +13,17 @@ rel agb
 # New3DS Sigs (1)
 seek  0009DF64
 test  C117491C31D0
-jmpne 8
+jmpne 6
 set   00204EB070BD
 
-# Bootscreen (5)
-seek  000D8B8A
-set   26
-jmp   12
+jmp   8
 
 #########################
 
-# OLD3DS Sigs (8)
+# OLD3DS Sigs (6)
 seek  0009D2A8
 set   00204EB070BD
 
-# OLD3ds bootscreen (10)
-seek  000D7A12
-set   26
-
 # #######################
 
-# End (12)
+# End (8)
diff --git a/patch/twl_fix.pco b/patch/twl_fix.pco
new file mode 100644 (file)
index 0000000..006ec73
--- /dev/null
@@ -0,0 +1,88 @@
+# $name TWL Patches
+# $desc 
+# $ver  01
+# $uuid 34
+
+# TODO - Make dynamic. Not that hard, but some 
+#        fixes need more context bytes than on Steveice10's
+#        pastebin
+
+# Relative to twl_firm (0)
+rel  twl
+
+###########################################
+# New3ds
+
+# Disable main signature checks (1)
+seek  00165D64
+test  C117491C31D0
+jmpne 20
+set   00204EB070BD
+
+# Patch RSA function to not report invalid signatures (5)
+seek 0017474A
+set  0120
+
+# Disable header Nintendo logo check (not generally needed) (7)
+seek 0017553E
+set  00200000
+
+# Disable whitelist check (9)
+seek 001756A0
+set  00200000
+
+# Disable cartridge blacklist check (mostly, if not entirely, demo carts) (11)
+seek 00175A8E
+set  01200000
+
+# Disable save type check (13)
+seek 00175A9A
+set  01200000
+
+# Disable DSi cartridge save exploit check (15)
+seek 00175AA6
+set  01200000
+
+# Stub function commonly used to compare SHA hashes to always succeed (17)
+seek 00175B92
+set  01207047
+
+jmp  36
+
+###########################################
+# Old3ds
+
+# Disable main signature checks (20)
+seek 001650C0
+set  00204EB070BD
+
+# Patch RSA function to not report invalid signatures (22)
+seek 00173A0E
+set  0120
+
+# Disable header Nintendo logo check (not generally needed) (24)
+seek 00174802
+set  00200000
+
+# Disable whitelist check (26)
+seek 00174964
+set  00200000
+
+# Disable cartridge blacklist check (mostly, if not entirely, demo carts) (28)
+seek 00174D52
+set  01200000
+
+# Disable save type check (30)
+seek 00174D5E
+set  01200000
+
+# Disable DSi cartridge save exploit check (32)
+seek 00174D6A
+set  01200000
+
+# Stub function commonly used to compare SHA hashes to always succeed (34)
+seek 00174E56
+set  01207047
+
+# end (36)
+
diff --git a/patch/twl_fix_new.pco b/patch/twl_fix_new.pco
deleted file mode 100644 (file)
index 13611cc..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# $name TWL_FIRM patches (New3DS)
-# $desc 
-# $ver  01
-# $uuid 34
-
-# TODO - Make dynamic
-
-# Relative to twl_firm
-rel  twl
-
-# Disable main signature checks
-seek 00165D64
-set  00204EB070BD
-
-# Patch RSA function to not report invalid signatures
-seek 0017474A
-set  0120
-
-# Disable header Nintendo logo check (not generally needed)
-seek 0017553E
-set  00200000
-
-# Disable whitelist check
-seek 001756A0
-set  00200000
-
-# Disable cartridge blacklist check (mostly, if not entirely, demo carts)
-seek 00175A8E
-set  01200000
-
-# Disable save type check
-seek 00175A9A
-set  01200000
-
-# Disable DSi cartridge save exploit check
-seek 00175AA6
-set  01200000
-
-# Stub function commonly used to compare SHA hashes to always succeed
-seek 00175B92
-set  01207047
-
diff --git a/patch/twl_fix_old.pco b/patch/twl_fix_old.pco
deleted file mode 100644 (file)
index ba3bb3b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# $name TWL_FIRM patches (Old3DS)
-# $desc 
-# $ver  01
-# $uuid 36
-
-# TODO - Make dynamic
-
-# Relative to agb_firm
-rel  twl
-
-# Disable main signature checks
-seek 001650C0
-set  00204EB070BD
-
-# Patch RSA function to not report invalid signatures
-seek 00173A0E
-set  0120
-
-# Disable header Nintendo logo check (not generally needed)
-seek 00174802
-set  00200000
-
-# Disable whitelist check
-seek 00174964
-set  00200000
-
-# Disable cartridge blacklist check (mostly, if not entirely, demo carts)
-seek 00174D52
-set  01200000
-
-# Disable save type check
-seek 00174D5E
-set  01200000
-
-# Disable DSi cartridge save exploit check
-seek 00174D6A
-set  01200000
-
-# Stub function commonly used to compare SHA hashes to always succeed
-seek 00174E56
-set  01207047
-
-# end
index 2c88764ff04f63db04c2ec07b53cb28d6efd804b..7307d0e8eaa34652f4c22f0337462470ccb8e482 100644 (file)
@@ -12,13 +12,11 @@ int is_n3ds = 0;
 int doing_autoboot = 0;
 void shut_up();
 
-#define CONFIG_PLATFORM_REG ((volatile uint32_t*)0x10140FFC)
-
 int
 main()
 {
-       if (*CONFIG_PLATFORM_REG == 7)
-               is_n3ds = 1;
+       if (PDN_MPCORE_CFG == 7)
+               is_n3ds = 1; // Enable n3ds specific options.
 
     int c = fmount();
     screen_init();
@@ -30,6 +28,11 @@ main()
 
     load_config(); // Load configuration.
 
+       if (CFG_BOOTENV == 7) {
+               fprintf(stderr, "Rebooted from AGB, disabling EmuNAND\n");
+               config.options[OPTION_EMUNAND] = 0;
+       }
+
     // Autoboot. Non-standard code path.
     if (config.options[OPTION_AUTOBOOT] && !(HID_PAD & BUTTON_R)) {
         if (config.options[OPTION_SILENCE])