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(); }
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(); }
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(); }
void rediscover() { debug_start( ); pnd_app_clean_list(); pnd_app_get_list(); list_curpos[category] = 0; gui_unload_preview(); debug_end(); }
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(); }
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(); }
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; }
void main_init(int argc, char *argv[]) { char t[512], *p; int c; int tapenext = 0, discnext = 0; startblit(); log_open(); log_info("main: starting %s", VERSION_STR); vid_fskipmax = 1; al_init_main(argc, argv); append_filename(t, exedir, "roms/tube/ReCo6502ROM_816", 511); if (!file_exists(t,FA_ALL,NULL) && selecttube == 4) selecttube = -1; curtube = selecttube; model_check(); for (c = 1; c < argc; c++) { // log_debug("%i : %s",c,argv[c]); /* if (!strcasecmp(argv[c],"-1770")) { I8271=0; WD1770=1; } else*/ //#ifndef WIN32 if (!strcasecmp(argv[c], "--help")) { printf("%s command line options :\n\n", VERSION_STR); printf("-mx - start as model x (see readme.txt for models)\n"); printf("-tx - start with tube x (see readme.txt for tubes)\n"); printf("-disc disc.ssd - load disc.ssd into drives :0/:2\n"); printf("-disc1 disc.ssd - load disc.ssd into drives :1/:3\n"); printf("-autoboot - boot disc in drive :0\n"); printf("-tape tape.uef - load tape.uef\n"); printf("-fasttape - set tape speed to fast\n"); printf("-s - scanlines display mode\n"); printf("-i - interlace display mode\n"); printf("-debug - start debugger\n"); printf("-allegro - use Allegro for video rendering\n"); exit(-1); } else //#endif if (!strcasecmp(argv[c], "-tape")) { tapenext = 2; } else if (!strcasecmp(argv[c], "-disc") || !strcasecmp(argv[c], "-disk")) { discnext = 1; } else if (!strcasecmp(argv[c], "-disc1")) { discnext = 2; } else if (argv[c][0] == '-' && (argv[c][1] == 'm' || argv[c][1] == 'M')) { sscanf(&argv[c][2], "%i", &curmodel); } else if (argv[c][0] == '-' && (argv[c][1] == 't' || argv[c][1] == 'T')) { sscanf(&argv[c][2], "%i", &curtube); } else if (!strcasecmp(argv[c], "-fasttape")) { fasttape = 1; } else if (!strcasecmp(argv[c], "-autoboot")) { autoboot = 150; } else if (argv[c][0] == '-' && (argv[c][1] == 'f' || argv[c][1]=='F')) { sscanf(&argv[c][2], "%i", &vid_fskipmax); if (vid_fskipmax < 1) vid_fskipmax = 1; if (vid_fskipmax > 9) vid_fskipmax = 9; } else if (argv[c][0] == '-' && (argv[c][1] == 's' || argv[c][1] == 'S')) { vid_scanlines = 1; } else if (!strcasecmp(argv[c], "-debug")) { debug_core = 1; } else if (!strcasecmp(argv[c], "-debugtube")) { debug_tube = 1; } else if (argv[c][0] == '-' && (argv[c][1] == 'i' || argv[c][1] == 'I')) { vid_interlace = 1; vid_linedbl = vid_scanlines = 0; } else if (tapenext) strcpy(tape_fn, argv[c]); else if (discnext) { strcpy(discfns[discnext-1], argv[c]); discnext = 0; } else { if ((p = strrchr(argv[c], '.')) && (!strcasecmp(p, ".uef") || !strcasecmp(p, ".csw"))) { strncpy(tape_fn, argv[c], sizeof tape_fn); tapenext = 0; } else { strncpy(discfns[0], argv[c], sizeof discfns[0]); discnext = 0; autoboot = 150; } } if (tapenext) tapenext--; } video_init(); mode7_makechars(); #ifndef WIN32 install_keyboard(); #endif install_timer(); mem_init(); ddnoise_init(); tapenoise_init(); sound_init(); al_init(); sid_init(); sid_settype(sidmethod, cursid); music5000_init(); adc_init(); #ifdef WIN32 pal_init(); #endif disc_init(); fdi_init(); scsi_init(); ide_init(); vdfs_init(); model_init(); midi_init(); main_reset(); install_int_ex(secint, MSEC_TO_TIMER(1000)); install_int_ex(int50, MSEC_TO_TIMER(20)); set_display_switch_mode(SWITCH_BACKGROUND); #ifdef WIN32 timeBeginPeriod(1); #endif oldmodel = curmodel; if (curtube == 3 || mouse_amx) install_mouse(); disc_load(0, discfns[0]); disc_load(1, discfns[1]); tape_load(tape_fn); if (defaultwriteprot) writeprot[0] = writeprot[1] = 1; endblit(); debug_start(); }
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; }
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(); }
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(); }
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; }
/*! main */ int main(void) { struct debug_t *debug; struct programs_t *progs; struct cmdli_t *cmdli; /* convenient pre-allocated structure */ struct tm *tm_clock; char c; /* anti warning for non initialized variables */ debug = NULL; progs = NULL; cmdli = NULL; tm_clock = NULL; /* Init sequence, turn on both led */ led_init(); led_set(BOTH, ON); io_init(); usb_init(); debug = debug_init(debug); progs = prog_init(progs); cmdli = cmdli_init(cmdli); tm_clock = date_init(tm_clock, debug); set_sleep_mode(SLEEP_MODE_PWR_SAVE); sei(); date_hwclock_start(); led_set(BOTH, OFF); while (1) { /* PC is connected but debug is off. */ if (usb_connected && (!debug->active)) debug_start(debug); if (debug->active && (!usb_connected)) debug_stop(debug); /* If PC is connected * then check for a command sent from the user * and execute it. * Anyway do NOT go to sleep. */ if (debug->active) { c = uart_getchar(0, 0); if (c) { /* echo */ uart_putchar(0, c); cmdli_exec(c, cmdli, progs, debug); } } else { go_to_sleep(progs->valve, debug); if (prog_alarm(progs) && flag_get(progs, FL_LED)) led_set(RED, BLINK); } /* if there is a job to do (open, close valves). */ if (date_timetorun(tm_clock, debug)) job_on_the_field(progs, debug, tm_clock); } /* This part should never be reached */ date_hwclock_stop(); cli(); date_free(tm_clock); cmdli_free(cmdli); prog_free(progs); debug_free(debug); return(0); }