Esempio n. 1
0
static int bmp_show(char* file)
{
    void* bmp = bmp_load(file, 1);
    if (!bmp) return 0;
    bmp_draw_scaled_ex(bmp, 0, 0, 720, 480, 0);
    free(bmp);
    return 1;
}
Esempio n. 2
0
void menu_help_show_page(int page)
{
    menu_help_active = 1;
    
#ifndef CONFIG_RELEASE_BUILD
    if (page == 1) { draw_beta_warning(); return; } // display this instead of the main About page
#endif

    if (page == 0) { draw_404_page(); return; } // help page not found
    if (page == -1) { draw_help_not_installed_page(); return; } // help page not found
    
    char path[100];
    struct bmp_file_t * doc = (void*) -1;

#ifdef CONFIG_HELP_CACHE
    char rpath[30];
    snprintf(rpath, sizeof(rpath), CARD_DRIVE "ML/doc/page-%03d.vrm", page);
    if (load_vram(rpath)==-1)
#endif
    {
        snprintf(path, sizeof(path), CARD_DRIVE "ML/doc/page-%03d.bmh", page);
        doc = bmp_load(path, 1);
        if (!doc)
        {
            snprintf(path, sizeof(path), CARD_DRIVE "ML/doc/page-%03d.bmp", page);
            doc = bmp_load(path, 1);
        }

        if (doc)
        {
            bmp_draw_scaled_ex(doc, 0, 0, 720, 480, 0);
            #ifdef CONFIG_HELP_CACHE
            extern int _bmp_draw_should_stop;
            if (!_bmp_draw_should_stop) save_vram(rpath);
            #endif
            FreeMemory(doc);
        }
        else
        {
            clrscr();
            bmp_printf(FONT_MED, 0, 0, "Could not load help page %s.", path);
        }
    }
}