Hacking [Source Code] ReiNAND with Brahma2Loader (Ninjhax 2.x support) (FW <= 9.2)

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Code:
ReiNand/mset/source/launcher_path.h:#define LAUNCHER_PATH "/reiNand.dat"
ReiNand/mset/.gitignore:reiNand.dat
ReiNand/mset/Makefile:name ?= reiNand.dat
ReiNand/mset/rop3ds/download.html.template:     l='reiNand.dat',g=decodeURI(d.URL).split('?');


Code:
ReiNand/Makefile:launcher: $(dir_out)/ReiNand.dat
ReiNand/Makefile:ninjhax: $(dir_out)/3ds/ReiNand
ReiNand/Makefile:.PHONY: $(dir_out)/ReiNand.dat
ReiNand/Makefile:$(dir_out)/ReiNand.dat: $(dir_build)/main.bin $(dir_out)/rei/
ReiNand/Makefile:$(dir_out)/3ds/ReiNand:
ReiNand/Makefile:       @mkdir -p "$(dir_out)/3ds/ReiNand"
ReiNand/Makefile:       @cp -av $(dir_ninjhax)/output/ReiNand.3dsx $@
ReiNand/Makefile:       @cp -av $(dir_ninjhax)/output/ReiNand.smdh $@

I don't think that will fail the checkout?

Edit:
If I checkout from rei's git and replaces BrahmaLoader I can compile but it will fail on copying the 3dsx and smdh-file because it expects Rei and not rei but it builds rei. ;)
built ... reiNAND.3dsx
built ... reiNAND.smdh
Oh well... care to shoot me a pull request? I can't test cause I'm a Windows user.

By the way, the same problem should be in @Reisyukaku's code as well. Maybe better to shoot him a prull request.
 
Last edited by d0k3,

m45t3r

Well-Known Member
Member
Joined
Jul 17, 2007
Messages
243
Trophies
0
Website
Visit site
XP
422
Country
Brazil
Alright, I'll help you (because I'm a nice person ;)).

Download Brahma2Loader source code, also don't forget about libkhax. In Brahma2Loaders resource dir, you'll find a file called "AppInfo". Contents:
Code:
#---------------------------------------------------------------------------------
# APP_TITLE: Name of the homebrew app, also name of folder and .3DSX/.SMDH
# APP_DESCRIPTION: Description of the homebrew app in HB launcher
# APP_AUTHOR: Author of the homebrew app, also display in HB launcher
#
# PAYLOAD_PATH: Path to the ARM9 payload on the 3DS SD card (don't forget "//")
# PAYLOAD_OFFSET: Offset of the ARM9 payload in the file given above
#
# If PAYLOAD_PATH is not given, payload is loaded from memory (data dir in source)
# PAYLOAD_OFFSET is optional if offset is 0x00000000
#---------------------------------------------------------------------------------

APP_TITLE = BrahmaLoader
APP_DESCRIPTION = Brahma based loader.
APP_AUTHOR = patois, delebile & d0k3

# PAYLOAD_PATH = /payload.bin
# PAYLOAD_OFFSET = 0x00000000

replace:
# PAYLOAD_OFFSET = 0x00000000
with
PAYLOAD_OFFSET = 0x12000

and:
# PAYLOAD_PATH = /payload.bin
with (for ReiNAND):
PAYLOAD_PATH = //ReiNand.dat
with (for CakesFW):
PAYLOAD_PATH = //Cakes.dat
with (for rxTools):
PAYLOAD_PATH = //rxTools/sys/code.bin

Set APP_TITLE, APP_DESCRIPTION and APP_AUTHOR as you wish (but credit the original authors). Also replace the icon as you wish. Compile and you get a fully functional Ninjhax loader. And yes, you can post this here (binaries and source code) cause there is nothing critical in there. All free code :).


Note (to be sure): Only the (modified) Brahma Loader (and the compiled 3DSX/SMDH) can be posted here, not the actual ReiNAND CFW. If you post anything, credit the original authors!

EDIT: I figured I'd just attach a functional copy of the Brahma2Loader source code. Can be compiled right away, but you may wish to modify it as described above. Have fun!

Well, tried to do this (for rxTools). Compiled and runs fine, however I only got a black screen and after a while I got back to Homebrew Launcher.

I am using Linux, btw.
 

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Well, tried to do this (for rxTools). Compiled and runs fine, however I only got a black screen and after a while I got back to Homebrew Launcher.

