Using embedded resources

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

May 3, 2010

Using embedded resources by diego_pmc at 4:24 PM (687 Views / 0 Likes) 3 replies

  1. diego_pmc
    OP

    Newcomer diego_pmc Advanced Member

    Joined:
    Sep 8, 2009
    Messages:
    52
    Country:
    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

    Member cwstjdenobs Sodomy non sapiens

    Joined:
    Mar 10, 2009
    Messages:
    1,757
    Location:
    Ankh-Morpork
    Country:
    United Kingdom
    #include "grrlib_logo_jpg.h"

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

    Newcomer diego_pmc Advanced Member

    Joined:
    Sep 8, 2009
    Messages:
    52
    Country:
    United States
    Thanks.
     
  4. diego_pmc
    OP

    Newcomer diego_pmc Advanced Member

    Joined:
    Sep 8, 2009
    Messages:
    52
    Country:
    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.)
     

Share This Page