Ejemplo n.º 1
0
void gui_unload_preview()
{
    debug_start();

    if( tmp_preview != NULL )
    {
        GLES2D_FreeTexture( tmp_preview );
        tmp_preview = NULL;
    }

    video_quit( );

    if ( applications[category]->type[list_curpos[ category ]] ) // .pnd spotted
    {
        if( pnd_mounted )
        {
            pnd_pnd_unmount( pndrun, applications[category]->fullpath[list_curpos[ category ]], applications[category]->id[list_curpos[ category ]] );
            pnd_mounted = 0;
        }
    }

    preview_timer = 100;

    debug_end();
}
Ejemplo n.º 2
0
void
weechat_shutdown (int return_code, int crash)
{
    gui_chat_print_lines_waiting_buffer (stderr);

    log_close ();
    network_end ();
    debug_end ();

    if (weechat_argv0)
        free (weechat_argv0);
    if (weechat_home)
        free (weechat_home);
    if (weechat_local_charset)
        free (weechat_local_charset);
    if (weechat_force_plugin_autoload)
        free (weechat_force_plugin_autoload);
    if (weechat_startup_commands)
        weelist_free (weechat_startup_commands);

    if (crash)
        abort ();
    else if (return_code >= 0)
        exit (return_code);
}
Ejemplo n.º 3
0
void gui_change_category( int requested_cat )
{
    debug_start();

    if( category != SETTINGS )
        gui_unload_preview();

	category = requested_cat;

    if( category != SETTINGS )
    {
        alpha = 0.0f;
        alpha_up = 1;
        reset_scroll_count = 1;
    }

	if( category == SETTINGS )
	{
        get_skins_list ();
        load_skin_preview();
	}
	else if( category == MEDIA )
	{
        get_media_list( now_path );
	}

	debug_end();
}
Ejemplo n.º 4
0
void gui_load()
{
    debug_start();

    pnd_app_get_list();
    cfg_gui_read();
    gui_load_skin();

    if ( ! ( nh = pnd_notify_init() ) )
    {
        debug_error ( "PND INOTIFY init problem spotted\n" );
    }

    if ( ! ( nh2 = pnd_dbusnotify_init() ) )
    {
        debug_error ( "PND DBUSINOTIFY init problem spotted\n" );
    }

    initStatusCalls();
    cpuUsage();
    getCPULoad();

    set_cpu( pmenu->cpu_mhz );

    debug_end();
}
Ejemplo n.º 5
0
int main(void)
{
	u8 *payload, *stage2;
	int payload_size, result;
		
#ifdef DEBUG
	debug_init();	
#endif

	DPRINTF("Stage 1.5 lan hello.\n");	
	
	result = gelic_init();
	if (result != 0)
		goto error;
	
	payload = (void *)MKA(0x700000);//alloc(MAX_PAYLOAD_SIZE, 0x27);
	if (!payload)
		goto error;
	
	payload_size = gelic_recv_data(payload, MAX_PAYLOAD_SIZE);
	if (payload_size <= 0)
		goto error;	
		
	DPRINTF("Receive data: %d\n", payload_size);
	
	stage2 = alloc(payload_size, 0x27);
	if (!stage2)
		goto error;
	
	memcpy(stage2, payload, payload_size);
	clear_icache(stage2, payload_size);
	memset(payload, 0, payload_size);
	
	//dealloc(payload, 0x27);

	result = gelic_deinit();
	if (result != 0)
		goto error;

	/*result = mm_deinit();
	if (result != 0)
		goto error;*/

	f_desc_t desc;	
	desc.addr = stage2;
	
	DPRINTF("Calling stage2...\n");
	debug_end();
	void (* stage2_func)(void) = (void *)&desc;
	stage2_func();	
	
	return 0;

error:

	lv1_panic(0);
	return -1;
}
Ejemplo n.º 6
0
void rediscover()
{
    debug_start( );

    pnd_app_clean_list();
	pnd_app_get_list();
	list_curpos[category] = 0;
	gui_unload_preview();

	debug_end();
}
Ejemplo n.º 7
0
void gui_change_skin()
{
    debug_start();

    int alpha;
    for ( alpha = 0; alpha < 245; alpha += 10 )
    {
        gui_draw();
        GLES2D_SetDrawingColor( 0, 0, 0, alpha );
        GLES2D_DrawRectangle ( 0, 0, 800, 480 );
        GLES2D_SwapBuffers();
    }

    char prev_skin[512];
    memset( prev_skin, 0, 512 );
    strcpy( prev_skin, pmenu->skin_dir_relative );

    debug_infof( "Updating skin path : %s\n", skin[skin_current]->path );
    cfg_pmenu_update_skin_path( skin[skin_current]->path );

    if ( ! cfg_gui_read() )
    {
        cfg_pmenu_update_skin_path( prev_skin );
        cfg_gui_read();
    }
    else
    {
        gui_clean_skin();

        if ( ! gui_load_skin() )
        {
            cfg_pmenu_update_skin_path( prev_skin );
            gui_clean_skin();
            gui_load_skin();
        }
    }

    for ( alpha = 255; alpha > 10; alpha-=10 )
    {
        gui_draw();
        GLES2D_SetDrawingColor( 0, 0, 0, alpha );
        GLES2D_DrawRectangle ( 0, 0, 800, 480 );
        GLES2D_SwapBuffers();
    }

    load_skin_preview();

    debug_end();
}
Ejemplo n.º 8
0
void gui_clean()
{
    debug_start();

    video_quit();

    gui_clean_skin();
    gui_unload_preview();
    pnd_app_clean_list();

    pnd_notify_shutdown ( nh );
	pnd_dbusnotify_shutdown ( nh2 );
    doneStatusCalls();

    GLES2D_Quit();

    debug_end();
}
Ejemplo n.º 9
0
void
weechat_shutdown (int return_code, int crash)
{
    gui_chat_print_lines_waiting_buffer (stderr);

    if (weechat_argv0)
        free (weechat_argv0);
    if (weechat_home)
        free (weechat_home);
    log_close ();
    if (weechat_local_charset)
        free (weechat_local_charset);

    network_end ();

    debug_end ();

    if (crash)
        abort();
    else if (return_code >= 0)
        exit (return_code);
}
Ejemplo n.º 10
0
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
        HMENU hmenu;
        RECT rect;
        int c;
	LRESULT r;
        
        switch (message)
        {
                case WM_COMMAND:
                hmenu = GetMenu(hwnd);
                switch (LOWORD(wParam))
                {
                        case IDM_FILE_RESET:
                        EnterCriticalSection(&cs);
                        main_reset();
                        LeaveCriticalSection(&cs);
                        break;

                        case IDM_FILE_LSTATE:
                        EnterCriticalSection(&cs);
                        if (!getfile(hwnd, "Save State (*.SNP)\0*.SNP\0All files (*.*)\0*.*\0\0", savestate_name))
                        {
                                CheckMenuItem(hmenu, IDM_TUBE_6502 + selecttube, MF_UNCHECKED);
                                CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_UNCHECKED);
                                savestate_load();
                                CheckMenuItem(hmenu, IDM_TUBE_6502 + selecttube, MF_CHECKED);
                                CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_CHECKED);
                        }
                        main_cleardrawit();
                        LeaveCriticalSection(&cs);
                        break;
                        case IDM_FILE_SSTATE:
                        EnterCriticalSection(&cs);
                        if (curtube != -1)
                        {
                                bem_error("Second processor save states not supported yet.");
                        }
                        else
                        {
                                if (!getsfile(hwnd, "Save State (*.SNP)\0*.SNP\0All files (*.*)\0*.*\0\0", savestate_name, "SNP"))
                                   savestate_save();
                        }
                        main_cleardrawit();
                        LeaveCriticalSection(&cs);
                        break;

                        case IDM_FILE_EXIT:
                        PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
                        break;


                        case IDM_DISC_AUTOBOOT:
                        if (!getfile(hwnd, "Disc image (*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI)\0*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI\0All files (*.*)\0*.*\0", discfns[0]))
                        {
                                doautoboot = 1;
                        }
                        break;
                        case IDM_DISC_LOAD_0:
                        if (!getfile(hwnd, "Disc image (*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI)\0*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI\0All files (*.*)\0*.*\0", discfns[0]))
                        {
                                disc_close(0);
                                disc_load(0, discfns[0]);
                                if (defaultwriteprot) writeprot[0] = 1;
                                CheckMenuItem(hmenu, IDM_DISC_WPROT_0, (writeprot[0]) ? MF_CHECKED : MF_UNCHECKED);
                        }
                        break;
                        case IDM_DISC_LOAD_1:
                        if (!getfile(hwnd, "Disc image (*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI)\0*.SSD;*.DSD;*.IMG;*.ADF;*.ADL;*.FDI\0All files (*.*)\0*.*\0", discfns[1]))
                        {
                                disc_close(1);
                                disc_load(1, discfns[1]);
                                if (defaultwriteprot) writeprot[1] = 1;
                                CheckMenuItem(hmenu, IDM_DISC_WPROT_1, (writeprot[1]) ? MF_CHECKED : MF_UNCHECKED);
                        }
                        break;
                        case IDM_DISC_EJECT_0:
                        disc_close(0);
                        discfns[0][0] = 0;
                        setejecttext(0, "");
                        break;
                        case IDM_DISC_EJECT_1:
                        disc_close(1);
                        discfns[1][0] = 0;
                        setejecttext(1, "");
                        break;
                        case IDM_DISC_NEW_0:
                        if (!getsfile(hwnd, "Disc image (*.SSD;*.DSD;*.ADF;*.ADL)\0*.SSD;*.DSD;*.ADF;*.ADL\0All files (*.*)\0*.*\0", discfns[0], "SSD"))
                        {
                                disc_close(0);
                                disc_new(0, discfns[0]);
                                if (defaultwriteprot) writeprot[0] = 1;
                                CheckMenuItem(hmenu, IDM_DISC_WPROT_0, (writeprot[0]) ? MF_CHECKED : MF_UNCHECKED);
                        }
                        break;
                        case IDM_DISC_NEW_1:
                        if (!getsfile(hwnd, "Disc image (*.SSD;*.DSD;*.ADF;*.ADL)\0*.SSD;*.DSD;*.ADF;*.ADL\0All files (*.*)\0*.*\0", discfns[1], "SSD"))
                        {
                                disc_close(1);
                                disc_new(1, discfns[1]);
                                if (defaultwriteprot) writeprot[1] = 1;
                                CheckMenuItem(hmenu, IDM_DISC_WPROT_1, (writeprot[1]) ? MF_CHECKED : MF_UNCHECKED);
                        }
                        break;
                        case IDM_DISC_WPROT_0:
                        writeprot[0] = !writeprot[0];
                        if (fwriteprot[0]) writeprot[0] = 1;
                        CheckMenuItem(hmenu, IDM_DISC_WPROT_0, (writeprot[0]) ? MF_CHECKED : MF_UNCHECKED);
                        break;
                        case IDM_DISC_WPROT_1:
                        writeprot[1] = !writeprot[1];
                        if (fwriteprot[1]) writeprot[1] = 1;
                        CheckMenuItem(hmenu, IDM_DISC_WPROT_1, (writeprot[1]) ? MF_CHECKED : MF_UNCHECKED);
                        break;
                        case IDM_DISC_WPROT_D:
                        defaultwriteprot = !defaultwriteprot;
                        CheckMenuItem(hmenu, IDM_DISC_WPROT_D, (defaultwriteprot) ? MF_CHECKED : MF_UNCHECKED);
                        break;
                        case IDM_DISC_VDFS_ENABLE:
                        vdfs_enabled = !vdfs_enabled;
                        CheckMenuItem(hmenu, IDM_DISC_VDFS_ENABLE, (vdfs_enabled) ? MF_CHECKED : MF_UNCHECKED);
                        break;
                        case IDM_DISC_VDFS_ROOT:
                        getfile(hwnd, "VDFS Root", vdfs_set_root);
                        break;
                        case IDM_TAPE_LOAD:
                        if (!getfile(hwnd, "Tape image (*.UEF;*.CSW)\0*.UEF;*.CSW\0All files (*.*)\0*.*\0", tape_fn))
                        {
                                tape_close();
                                tape_load(tape_fn);
                                tape_loaded = 1;
                        }
                        break;
                        case IDM_TAPE_EJECT:
                        tape_close();
                        tape_loaded = 0;
                        break;
                        
                        case IDM_TAPE_REWIND:
                        tape_close();
                        tape_load(tape_fn);
                        break;
                        case IDM_TAPE_CAT:
                        showcatalogue(hinstance, ghwnd);
                        break;
                        
                        case IDM_TAPES_NORMAL: case IDM_TAPES_FAST:
                        fasttape = LOWORD(wParam) - IDM_TAPES_NORMAL;
                        CheckMenuItem(hmenu, IDM_TAPES_NORMAL, MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_TAPES_FAST,   MF_UNCHECKED);
                        CheckMenuItem(hmenu, LOWORD(wParam),   MF_CHECKED);
                        break;

                        case IDM_VIDEO_NOBORDERS: case IDM_VIDEO_MBORDERS: case IDM_VIDEO_FBORDERS:
                        CheckMenuItem(hmenu, IDM_VIDEO_NOBORDERS + vid_fullborders, MF_UNCHECKED);
                        vid_fullborders = LOWORD(wParam) - IDM_VIDEO_NOBORDERS;
                        CheckMenuItem(hmenu, IDM_VIDEO_NOBORDERS + vid_fullborders, MF_CHECKED);
                        break;
                        case IDM_VIDEO_FULLSCR:
                        fullscreen = 1;
                        EnterCriticalSection(&cs);
                        video_enterfullscreen();
                        LeaveCriticalSection(&cs);
                        break;
                        case IDM_VIDEO_RESIZE:
                        videoresize = !videoresize;
                        CheckMenuItem(hmenu, IDM_VIDEO_RESIZE, (videoresize) ? MF_CHECKED : MF_UNCHECKED);
                        if (videoresize) SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE);
                        else             SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX) | WS_VISIBLE);
                        GetWindowRect(hwnd, &rect);
                        SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED);
                        break;
                        
                        case IDM_VIDEO_SLINEDBL: case IDM_VIDEO_LINEDBL: case IDM_VIDEO_SCANLINES: case IDM_VIDEO_INTERLACED: case IDM_VIDEO_PAL: case IDM_VIDEO_PALI:
                        CheckMenuItem(hmenu, IDM_VIDEO_SLINEDBL,   MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_VIDEO_LINEDBL,    MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_VIDEO_SCANLINES,  MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_VIDEO_INTERLACED, MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_VIDEO_PAL,        MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_VIDEO_PALI,       MF_UNCHECKED);
                        CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED);
                        vid_scanlines = vid_interlace = vid_linedbl = vid_pal = 0;
                        if (LOWORD(wParam) == IDM_VIDEO_INTERLACED) vid_interlace = 1;
                        if (LOWORD(wParam) == IDM_VIDEO_SCANLINES)  vid_scanlines = 1;
                        if (LOWORD(wParam) == IDM_VIDEO_SLINEDBL)   vid_linedbl = 1;
                        if (LOWORD(wParam) == IDM_VIDEO_PAL)        vid_pal = 1;
                        if (LOWORD(wParam) == IDM_VIDEO_PALI)       vid_interlace = vid_pal = 1;
                        video_clearscreen();
                        break;
                        case IDM_TUBE_NONE: case IDM_TUBE_6502: case IDM_TUBE_Z80: case IDM_TUBE_65816: case IDM_TUBE_32016:
                        CheckMenuItem(hmenu, IDM_TUBE_NONE,  MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_TUBE_6502,  MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_TUBE_65816, MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_TUBE_Z80,   MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_TUBE_32016, MF_UNCHECKED);
                        CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED);
                        selecttube = LOWORD(wParam) - IDM_TUBE_6502;
                        main_restart();
                        break;
                        case IDM_TUBES_4: case IDM_TUBES_8: case IDM_TUBES_16: case IDM_TUBES_32: case IDM_TUBES_64:
                        CheckMenuItem(hmenu, IDM_TUBES_4,    MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_TUBES_8,    MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_TUBES_16,   MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_TUBES_32,   MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_TUBES_64,   MF_UNCHECKED);
                        CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED);
                        tube_6502_speed = (LOWORD(wParam) - IDM_TUBES_4) + 1;
                        tube_updatespeed();
                        break;
                        
                        case IDM_SOUND_INTERNAL:
                        sound_internal = !sound_internal;
                        CheckMenuItem(hmenu, IDM_SOUND_INTERNAL, (sound_internal) ? MF_CHECKED : MF_UNCHECKED);
                        break;
                        case IDM_SOUND_BEEBSID:
                        sound_beebsid = !sound_beebsid;
                        CheckMenuItem(hmenu, IDM_SOUND_BEEBSID, (sound_beebsid) ? MF_CHECKED : MF_UNCHECKED);
                        break;
                        case IDM_SOUND_DAC:
                        sound_dac = !sound_dac;
                        CheckMenuItem(hmenu, IDM_SOUND_BEEBSID, (sound_dac) ? MF_CHECKED : MF_UNCHECKED);
                        break;
                        case IDM_SOUND_DDNOISE:
                        sound_ddnoise = !sound_ddnoise;
                        CheckMenuItem(hmenu, IDM_SOUND_DDNOISE, (sound_ddnoise) ? MF_CHECKED : MF_UNCHECKED);
                        break;
                        case IDM_SOUND_TAPE:
                        sound_tape = !sound_tape;
                        CheckMenuItem(hmenu, IDM_SOUND_TAPE, (sound_tape) ? MF_CHECKED : MF_UNCHECKED);
                        break;
                        case IDM_SOUND_FILTER:
                        sound_filter = !sound_filter;
                        CheckMenuItem(hmenu, IDM_SOUND_FILTER, (sound_filter) ? MF_CHECKED : MF_UNCHECKED);
                        break;
                        
                        case IDM_WAVE_SQUARE: case IDM_WAVE_SAW: case IDM_WAVE_SINE: case IDM_WAVE_TRI: case IDM_WAVE_SID:
                        CheckMenuItem(hmenu, IDM_WAVE_SQUARE + curwave, MF_UNCHECKED);
                        curwave = LOWORD(wParam) - IDM_WAVE_SQUARE;
                        CheckMenuItem(hmenu, IDM_WAVE_SQUARE + curwave, MF_CHECKED);
                        break;

                        case IDM_SID_INTERP: case IDM_SID_RESAMP:
                        CheckMenuItem(hmenu, IDM_SID_INTERP, MF_UNCHECKED);
                        CheckMenuItem(hmenu, IDM_SID_RESAMP, MF_UNCHECKED);
                        CheckMenuItem(hmenu, LOWORD(wParam), MF_CHECKED);
                        sidmethod = LOWORD(wParam) - IDM_SID_INTERP;
                        sid_settype(sidmethod, cursid);
                        break;
                        
                        case IDM_DDV_33: case IDM_DDV_66: case IDM_DDV_100:
                        CheckMenuItem(hmenu, (IDM_DDV_33 + ddnoise_vol) - 1, MF_UNCHECKED);
                        ddnoise_vol = (LOWORD(wParam) - IDM_DDV_33) + 1;
                        CheckMenuItem(hmenu, (IDM_DDV_33 + ddnoise_vol) - 1, MF_CHECKED);
                        break;

                        case IDM_DDT_525: case IDM_DDT_35:
                        CheckMenuItem(hmenu, IDM_DDT_525 + ddnoise_type, MF_UNCHECKED);
                        ddnoise_type = LOWORD(wParam) - IDM_DDT_525;
                        CheckMenuItem(hmenu, IDM_DDT_525 + ddnoise_type, MF_CHECKED);
                        ddnoise_close();
                        ddnoise_init();
                        break;

                        case IDM_DEBUGGER:
                        EnterCriticalSection(&cs);
                        rest(200);
                        if (!debugon)
                        {
                                debug = debugon = 1;
                                debug_start();
//                                EnableMenuItem(hmenu,IDM_BREAK,MF_ENABLED);
                        }
                        else
                        {
                                debug ^= 1;
                                debug_end();
//                                EnableMenuItem(hmenu,IDM_BREAK,MF_GRAYED);
                        }
                        CheckMenuItem(hmenu, IDM_DEBUGGER, (debug) ? MF_CHECKED: MF_UNCHECKED);
                        LeaveCriticalSection(&cs);
                        break;
                        case IDM_BREAK:
                        debug = 1;
                        break;
                        
                        case IDM_SCRSHOT:
                        if (!getsfile(hwnd, "Bitmap file (*.BMP)\0*.BMP\0All files (*.*)\0*.*\0", vid_scrshotname, "BMP"))
                        {
                                vid_savescrshot = 1;
                        }
                        break;

                        case IDM_KEY_REDEFINE:
                        redefinekeys();
                        break;

                        case IDM_KEY_AS:
                        keyas = !keyas;
                        CheckMenuItem(hmenu, IDM_KEY_AS, (keyas) ? MF_CHECKED : MF_UNCHECKED);
                        break;
                        
                        case IDM_MOUSE_AMX:
                        mouse_amx = !mouse_amx;
                        CheckMenuItem(hmenu, IDM_MOUSE_AMX, (mouse_amx) ? MF_CHECKED : MF_UNCHECKED);
                        main_setmouse();
                        updatewindowtitle();
                        break;

                        case IDM_IDE_ENABLE:
                        EnterCriticalSection(&cs);
                        CheckMenuItem(hmenu, IDM_IDE_ENABLE, (!ide_enable) ? MF_CHECKED : MF_UNCHECKED);
                        ide_enable = !ide_enable;
                        main_restart();
                        LeaveCriticalSection(&cs);
                        break;
                        
                        case IDM_SPD_10: case IDM_SPD_25: case IDM_SPD_50: case IDM_SPD_75: case IDM_SPD_100:
                        case IDM_SPD_150: case IDM_SPD_200: case IDM_SPD_300: case IDM_SPD_400: case IDM_SPD_500:
                        CheckMenuItem(hmenu, IDM_SPD_10 + emuspeed, MF_UNCHECKED);
                        emuspeed = curmodel = LOWORD(wParam) - IDM_SPD_10;
                        changetimerspeed(timerspeeds[emuspeed]);
                        vid_fskipmax = frameskips[emuspeed];
                        CheckMenuItem(hmenu, IDM_SPD_10 + emuspeed, MF_CHECKED);
                        break;
                }
                if (LOWORD(wParam) >= IDM_MODEL_0 && LOWORD(wParam) < (IDM_MODEL_0 + 50))
                {
                        CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_UNCHECKED);
                        oldmodel = curmodel;
                        curmodel = LOWORD(wParam) - IDM_MODEL_0;
                        CheckMenuItem(hmenu, IDM_MODEL_0 + curmodel, MF_CHECKED);
                        main_restart();
                        updatewindowtitle();
                }
                if (LOWORD(wParam) >= IDM_SID_TYPE && LOWORD(wParam) < (IDM_SID_TYPE + 100))
                {
                        CheckMenuItem(hmenu, IDM_SID_TYPE + cursid, MF_UNCHECKED);
                        cursid = LOWORD(wParam) - IDM_SID_TYPE;
                        CheckMenuItem(hmenu, IDM_SID_TYPE + cursid, MF_CHECKED);
                        sid_settype(sidmethod, cursid);
                }
                return 0;
                
                case WM_USER:
                if (videoresize) SetWindowLong(hwnd, GWL_STYLE,  WS_OVERLAPPEDWINDOW | WS_VISIBLE);
                else             SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX) | WS_VISIBLE);
                GetWindowRect(hwnd, &rect);
                SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED);
                break;
                
                case WM_USER+1:
                if (videoresize) SetWindowLong(hwnd, GWL_STYLE,  WS_OVERLAPPEDWINDOW & ~WS_VISIBLE);
                else             SetWindowLong(hwnd, GWL_STYLE, (WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX) & ~WS_VISIBLE);
                GetWindowRect(hwnd,&rect);
                SetWindowPos(hwnd, 0, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_FRAMECHANGED);
                break;

                case WM_DESTROY:
                PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
                break;
                
                case WM_KILLFOCUS:
