Using embedded resources

Discussion in 'Wii - Emulation and Homebrew' started by diego_pmc, May 3, 2010.

  1. diego_pmc
    OP

    diego_pmc Advanced Member

    Newcomer
    52
    0
    Sep 8, 2009
    United States
    I would like to know how I can use data I embedded into my program. In my project I added an image "grrlib_logo.jpg" as a resource. It compiles, and in the build log it is telling me that it has embedded the data:
    Now, the question is, how can I use the data?
     
  2. cwstjdenobs

    cwstjdenobs Sodomy non sapiens

    Member
    1,757
    1
    Mar 10, 2009
    Ankh-Morpork
    #include "grrlib_logo_jpg.h"

    and grrlib_logo_jpg will be the variable name.
     
  3. diego_pmc
    OP

    diego_pmc Advanced Member

    Newcomer
    52
    0
    Sep 8, 2009
    United States
    Thanks.
     
  4. diego_pmc
    OP

    diego_pmc Advanced Member

    Newcomer
    52
    0
    Sep 8, 2009
    United States
    I included that file, created a GRRLIB_texImg with it and tried to print it. However nothing happened; the screen just stayed black (no crashes, no nothing, and everything else behaved normally -- I was able to exit by pressing HOME). I know I once saw a homebrew app that used embedded resources, but I can't remember which one it was. Could someone please either point me to that app, or explain to me how to make this work?

    This is the relevant code in my app:
    Code:
    #include "grrlib_logo_jpg.h"
    // ...
    GRRLIB_texImg* img = GRRLIB_LoadTexture(grrlib_logo_jpg);
    
    while (/*...*/) {
    ÂÂÂÂGRRLIB_DrawImg(0, 0, img, 0, 1, 1, 0xFFFFFF);
    ÂÂÂÂGRRLIB_Render();
    }
    (The image, however, can be printed if I read it from a file during execution instead.)