[Release] FirmwareDownloader

Discussion in '3DS - Homebrew Development and Emulators' started by machinamentum, Apr 4, 2016.

  1. machinamentum
    OP

    machinamentum GBAtemp Regular

    Member
    163
    450
    Jul 5, 2015
    United States
    This is a small app i've been working on as a side project. It downloads firmware files from NUS and packages them as CIAs for ease of upgrading/downgrading.

    NOTE: since many factory installed titles (and some older titles) aren't available on NUS anymore, this cannot download all titles needed for a complete downgrade or a complete region change.

    Attempts to download all available titles for chosen firmware. 404s are skipped. Firmwares are downloaded to /3ds/FirmwareDownloader/updates/<system>_<region>/<firmware_version>.
    ctr = Old3DS, ktr = New3DS.

    Controls: LEFT/RIGHT move cursor. UP/DOWN change value. START exit from menu.
    When downloading, the app doesn't check input again until all titles have been downloaded, so the only way to exit is L+R+DOWN+B (on hax versions that support this).

    Releases: https://github.com/machinamentum/FirmwareDownloader/releases
    Source: https://github.com/machinamentum/FirmwareDownloader

    License: GPL to comply with the usage of code from make_cdn_cia.

    Credits:
    yellows8 - nintendo update reports
    Based on code from 3DNUS & UpdateCDN (ground & cearp), sslc and httpc examples, and make_cdn_cia (3DSGuy)
     
    Last edited by machinamentum, Apr 4, 2016
  2. RednaxelaNnamtra

    RednaxelaNnamtra GBAtemp Advanced Fan

    Member
    743
    632
    Dec 8, 2011
    Gambia, The
    To check them every time, it would need a md5 list, and somebody would need to keep it updated.
     
  3. machinamentum
    OP

    machinamentum GBAtemp Regular

    Member
    163
    450
    Jul 5, 2015
    United States
    As far as the integrity of the CIA files go, the app uses the same code as make_cdn_cia, so they'll be as safe as any CIA generated with that tool. If there's any discrepancies detected by the make_cdn_cia code, they'll be printed to the screen. I've installed several CIAs downloaded with this tool without problem.
     
  4. SmellyPirateMonkey

    SmellyPirateMonkey GBAtemp Fan

    Member
    346
    99
    Sep 18, 2015
    United States
    Handy. Thanks for your work
     
  5. cearp

    cearp the ticket master

    Member
    7,392
    4,641
    May 26, 2008
    Tuvalu
    nice work! it would be nice if you implemented some FunkyCIA stuff, like grabbing the ticket.db - then we could make our own cias from store bought stuff :)
    although i personally like it on the computer because i can automate it.

    plus, tickets can be updated while the contents will still work the same, giving a different hash... so not truly reliable.
    have there really been any cias out there that are corrupt but still install, bricking your system? i think it's just people being paranoid - or the installers fault if there are any problems... no?
     
    Progamer444 likes this.
  6. cearp

    cearp the ticket master

    Member
    7,392
    4,641
    May 26, 2008
    Tuvalu
    hi, i'm not sure what i am doing wrong - i tried to compile this both on my mac and then linux (that i just set up right a few hours ago)
    i have compiled other homebrews in the past before, so, i'm not sure what the problem with this one is.

    the code is straight from the zip that github gave me, i didn't edit anything.
    Code:
    user@user-VirtualBox ~/Desktop/FirmwareDownloader-master $ make
    builtin_rootca.der
    main.cpp
    arm-none-eabi-g++ -MMD -MP -MF /home/user/Desktop/FirmwareDownloader-master/build/main.d -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard -I/home/user/Desktop/FirmwareDownloader-master/include -I/opt/devkitpro/libctru/include -I/home/user/Desktop/FirmwareDownloader-master/build -DARM11 -D_3DS -fno-rtti -fno-exceptions -std=c++11 -c /home/user/Desktop/FirmwareDownloader-master/source/main.cpp -o main.o 
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp: In function 'Result DownloadFile(std::__cxx11::string, std::ofstream&)':
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:81:32: error: 'HTTPC_METHOD_GET' was not declared in this scope
         httpcOpenContext(&context, HTTPC_METHOD_GET, (char *)url.c_str(), 1);
                                    ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp: In function 'Result network_request(char*, char*, std::ofstream&)':
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:259:21: error: aggregate 'network_request(char*, char*, std::ofstream&)::addrinfo hints' has incomplete type and cannot be defined
         struct addrinfo hints;
                         ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:264:5: error: 'sslcContext' was not declared in this scope
         sslcContext sslc_context;
         ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:274:45: error: invalid application of 'sizeof' to incomplete type 'network_request(char*, char*, std::ofstream&)::addrinfo'
         memset(&hints, 0, sizeof(struct addrinfo));
                                                 ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:278:53: error: 'getaddrinfo' was not declared in this scope
         if(getaddrinfo(hostname, "443", &hints, &resaddr)!=0)
                                                         ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:285:76: error: invalid use of incomplete type 'struct network_request(char*, char*, std::ofstream&)::addrinfo'
     r(resaddr_cur = resaddr; resaddr_cur!=NULL; resaddr_cur = resaddr_cur->ai_next)
                                                                          ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:259:12: note: forward declaration of 'struct network_request(char*, char*, std::ofstream&)::addrinfo'
         struct addrinfo hints;
                ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:287:39: error: invalid use of incomplete type 'struct network_request(char*, char*, std::ofstream&)::addrinfo'
             if(connect(sockfd, resaddr_cur->ai_addr, resaddr_cur->ai_addrlen)==0)br
                                           ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:259:12: note: forward declaration of 'struct network_request(char*, char*, std::ofstream&)::addrinfo'
         struct addrinfo hints;
                ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:287:61: error: invalid use of incomplete type 'struct network_request(char*, char*, std::ofstream&)::addrinfo'
             if(connect(sockfd, resaddr_cur->ai_addr, resaddr_cur->ai_addrlen)==0)br
                                                                 ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:259:12: note: forward declaration of 'struct network_request(char*, char*, std::ofstream&)::addrinfo'
         struct addrinfo hints;
                ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:290:25: error: 'freeaddrinfo' was not declared in this scope
         freeaddrinfo(resaddr);
                             ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:299:63: error: 'sslcCreateRootCertChain' was not declared in this scope
         ret = sslcCreateRootCertChain(&RootCertChain_contexthandle);
                                                                   ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:307:115: error: 'sslcAddTrustedRootCA' was not declared in this scope
     rtChain_contexthandle, (u8*)builtin_rootca_der, builtin_rootca_der_size, NULL);
                                                                                  ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:312:61: error: 'sslcDestroyRootCertChain' was not declared in this scope
             sslcDestroyRootCertChain(RootCertChain_contexthandle);
                                                                 ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:316:30: error: 'sslc_context' was not declared in this scope
         ret = sslcCreateContext(&sslc_context, sockfd, SSLCOPT_Default, hostname);
                                  ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:316:52: error: 'SSLCOPT_Default' was not declared in this scope
         ret = sslcCreateContext(&sslc_context, sockfd, SSLCOPT_Default, hostname);
                                                        ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:316:77: error: 'sslcCreateContext' was not declared in this scope
         ret = sslcCreateContext(&sslc_context, sockfd, SSLCOPT_Default, hostname);
                                                                                 ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:321:61: error: 'sslcDestroyRootCertChain' was not declared in this scope
             sslcDestroyRootCertChain(RootCertChain_contexthandle);
                                                                 ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:325:81: error: 'sslcContextSetRootCertChain' was not declared in this scope
      ret = sslcContextSetRootCertChain(&sslc_context, RootCertChain_contexthandle);
                                                                                  ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:329:41: error: 'sslcDestroyContext' was not declared in this scope
             sslcDestroyContext(&sslc_context);
                                             ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:330:61: error: 'sslcDestroyRootCertChain' was not declared in this scope
             sslcDestroyRootCertChain(RootCertChain_contexthandle);
                                                                 ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:335:56: error: 'sslcStartConnection' was not declared in this scope
         ret = sslcStartConnection(&sslc_context, NULL, NULL);
                                                            ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:339:41: error: 'sslcDestroyContext' was not declared in this scope
             sslcDestroyContext(&sslc_context);
                                             ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:340:61: error: 'sslcDestroyRootCertChain' was not declared in this scope
             sslcDestroyRootCertChain(RootCertChain_contexthandle);
                                                                 ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:345:73: error: 'sslcWrite' was not declared in this scope
         ret = sslcWrite(&sslc_context, (u8*)http_netreq, strlen(http_netreq));
                                                                             ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:349:41: error: 'sslcDestroyContext' was not declared in this scope
             sslcDestroyContext(&sslc_context);
                                             ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:350:61: error: 'sslcDestroyRootCertChain' was not declared in this scope
             sslcDestroyRootCertChain(RootCertChain_contexthandle);
                                                                 ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:356:48: error: 'sslcRead' was not declared in this scope
         sslcRead(&sslc_context, readbuf, 204, false); // discard HTTP header
                                                    ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:363:45: error: 'sslcDestroyContext' was not declared in this scope
                 sslcDestroyContext(&sslc_context);
                                                 ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:364:65: error: 'sslcDestroyRootCertChain' was not declared in this scope
                 sslcDestroyRootCertChain(RootCertChain_contexthandle);
                                                                     ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:372:37: error: 'sslcDestroyContext' was not declared in this scope
         sslcDestroyContext(&sslc_context);
                                         ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:373:57: error: 'sslcDestroyRootCertChain' was not declared in this scope
         sslcDestroyRootCertChain(RootCertChain_contexthandle);
                                                             ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp: In function 'int main()':
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:576:16: error: too many arguments to function 'Result httpcInit()'
         httpcInit(0);
                    ^
    In file included from /opt/devkitpro/libctru/include/3ds.h:42:0,
                     from /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:18:
    /opt/devkitpro/libctru/include/3ds/services/httpc.h:23:8: note: declared here
     Result httpcInit(void);
            ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:579:15: error: 'sslcInit' was not declared in this scope
         sslcInit(0);
                   ^
    /home/user/Desktop/FirmwareDownloader-master/source/main.cpp:728:14: error: 'sslcExit' was not declared in this scope
         sslcExit();
                  ^
    make[1]: *** [main.o] Error 1
    make: *** [build] Error 2
    
    any help? :) thank you
     
  7. machinamentum
    OP

    machinamentum GBAtemp Regular

    Member
    163
    450
    Jul 5, 2015
    United States
    Install the latest ctrulib from GitHub; yours is outdated.
     
  8. cearp

    cearp the ticket master

    Member
    7,392
    4,641
    May 26, 2008
    Tuvalu
    thanks again for all the help!
     
  9. GuyInDogSuit

    GuyInDogSuit I ain't your pa.

    Member
    1,361
    299
    Aug 1, 2008
    United States
    Antelope, CA
    This is good. I could never get 3DNUS to work.
     
  10. zoogie

    zoogie simple pimp tool

    Member
    6,146
    7,721
    Nov 30, 2014
    United States
    This won't magically make old firmware titles available.
     
    cearp likes this.
  11. GuyInDogSuit

    GuyInDogSuit I ain't your pa.

    Member
    1,361
    299
    Aug 1, 2008
    United States
    Antelope, CA
    I know, but at least you can download those with 3DNUS. Couldn't get it to download new ones.