Hacking 3DS Injector

zoogie

playing around in the end of life
OP
Developer
Joined
Nov 30, 2014
Messages
8,560
Trophies
2
XP
15,000
Country
Micronesia, Federated States of
This is a nice new CFW-ish thing from our good friend @yifan_lu (GW ultra reversing, spider3dstools). Obviously, don't install this unsigned module to sysnand or you'll likely brick.

Update: Here is a Writeup from the author's blog that explains how things work things nicely. It's in a conversation tone, so even novices might want to give it a read!
Update2: It appears 3ds injector now is part of a larger plan for yifanlu's new cfw!
https://github.com/yifanlu/Cosmo3DS/releases (a fork of reinand!)
http://yifan.lu/2016/03/28/cosmo3ds-the-cfw-nobody-wanted/ (another writeup!)
readme said:
3DS Loader Replacement

This is an open source implementation of 3DS loader system module--with additional features. The current aim of the project is to provide a nice entry point for patching 3DS modules.

Roadmap
Right now, this can serve as an open-source replacement for the built in loader. There is additional support for patching any executable after it's loaded but before it starts. For example, you can patch menu to skip region checks and have region free game launching directly from the home menu. There is also support for SDMC reading (not found in original loader implementation) which means that patches can be loaded from the SD card. Ultimately, there would be a patch system that supports easy loading of patches from the SD card.

Build
You need a working 3DS build environment with a fairly recent copy of devkitARM, ctrulib, and makerom. If you see any errors in the build process, it's likely that you're using an older version.

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.

Once you have a NCCH of the right size, just replace it in your decrypted FIRM and find a way to launch it (for example with ReiNAND).
Note: installation instructions under the "Build" heading in the above readme
https://github.com/yifanlu/3ds_injector
Latest release
https://github.com/yifanlu/3ds_injector/releases
 

Attachments

  • 3ds_injector.zip
    5.9 KB · Views: 292
  • 3ds_injector_padded.zip
    6.3 KB · Views: 251
Last edited by zoogie,

zoogie

playing around in the end of life
OP
Developer
Joined
Nov 30, 2014
Messages
8,560
Trophies
2
XP
15,000
Country
Micronesia, Federated States of
I've updated the OP with the padded version of the loader.
Turns out the patch made by yifanlu is exectly what's needed (9K -> 12K)

You simply overwrite this file where the loader ncch begins in the decrypted firm. (cntl-F "loader" then back up 0x200)
If you used phailect's a9lh guide and aureinand, then the file offsets should be:
old 0x26400
new 0x26600

MD5
firmware.bin old
clean 180d297732415d27ca49e69967eb68b6
patched 5d99ccb9db1a9325b4eadd10d2036df1

firmware.bin new
clean 7512abc6bdfddb2fcf10732888ff81e5
patched d58bf5ce02f1cb4fd631f4bc1adb8bd6

Interestingly new 3ds worked for region free, but old3ds did not. The loader moduledid function at least though. Tested with EUR mario 3d land legit on US consoles.
 
Last edited by zoogie,
  • Like
Reactions: peteruk

yifan_lu

@yifanlu
Member
Joined
Apr 28, 2007
Messages
663
Trophies
0
XP
1,671
Country
United States
Yeah, I was planning to make a post when it's in a more presentable fashion. It's pretty useless right now--it duplicates Nintendo's code exactly. Also, you need to manually pull the latest version of ctrulib, Project_CTR (makerom), and devkitARM (specifically this patch https://github.com/devkitPro/buildscripts/pull/9) manually to get it to compile. Hopefully by the time everything is done, all the tools will be updated to support it.

The goal of this is to provide a basic framework for creating patches for more than just Kernel11. You can patch processes after the .code is loaded to memory but BEFORE the process runs. So you can, for example, patch home menu to skip region checks or NIM to skip update checks and so on without any hacky linear scan of physical memory or the need to query kernel objects every so often to find new processes and so on. I've tested it on 7.4, 9.2, and 9.6 but it should work on any firmware > 2.x (provided you run it with the right CFW that supports it in emunand). If you have patches, make sure they're for the right FW version.

If you have patches you want to write, please tell me what kind of features you want from such a framework. For example, I will provide a simple search and replace system to load patches like the ones you find in freemultipatcher. I'll also provide support for absolute addresses (you must specify one for each fw version).
 
Last edited by yifan_lu,

yifan_lu

@yifanlu
Member
Joined
Apr 28, 2007
Messages
663
Trophies
0
XP
1,671
Country
United States
In terms of help, if anyone can PM me with a complete set decrypted CIAs for FW versions 9.2U, 10.4U, and 10.7U, it would help a lot with testing. Of course I can do it myself, but I would rather waste time programming rather than finding and decrypting stuff.