//              bem_debug("KillFocus\n");
//                infocus=0;
//                spdcount=0;
                if (mousecapture)
                {
                        ClipCursor(&oldclip);
                        mousecapture = 0;
                        updatewindowtitle();
                }
                break;

                case WM_LBUTTONUP:
                if (!mousecapture && (curtube == 3 || mouse_amx))
                {
                        GetClipCursor(&oldclip);
                        GetWindowRect(hwnd, &newclip);
                        newclip.left   += GetSystemMetrics(SM_CXFIXEDFRAME) + 10;
                        newclip.right  -= GetSystemMetrics(SM_CXFIXEDFRAME) + 10;
                        newclip.top    += GetSystemMetrics(SM_CXFIXEDFRAME) + GetSystemMetrics(SM_CYMENUSIZE) + GetSystemMetrics(SM_CYCAPTION) + 10;
                        newclip.bottom -= GetSystemMetrics(SM_CXFIXEDFRAME) + 10;
                        ClipCursor(&newclip);
                        mousecapture = 1;
                        updatewindowtitle();
                }
                break;
                
                case WM_ENTERMENULOOP:
//              bem_debug("EnterMenuLoop\n");
                bempause = 1;
                //EnterCriticalSection(&cs);
                break;
                case WM_EXITMENULOOP:
