Homebrew [release] QR Web Installer (cia installer)

  • Thread starter Thread starter ksanislo
  • Start date Start date
  • Views Views 124,398
  • Replies Replies 133
  • Likes Likes 29
Great work so far, I have been watching it for a while now. The biggest issue I'm seeing with it is not really your program itself, half of the cias are compressed. Some even require placing folders/files into the sdcard. There are other programs I have seen on here that supports file extraction so I assume there are some libraries for doing so somewhere. Adding support for extracting zips and rars may make this program spread out more since it would be less of a hassle to uploaders. can also make a method for copying files from the SD card like it just copies over contents in a folder to the main directory of the SD card during the installation.

Nice job adding visual camera support though. Was sometimes difficult reading the QR codes before.

Thanks for the support and input. I've got more ideas for additional features like you suggest, but most of it brings extra complication such as how .zip files store their directory/file info at the tailing end of the archive, so it's a good bit harder to process in a "streaming" type format that installing large .cia files requires. I'll put more effort into that later on, since using libarchive will help support it.

Here's my upcoming feature list by priority at the moment:
* Rewriting libcitrus to use callback functions to install from RAM instead of http:C directly (required before AES or rar/zip)
* AES encryption/decryption support (mega.nz support requires)
* Convert away from direct framebuffer drawing to using libsf2d
* libarchive support (after libsf2d, since proper use requires a UI and menu, and I don't want to build that twice.)
* Targeting/status graphic overlays and splash screen as well as new icons and artwork.
* Better status and a progress bar
* libsu or similar for legit CIA install (maybe? ninjahax or HBL was breaking http:C, this app only functioned as a .cia last time I checked anyway.)

Of course, if you or anyone else has reason to justify why these priorities should be ordered differently, go ahead and make a case for why. I'll reconsider things if the reason is solid.
 
QR Web Loader 0.8.0 is released!

You guys asked, so here's me delivering. Now with direct cia file installation from mega.nz links. Do with it what you will. Just make a QR code out of a direct link to a .cia file, folders are /not/ supported yet.
 
Ok, the image that I am getting is not correct. The camera init stuff in basically the same, just moved CAMU_Activate out.

Code:
void writePictureToFramebufferRGB565(void *fb, void *img, u16 x, u16 y, u16 width, u16 height) {
    u8 *fb_8 = (u8*) fb;
    u16 *img_16 = (u16*) img;
    int i, j, draw_x, draw_y;
    for(j = 0; j < height; j++) {
        for(i = 0; i < width; i++) {
            draw_y = y + height-1 - j;
            draw_x = x + i;
            u32 v = (draw_y + draw_x * height) * 3;
            u16 data = img_16[j * width + i];
            uint8_t b = ((data >> 11) & 0x1F) << 3;
            uint8_t g = ((data >> 5) & 0x3F) << 2;
            uint8_t r = (data & 0x1F) << 3;
            fb_8[ v ] = r;
            fb_8[v+1] = g;
            fb_8[v+2] = b;
        }
    }
}

void writePictureToIntensityMap(void *fb, void *img, u16 width, u16 height){
    u8 *fb_8 = (u8*) fb;
    u16 *img_16 = (u16*) img;
    for(u32 i = 0; i < width * height; i++){
        u16 data = img_16[i];
        uint8_t b = ((data >> 11) & 0x1F) << 3;
        uint8_t g = ((data >> 5) & 0x3F) << 2;
        uint8_t r = (data & 0x1F) << 3;
        fb_8[i] = (r + g + b) / 3;
    }
}

void action_scan_qr(void){
    u16 *cameraBuffer = (u16 *)malloc(CAMERA_WIDTH * CAMERA_HEIGHT * 2);
    if(!cameraBuffer){
        return;
    }
   
    struct quirc *qr;
    qr = quirc_new();
   
    if(!qr){
        free(cameraBuffer);
        return;
    }
   
    if(quirc_resize(qr, CAMERA_WIDTH, CAMERA_HEIGHT)){
        free(cameraBuffer);
        quirc_destroy(qr);
    }
   
    activateCamera();
   
    u8 reading = 1;
    while(reading){
        hidScanInput();
       
        if (hidKeysDown()){
            break;
        }
       
        takePicture(cameraBuffer);
       
        writePictureToFramebufferRGB565(gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), cameraBuffer, 0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
        gfxFlushBuffers();
        gfxSwapBuffers();
       
        int w = CAMERA_WIDTH;
        int h = CAMERA_HEIGHT;
       
        u8* image = (u8*)quirc_begin(qr, &w, &h);
        writePictureToIntensityMap(image, cameraBuffer, CAMERA_WIDTH, CAMERA_HEIGHT);
        quirc_end(qr);
       
        int codeCount = quirc_count(qr);
       
        int i;
        for(i = 0; i < codeCount; i++){
            struct quirc_code code;
            struct quirc_data data;
            quirc_decode_error_t err;
           
            quirc_extract(qr, i, &code);
           
            err = quirc_decode(&code, &data);
            if (!err){
//processing redacted, should not be needed for this
                   
                    reading = 0;
                   
                    break;
                }
            }
        }
       
        gfxFlushBuffers();
        gfxSwapBuffers();
        gspWaitForVBlank();
    }
   
    free(cameraBuffer);
    quirc_destroy(qr);
}
 
Last edited by gudenau,
Ok, the image that I am getting is not correct. The camera init stuff in basically the same, just moved CAMU_Activate out.

What's the image that you're getting? Is it solid black, or with colors/random data in it? Do you have a github repo where I can pull down a copy and poke at what you're doing myself?
 
What's the image that you're getting? Is it solid black, or with colors/random data in it? Do you have a github repo where I can pull down a copy and poke at what you're doing myself?
I do not have it up, but I will upload it. I am getting a distorted image, almost as if the channels are incorrect.
 