I am using Linux, btw.
I think it shouldn't matter if Linux or Windows here. You have the //rxTools/sys/code.bin file on your SD card and your 3DS is on an exploitable FW? Does rxTools run via a different way on your 3DS (memset, f.e.)? Try that first, just to make sure rxTools files are okay! Also, could you show me your AppInfo?
 
Last edited by d0k3,

m45t3r

Well-Known Member
Member
Joined
Jul 17, 2007
Messages
243
Trophies
0
Website
Visit site
XP
422
Country
Brazil
I think it shouldn't matter if Linux or Windows here. You have the //rxTools/sys/code.bin file on your SD card and your 3DS is on an exploitable FW? Does rxTools run via a different way on your 3DS (memset, f.e.)?Try that first! Also, could you show me your AppInfo?

Yep, I was autobooting rxTools before using HomeMenuHax (decided to do this for fun). I can run it too using DS Profile (downgraded mset). Btw, I am on firmware 9.2. And yes, I am using the lastest version of rxTools that has /rxTools/sys/code.bin instead of rxTools.dat.

I just cloned BrahmaLauncher, changed to launcher2 branch, download and copied the contents from libkhax-master in source/libkhax, compiled and installed in 3DS. My AppInfo file is in attachment (had to add .txt extension to allow upload in here).
 

Attachments

  • AppInfo.txt
    854 bytes · Views: 244

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
Nice job on the release. CakeBrah also uses libkhax/brahma2, so I don't think there would be a huge difference, but I might try it out for fun.
 
  • Like
Reactions: d0k3

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Yep, I was autobooting rxTools before using HomeMenuHax (decided to do this for fun). I can run it too using DS Profile (downgraded mset). Btw, I am on firmware 9.2. And yes, I am using the lastest version of rxTools that has /rxTools/sys/code.bin instead of rxTools.dat.

I just cloned BrahmaLauncher, changed to launcher2 branch, download and copied the contents from libkhax-master in source/libkhax, compiled and installed in 3DS. My AppInfo file is in attachment (had to add .txt extension to allow upload in here).
Okay, let's try something else then... Remove the PAYLOAD_OFFSET and PAYLOAD_PATH lines from the AppInfo file (or just put # in front). Copy the code.bin into the BrahmaLoader data dir, then remove the first 0x12000 byte from it (via HxD for example). Compile and it should work. It should have worked before, though.
 

Orkna

Well-Known Member
Member
Joined
Feb 7, 2014
Messages
379
Trophies
0
Location
Sviiiiiden
XP
277
Country
Last edited by Orkna,

m45t3r

Well-Known Member
Member
Joined
Jul 17, 2007
Messages
243
Trophies
0
Website
Visit site
XP
422
Country
Brazil
Okay, let's try something else then... Remove the PAYLOAD_OFFSET and PAYLOAD_PATH lines from the AppInfo file (or just put # in front). Copy the code.bin into the BrahmaLoader data dir, then remove the first 0x12000 byte from it (via HxD for example). Compile and it should work. It should have worked before, though.

Same result, however this time I got a red screen in the bottom screen.

Don't know if I removed the first 0x12000 bytes correctly. I converted hex to decimal (got 73728) and used the following command:

Code:
$ dd bs=1 skip=73728 if=code.bin of=code_mod.bin

Afterwards, I copied the result in the folder data and compiled (after doing a "make clean").
 

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Same result, however this time I got a red screen in the bottom screen.

Don't know if I removed the first 0x12000 bytes correctly. I converted hex to decimal (got 73728) and used the following command:

Code:
$ dd bs=1 skip=73728 if=code.bin of=code_mod.bin

Afterwards, I copied the result in the folder data and compiled (after doing a "make clean").
Strange. I need to find out what happens here. Let me get back to you about that later. Maybe someone else can try it, too?

No problem :). I'll just see how you fixed it in the original source code.
 

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Red screen here too (trying rei) but I got the same with the original source. Boot via mset works.
Is this on Ninjhax 2.1, HomeMenuHax 1.2, (it worked for me on both) or even something other? We need to keep in mind, this kind of Hax are still pretty much bleeding edge, so unexpected stuff happens. :/
 

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Homemenuhax 1.3. N3DS fw 9.2
Dammit... The original source will not work on those newer Hax at all. It's pretty strange you got the same error for both then, though. You used the loader2 branch for Brahma Loader (or used git/github to clone), correct?
 

Orkna

