Hacking [Release] 3DSafe: In-NAND PIN lock for 3DS

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,084
Country
https://github.com/Plailect/Guide/wiki/Updating-arm9loaderhax
Ah, I'm almost positive it should work as I thought then. Seems like the same, simple process described here. Thanks!
Hmm, it seems it's not as simple as I put in the instructions. I think I had updated it previously when screen init was first released, so I already had the necessary additional files. I forgot about that so didn't mention it. I'll incorporate those additional steps into the installation instructions at some point. Thanks for the heads-up!
 

MadMageKefka

Well-Known Member
Member
Joined
Apr 28, 2016
Messages
1,672
Trophies
0
Age
36
Location
World of ruin
XP
1,915
Country
United States
Hmm, it seems it's not as simple as I put in the instructions. I think I had updated it previously when screen init was first released, so I already had the necessary additional files. I forgot about that so didn't mention it. I'll incorporate those additional steps into the installation instructions at some point. Thanks for the heads-up!
Oh, I see. So then I would want to update first, THEN install this? Eh, I'll just find out when you update the tutorial, Thanks again! So glad someone is finally making something like this. I use my Majora's Mask edition at work all the time and dread I leave it behind or someone grabs it. I'm always very careful and already have fairly good protection on it, but this will even protect it from people who understand 3DS hacks and the contact info thing is EXACTLY what I need on it!
 

Billy Acuña

Well-Known Member
Member
Joined
Oct 10, 2015
Messages
3,126
Trophies
1
Age
31
XP
3,701
Country
Mexico
Hmm, it seems it's not as simple as I put in the instructions. I think I had updated it previously when screen init was first released, so I already had the necessary additional files. I forgot about that so didn't mention it. I'll incorporate those additional steps into the installation instructions at some point. Thanks for the heads-up!
SafeA9LHInstaller will not let you install 3DSafe if you have a a9lh v1 setup anyways if you don't have the proper data input's files.
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,084
Country
Oh, I see. So then I would want to update first, THEN install this? Eh, I'll just find out when you update the tutorial, Thanks again! So glad someone is finally making something like this. I use my Majora's Mask edition at work all the time and dread I leave it behind or someone grabs it. I'm always very careful and already have fairly good protection on it, but this will even protect it from people who understand 3DS hacks and the contact info thing is EXACTLY what I need on it!
No, there's no need to do that. You can just update from A9LH v1 as long as you have the correct files in position (as per the page you linked to from Plailect's guide) but substitute the 3DSafe payloads.

SafeA9LHInstaller will not let you install 3DSafe if you have a a9lh v1 setup anyways if you don't have the proper data input's files.
I suspected it would just fail, so I'll update the instructions in case people want to install it who have never updated their A9LH so might not have those files in place.

Right now I'm working on an image drawing function :D
 
  • Like
Reactions: Billy Acuña

MadMageKefka

Well-Known Member
Member
Joined
Apr 28, 2016
Messages
1,672
Trophies
0
Age
36
Location
World of ruin
XP
1,915
Country
United States
No, there's no need to do that. You can just update from A9LH v1 as long as you have the correct files in position (as per the page you linked to from Plailect's guide) but substitute the 3DSafe payloads.


I suspected it would just fail, so I'll update the instructions in case people want to install it who have never updated their A9LH so might not have those files in place.
Ah, I understand now.
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,084
Country
Just got image display working in an A9LH payload. Although this doesn't look too impressive, it was really quite complicated. There's a very limited amount of RAM available, and I was only able to load about 100 pixels worth of image data at a time, otherwise the 3DS would just lock up when allocating the memory for the loaded file. So I had to devise a method of splitting the image up into tiles, reading the data for each tile individually, and copying them to the framebuffer one at a time so that only one tile was in memory at any point. It needs some optimisation, but it works :) More beautiful 3DSafe is now possible :D

IMG_0018.JPG
 

Billy Acuña

Well-Known Member
Member
Joined
Oct 10, 2015
Messages
3,126
Trophies
1
Age
31
XP
3,701
Country
Mexico
Just got image display working in an A9LH payload. Although this doesn't look too impressive, it was really quite complicated. There's a very limited amount of RAM available, and I was only able to load about 100 pixels worth of image data at a time, otherwise the 3DS would just lock up when allocating the memory for the loaded file. So I had to devise a method of splitting the image up into tiles, reading the data for each tile individually, and copying them to the framebuffer one at a time so that only one tile was in memory at any point. It needs some optimisation, but it works :) More beautiful 3DSafe is now possible :D

View attachment 62291
Just curious. Did you tried a bin format image (like most of splashes)?
Althought dunno if you are loading the image from SD or ctrnand...
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,084
Country
Just curious. Did you tried a bin format image (like most of splashes)?
Althought dunno if you are loading the image from SD or ctrnand...
Yeah I'm using bin format images. The problem isn't with the image loading actually, it's with the buffer for the image. For example, even doing this causes A9LH to hang:

Code:
//Create a buffer large enough for all three colour channels of the whole screen
u8 im[400*420*3];

I think there's not enough memory allocated for A9LH to contain that amount of data and it's overrunning. So I'm iterating over each row of pixels, and within each I'm dividing the row up into columns of 40 pixels. I then read 120 bytes from the file (40 pixels * 3 channels) starting from the beginning of that column for that row, and draw that on the screen.

The problem is that it's a lot of filesystem access, as it has to open the file every time. It's quite slow whether reading the file from SD or CTRNAND (I tried both). I might play with some custom file reading routines to avoid opening and closing the file every time to see if that improves it.
 

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,084
Country
Hourglass9 displays an image on the bottom screen, maybe look into how it does that.
Thanks, I'll have a look at the code.

As it happens, I've just drastically improved the image loading function. Before, I was using a helper function which opened the file, seeked to the read offset location, read the bytes to the buffer, and then closed the file. I was repeating this for every 40 pixels, which in a 400*240 image resulted in 2400 open-seek-read-close operations! I've now rewritten this so it opens the file once, does all the seek/read operations, then closes the file once. It's considerably faster now :)

--------------------- MERGED ---------------------------

Oh, and I've just realised the explicit seek operation isn't required. Unless you close the file, the next read operation will continue where the last left off. So I can just open, read ((width*height)/40) times, then close. It's really fast now :)
 

GerbilSoft

Well-Known Member
Member
Joined
Mar 8, 2012
Messages
2,395
Trophies
2
Age
35
XP
4,277
Country
United States
Yeah I'm using bin format images. The problem isn't with the image loading actually, it's with the buffer for the image. For example, even doing this causes A9LH to hang:

Code:
//Create a buffer large enough for all three colour channels of the whole screen
u8 im[400*420*3];
You're attempting to allocate ~492 KB on the stack. That's probably not available with the ARM9 linker script you're using, and there's no point in doing that anyway.

If you check out Luma3DS's splash screen code at https://github.com/AuroraWright/Lum...edc46f1c40620b4f597923835c8/source/draw.c#L35 :
Code:
    fileRead(fb->top_left, "/luma/splash.bin");
    fileRead(fb->bottom, "/luma/splashbottom.bin");
it loads the splash screen files directly into the framebuffer.

Hourglass9 does something similar if an h9logo.bin is found:
Code:
FileGetData("h9logo.bin", BOT_SCREEN0, 320 * 240 * 3, 0);
where BOT_SCREEN0 is a macro that's basically a pointer to the bottom screen's framebuffer.
 
Last edited by GerbilSoft, , Reason: +Hourglass9

mashers

Stubborn ape
OP
Member
Joined
Jun 10, 2015
Messages
3,837
Trophies
0
Age
40
Location
Kongo Jungle
XP
5,084
Country
Surprising considering it is linked at least ten times a day in this forum :-p
Well I know what it is, I just haven't read it.

I just perma bricked my N3DS by installing this lol
What did you do?

@mashers

so this version of payload means its have screen init?
Yes.

when i try to install 0.4 it says otp hash or nand key sector are invalid
Do you already have 3DSafe installed? If so what version?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: Why so serious!