I do not have it up, but I will upload it. I am getting a distorted image, almost as if the channels are incorrect.

Yeah, that's probably the case. Double check the camera settings init you're using against how QRWebLoader handles it. There's a lot of seemingly insignificant stuff in there that is more required than it looks. Also, keep track of how the camera gets activated and held open so it isn't reset for every capture like the 3ds-examples code had, as that caused some screwy problems with auto brightness and contrast adjustments.
 
Yeah, that's probably the case. Double check the camera settings init you're using against how QRWebLoader handles it. There's a lot of seemingly insignificant stuff in there that is more required than it looks. Also, keep track of how the camera gets activated and held open so it isn't reset for every capture like the 3ds-examples code had, as that caused some screwy problems with auto brightness and contrast adjustments.
Well, I am not seeing anything. Would you look at my code, it is basicly camera.c and 527-640 & 803-804 in main.cpp.
 
Well, I am not seeing anything. Would you look at my code, it is basicly camera.c and 527-640 & 803-804 in main.cpp.

Sure, give me a minute to get things setup on my build server. Your .zip doesn't build cleanly for me quite yet, so it might be a few minutes until I've got it compiling.
 
Okay, thanks ! I am spiking with you when a release the downgrade 9.2 !

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

And do you have some website explain the dowgrade for 10.5.0.30E in the 10.3.0.28E ?
github arm9 tutorial will have a page on how to downgrade.
 
@ksanislo please work with @Steveice10 to get mega support to work on FBI 2.X please!

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

For anyone using this app or FBI to install, I recommend webqr.com as it is very simple and has no ads!
 
Could you add unzipping support? It's always a pain to find out that the mega link actually is a zip file so you can't load it.

Unzip support will come about eventually, but some of the most popular zip formats (pkzip most notably) store their archive info in the file footer instead of a header, so stream based parsing is a bit of a pain in the ass. However, most of this code (or technically my 'devproject' build on github, since that's where Mega was being developed) will cleanly handle re-positioning anywhere in the HTTP stream. It basically just needs to be wrapped in libarchive or 7zip and have a folder UI put on top so you can choose the files you need.

@ksanislo please work with @Steveice10 to get mega support to work on FBI 2.X please!

For anyone using this app or FBI to install, I recommend webqr.com as it is very simple and has no ads!

I personally recommend http://ctrlq.org/qrcode/, but webqr.com is probably easier to remember, and both of these use the google API to generate a hotlinkable image.

As far as Mega support into FBI, I'll probably eventually get around to it. However having Steveice10 clone my project into FBI without any credit for the idea or mention of all the background work that was done to make this possible really took away the drive to bother finishing this.
 
  • Like
Reactions: Deleted User
I would suggest storing the titlekey/region in the QR and simply download them from CDN. But for whatever reason Steveice10 doesn't want to do it. :P

Maybe you can. You may need a larger QR code to support it. CDN URLs are predictable so you should only need some basic info in the QR. The titlekey, region and maybe game title/code. The CDN URL is determined by the TID of the title anyways. So I assume TID would also be in the QR.
 
Last edited by Apache Thunder,
I would suggest storing the titlekey/region in the QR and simply download them from CDN. But for whatever reason Steveice10 doesn't want to do it. :P

Maybe you can. You may need a larger QR code to support it. CDN URLs are predictable so you should only need some basic info in the QR. The titlekey, region and maybe game title/code. The CDN URL is determined by the TID of the title anyways. So I assume TID would also be in the QR.

QR size here in my codebase is basically only limited by the 3DS' camera resolution and the quirc lib (effectively 8896 characters). FBI has a much smaller artificial limit that isn't in play here.

However realistically you'd only need the TitleID and the AES key, which is 24 bytes of raw binary data (64 bits for titleid + 128 bits for the key), or 48 characters of hex data. If you really wanted to include region data a single extra byte would suffice, however I'm fairly sure you can decode this data from the CDN itself. It seems that while region info isn't coded into the TID value, different regions of the same title will always have different IDs. You can use HTTP's Content-Range: header to selectively pull just the region info in advance of starting the download if you really need it first for some reason.

I'm pretty sure this is basically what gudenaurock was doing just a few posts back in this thread though... You might want to PM him directly and ask what the state of his project (a fork of CIAngel) is, It's been a few weeks since we got the QR scanner running.
 
  • Like
Reactions: Apache Thunder
Unzip support will come about eventually, but some of the most popular zip formats (pkzip most notably) store their archive info in the file footer instead of a header, so stream based parsing is a bit of a pain in the ass. However, most of this code (or technically my 'devproject' build on github, since that's where Mega was being developed) will cleanly handle re-positioning anywhere in the HTTP stream. It basically just needs to be wrapped in libarchive or 7zip and have a folder UI put on top so you can choose the files you need.



I personally recommend http://ctrlq.org/qrcode/, but webqr.com is probably easier to remember, and both of these use the google API to generate a hotlinkable image.

As far as Mega support into FBI, I'll probably eventually get around to it. However having Steveice10 clone my project into FBI without any credit for the idea or mention of all the background work that was done to make this possible really took away the drive to bother finishing this.
Yeah, @Steveice10 should credit you.
 
As far as Mega support into FBI, I'll probably eventually get around to it. However having Steveice10 clone my project into FBI without any credit for the idea or mention of all the background work that was done to make this possible really took away the drive to bother finishing this.
"clone my project"? FYI, I coded the feature entirely from scratch, didn't even know of this, and had the idea proposed to me and looked into by another months ago (February 6, 2016).
 
Last edited by ,

Site & Scene News

Popular threads in this forum