Well-Known Member
Member
Joined
Feb 7, 2014
Messages
379
Trophies
0
Location
Sviiiiiden
XP
277
Country
Dammit... The original source will not work on those newer Hax at all. It's pretty strange you got the same error for both then, though. You used the loader2 branch for Brahma Loader (or used git/github to clone), correct?

I had to clone rei's repo first and then replace the brahma-folder. I may have done something wrong. I will try again.
Edit: Eh, no, I don't remember what i did. lol
 
Last edited by Orkna,

Orkna

Well-Known Member
Member
Joined
Feb 7, 2014
Messages
379
Trophies
0
Location
Sviiiiiden
XP
277
Country
Yeah. Got it.
git clone --recursive https://github.com/d0k3/ReiNand.git
It will complain.
cd ReiNand
Remove empty BrahmaLoader-folder.
Add BrahmaLoader from repo:
git clone --branch loader2 https://github.com/d0k3/BrahmaLoader.git
cd BrahmaLoader
Remove empty libkhax-folder
Clone libkhax-repo:
git clone https://github.com/Myriachan/libkhax
cd back to start folder
Fix any wrong filenames in code:
find . -type f -exec sed -i 's/reiNand/ReiNand/g' {} +
find . -type f -exec sed -i 's/reiNAND/ReiNand/g' {} +
find . -type f -exec sed -i 's/ReiNAND/ReiNand/g' {} +
copy contents of resources to BrahmaLoader/resources
copy any required file.
compile, and done.

Successful ReiNand boot from HBL booted using Homemenuhax 1.3. :)

Edit: Rename ReiNand.3dsx to boot.3dsx, put in sd-root. Auto boot ReiNand with Homemenuhax 1.3.
 
Last edited by Orkna,
  • Like
Reactions: klear and d0k3

daxtsu

Well-Known Member
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
Yeah. Got it.
git clone --recursive https://github.com/d0k3/ReiNand.git
It will complain.
cd ReiNand
Remove empty BrahmaLoader-folder.
Add BrahmaLoader from repo:
git clone --branch loader2 https://github.com/d0k3/BrahmaLoader.git
cd BrahmaLoader
Remove empty libkhax-folder
Clone libkhax-repo:
git clone https://github.com/Myriachan/libkhax
cd back to start folder
Fix any wrong filenames in code:
find . -type f -exec sed -i 's/reiNand/ReiNand/g' {} +
find . -type f -exec sed -i 's/reiNAND/ReiNand/g' {} +
find . -type f -exec sed -i 's/ReiNAND/ReiNand/g' {} +
copy contents of resources to BrahmaLoader/resources
copy any required file.
compile, and done.

Successful ReiNand boot from HBL booted using Homemenuhax 1.3. :)

Could've saved yourself some headaches with git submodule update --init --recursive, although the BrahmaLoader submodule is messed up.

Code:
fatal: reference is not a tree: e91330fab181cc15d595065229fd907229aa5796
Unable to checkout 'e91330fab181cc15d595065229fd907229aa5796' in submodule path
'BrahmaLoader'

I worked around it by cd'ing into BrahmaLoader and typing git checkout.
 
  • Like
Reactions: d0k3 and Orkna

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Yeah. Got it.
git clone --recursive https://github.com/d0k3/ReiNand.git
It will complain.
cd ReiNand
Remove empty BrahmaLoader-folder.
Add BrahmaLoader from repo:
git clone --branch loader2 https://github.com/d0k3/BrahmaLoader.git
cd BrahmaLoader
Remove empty libkhax-folder
Clone libkhax-repo:
git clone https://github.com/Myriachan/libkhax
cd back to start folder
Fix any wrong filenames in code:
find . -type f -exec sed -i 's/reiNand/ReiNand/g' {} +
find . -type f -exec sed -i 's/reiNAND/ReiNand/g' {} +
find . -type f -exec sed -i 's/ReiNAND/ReiNand/g' {} +
copy contents of resources to BrahmaLoader/resources
copy any required file.
compile, and done.

Successful ReiNand boot from HBL booted using Homemenuhax 1.3. :)

Edit: Rename ReiNand.3dsx to boot.3dsx, put in sd-root. Auto boot ReiNand with Homemenuhax 1.3.
Could've saved yourself some headaches with git submodule update --init --recursive, although the BrahmaLoader submodule is messed up.

Code:
fatal: reference is not a tree: e91330fab181cc15d595065229fd907229aa5796
Unable to checkout 'e91330fab181cc15d595065229fd907229aa5796' in submodule path
'BrahmaLoader'

I worked around it by cd'ing into BrahmaLoader and typing git checkout.
Thanks, both of you! I'll figure out what's wrong with the repo later. Still doesn't explain what's wrong for those just trying to modify BrahmaLoader, though!

EDIT: Okay, looks fine now. No idea how the submodule got messed up.
 
Last edited by d0k3,
  • Like
Reactions: daxtsu

d0k3

3DS Homebrew Legend
OP
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
... and here's something else for you: Brahma2Loader source code & binaries, already modified for rxTools (binaries are in folder "/output/"). Untested, cause I can't test right now. There's no reason it should not work though.

@m45t3r, you can try if this one works for you. As for the one you compiled yourself... Is your CTRUlib on a fairly recent version? Also, @Asia81, you asked for this too ;).
 

Attachments

  • Brahma2Loader_rxTools.zip
    175.1 KB · Views: 235
Last edited by d0k3,

Shadowtrance

Well-Known Member
Member
Joined
May 9, 2014
Messages
2,493
Trophies
0
Location
Hervey Bay, Queensland
XP
1,807
Country
Dammit... The original source will not work on those newer Hax at all. It's pretty strange you got the same error for both then, though. You used the loader2 branch for Brahma Loader (or used git/github to clone), correct?
Works for me. :P
Just built brahmaloader2 pointing to my reiNand.dat, turned on my 3ds and booted into HB menu (themehax/homemenuhax) then loaded the newly created reinand 3dsx from HB menu (ninjhax 2.1).
 
  • Like
Reactions: d0k3

m45t3r

Well-Known Member
Member
Joined
Jul 17, 2007
Messages
243
Trophies
0
Website
Visit site
XP
422
Country
Brazil
... and here's something else for you: Brahma2Loader source code & binaries, already modified for rxTools (binaries are in folder "/output/"). Untested, cause I can't test right now. There's no reason it should not work though.

@m45t3r, you can try if this one works for you. As for the one you compiled yourself... Is your CTRUlib on a fairly recent version? Also, @Asia81, you asked for this too ;).

CTRUlib is from lastest git, commit b9e5ddb.

Tried the pre-compiled binaries on attachment, black screen and reboot to Homebrew Launcher. I am using HomeMenuHax 1.3 (unofficial, posted somewhere in GBATemp), through. Homebrew Launcher itself is the official release from smealum. Tried booting from Homebrew Launcher and directly from HomeMenuHax.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • K3Nv2 @ K3Nv2:
    They still have but it's like $10 cookies honestly not a bad deal for $5
  • K3Nv2 @ K3Nv2:
    Bidenomics
  • BigOnYa @ BigOnYa:
    True, everything almost double nowadays
  • K3Nv2 @ K3Nv2:
    But I could go to Aldis and get a cookie pie for like $4
  • BigOnYa @ BigOnYa:
    Or use your new cooking pan and make some, don't mind the Old leftover foods mixed in.
  • K3Nv2 @ K3Nv2:
    Just eat plain flour around cops
  • BigOnYa @ BigOnYa:
    thats Gluten abuse, they would shoot you
  • K3Nv2 @ K3Nv2:
    Depends on the color chart
  • K3Nv2 @ K3Nv2:
    Wheat flour has a lower chance at survival
  • Veho @ Veho:
    Isn't wheat flour the whitest of the white?
  • Veho @ Veho:
    Rye would get shot at sight.
    +1
  • K3Nv2 @ K3Nv2:
    Depends
    img_5941-1.jpeg
    everyone mixing their flour now days
  • Veho @ Veho:
    That's whole wheat, right? Because all purpose flour is also made from wheat.
  • K3Nv2 @ K3Nv2:
    I'm not a flour expert I just snort it
  • BigOnYa @ BigOnYa:
    There also is black rice flour, and its really black colored
  • Veho @ Veho:
    Bruh that's gray.
  • K3Nv2 @ K3Nv2:
    That's ancientboi color
    +1
  • Veho @ Veho:
    You need to add some activated charcoal.
    +1
  • BigOnYa @ BigOnYa:
    I've seen some that are dark dark, my wifey uses it sometimes in her bs recipes
  • Veho @ Veho:
    Cool.
  • SylverReZ @ SylverReZ:
    @BigOnYa, Seems like your wifey likes hers black. :creep:
  • Veho @ Veho:
    "BS" stands for "Bowel Scraping" because that's what whole grain does.
    +1
    Veho @ Veho: "BS" stands for "Bowel Scraping" because that's what whole grain does. +1