Homebrew RELEASE Open source horizon nand-dumper

asdfaaasssdddfff

New Member
Newbie
Joined
Sep 15, 2018
Messages
3
Reaction score
18
Trophies
0
Age
38
XP
92
Country
United States
This is an open source tool which dumps the nand from horizon. (like the reinx-toolbox)
I made this because I dislike that the reinx-toolbox is being kept close-source for no apparent reason since all the information needed to dump the nand from horizon is already public.

It's mostly a direct port of this pegaswitch-script. (github_com/reswitched/pegaswitch/blob/master/usefulscripts/DumpBIS.js)
It will dump boot0+1, prodinfo and the rawnand to the root of the sdcard, automatically splitting the file if on a fat32-sdcard.

Warning: This may or may not result in a corrupted backup, I take no responsibility whatsoever for bricks.
If you want a proper backup use hekate which has proper backup-verification.

If you want a horizon-nand-dumper, the reinx toolbox is probably better than this (idk, I can't look at the source code).

License: MIT
 

Attachments

Last edited by asdfaaasssdddfff,
This is an open source tool which dumps the nand from horizon. (like the reinx-toolbox)
I made this because I dislike that the reinx-toolbox is being kept close-source for no apparent reason since all the information needed to dump the nand from horizon is already public.

It's mostly a direct port of this pegaswitch-script. (github_com/reswitched/pegaswitch/blob/master/usefulscripts/DumpBIS.js)
It will dump boot0+1, prodinfo and the rawnand to the root of the sdcard, automatically splitting the file if on a fat32-sdcard.

Warning: This may or may not result in a corrupted backup, I take no responsibility whatsoever for bricks.
If you want a proper backup use hekate which has proper backup-verification.

If you want a horizon-nand-dumper, the reinx toolbox is probably better than this (idk, I can't look at the source code).

Cool work :)
 
Last edited by Adran_Marit,
Why would we use this? You are not a known dev its probably a brick code

This is not compiled, so you have to compile it yourself. Meaning you can look at the code, see what its doing and improve it if you wish.

All dev's have to start somewhere.
 
  • Like
Reactions: Cyan
Why would we use this? You are not a known dev its probably a brick code
you were complaining yet you don't even open the attachment do you?
there's no binary provided, and I'm no Switch dev but based on what I saw, it doesn't look like it (whether it's working as intended or not I don't know)
 
  • Like
Reactions: comput3rus3r
  • Like
Reactions: EliseZeroTwo
I love how a user with an extremely random username @asdfaaasssdddfff and no other activity posts some script, then another person who also only registered yesterday and also only posted on this thread vouches for it.
This just has attention written all over it, even with the source attached.
 
Good work! As the writer of the reins toolkit dumper I can say you have the right idea here. I was planning to release the source for mine at some point but just been very busy recently. While I would love to have everyone use my stuff I think its great that other people are learning to code and making contributions.

If you ever want to talk to other devs, share ideas and code why don't you consider dropping by the reiswitched discord server and talking to the people on there.

Cheers,

-caly0
 
I love how a user with an extremely random username @asdfaaasssdddfff and no other activity posts some script, then another person who also only registered yesterday and also only posted on this thread vouches for it.
This just has attention written all over it, even with the source attached.

Even calypso who is one of the Reiswitched discord devs (the one who wrote their dump code) said good work and approves it. That says more than enough for me that it is legit and worth any and all attention it is given


Hmm, now I wonder which one dumps faster: the open-source version or the toolkit?
No idea, would be a nice thing to test
 
  • Like
Reactions: tiliarou
Did not know the ReiNX Toolkit is closed-source, that's pretty shitty. Newfound disrespect for that project...
Good work! As the writer of the reins toolkit dumper I can say you have the right idea here. I was planning to release the source for mine at some point but just been very busy recently. While I would love to have everyone use my stuff I think its great that other people are learning to code and making contributions.

If you ever want to talk to other devs, share ideas and code why don't you consider dropping by the reiswitched discord server and talking to the people on there.

Cheers,

-caly0

no what's shitty is finding disrespect for the project when they have every intent to release the source for the toolkit.

but that's just my opinion
 
  • Like
Reactions: tiliarou
no what's shitty is finding disrespect for the project when they have every intent to release the source for the toolkit.
No need to be brash! I missed that statement. Though, still a bit unnerving to see the release of said project without a proper source accompanying it, even if its being promised at a later date!
 
  • Like
Reactions: Meepers55
No need to be brash! I missed that statement. Though, still a bit unnerving to see the release of said project without a proper source accompanying it, even if its being promised at a later date!

Sorry u.u

I understand why they delayed their release though apart from been busy, I doubt they wanted TX to instantly copy it
 
I love how a user with an extremely random username @asdfaaasssdddfff and no other activity posts some script, then another person who also only registered yesterday and also only posted on this thread vouches for it.
This just has attention written all over it, even with the source attached.
Look at the code, it's pretty simple, there's nothing suspicious here...
 
For those LAZY to open it up and read it:
Also, Coming up on your next SX OS:

Code:
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/statvfs.h>
#include <unistd.h>
#include <switch.h>

#define MIN(x, y) (((x) < (y)) ? (x) : (y))

/*
This is basically a port of this pegaswitch-script:
https://github.com/reswitched/pegaswitch/blob/master/usefulscripts/DumpBIS.js
*/

int partitionIds[] = {0, 10, 27, 20};
char *partitionNames[] = {"BOOT0", "BOOT1", "PRODINFO", "rawnand"};

#define BufSize 0x500000

long GetAvailableSpace(const char *path)
{
    struct statvfs stat;

    if (statvfs(path, &stat) != 0)
    {
        // error happens, just quits here
        return -1;
    }

    // the available size is f_bsize * f_bavail
    return stat.f_bsize * stat.f_bavail;
}

int dumpPartition(int partitionIndex)
{
    printf("\n%s\n", partitionNames[partitionIndex]);
    int id = partitionIds[partitionIndex];

    char *buffer = malloc(BufSize);

    FsStorage partition;
    fsOpenBisStorage(&partition, id);
    u64 size = 0;
    fsStorageGetSize(&partition, &size);

    if (GetAvailableSpace("/") < size)
    {
        consoleClear();
        fsStorageClose(&partition);
        printf("Not enough space left on the sd!\n");
        while (appletMainLoop())
        {

            hidScanInput();
            u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);

            if (kDown & KEY_PLUS)
                break;

            gfxFlushBuffers();
            gfxSwapBuffers();
        }
        return -1;
    }

    int file_num = 0;

    char filename[100];
    sprintf(filename, "/%s.bin", partitionNames[partitionIndex]);

    FILE *partitionfile = fopen(filename, "wb");

    u64 curPos = 0;

    bool isFat32 = false;

    // dump loop
    while (appletMainLoop())
    {
        u64 readSize = MIN(size - curPos, BufSize);
        if (readSize == 0)
            break;

        fsStorageRead(&partition, curPos, buffer, readSize);

        u64 sucessfullyWriten = fwrite(buffer, 1, readSize, partitionfile);

        curPos += sucessfullyWriten;

        if (sucessfullyWriten < readSize)
        {
            fclose(partitionfile);
            // Filesystem doesn't support big files
            if(!isFat32) {
                char oldFilename[100];
                strcpy(oldFilename, filename);
                sprintf(filename, "/%s_%d.bin", partitionNames[partitionIndex], file_num++);
                rename(oldFilename, filename);
                isFat32 = true;
            }
            sprintf(filename, "/%s_%d.bin", partitionNames[partitionIndex], file_num++);
            partitionfile = fopen(filename, "wb");
        }


        printf("\r%lu/%lu", curPos, size);

        gfxFlushBuffers();
        gfxSwapBuffers();
    }
    fclose(partitionfile);
    fsStorageClose(&partition);
    free(buffer);

    return 0;
}

int main(int argc, char **argv)
{
    gfxInitDefault();
    consoleInit(NULL);

    printf("ATTENTION, DO NOT USE THIS AS YOUR PRIMARY BACKUP!\n");
    printf("I'm serious: I'll not be responsible for any bricks because of this!\n");
    printf("Press + if you want to continue\n");

    while (appletMainLoop())
    {
        hidScanInput();
        u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);

        if (kDown & KEY_PLUS)
            break;

        gfxFlushBuffers();
        gfxSwapBuffers();
    }
  
    consoleClear();

    for (int i = 0; i < (sizeof(partitionIds) / sizeof(int)); i++)
    {
        if(dumpPartition(i) != 0)
            return 0;
    }

    printf("\nDump complete!\nPress + to exit");

    while (appletMainLoop())
    {
        hidScanInput();
        u64 kDown = hidKeysDown(CONTROLLER_P1_AUTO);

        if (kDown & KEY_PLUS)
            break;

        gfxFlushBuffers();
        gfxSwapBuffers();
    }

    gfxExit();
    return 0;
}
 

Site & Scene News

Popular threads in this forum