EDIT: Got it thanks.
 
Last edited by yifan_lu,

zoogie

playing around in the end of life
OP
Developer
Joined
Nov 30, 2014
Messages
8,560
Trophies
2
XP
15,000
Country
Micronesia, Federated States of
In terms of help, if anyone can PM me with a complete set decrypted CIAs for FW versions 9.2U, 10.4U, and 10.7U, it would help a lot with testing. Of course I can do it myself, but I would rather waste time programming rather than finding and decrypting stuff.
n3ds or o3ds?
 

Shadowtrance

Well-Known Member
Member
Joined
May 9, 2014
Messages
2,493
Trophies
0
Location
Hervey Bay, Queensland
XP
1,807
Country
In terms of help, if anyone can PM me with a complete set decrypted CIAs for FW versions 9.2U, 10.4U, and 10.7U, it would help a lot with testing. Of course I can do it myself, but I would rather waste time programming rather than finding and decrypting stuff.
Anything us "E" system users can do to help? :)
Also, with the example patch you added to test, what would need to be changed to work/test on EUR systems? besides the titleID obviously.
As always, great work. :)
 
  • Like
Reactions: peteruk

TVL

#|
Member
Joined
Feb 17, 2004
Messages
577
Trophies
2
Location
World -1
XP
2,320
Country
Sweden
  • Like
Reactions: peteruk

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Psionic Roshambo @ Psionic Roshambo:
    I wonder if that was the point of game streaming
  • Psionic Roshambo @ Psionic Roshambo:
    But it's a dead end
  • Xdqwerty @ Xdqwerty:
    @Psionic Roshambo, people who cant download it can still play the game
  • BigOnYa @ BigOnYa:
    If your internet speeds are fast enough. Streaming 4k takes alot. I used to only have 20mb sec, and 4k struggled. Now I have 300mb sec and 4k plays fine.
    +1
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, i only have like 1 or 2 mb sec
  • BigOnYa @ BigOnYa:
    Did you feed the hamster in your internet router? It prob died and is running slow now.
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, why did you start saying my pc has a hamster in the first place?
    +1
  • BigOnYa @ BigOnYa:
    Its actua!ly just a old joke, meaning its slow. Was just kidding around with you.
    +1
  • BigOnYa @ BigOnYa:
    I bet @AncientBoi has some hamsters hidden somewhere tho....
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    I think Game streaming should work like this.... Local Hardware able the run the game fine, game engine and common assets stored locally, all FMV and music and textures could be streaming
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Some temporary storage
  • Xdqwerty @ Xdqwerty:
    also @BigOnYa im making some progress on my gdevelop project, implemented various mechanics
  • Psionic Roshambo @ Psionic Roshambo:
    They went all in on streaming, should have been more of a hybrid approach
    +1
  • BigOnYa @ BigOnYa:
    Or free government supplied high speed internet be nice also. Like Obama care. Xdqwerty that's cool, its time consuming but rewarding once done or playable, to see what you've made from scratch. Animations take forever, but worth it.
    +1
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, although the bullets are a bit buggy
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Not to mention this would be a massive pain to pirate
  • Xdqwerty @ Xdqwerty:
    @BigOnYa,
    and the visual aspect of the game is quite crude (the sprite that looks best is that of the protagonist just because he is a stickman with sunglasses)
    +1
  • BigOnYa @ BigOnYa:
    There is a bullets behaviour you assign to your character, that makes the code easier, under "behaviours"
  • Xdqwerty @ Xdqwerty:
    i meant that when the character is pointing to the right, the bullets spawn where they should, but when he is on the right, they move to the right but the spawn point is incorrect
  • BigOnYa @ BigOnYa:
    Itch.io has lots of free assets also. Under the bullets behavior tab, there is a "rotate bullets" option, can try that. Or in the code can try
    - fire bullet Player.X(PlayerDirection)
  • Xdqwerty @ Xdqwerty:
    im taking a break for today anyway
    +1
  • BigOnYa @ BigOnYa:
    YEa gotta after a while, looking at code for long periods will bug your eyes.
    +1
  • BigOnYa @ BigOnYa:
    That's cool tho, I'm proud of you going back to it, not giving up. It is difficult at first to learn, but fun once you get the hang of it. I think I've watched every tutorial video there is, but I still struggle sometimes to get stuff to work right. But gotta keep trying dif things, and eventually you will get it right.
    +1
    BigOnYa @ BigOnYa: That's cool tho, I'm proud of you going back to it, not giving up. It is difficult at first to... +1