Hacking 3DS Injector

mariogamer

Well-Known Member
Member
Joined
Aug 12, 2015
Messages
1,256
Trophies
0
Age
28
XP
790
Country
Canada
@mariogamer The NCCH is the build output, e.g. the repo itself. The output needs to be a certain size for injection to work.

You don't need to get anything, it's all there already. :P

Maybe,but I want doing it mysefl,not like other user...

But I don't understand the:

Currently, there is no support for FIRM building, so you need to do some steps manually. First, you have to add padding to make sure the NCCH is of the right size to drop in as a replacement. A hacky way is this patch which adds junk data. Play around with the size value to get the NCCH to be the exact same size as the one found in your decrypted FIRM dump.
 
Last edited by mariogamer,

chaoskagami

G̷̘̫̍̈́̊̓̈l̴̙͔̞͠i̵̳͊ţ̸̙͇͒̓c̵̬̪̯̥̳͒͌̚h̵̹̭͛̒̊̽̚
Developer
Joined
Mar 26, 2016
Messages
1,365
Trophies
1
Location
↑↑↓↓←→←→BA
Website
github.com
XP
2,262
Country
United States
FIRM modules are always a certain size. In order to properly rebuild a firm, they have to have the same size as the official nintendo modules. That patch does it by adding garbage after the code.

Chances are if you didn't understand what I just said nor the instructions, you're probably not the intended audience of this. Wait for it to make it to a CFW. It's mainly for devs at this point, e.g. not user friendly.
 
  • Like
Reactions: astronautlevel

Vappy

Well-Known Member
Member
Joined
May 23, 2012
Messages
1,508
Trophies
2
XP
2,613
Country
does somebody have a backup from the "hacky padding trick" to pad the code to the right size?
This it?
Code:
diff --git a/source/loader.c b/source/loader.c
index 1bcb36d..52e0cc7 100644
--- a/source/loader.c
+++ b/source/loader.c
@@ -11,6 +11,15 @@

#define MAX_SESSIONS 1

+const volatile char test[0x7000] = {0xff};
+
const char CODE_PATH[] = {0x01, 0x00, 0x00, 0x00, 0x2E, 0x63, 0x6F, 0x64, 0x65, 0x00, 0x00, 0x00};

typedef struct
@@ -489,6 +498,10 @@ int main()
   u32* cmdbuf;

   ret = 0;
+  if (test[100] == 0)
+  {
+    ret = ret << 2;
+  }
   srv_handle = &g_handles[1];
   notification_handle = &g_handles[0];
 

ground

Well-Known Member
Member
Joined
Mar 22, 2007
Messages
907
Trophies
0
XP
572
Country
Netherlands
This it?
Code:
diff --git a/source/loader.c b/source/loader.c
index 1bcb36d..52e0cc7 100644
--- a/source/loader.c
+++ b/source/loader.c
@@ -11,6 +11,15 @@

#define MAX_SESSIONS 1

+const volatile char test[0x7000] = {0xff};
+
const char CODE_PATH[] = {0x01, 0x00, 0x00, 0x00, 0x2E, 0x63, 0x6F, 0x64, 0x65, 0x00, 0x00, 0x00};

typedef struct
@@ -489,6 +498,10 @@ int main()
   u32* cmdbuf;

   ret = 0;
+  if (test[100] == 0)
+  {
+    ret = ret << 2;
+  }
   srv_handle = &g_handles[1];
   notification_handle = &g_handles[0];
no not that (but thank you ;)). The one he links to in this file (under the build section):
https://github.com/yifanlu/3ds_injector/blob/master/README.md

I made some adjustments, but when i compile i can't padd it right.

I also notice that the files attached to the first post of this topic (padded, and unpadded) have their strings stored in a different way (seems like endianness issues), what i assume has to do with the padding, but i want to know why ;)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Sonic Angel Knight @ Sonic Angel Knight: :ninja: