1. asdfaaasssdddfff

    OP asdfaaasssdddfff Newbie
    Newcomer

    Joined:
    Sep 15, 2018
    Messages:
    3
    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
     

    Attached Files:

    Last edited by asdfaaasssdddfff, Sep 15, 2018
  2. Adran_Marit

    Adran_Marit Walküre's Hacker
    Member

    Joined:
    Oct 3, 2015
    Messages:
    2,560
    Country:
    Australia
    Cool work :)
     
    Last edited by Adran_Marit, Sep 15, 2018
  3. dragon_from_iso

    dragon_from_iso GBAtemp Regular
    Member

    Joined:
    Dec 24, 2011
    Messages:
    156
    Why would we use this? You are not a known dev its probably a brick code
     
  4. EliseZeroTwo

    EliseZeroTwo Member
    Newcomer

    Joined:
    Sep 14, 2018
    Messages:
    47
    Country:
    United Kingdom
    i can vouch for this not being brick code, i just read the source it literally reads directly from the nand into the file...
     
    Last edited by EliseZeroTwo, Sep 15, 2018
  5. InsaneNutter

    InsaneNutter GBAtemp Advanced Fan
    Member

    Joined:
    Dec 26, 2007
    Messages:
    886
    Country:
    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.
     
    Cyan likes this.
  6. Garou

    Garou GBAtemp Maniac
    Member

    Joined:
    Jan 13, 2015
    Messages:
    1,200
    Country:
    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)
     
    comput3rus3r likes this.
  7. Adran_Marit

    Adran_Marit Walküre's Hacker
    Member

    Joined:
    Oct 3, 2015
    Messages:
    2,560
    Country:
    Australia
    I can also verify the authenticity of the dev and elisezerotwo
     
    EliseZeroTwo likes this.
  8. EliseZeroTwo

    EliseZeroTwo Member
    Newcomer

    Joined:
    Sep 14, 2018
    Messages:
    47
    Country:
    United Kingdom
    thank you senpai OwO
     
    Draxzelex and Adran_Marit like this.
  9. dragon_from_iso

    dragon_from_iso GBAtemp Regular
    Member

    Joined:
    Dec 24, 2011
    Messages:
    156
    Im still not using it.
     
  10. Adran_Marit

    Adran_Marit Walküre's Hacker
    Member

    Joined:
    Oct 3, 2015
    Messages:
    2,560
    Country:
    Australia
    No one is forcing you to use it.

    Neither is the dev or elisezerotwo
     
    tiliarou, EliseZeroTwo and opmas like this.
  11. wurstpistole

    wurstpistole GBAtemp MVP
    Member

    Joined:
    Nov 19, 2015
    Messages:
    4,343
    Country:
    United Kingdom
    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.
     
  12. palantine

    palantine GBAtemp Regular
    Member

    Joined:
    Oct 5, 2014
    Messages:
    174
    Country:
    Italy
    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
     
  13. Draxzelex

    Draxzelex GBAtemp Legend
    Member

    Joined:
    Aug 6, 2017
    Messages:
    11,581
    Country:
    United States
    Hmm, now I wonder which one dumps faster: the open-source version or the toolkit?
     
  14. Adran_Marit

    Adran_Marit Walküre's Hacker
    Member

    Joined:
    Oct 3, 2015
    Messages:
    2,560
    Country:
    Australia
    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


    No idea, would be a nice thing to test
     
    tiliarou likes this.
  15. Huntereb

    Huntereb GBAtemp Psycho!
    Member

    Joined:
    Sep 1, 2013
    Messages:
    3,252
    Country:
    United States
    Did not know the ReiNX Toolkit is closed-source, that's pretty shitty. Newfound disrespect for that project...
     
  16. Adran_Marit

    Adran_Marit Walküre's Hacker
    Member

    Joined:
    Oct 3, 2015
    Messages:
    2,560
    Country:
    Australia
    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
     
    tiliarou likes this.
  17. Huntereb

    Huntereb GBAtemp Psycho!
    Member

    Joined:
    Sep 1, 2013
    Messages:
    3,252
    Country:
    United States
    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!
     
    Meepers55 likes this.
  18. Adran_Marit

    Adran_Marit Walküre's Hacker
    Member

    Joined:
    Oct 3, 2015
    Messages:
    2,560
    Country:
    Australia
    Sorry u.u

    I understand why they delayed their release though apart from been busy, I doubt they wanted TX to instantly copy it
     
  19. eliboa

    eliboa GBAtemp Regular
    Member

    Joined:
    Jan 13, 2016
    Messages:
    141
    Country:
    France
    Look at the code, it's pretty simple, there's nothing suspicious here...
     
  20. ScarletDreamz

    ScarletDreamz [Debug Mode]
    Member

    Joined:
    Feb 16, 2015
    Messages:
    3,877
    Country:
    United States
    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;
    }
    
    
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - horizon, source, dumper