//              bem_debug("ExitMenuLoop\n");
                bempause = 0;
                key_clear();
                for (c = 0; c < 128; c++) key[c] = 0;
                //LeaveCriticalSection(&cs);
                break;

                case WM_SETFOCUS:
//              bem_debug("SetFocus\n");
                key_clear();
                for (c = 0; c < 128; c++) key[c] = 0;
		bempause = 0;
		break;
                
                case WM_SIZE:
                winsizex = lParam & 0xFFFF;
                winsizey = lParam >> 16;
                break;

        	case WM_SYSKEYDOWN:
        	case WM_KEYDOWN:
                if (LOWORD(wParam) != 255)
                {
                        //bem_debugf("Key %04X %04X\n",LOWORD(wParam),VK_LEFT);
                        c = MapVirtualKey(LOWORD(wParam),0);
                        c = hw_to_mycode[c];
//                        bem_debugf("MVK %i %i %i\n",c,hw_to_mycode[c],KEY_PGUP);
                        if (LOWORD(wParam) == VK_LEFT)   c = KEY_LEFT;
                        if (LOWORD(wParam) == VK_RIGHT)  c = KEY_RIGHT;
                        if (LOWORD(wParam) == VK_UP)     c = KEY_UP;
                        if (LOWORD(wParam) == VK_DOWN)   c = KEY_DOWN;
                        if (LOWORD(wParam) == VK_HOME)   c = KEY_HOME;
                        if (LOWORD(wParam) == VK_END)    c = KEY_END;
                        if (LOWORD(wParam) == VK_INSERT) c = KEY_INSERT;
                        if (LOWORD(wParam) == VK_DELETE) c = KEY_DEL;
                        if (LOWORD(wParam) == VK_PRIOR)  c = KEY_PGUP;
                        if (LOWORD(wParam) == VK_NEXT)   c = KEY_PGDN;
                        //bem_debugf("MVK2 %i %i %i\n",c,hw_to_mycode[c],KEY_PGUP);
                        key[c]=1;
                }
                break;
        	case WM_SYSKEYUP:
        	case WM_KEYUP:
                if (LOWORD(wParam) != 255)
                {
//                        bem_debugf("Key %04X %04X\n",LOWORD(wParam),VK_LEFT);
                        c = MapVirtualKey(LOWORD(wParam), 0);
                        c = hw_to_mycode[c];
                        if (LOWORD(wParam) == VK_LEFT)   c = KEY_LEFT;
                        if (LOWORD(wParam) == VK_RIGHT)  c = KEY_RIGHT;
                        if (LOWORD(wParam) == VK_UP)     c = KEY_UP;
                        if (LOWORD(wParam) == VK_DOWN)   c = KEY_DOWN;
                        if (LOWORD(wParam) == VK_HOME)   c = KEY_HOME;
                        if (LOWORD(wParam) == VK_END)    c = KEY_END;
                        if (LOWORD(wParam) == VK_INSERT) c = KEY_INSERT;
                        if (LOWORD(wParam) == VK_DELETE) c = KEY_DEL;
                        if (LOWORD(wParam) == VK_PRIOR)  c = KEY_PGUP;
                        if (LOWORD(wParam) == VK_NEXT)   c = KEY_PGDN;
//                        bem_debugf("MVK %i\n",c);
                        key[c] = 0;
                }
                break;

                case WM_CREATE:

//        initbbc(argc,argv);

//        free(argv);

//                mainthread=(HANDLE)_beginthread(_mainthread,0,NULL);
                break;

                default:
                r = DefWindowProc (hwnd, message, wParam, lParam);
		return r;
        }
        return 0;
}
Ejemplo n.º 11
0
int gui_load_skin()
{
    debug_start();

    char tmp[512];

	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->background_applications );
	if ( ( background_applications = GLES2D_CreateTexture( tmp, 0 ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}
	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->background_media );
	if ( ( background_media = GLES2D_CreateTexture( tmp, 0 ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}
	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->background_settings );
	if ( ( background_settings = GLES2D_CreateTexture( tmp, 0 ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->highlight );
	if ( ( highlight = GLES2D_CreateTexture( tmp, 0 ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->application_highlight );
	if ( ( app_highlight = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->favorites_icon );
	if ( ( category_icon[FAVORITES] = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}
	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->favorites_icon_highlight );
	if ( ( category_icon_highlight[FAVORITES] = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->emulators_icon );
	if ( ( category_icon[EMULATORS] = GLES2D_CreateTexture( tmp , 0 ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}
	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->emulators_icon_highlight );
	if ( ( category_icon_highlight[EMULATORS] = GLES2D_CreateTexture( tmp , 0 ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->games_icon );
	if ( ( category_icon[GAMES] = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}
	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->games_icon_highlight );
	if ( ( category_icon_highlight[GAMES] = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->misc_icon );
	if ( ( category_icon[MISC] = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}
	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->misc_icon_highlight );
	if ( ( category_icon_highlight[MISC] = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->media_icon );
	if ( ( category_icon[MEDIA] = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}
	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->media_icon_highlight );
	if ( ( category_icon_highlight[MEDIA] = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}
	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->media_file_icon );
	if ( ( media_file_icon = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}
	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->media_folder_icon );
	if ( ( media_folder_icon = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}


	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->settings_icon );
    if ( ( category_icon[SETTINGS] = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}
	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->settings_icon_highlight );
    if ( ( category_icon_highlight[SETTINGS] = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->confirm_box );
	if ( ( confirm_box = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->no_icon );
	if ( ( no_icon = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->no_preview );
	if ( ( no_preview = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->cpu_icon );
    if ( ( cpu_icon = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->clock_icon );
    if ( ( clock_icon = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->sd1_icon );
    if ( ( sd1_icon = GLES2D_CreateTexture( tmp , 0 ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->sd2_icon );
    if ( ( sd2_icon = GLES2D_CreateTexture( tmp, 0  ) ) == NULL )
	{
        debug_errorf( "Could not load image (%s)", tmp );
        debug_end();
        return 0;
	}

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->font_big );
    if ( ( fnt[BIG] = GLES2D_CreateFont( tmp, gui->font_big_style, gui->font_big_size ) ) == NULL )
    {
        debug_errorf( "Could not load font (%s)", tmp );
        debug_end();
        return 0;
    }
    GLES2D_SetFontFiltering( fnt[BIG], gui->font_big_aliasing );

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->font_small );
	if ( ( fnt[SMALL] = GLES2D_CreateFont( tmp, gui->font_small_style, gui->font_small_size ) ) == NULL )
	{
        debug_errorf( "Could not load font (%s)", tmp );
        debug_end();
        return 0;
	}
	GLES2D_SetFontFiltering( fnt[SMALL], gui->font_small_aliasing );

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->clock_text_font );
	if ( ( fnt[CLOCK] = GLES2D_CreateFont( tmp, gui->clock_text_style, gui->clock_text_size ) ) == NULL )
	{
        debug_errorf( "Could not load font (%s)", tmp );
        debug_end();
        return 0;
	}
	GLES2D_SetFontColor( fnt[CLOCK], HEXTOR(gui->clock_text_color), HEXTOG(gui->clock_text_color), HEXTOB(gui->clock_text_color), HEXTOA(gui->clock_text_color) );
    GLES2D_SetFontFiltering( fnt[CLOCK], gui->clock_text_aliasing );

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->sd1_text_font );
	if ( ( fnt[SD1] = GLES2D_CreateFont( tmp, gui->sd1_text_style, gui->sd1_text_size ) ) == NULL )
	{
        debug_errorf( "Could not load font (%s)", tmp );
        debug_end();
        return 0;
	}
	GLES2D_SetFontColor( fnt[SD1], HEXTOR(gui->sd1_text_color), HEXTOG(gui->sd1_text_color), HEXTOB(gui->sd1_text_color), HEXTOA(gui->sd1_text_color) );
    GLES2D_SetFontFiltering( fnt[SD1], gui->sd1_text_aliasing );

	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->sd2_text_font );
	if ( ( fnt[SD2] = GLES2D_CreateFont( tmp, gui->sd2_text_style, gui->sd2_text_size ) ) == NULL )
	{
        debug_errorf( "Could not load font (%s)", tmp );
        debug_end();
        return 0;
	}
	GLES2D_SetFontColor( fnt[SD2], HEXTOR(gui->sd2_text_color), HEXTOG(gui->sd2_text_color), HEXTOB(gui->sd2_text_color), HEXTOA(gui->sd2_text_color) );
    GLES2D_SetFontFiltering( fnt[SD2], gui->sd2_text_aliasing );

	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->cpu_text_font );
	if ( ( fnt[CPU] = GLES2D_CreateFont( tmp, gui->cpu_text_style, gui->cpu_text_size ) ) == NULL )
	{
        debug_errorf( "Could not load font (%s)", tmp );
        debug_end();
        return 0;
	}
	GLES2D_SetFontColor( fnt[CPU], HEXTOR(gui->cpu_text_color), HEXTOG(gui->cpu_text_color), HEXTOB(gui->cpu_text_color), HEXTOA(gui->cpu_text_color) );
    GLES2D_SetFontFiltering( fnt[CPU], gui->cpu_text_aliasing );

	memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->media_text_font );
	if ( ( fnt[MEDIA_FNT] = GLES2D_CreateFont( tmp, gui->media_text_style, gui->media_text_size ) ) == NULL )
	{
        debug_errorf( "Could not load font (%s)", tmp );
        debug_end();
        return 0;
	}
	GLES2D_SetFontColor( fnt[MEDIA_FNT], HEXTOR(gui->media_text_color), HEXTOG(gui->media_text_color), HEXTOB(gui->media_text_color), HEXTOA(gui->media_text_color) );
    GLES2D_SetFontFiltering( fnt[MEDIA_FNT], gui->media_text_aliasing );

    memset ( tmp, 0, 512 );
    sprintf( tmp, "%s/%s", pmenu->skin_dir, gui->font_small );

    int i;
    for ( i = 0; i < CATEGORY_COUNT; i++ )
	{
	    gui->title_cache[i] = GLES2D_CreateFontCache( tmp, gui->title[i], gui->font_small_style, gui->font_small_size, 800 );
	}

	debug_end();
	return 1;
}
Ejemplo n.º 12
0
void gui_clean_skin()
{
    debug_start();

    int i;

    if ( background_applications != NULL )
    {
        GLES2D_FreeTexture( background_applications );
        background_applications = NULL;
    }
    if ( background_media != NULL )
    {
        GLES2D_FreeTexture( background_media );
        background_media = NULL;
    }
    if ( background_settings != NULL )
    {
        GLES2D_FreeTexture( background_settings );
        background_settings = NULL;
    }

    if ( highlight != NULL )
    {
        GLES2D_FreeTexture( highlight );
        highlight = NULL;
    }

	if ( app_highlight != NULL )
	{
        GLES2D_FreeTexture( app_highlight );
        app_highlight = NULL;
	}

	if ( confirm_box != NULL )
	{
        GLES2D_FreeTexture( confirm_box );
        confirm_box = NULL;
	}

	if ( no_icon != NULL )
	{
        GLES2D_FreeTexture( no_icon );
        no_icon = NULL;
    }

	if ( no_preview != NULL )
	{
        GLES2D_FreeTexture( no_preview );
        no_preview = NULL;
	}

	if ( cpu_icon != NULL )
	{
        GLES2D_FreeTexture( cpu_icon );
        cpu_icon = NULL;

    }

    if ( clock_icon != NULL )
    {
        GLES2D_FreeTexture( clock_icon );
        clock_icon = NULL;
    }


    if ( sd1_icon != NULL )
    {
        GLES2D_FreeTexture( sd1_icon );
        sd1_icon = NULL;
    }

    if ( sd2_icon != NULL )
    {
        GLES2D_FreeTexture( sd2_icon );
        sd2_icon = NULL;
    }


	for ( i = 0; i < CATEGORY_COUNT; i++ )
	{
	    if ( category_icon[i] != NULL )
	    {
            GLES2D_FreeTexture( category_icon[i] );
            category_icon[i] = NULL;
	    }
	    if ( category_icon_highlight[i] != NULL )
	    {
            GLES2D_FreeTexture( category_icon_highlight[i] );
            category_icon_highlight[i] = NULL;
	    }
	}

	for ( i = 0; i < FONT_COUNT; i++ )
	{
        if ( fnt[i] != NULL )
        {
            GLES2D_FreeFont( fnt[i] );
            fnt[i] = NULL;
        }
	}

    debug_end();
}
Ejemplo n.º 13
0
void gui_load_preview( int cat, int n )
{
    debug_start();

	alpha_preview = 0;
	preview_scale = 0;

	if( tmp_preview != NULL )
	{
	    GLES2D_FreeTexture( tmp_preview );
	    tmp_preview = NULL;
	}

	if ( access ( applications[cat]->preview_pic1[n], R_OK ) == 0 )
	{
	    if ( is_avi( applications[cat]->preview_pic1[n] ) )
	    {
            debug_info( "Preview is a video" );
            video_play_preview( applications[cat]->preview_pic1[n] );
	    }
	    else
	    {
	        debug_info( "Preview is a picture" );
            if ( ( tmp_preview = GLES2D_CreateTexture( applications[cat]->preview_pic1[n], 0 ) ) == NULL )
            {
                debug_errorf( "GLES2D_CreateTexture(%s);", applications[cat]->preview_pic1[n] );
            }
	    }
	}
	else
	{
	    if ( access ( applications[cat]->fullpath[n], R_OK ) == 0 )
	    {
            if ( applications[cat]->type[n] == IS_PND )
            {
                char src[512];
                memset ( src, 0, 512 );
                sprintf( src, "/mnt/pnd/%s/%s", applications[cat]->id[n], applications[cat]->preview_pic1_name[n] );

                if ( is_avi( applications[cat]->preview_pic1_name[n] ) )
                {
                    pnd_pnd_mount ( pndrun, applications[cat]->fullpath[n], applications[cat]->id[n] );
                    pnd_mounted = 1;

                    if ( access ( src, R_OK ) == 0 )
                    {
                        pnd_pnd_mount ( pndrun, applications[cat]->fullpath[n], applications[cat]->id[n] );
                        pnd_mounted = 1;

                        video_play_preview( src );
                    }
                    else
                    {
                        pnd_pnd_unmount( pndrun, applications[cat]->fullpath[n], applications[cat]->id[n] );
                        pnd_mounted = 0;
                        debug_errorf("Preview pic do not exist (%s)", applications[cat]->preview_pic1[n]);
                        debug_info("Will use fail safe preview pic");
                    }
                }
                else
                {
                    debug_infof( "pnd_pnd_mount( pndrun, %s, %s );\n", applications[cat]->fullpath[n], applications[cat]->id[n] );

                    //pnd_pnd_mount ( pndrun, applications[cat]->fullpath[n], applications[cat]->id[n] );
			fast_mount( applications[cat]->fullpath[n] );

                    debug_info( "Done : pnd_pnd_mount()\n" );

			memset ( src, 0, 512 );
			sprintf( src, "/tmp/%s", applications[cat]->preview_pic1_name[n] );

                    debug_infof( "Creating preview texture from %s\n", src );

                    if ( ( tmp_preview = GLES2D_CreateTexture( src, 0 ) ) == NULL )
                    {
                        debug_errorf( "GLES2D_CreateTexture(%s);", applications[cat]->preview_pic1[n] );
                    }

                    debug_info( "pnd_pnd_umount()\n" );
                    //pnd_pnd_unmount ( pndrun, applications[cat]->fullpath[n], applications[cat]->id[n] );
			fast_umount( );
                    debug_info( "Done : pnd_pnd_umount()\n" );
                }
            }
            else
            {
                debug_errorf("Preview pic do not exist (%s)", applications[cat]->preview_pic1[n]);
                debug_info("Will use fail safe preview pic");
            }
	    }
	    else
	    {
            debug_errorf("Preview pic do not exist (%s)", applications[cat]->preview_pic1[n]);
            debug_info("Will use fail safe preview pic");
	    }
	}
	debug_end();
}
Ejemplo n.º 14
0
int cfg_gui_read()
{
    debug_start();

	config_init(&cfg);

	char cfg_file[512];
    sprintf( cfg_file, "%s/skin.cfg", pmenu->skin_dir );

	if (!config_read_file( &cfg, cfg_file ) )
	{
		debug_errorf ("config_read_file() failed : %s (line %d of %s)\n", cfg_file, (__LINE__ -1), __FILE__);;
		config_destroy(&cfg);
        debug_end();
		return -1;
	}
	else
	{
	    if ( gui != NULL )
	    {
            free( gui );
	    }

		gui = (GUI_CONFIG *) malloc( sizeof(GUI_CONFIG));

		config_setting_t *search = NULL;

		search = config_lookup(&cfg, "gui_main");

		if (!search)
		{
			error("config_lookup() failed\n");
			config_destroy(&cfg);
            debug_end();
			return -1;
		}
		else
		{
            /* skin data files */
		    config_setting_t *tmp = config_setting_get_member(search, "background_applications");
            if(tmp)
            {
                    strcpy( gui->background_applications, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find background_applications in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "background_media");
            if(tmp)
            {
                    strcpy( gui->background_media, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find background_media in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "background_settings");
            if(tmp)
            {
                    strcpy( gui->background_settings, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find background_settings in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "highlight");
            if(tmp)
            {
                    strcpy( gui->highlight, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find highlight in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "highlight_enabled");
            if(tmp)
            {
                    gui->highlight_enabled = config_setting_get_int(tmp);
            }
            else
            {
                debug_errorf( "could not find highlight_enabled in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "application_highlight");
            if(tmp)
            {
                    strcpy( gui->application_highlight, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find application_highlight in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "favorites_icon");
            if(tmp)
            {
                    strcpy( gui->favorites_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find favorites_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "favorites_icon_highlight");
            if(tmp)
            {
                    strcpy( gui->favorites_icon_highlight, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find favorites_icon_highlight in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "emulators_icon");
            if(tmp)
            {
                    strcpy( gui->emulators_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find emulators_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "emulators_icon_highlight");
            if(tmp)
            {
                    strcpy( gui->emulators_icon_highlight, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find emulators_icon_highlight in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }


            tmp = config_setting_get_member(search, "games_icon");
            if(tmp)
            {
                    strcpy( gui->games_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find games_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "games_icon_highlight");
            if(tmp)
            {
                    strcpy( gui->games_icon_highlight, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find games_icon_highlight in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "misc_icon");
            if(tmp)
            {
                    strcpy( gui->misc_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find misc_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "misc_icon_highlight");
            if(tmp)
            {
                    strcpy( gui->misc_icon_highlight, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find misc_icon_highlight in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "media_icon");
            if(tmp)
            {
                    strcpy( gui->media_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find media_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "media_icon_highlight");
            if(tmp)
            {
                    strcpy( gui->media_icon_highlight, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find media_icon_highlight in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "media_file_icon");
            if(tmp)
            {
                    strcpy( gui->media_file_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find media_file_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "media_folder_icon");
            if(tmp)
            {
                    strcpy( gui->media_folder_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find media_folder_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "settings_icon");
            if(tmp)
            {
                    strcpy( gui->settings_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find settings_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "settings_icon_highlight");
            if(tmp)
            {
                    strcpy( gui->settings_icon_highlight, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find settings_icon_highlight in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "confirm_box");
            if(tmp)
            {
                    strcpy( gui->confirm_box, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find confirm_box in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "no_icon");
            if(tmp)
            {
                    strcpy( gui->no_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find no_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "no_preview");
            if(tmp)
            {
                    strcpy( gui->no_preview, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find no_preview in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "cpu_icon");
            if(tmp)
            {
                    strcpy( gui->cpu_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find cpu_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "sd1_icon");
            if(tmp)
            {
                    strcpy( gui->sd1_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find sd1_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "sd2_icon");
            if(tmp)
            {
                    strcpy( gui->sd2_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find sd2_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "clock_icon");
            if(tmp)
            {
                    strcpy( gui->clock_icon, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find clock_icon in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "font_big");
            if(tmp)
            {
                    strcpy( gui->font_big, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find font_big in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "font_small");
            if(tmp)
            {
                    strcpy( gui->font_small, config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find font_small in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

		    tmp = config_setting_get_member( search, "font_small_size" );
		    if(tmp)
			{
				gui->font_small_size = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find font_small_size in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member( search, "font_small_color" );
			if(tmp)
			{
				gui->font_small_color = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find font_small_color in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member( search, "font_small_color_highlight" );
			if(tmp)
			{
				gui->font_small_color_highlight = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find font_small_color_highlight in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "font_small_aliasing" );
			if(tmp)
			{
				gui->font_small_aliasing = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find font_small_aliasing in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "font_small_style" );
			if(tmp)
			{
				gui->font_small_style = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find font_small_style in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member( search, "font_big_size" );
			if(tmp)
			{
				gui->font_big_size = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find font_big_size in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member( search, "font_big_color" );
			if(tmp)
			{
				gui->font_big_color = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find font_big_color in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member( search, "font_big_color_highlight" );
			if(tmp)
			{
				gui->font_big_color_highlight = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find font_big_color_highlight in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "font_big_aliasing" );
			if(tmp)
			{
				gui->font_big_aliasing = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find font_big_aliasing in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "font_big_style" );
			if(tmp)
			{
				gui->font_big_style = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find font_big_style in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "applications_box_x");
			if(tmp)
			{
				gui->applications_box_x = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find applications_box_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "applications_box_y");
			if(tmp)
			{
				gui->applications_box_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find applications_box_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "applications_box_w");
			if(tmp)
			{
				gui->applications_box_w = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find applications_box_w in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "confirm_box_x");
			if(tmp)
			{
				gui->confirm_box_x = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find confirm_box_x in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "confirm_box_y");
			if(tmp)
			{
				gui->confirm_box_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find confirm_box_y in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "preview_pic_x");
			if(tmp)
			{
				gui->preview_pic_x = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find preview_pic_x in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "preview_pic_y");
			if(tmp)
			{
				gui->preview_pic_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find preview_pic_y in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "preview_pic_w");
			if(tmp)
			{
				gui->preview_pic_w = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find preview_pic_w in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "emulators_icon_x");
			if(tmp)
			{
				gui->emulators_icon_x = config_setting_get_int(tmp);
				category_icon_x[EMULATORS] = gui->emulators_icon_x;
			}
			else
            {
                debug_errorf( "could not find emulators_icon_x in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "emulators_icon_y");
			if(tmp)
			{
				gui->emulators_icon_y = config_setting_get_int(tmp);
				category_icon_y[EMULATORS] = gui->emulators_icon_y;
			}
			else
            {
                debug_errorf( "could not find emulators_icon_y in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "emulators_title");
            if(tmp)
            {
                    strcpy( gui->title[EMULATORS], config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find emulators_title in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "games_icon_x");
			if(tmp)
			{
				gui->games_icon_x = config_setting_get_int(tmp);
				category_icon_x[GAMES] = gui->games_icon_x;
			}
			else
            {
                debug_errorf( "could not find games_icon_x in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "games_icon_y");
			if(tmp)
			{
				gui->games_icon_y = config_setting_get_int(tmp);
				category_icon_y[GAMES] = gui->games_icon_y;
			}
			else
            {
                debug_errorf( "could not find games_icon_y in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "games_title");
            if(tmp)
            {
                    strcpy( gui->title[GAMES], config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find games_title in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }


			tmp = config_setting_get_member(search, "misc_icon_x");
			if(tmp)
			{
				gui->misc_icon_x = config_setting_get_int(tmp);
				category_icon_x[MISC] = gui->misc_icon_x;
			}
			else
            {
                debug_errorf( "could not find misc_icon_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "misc_icon_y");
			if(tmp)
			{
				gui->misc_icon_y = config_setting_get_int(tmp);
				category_icon_y[MISC] = gui->misc_icon_y;
			}
			else
            {
                debug_errorf( "could not find misc_icon_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "misc_title");
            if(tmp)
            {
                    strcpy( gui->title[MISC], config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find misc_title in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "media_icon_x");
			if(tmp)
			{
				gui->media_icon_x = config_setting_get_int(tmp);
				category_icon_x[MEDIA] = gui->media_icon_x;
			}
			else
            {
                debug_errorf( "could not find media_icon_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "media_icon_y");
			if(tmp)
			{
				gui->media_icon_y = config_setting_get_int(tmp);
				category_icon_y[MEDIA] = gui->media_icon_y;
			}
			else
            {
                debug_errorf( "could not find media_icon_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "media_title");
            if(tmp)
            {
                    strcpy( gui->title[MEDIA], config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find media_title in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "media_text_font");
            if(tmp)
            {
                    strcpy( gui->media_text_font, config_setting_get_string(tmp) );
            }
            else
            {
                debug_errorf( "could not find media_text_font in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "media_text_size" );
            if(tmp)
            {
                gui->media_text_size = config_setting_get_int(tmp);
            }
            else
            {
                debug_errorf( "could not find media_text_size in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "media_text_color" );
            if(tmp)
            {
                gui->media_text_color = config_setting_get_int(tmp);
            }
            else
            {
                debug_errorf( "could not find media_text_color in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member(search, "media_text_color_highlight" );
            if(tmp)
            {
                gui->media_text_color_highlight = config_setting_get_int(tmp);
            }
            else
            {
                debug_errorf( "could not find media_text_color_highlight in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "media_text_aliasing" );
			if(tmp)
			{
				gui->media_text_aliasing = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find media_text_aliasing in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "media_text_style" );
			if(tmp)
			{
				gui->media_text_style = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find media_text_style in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "media_max_files_per_page");
            if(tmp)
            {
                gui->media_max_files_per_page = config_setting_get_int(tmp);
            }
            else
            {
                debug_errorf( "could not find media_max_files_per_page in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "favorites_icon_x");
			if(tmp)
			{
				gui->favorites_icon_x = config_setting_get_int(tmp);
				category_icon_x[FAVORITES] = gui->favorites_icon_x;
			}
			else
            {
                debug_errorf( "could not find favorites_icon_x in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "favorites_icon_y");
			if(tmp)
			{
				gui->favorites_icon_y = config_setting_get_int(tmp);
				category_icon_y[FAVORITES] = gui->favorites_icon_y;
			}
			else
            {
                debug_errorf( "could not find favorites_icon_y in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "favorites_title");
            if(tmp)
            {
                    strcpy( gui->title[FAVORITES], config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find favorites_title in %s", cfg_file );
                config_destroy(&cfg);
	debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "settings_icon_x");
			if(tmp)
			{
				gui->settings_icon_x = config_setting_get_int(tmp);
				category_icon_x[SETTINGS] = gui->settings_icon_x;
			}
			else
            {
                debug_errorf( "could not find settings_icon_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "settings_icon_y");
			if(tmp)
			{
				gui->settings_icon_y = config_setting_get_int(tmp);
				category_icon_y[SETTINGS] = gui->settings_icon_y;
			}
			else
            {
                debug_errorf( "could not find settings_icon_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			/* cpu infos */
            tmp = config_setting_get_member(search, "cpu_icon_x");
			if(tmp)
			{
				gui->cpu_icon_x = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find cpu_icon_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "cpu_icon_y");
			if(tmp)
			{
				gui->cpu_icon_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find cpu_icon_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "cpu_text_x");
			if(tmp)
			{
				gui->cpu_text_x = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find cpu_text_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "cpu_text_y");
			if(tmp)
			{
				gui->cpu_text_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find cpu_text_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member( search, "cpu_text_font" );
			if(tmp)
			{
				strcpy( gui->cpu_text_font, config_setting_get_string(tmp));
			}
			else
            {
                debug_errorf( "could not find cpu_text_font in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "cpu_text_size" );
			if(tmp)
			{
				gui->cpu_text_size = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find cpu_text_size in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member( search, "cpu_text_color" );
			if(tmp)
			{
				gui->cpu_text_color = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find cpu_text_color in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "cpu_text_aliasing" );
			if(tmp)
			{
				gui->cpu_text_aliasing = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find cpu_text_aliasing in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "cpu_text_style" );
			if(tmp)
			{
				gui->cpu_text_style = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find cpu_text_style in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }


			/*sd1 infos*/
            tmp = config_setting_get_member(search, "sd1_icon_x");
			if(tmp)
			{
				gui->sd1_icon_x = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd1_icon_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "sd1_icon_y");
			if(tmp)
			{
				gui->sd1_icon_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd1_icon_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "sd1_text_x");
			if(tmp)
			{
				gui->sd1_text_x = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd1_text_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "sd1_text_y");
			if(tmp)
			{
				gui->sd1_text_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd1_text_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member( search, "sd1_text_font" );
			if(tmp)
			{
				strcpy( gui->sd1_text_font, config_setting_get_string(tmp));
			}
			else
            {
                debug_errorf( "could not find sd1_text_font in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "sd1_text_size" );
			if(tmp)
			{
				gui->sd1_text_size = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd1_text_size in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
			tmp = config_setting_get_member( search, "sd1_text_color" );
			if(tmp)
			{
				gui->sd1_text_color = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd1_text_color in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "sd1_text_aliasing" );
			if(tmp)
			{
				gui->sd1_text_aliasing = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd1_text_aliasing in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "sd1_text_style" );
			if(tmp)
			{
				gui->sd1_text_style = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd1_text_style in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }


			/*sd2 infos*/
            tmp = config_setting_get_member(search, "sd2_icon_x");
			if(tmp)
			{
				gui->sd2_icon_x = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd2_icon_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "sd2_icon_y");
			if(tmp)
			{
				gui->sd2_icon_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd2_icon_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "sd2_text_x");
			if(tmp)
			{
				gui->sd2_text_x = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd2_text_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "sd2_text_y");
			if(tmp)
			{
				gui->sd2_text_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd2_text_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member( search, "sd2_text_font" );
			if(tmp)
			{
				strcpy( gui->sd2_text_font, config_setting_get_string(tmp));
			}
			else
            {
                debug_errorf( "could not find sd2_text_font in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "sd2_text_size" );
			if(tmp)
			{
				gui->sd2_text_size = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd2_text_size in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member( search, "sd2_text_color" );
			if(tmp)
			{
				gui->sd2_text_color = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd2_text_color in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "sd2_text_aliasing" );
			if(tmp)
			{
				gui->sd2_text_aliasing = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd2_text_aliasing in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "sd2_text_style" );
			if(tmp)
			{
				gui->sd2_text_style = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find sd2_text_style in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			/*clock infos*/
            tmp = config_setting_get_member(search, "clock_icon_x");
			if(tmp)
			{
				gui->clock_icon_x = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find clock_icon_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "clock_icon_y");
			if(tmp)
			{
				gui->clock_icon_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find clock_icon_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "clock_text_x");
			if(tmp)
			{
				gui->clock_text_x = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find clock_text_x in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "clock_text_y");
			if(tmp)
			{
				gui->clock_text_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find clock_text_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member( search, "clock_text_font" );
			if(tmp)
			{
				strcpy( gui->clock_text_font, config_setting_get_string(tmp));
			}
			else
            {
                debug_errorf( "could not find clock_text_font in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "clock_text_size" );
			if(tmp)
			{
				gui->clock_text_size = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find clock_text_size in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member( search, "clock_text_color" );
			if(tmp)
			{
				gui->clock_text_color = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find clock_text_color in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "clock_text_aliasing" );
			if(tmp)
			{
				gui->clock_text_aliasing = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find clock_text_aliasing in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
            tmp = config_setting_get_member( search, "clock_text_style" );
			if(tmp)
			{
				gui->clock_text_style = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find clock_text_style in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }


            tmp = config_setting_get_member(search, "settings_title");
            if(tmp)
            {
                    strcpy( gui->title[SETTINGS], config_setting_get_string(tmp));
            }
            else
            {
                debug_errorf( "could not find settings_title in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

			tmp = config_setting_get_member(search, "show_category_title");
			if(tmp)
			{
				gui->show_category_title = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find show_category_title in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }


			tmp = config_setting_get_member(search, "max_app_per_page");
			if(tmp)
			{
				gui->max_app_per_page = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find max_app_per_page in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "settings_text_spacing");
			if(tmp)
			{
				gui->settings_text_spacing = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find settings_text_spacing in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "icon_scale_max" );
			if(tmp)
			{
				gui->icon_scale_max = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find icon_scale_max in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "icon_scale_min" );
			if(tmp)
			{
				gui->icon_scale_min = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find icon_scale_min in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "applications_spacing" );
			if(tmp)
			{
				gui->applications_spacing = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find applications_spacing in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }

            tmp = config_setting_get_member(search, "applications_title_description_y" );
			if(tmp)
			{
				gui->applications_title_description_y = config_setting_get_int(tmp);
			}
			else
            {
                debug_errorf( "could not find applications_title_description_y in %s", cfg_file );
                config_destroy(&cfg);
                debug_end();
                return 0;
            }
		}
	}

	config_destroy(&cfg);
	debug_end();

	return 1;
}
 uint              oopoff() const { return debug_end(); }