void ShowGps(GPS_READING &item) { LogStart(GPS_TYPE,"GPS"); LogElement( itow , "itow"); // ms GPS Millisecond Time of Week LogElement(ECEF_X , "ECEF_X"); // cm ECEF X coordinate LogElement(ECEF_Y , "ECEF_Y"); // cm ECEF Y coordinate LogElement(ECEF_Z , "ECEF_Z"); // cm ECEF Z coordinate LogElement(PAcc , "PAcc"); // cm 3D Position Accuracy Estimate LogElement(ECEFVX , "ECEFVX"); // cm/s ECEF X velocity LogElement(ECEFVY , "ECEFVY"); // cm/s ECEF Y velocity LogElement(ECEFVZ , "ECEFVZ"); // cm/s ECEF Z velocity LogElement(LON , "LON"); // 1e-07 deg Longitude LogElement(LAT , "LAT"); // 1e-07 deg Latitude LogElement(HEIGHT , "HEIGHT"); // mm Height above Ellipsoid LogElement(HMSL , "HMSL"); // mm Height above mean sea level LogElement(VEL_N , "VEL_N"); // cm/s NED north velocity LogElement(VEL_E , "VEL_E"); // cm/s NED east velocity LogElement(VEL_D , "VEL_D"); // cm/s NED down velocity LogElement(Speed , "Speed"); // cm/s Speed (3-D) LogElement(GSpeed , "GSpeed"); // cm/s Ground Speed (2-D) LogElement(Heading, "Heading"); // 1e-05 deg Heading 2-D LogElement(SAcc , "SAcc"); // cm/s Speed Accuracy Estimate LogElement(CAcc , "CAcc"); // deg Course / Heading Accuracy Estimate LogElement(Hacc , "Hacc"); // mm Horizontal Accuracy Estimate LogElement(Vacc , "Vacc"); // mm Vertical Accuracy Estimate LogElement(numSV , "numSV"); // Number of SVs used in navigation solution LogElement(GPSfix , "GPSfix"); // GPSfix Type, range 0..6 LogElement(week , "week"); // GPS week LogElement(ReadingNum,"RN"); }
void ShowConfig(sensor_saved_config &item) { LogStart(CFG_TYPE,"Config"); LogElement(mag_max[0] ,"mag_max[0]"); LogElement(mag_max[1] ,"mag_max[1]"); LogElement(mag_max[2] ,"mag_max[2]"); LogElement(mag_min[0] ,"mag_min[0]"); LogElement(mag_min[1] ,"mag_min[1]"); LogElement(mag_min[2] ,"mag_min[2]"); LogElement(accel_zero[0] ,"accel_zero[0]"); LogElement(accel_zero[1] ,"accel_zero[1]"); LogElement(accel_zero[2] ,"accel_zero[2]"); LogElement(default_gyro_zero[0] ,"default_gyro_zero[0]"); LogElement(default_gyro_zero[1] ,"default_gyro_zero[1]"); LogElement(default_gyro_zero[2] ,"default_gyro_zero[2]"); LogElement(servo_neg_lim[0] ,"servo_neg_lim[0]"); LogElement(servo_neg_lim[1] ,"servo_neg_lim[1]"); LogElement(servo_neg_lim[2] ,"servo_neg_lim[2]"); LogElement(servo_neg_lim[3] ,"servo_neg_lim[3]"); LogElement(servo_pos_lim[0] ,"servo_pos_lim[0]"); LogElement(servo_pos_lim[1] ,"servo_pos_lim[1]"); LogElement(servo_pos_lim[2] ,"servo_pos_lim[2]"); LogElement(servo_pos_lim[3] ,"servo_pos_lim[3]"); LogElement(servo_mid[0] ,"servo_mid[0]"); LogElement(servo_mid[1] ,"servo_mid[1]"); LogElement(servo_mid[2] ,"servo_mid[2]"); LogElement(servo_mid[3] ,"servo_mid[3]"); }
void CreateInvokeFile( char *name, void (*rtn)(void) ) { char *p; p = ReScan( name ); LogStart(); rtn(); LogEnd(); ReScan( p ); }
void ShowSmGps(SMGPS_READING & item) { LogStart(SGPS_TYPE,"SGPS"); LogElement(LON , "LON"); // 1e-07 deg Longitude LogElement(LAT , "LAT"); // 1e-07 deg Latitude LogElement(numSV , "numSV"); // Number of SVs used in navigation solution LogElement(GSpeed , "GSpeed"); // cm/s Ground Speed (2-D) LogElement(Heading, "Heading"); // 1e-05 deg Heading 2-D LogElement(Hacc , "Hacc"); // mm Horizontal Accuracy Estimate }
void ShowMMRec(mmax & item) { LogStart(MAX_TYPE,"MAX"); LogElement(mgz,"MGZ"); LogElement(mmx,"MMX"); LogElement(mmy,"MMY"); LogElement(ngz,"NGZ"); LogElement(nmx,"NMX"); LogElement(nmy,"NMY"); }
jint JNI_OnLoad(JavaVM * vm, void * reserved) { JNIEnv * env; if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_6) != JNI_OK) return -1; yvm = vm; LogStart(); LogChangeOutput(DEBUG_CALLBACK, (char *) log_callback); return JNI_VERSION_1_6; }
void ProcLog( void ) { if( ScanEOC() ) { LogEnd(); } else if( CurrToken == T_GT ) { Scan(); LogAppend(); } else if( CurrToken == T_DIV ) { Scan(); (*LogJmpTab[ ScanCmd( LogNameTab ) ])(); } else { LogStart(); } }
void ShowRC(DSM2_READING &item) { LogStart(DSM2_TYPE,"DSM2"); LogElement(val[0],"V0"); LogElement(val[1],"V1"); LogElement(val[2],"V2"); LogElement(val[3],"V3"); LogElement(val[4],"V4"); LogElement(val[5],"V5"); LogElement(val[6],"V6"); LogElement(val[7],"V7"); LogElement(ReadingNum,"RN"); }
uint32_t DataBaseStart(void) { uint32_t result; result = LogStart(); if(result == FR_OK) { result = DB_NO_ERROR; }else { result = DB_ERROR; } return result; }
void ShowImuRec(ImuRegisters & item) { LogStart(IMU_TYPE,"IMU"); LogElement(ax,"Ax"); LogElement(ay,"Ay"); LogElement(az,"Az"); LogElement(gx,"Gx"); LogElement(gy,"Gy"); LogElement(gz,"Gz"); LogElement(mx,"Mx"); LogElement(my,"My"); LogElement(mz,"Mz"); LogElement(t,"T"); LogElement(ReadingNum,"RN"); LogElement(fIhead,"IH"); LogElement(fMhead,"MH"); LogElement(GHeading,"GH"); LogElement(odo,"Od"); }
void ProcLog( void ) { int cmd; if( ScanEOC() ) { LogEnd(); } else if( CurrToken == T_GT ) { Scan(); LogAppend(); } else if( CurrToken == T_DIV ) { Scan(); cmd = ScanCmd( LogNameTab ); if( cmd < 0 ) { BadLog(); } else { (*LogJmpTab[cmd])(); } } else { LogStart(); } }
void UIYabause::showEvent( QShowEvent* e ) { QMainWindow::showEvent( e ); if ( !mInit ) { LogStart(); LogChangeOutput( DEBUG_CALLBACK, (char*)qAppendLog ); VolatileSettings* vs = QtYabause::volatileSettings(); if ( vs->value( "View/Menubar" ).toInt() == BD_ALWAYSHIDE ) menubar->hide(); if ( vs->value( "View/Toolbar" ).toInt() == BD_ALWAYSHIDE ) toolBar->hide(); if ( vs->value( "autostart" ).toBool() ) aEmulationRun->trigger(); aEmulationFrameSkipLimiter->setChecked( vs->value( "General/EnableFrameSkipLimiter" ).toBool() ); aViewFPS->setChecked( vs->value( "General/ShowFPS" ).toBool() ); mInit = true; } }
int main(int argc, char ** argv) { static unsigned short keypad = 0; u32 last_cycle; #ifdef DEBUG LogStart(); #endif NDS_Init(); SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4); if (argc < 2) { fprintf(stderr, "usage: %s filename\n", argv[0]); return 1; } if (NDS_LoadROM(argv[1], MC_TYPE_AUTODETECT, 1) < 0) { fprintf(stderr, "error while loading %s\n", argv[1]); return 2; } /* // This has to get fixed yet strcpy(szRomPath, dirname(argv[1])); cflash_close(); cflash_init(); */ execute = TRUE; if(SDL_Init(SDL_INIT_VIDEO) == -1) { fprintf(stderr, "Error trying to initialize SDL: %s\n", SDL_GetError()); return 1; } SDL_WM_SetCaption("Desmume SDL", NULL); /* Initialize joysticks */ if(!init_joy()) return 1; /* Load our own keyboard configuration */ set_kb_keys(cli_kb_cfg); surface = SDL_SetVideoMode(256, 384, 32, SDL_SWSURFACE); while(!sdl_quit) { /* Look for queued events and update keypad status */ keypad = process_ctrls_events(keypad); /* Update mouse position and click */ if(mouse.down) NDS_setTouchPos(mouse.x, mouse.y); if(mouse.click) { NDS_releasTouch(); mouse.click = FALSE; } update_keypad(keypad); /* Update keypad */ last_cycle = NDS_exec((560190 << 1) - last_cycle, FALSE); SPU_Emulate(); Draw(); } /* Unload joystick */ uninit_joy(); SDL_Quit(); NDS_DeInit(); #ifdef DEBUG LogStop(); #endif return 0; }
static int common_gtk_glade_main( struct configured_features *my_config) { SDL_TimerID limiter_timer; gdbstub_handle_t arm9_gdb_stub; gdbstub_handle_t arm7_gdb_stub; struct armcpu_memory_iface *arm9_memio = &arm9_base_memory_iface; struct armcpu_memory_iface *arm7_memio = &arm7_base_memory_iface; struct armcpu_ctrl_iface *arm9_ctrl_iface; struct armcpu_ctrl_iface *arm7_ctrl_iface; #ifdef GTKGLEXT_AVAILABLE // check if you have GTHREAD when running configure script //g_thread_init(NULL); register_gl_fun(my_gl_Begin,my_gl_End); #endif #ifdef DEBUG LogStart(); #endif init_keyvals(); if ( my_config->arm9_gdb_port != 0) { arm9_gdb_stub = createStub_gdb( my_config->arm9_gdb_port, &arm9_memio, &arm9_base_memory_iface); if ( arm9_gdb_stub == NULL) { g_print( "Failed to create ARM9 gdbstub on port %d\n", my_config->arm9_gdb_port); return -1; } } if ( my_config->arm7_gdb_port != 0) { arm7_gdb_stub = createStub_gdb( my_config->arm7_gdb_port, &arm7_memio, &arm7_base_memory_iface); if ( arm7_gdb_stub == NULL) { g_print( "Failed to create ARM7 gdbstub on port %d\n", my_config->arm7_gdb_port); return -1; } } if(SDL_Init( SDL_INIT_TIMER | SDL_INIT_VIDEO) == -1) { fprintf(stderr, "Error trying to initialize SDL: %s\n", SDL_GetError()); return 1; } desmume_init( arm9_memio, &arm9_ctrl_iface, arm7_memio, &arm7_ctrl_iface); /* * Activate the GDB stubs * This has to come after the NDS_Init (called in desmume_init) * where the cpus are set up. */ if ( my_config->arm9_gdb_port != 0) { activateStub_gdb( arm9_gdb_stub, arm9_ctrl_iface); } if ( my_config->arm7_gdb_port != 0) { activateStub_gdb( arm7_gdb_stub, arm7_ctrl_iface); } /* Initialize joysticks */ if(!init_joy()) return 1; CONFIG_FILE = g_build_filename(g_get_home_dir(), ".desmume.ini", NULL); Read_ConfigFile(); /* load the interface */ xml = glade_xml_new(get_ui_file("DeSmuMe.glade"), NULL, NULL); xml_tools = glade_xml_new(get_ui_file("DeSmuMe_Dtools.glade"), NULL, NULL); pWindow = glade_xml_get_widget(xml, "wMainW"); pDrawingArea = glade_xml_get_widget(xml, "wDraw_Main"); pDrawingArea2 = glade_xml_get_widget(xml, "wDraw_Sub"); /* connect the signals in the interface */ glade_xml_signal_autoconnect_StringObject(xml); glade_xml_signal_autoconnect_StringObject(xml_tools); init_GL_capabilities( my_config->software_colour_convert); /* check command line file */ if( my_config->nds_file) { if(desmume_open( my_config->nds_file) >= 0) { desmume_resume(); enable_rom_features(); } else { GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pWindow), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Unable to load :\n%s", my_config->nds_file); gtk_dialog_run(GTK_DIALOG(pDialog)); gtk_widget_destroy(pDialog); } } gtk_widget_show(pDrawingArea); gtk_widget_show(pDrawingArea2); { int use_null_3d = my_config->disable_3d; #ifdef GTKGLEXT_AVAILABLE if ( !use_null_3d) { /* setup the gdk 3D emulation */ if ( init_opengl_gdk_3Demu()) { NDS_3D_SetDriver(1); if (!gpu3D->NDS_3D_Init()) { fprintf( stderr, "Failed to initialise openGL 3D emulation; " "removing 3D support\n"); use_null_3d = 1; } } else { fprintf( stderr, "Failed to setup openGL 3D emulation; " "removing 3D support\n"); use_null_3d = 1; } } #endif if ( use_null_3d) { NDS_3D_SetDriver ( 0); gpu3D->NDS_3D_Init(); } } // on_menu_tileview_activate(NULL,NULL); /* setup the frame limiter and indicate if it is disabled */ glade_fps_limiter_disabled = my_config->disable_limiter; if ( !glade_fps_limiter_disabled) { /* create the semaphore used for fps limiting */ glade_fps_limiter_semaphore = SDL_CreateSemaphore( 1); /* start a SDL timer for every FPS_LIMITER_FRAME_PERIOD * frames to keep us at 60 fps */ limiter_timer = SDL_AddTimer( 16 * FPS_LIMITER_FRAME_PERIOD, glade_fps_limiter_fn, glade_fps_limiter_semaphore); if ( limiter_timer == NULL) { fprintf( stderr, "Error trying to start FPS limiter timer: %s\n", SDL_GetError()); SDL_DestroySemaphore( glade_fps_limiter_semaphore); glade_fps_limiter_disabled = 1; } } /* start event loop */ gtk_main(); desmume_free(); if ( !glade_fps_limiter_disabled) { /* tidy up the FPS limiter timer and semaphore */ SDL_RemoveTimer( limiter_timer); SDL_DestroySemaphore( glade_fps_limiter_semaphore); } #ifdef DEBUG LogStop(); #endif /* Unload joystick */ uninit_joy(); SDL_Quit(); Write_ConfigFile(); return EXIT_SUCCESS; }
TestHarness::TestHarness(QWidget *parent) : QWidget(parent) { QGroupBox *ecu_box = new QGroupBox("Engine Control Unit"); QGroupBox *gps_box = new QGroupBox("GPS"); QGroupBox *imu_box = new QGroupBox("Inertial Measurement Unit"); QGroupBox *lts_box = new QGroupBox("Lighting System"); QGroupBox *wls_box = new QGroupBox("Wireless Radio"); QGroupBox *tmr_box = new QGroupBox("Timer/Logger"); QGridLayout *ecu_layout = new QGridLayout(); QGridLayout *gps_layout = new QGridLayout(); QGridLayout *imu_layout = new QGridLayout(); QGridLayout *lts_layout = new QGridLayout(); QGridLayout *wls_layout = new QGridLayout(); QGridLayout *tmr_layout = new QGridLayout(); QGridLayout *layout = new QGridLayout(); // ecu box ecu_rpm_label = new QLabel("RPM:"); ecu_rpm_edit = new QLineEdit("2000"); ecu_spark_label = new QLabel("Spark Advance:"); ecu_spark_edit = new QLineEdit("15.0"); ecu_cranking_label = new QLabel("Cranking:"); ecu_cranking_edit = new QCheckBox("Yes"); ecu_map_label = new QLabel("Manifold Air Pres:"); ecu_map_edit = new QLineEdit("1500.0"); ecu_mat_label = new QLabel("Manifold Air Temp:"); ecu_mat_edit = new QLineEdit("15.0"); ecu_clt_label = new QLabel("Coolant Temp:"); ecu_clt_edit = new QLineEdit("90.0"); ecu_tps_label = new QLabel("Throttle Position:"); ecu_tps_edit = new QLineEdit("50.0"); ecu_batt_label = new QLabel("Battery:"); ecu_batt_edit = new QLineEdit("11.9"); ecu_maf_label = new QLabel("Mass Airflow:"); ecu_maf_edit = new QLineEdit("900.0"); ecu_tc_label = new QLabel("Tach Count:"); ecu_tc_edit = new QLineEdit("100"); ecu_update_button = new QPushButton("Update"); ecu_layout->addWidget(ecu_rpm_label, 0, 0); ecu_layout->addWidget(ecu_rpm_edit, 0, 1); ecu_layout->addWidget(ecu_spark_label, 1, 0); ecu_layout->addWidget(ecu_spark_edit, 1, 1); ecu_layout->addWidget(ecu_cranking_label, 2, 0); ecu_layout->addWidget(ecu_cranking_edit, 2, 1); ecu_layout->addWidget(ecu_map_label, 3, 0); ecu_layout->addWidget(ecu_map_edit, 3, 1); ecu_layout->addWidget(ecu_mat_label, 4, 0); ecu_layout->addWidget(ecu_mat_edit, 4, 1); ecu_layout->addWidget(ecu_clt_label, 5, 0); ecu_layout->addWidget(ecu_clt_edit, 5, 1); ecu_layout->addWidget(ecu_tps_label, 6, 0); ecu_layout->addWidget(ecu_tps_edit, 6, 1); ecu_layout->addWidget(ecu_batt_label, 7, 0); ecu_layout->addWidget(ecu_batt_edit, 7, 1); ecu_layout->addWidget(ecu_maf_label, 8, 0); ecu_layout->addWidget(ecu_maf_edit, 8, 1); ecu_layout->addWidget(ecu_tc_label, 9, 0); ecu_layout->addWidget(ecu_tc_edit, 9, 1); ecu_layout->addWidget(ecu_update_button, 10, 0, 1, 2); ecu_layout->setRowStretch(11, 1); // gps box gps_time_label = new QLabel("UTC Time:"); gps_colon1_label = new QLabel(":"); gps_colon2_label = new QLabel(":"); gps_hrs_edit = new QLineEdit("12"); gps_mins_edit = new QLineEdit("01"); gps_secs_edit = new QLineEdit("01.001"); gps_lat_label = new QLabel("Latitude:"); gps_deg1_label = new QLabel("deg"); gps_min1_label = new QLabel("min"); gps_latdeg_edit = new QLineEdit("35"); gps_latmin_edit = new QLineEdit("15.653229"); gps_latdir_edit = new QLineEdit("N"); gps_long_label = new QLabel("Longitude:"); gps_deg2_label = new QLabel("deg"); gps_min2_label = new QLabel("min"); gps_longdeg_edit = new QLineEdit("120"); gps_longmin_edit = new QLineEdit("39.2362974"); gps_longdir_edit = new QLineEdit("W"); gps_alt_label = new QLabel("Altitude:"); gps_alt_edit = new QLineEdit("500.0"); gps_speed_label = new QLabel("Speed:"); gps_speed_edit = new QLineEdit("25.0"); gps_heading_label = new QLabel("Heading:"); gps_heading_edit = new QLineEdit("187.5"); gps_update_button = new QPushButton("Update"); gps_layout->addWidget(gps_time_label, 0, 0); gps_layout->addWidget(gps_hrs_edit, 0, 1); gps_layout->addWidget(gps_colon1_label, 0, 2); gps_layout->addWidget(gps_mins_edit, 0, 3); gps_layout->addWidget(gps_colon2_label, 0, 4); gps_layout->addWidget(gps_secs_edit, 0, 5); gps_layout->addWidget(gps_lat_label, 1, 0); gps_layout->addWidget(gps_latdeg_edit, 1, 1); gps_layout->addWidget(gps_deg1_label, 1, 2); gps_layout->addWidget(gps_latmin_edit, 1, 3); gps_layout->addWidget(gps_min1_label, 1, 4); gps_layout->addWidget(gps_latdir_edit, 1, 5); gps_layout->addWidget(gps_long_label, 2, 0); gps_layout->addWidget(gps_longdeg_edit, 2, 1); gps_layout->addWidget(gps_deg2_label, 2, 2); gps_layout->addWidget(gps_longmin_edit, 2, 3); gps_layout->addWidget(gps_min2_label, 2, 4); gps_layout->addWidget(gps_longdir_edit, 2, 5); gps_layout->addWidget(gps_alt_label, 3, 0); gps_layout->addWidget(gps_alt_edit, 3, 1, 1, 5); gps_layout->addWidget(gps_speed_label, 4, 0); gps_layout->addWidget(gps_speed_edit, 4, 1, 1, 5); gps_layout->addWidget(gps_heading_label, 5, 0); gps_layout->addWidget(gps_heading_edit, 5, 1, 1, 5); gps_layout->addWidget(gps_update_button, 6, 0, 1, 6); gps_layout->setRowStretch(7, 1); // imu box imu_ax_label = new QLabel("Accel X:"); imu_ax_edit = new QLineEdit("0.0"); imu_ay_label = new QLabel("Accel Y:"); imu_ay_edit = new QLineEdit("1.0"); imu_az_label = new QLabel("Accel Z:"); imu_az_edit = new QLineEdit("0.0"); imu_gx_label = new QLabel("Gyro X:"); imu_gx_edit = new QLineEdit("0.0"); imu_gy_label = new QLabel("Gyro Y:"); imu_gy_edit = new QLineEdit("0.0"); imu_gz_label = new QLabel("Gyro Z:"); imu_gz_edit = new QLineEdit("0.0"); imu_update_button = new QPushButton("Update"); imu_layout->addWidget(imu_ax_label, 0, 0); imu_layout->addWidget(imu_ax_edit, 0, 1); imu_layout->addWidget(imu_ay_label, 1, 0); imu_layout->addWidget(imu_ay_edit, 1, 1); imu_layout->addWidget(imu_az_label, 2, 0); imu_layout->addWidget(imu_az_edit, 2, 1); imu_layout->addWidget(imu_gx_label, 3, 0); imu_layout->addWidget(imu_gx_edit, 3, 1); imu_layout->addWidget(imu_gy_label, 4, 0); imu_layout->addWidget(imu_gy_edit, 4, 1); imu_layout->addWidget(imu_gz_label, 5, 0); imu_layout->addWidget(imu_gz_edit, 5, 1); imu_layout->addWidget(imu_update_button, 6, 0, 1, 2); imu_layout->setRowStretch(7, 1); // lights box lts_head_label = new QLabel("Headlights:"); lts_head_edit = new QCheckBox("On"); lts_brake_label = new QLabel("Brakelights:"); lts_brake_edit = new QCheckBox("On"); lts_left_label = new QLabel("Left Turn Signal:"); lts_left_edit = new QCheckBox("On"); lts_right_label = new QLabel("Right Turn Signal:"); lts_right_edit = new QCheckBox("On"); lts_hazards_label = new QLabel("Hazards:"); lts_hazards_edit = new QCheckBox("On"); lts_update_button = new QPushButton("Update"); lts_layout->addWidget(lts_head_label, 0, 0); lts_layout->addWidget(lts_head_edit, 0, 1); lts_layout->addWidget(lts_brake_label, 1, 0); lts_layout->addWidget(lts_brake_edit, 1, 1); lts_layout->addWidget(lts_left_label, 2, 0); lts_layout->addWidget(lts_left_edit, 2, 1); lts_layout->addWidget(lts_right_label, 3, 0); lts_layout->addWidget(lts_right_edit, 3, 1); lts_layout->addWidget(lts_hazards_label, 4, 0); lts_layout->addWidget(lts_hazards_edit, 4, 1); lts_layout->addWidget(lts_update_button, 5, 0, 1, 2); lts_layout->setRowStretch(6, 1); // wireless box wls_rx_label = new QLabel("Received from the radio:"); wls_rx_edit = new QTextEdit(); wls_tx_label = new QLabel("Transmit to the radio:"); wls_tx_edit = new QTextEdit(); wls_update_button = new QPushButton("Update"); wls_layout->addWidget(wls_rx_label, 0, 0); wls_layout->addWidget(wls_rx_edit, 1, 0); wls_layout->addWidget(wls_tx_label, 2, 0); wls_layout->addWidget(wls_tx_edit, 3, 0); wls_layout->addWidget(wls_update_button, 4, 0); wls_layout->setRowStretch(5, 1); // timer box tmr_time_display = new QLCDNumber(8); tmr_time_display->setSegmentStyle(QLCDNumber::Flat); tmr_start_button = new QPushButton("Start Timer"); tmr_stop_button = new QPushButton("Stop Timer"); log_start_button = new QPushButton("Start Data Logger"); log_stop_button = new QPushButton("Stop Data Logger"); tmr_layout->addWidget(tmr_time_display, 0, 0); tmr_layout->addWidget(tmr_start_button, 1, 0); tmr_layout->addWidget(tmr_stop_button, 2, 0); tmr_layout->addWidget(log_start_button, 3, 0); tmr_layout->addWidget(log_stop_button, 4, 0); tmr_layout->setRowStretch(5, 1); // master layout ecu_box->setLayout(ecu_layout); gps_box->setLayout(gps_layout); imu_box->setLayout(imu_layout); lts_box->setLayout(lts_layout); wls_box->setLayout(wls_layout); tmr_box->setLayout(tmr_layout); layout->addWidget(ecu_box, 0, 0); layout->addWidget(gps_box, 0, 1); layout->addWidget(imu_box, 0, 2); layout->addWidget(lts_box, 1, 0); layout->addWidget(wls_box, 1, 1); layout->addWidget(tmr_box, 1, 2); setLayout(layout); setWindowTitle("Hardware Interface Test Harness"); // connect up the ui to internal slots connect(tmr_start_button, SIGNAL(clicked()), this, SLOT(TmrStart())); connect(tmr_stop_button, SIGNAL(clicked()), this, SLOT(TmrStop())); connect(this, SIGNAL(TmrTick(int)), tmr_time_display, SLOT(display(int))); connect(ecu_update_button, SIGNAL(clicked()), this, SLOT(UpdateEcu())); connect(gps_update_button, SIGNAL(clicked()), this, SLOT(UpdateGps())); connect(imu_update_button, SIGNAL(clicked()), this, SLOT(UpdateImu())); connect(lts_update_button, SIGNAL(clicked()), this, SLOT(UpdateLts())); connect(wls_update_button, SIGNAL(clicked()), this, SLOT(UpdateWls())); // done initializing ui, set up some internal stuff timer_running = false; time = new QTime(); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(TimerTick())); // debug logger = new DataLogger(); dashboard = new Dashboard(); dashboard->show(); // connect up the test harness to the data logger connect(log_start_button, SIGNAL(clicked()), logger, SLOT(LogStart())); connect(log_stop_button, SIGNAL(clicked()), logger, SLOT(LogStop())); connect(this, SIGNAL(EcuStateChanged(ecustate_t)), logger, SLOT(EcuUpdate(ecustate_t))); connect(this, SIGNAL(GpsStateChanged(gpsstate_t)), logger, SLOT(GpsUpdate(gpsstate_t))); connect(this, SIGNAL(ImuStateChanged(imustate_t)), logger, SLOT(ImuUpdate(imustate_t))); connect(this, SIGNAL(LtsStateChanged(ltsstate_t)), logger, SLOT(LtsUpdate(ltsstate_t))); connect(this, SIGNAL(TmrTick(int)), logger, SLOT(TmrUpdate(int))); // connect up the test harness to the dashboard connect(this, SIGNAL(TmrTick(int)), dashboard, SLOT(TmrUpdate(int))); connect(this, SIGNAL(EcuStateChanged(ecustate_t)), dashboard, SLOT(EcuUpdate(ecustate_t))); connect(this, SIGNAL(GpsStateChanged(gpsstate_t)), dashboard, SLOT(GpsUpdate(gpsstate_t))); connect(this, SIGNAL(ImuStateChanged(imustate_t)), dashboard, SLOT(ImuUpdate(imustate_t))); connect(this, SIGNAL(LtsStateChanged(ltsstate_t)), dashboard, SLOT(LtsUpdate(ltsstate_t))); }
int main(int argc, const char *argv[]) // return values: // 1 == error init dpmi / couldn't lock // 2 == error initing log buffers // 3 == error installing lammcall rmcode // 4 == useipxlink requested, but couldn't install // 5 == error while linking // 6 == error loading gp2.exe { char *fullname = NULL; DWORD *pULongCfg = NULL; char *pStrCfg = NULL; char cfgnamebuf[_MAX_PATH]; char *cfgname = NULL; char *gp2exename = GP2_EXE_FILENAME; char *gp2logname = GP2LOG_DEBUG_FILENAME; DWORD dpmicode; ubyte log_flags = 0, i /* count var */; char tmpbuf[128]; #ifndef TEST //----- invoked by our own stub? -------- // ACHTUNG: "GP2LINT" muss ungerade Anzahl Buchstaben haben (wegen updown & gamma) if (strcmp(getenv(updown("GP2LINT")), updown("GAMMA")) != 0) { //--- it's not defined, so leave quiet --- #ifdef TEST fprintf(stderr, "GP2LINT not defined!\n"); #endif return 140; } #endif printf(GP2LAP_BANNER_STR); #ifdef SOCKCLNT printf("This version of GP2Lap was compiled as a socket client.\n"); #endif #ifndef AUTH printf("This version of GP2Lap cannot be used for online leagues that require authentication.\n"); #endif //------- Init configuration if (GetConfigFileNameOpt(cfgnamebuf, _MAX_PATH, argc, (void*)argv)) { cfgname = cfgnamebuf; if (!strchr(cfgname, '.')) strcat(cfgname, ".cfg"); } else cfgname = GP2LAP_CFG_FILENAME; switch (InitCfgValues(cfgname, &paths_to_check, &items, &fullname)) { case 0: printf("- Configuration read from: %s\n", fullname); break; case 1: fprintf(stderr, "*** can't open %s\n", fullname); break; case 2: fprintf(stderr, "*** can't locate %s\n", fullname); break; } pULongCfg = GetCfgULong("logDebug"); if (pULongCfg) setbits(log_flags, BLF_DISABLED, !*pULongCfg); pULongCfg = GetCfgULong("logDebugFlush"); if (pULongCfg) setbits(log_flags, BLF_FLUSHALWAYS, *pULongCfg); pStrCfg = GetCfgString("logDebugName"); if (pStrCfg && strlen(pStrCfg) > 0) // strlen doesn't seem to do nullptr chk gp2logname = pStrCfg; if (isoff(log_flags, BLF_DISABLED)) printf("- Logging debug output to: %s\n", gp2logname); pULongCfg = GetCfgULong("hof25Enable"); if (pULongCfg) opt_hof25 = *pULongCfg; if (opt_hof25) printf("- HOF2.5 mode enabled\n"); pULongCfg = GetCfgULong("logPerf"); if (pULongCfg) opt_log_perf = *pULongCfg; if (opt_log_perf) printf("- Extended perfing enabled\n"); pULongCfg = GetCfgULong("logGLX"); if (pULongCfg) opt_log_glx = *pULongCfg; if (opt_log_glx) { printf("- GLX log file enabled\n"); // only enable opt_log_cc if opt_log_glx is TRUE pULongCfg = GetCfgULong("logCC"); if (pULongCfg) opt_log_cc = *pULongCfg; if (opt_log_cc) printf("- Computer car logging enabled\n"); } pULongCfg = GetCfgULong("Spa98"); if (pULongCfg) opt_spa98 = *pULongCfg; if (opt_spa98) printf("- Spa '98 enabled\n"); if (!LogStart(log_flags, gp2logname) && isoff(log_flags, BLF_DISABLED)) fprintf(stderr, "*** error opening logfile '%s'\n", gp2logname); atexit(LogEnd); #ifdef SOCKCLNT sockInit(); atexit(sockExit); #endif //--- init Frank's stuff ------ init_new_gp2strings(); // init our strings FrankSoftInit(); // atexit'ed //---- init dpmi before all other stuff now ------ dpmicode = dpmi_init(0 /* no verbose */); // atexit'ed if (dpmicode) { fprintf(stderr, "*** dpmi: error %04u\n", dpmicode); return 1; } initvesa(); //---- lock my int9 handler ------ if (!dpmi_lock_region((void near *)(MyInt9), 4096)) { // should be enough if (GetLogDpmiInfo()) LogLine("- dpmi: error: MI9 can't be locked!\n"); } else { if (GetLogDpmiInfo()) LogLine("- dpmis: MI9 locked\n"); } //============================================ //======== the complete logging stuff ======== //============================================ // Warning: don't change options after starting the log system! if (!Log_Create()) { fprintf(stderr, "*** error initing log buffers\n"); return 2; } atexit(Log_Kill); if (!PrfLog_Create()) { fprintf(stderr, "*** error initing perf log buffers\n"); return 2; } atexit(PrfLog_Kill); //================================================= //======== RM-Code fuer int21h vorbereiten ========= //================================================= if ( !install_int21_hook() ) { // atexit'ed fprintf(stderr, "*** lowp: error e004"); return 3; } //============================================ //======== the complete network stuff ======== //============================================ if ( UseIpxLink ) { if ( !ipx_basic_init(0) ) // init the ipx // atexit'ed return 4; if ( !start_ipx_link() ) // init the link return 5; } CloserInit(); // atexit'ed // the very last //---- ok, send alive to logfile ----------- _strdate(&tmpbuf); sprintf(strbuf,"\n"GP2LAP_NAME" started on %s ", tmpbuf); _strtime(&tmpbuf); strcat(strbuf, tmpbuf); strcat(strbuf, "\n"); LogLine(strbuf); sprintf(strbuf, "- Code start at 0x%08x\n", &__begtext); LogLine(strbuf); //----- 08/99 for solving the int2F prob--------------- InitFixInt2F(); //----- Fremdapplikation starten ------- putenv("DOS4G=QUIET"); sprintf(strbuf, "Loading %s...\n", gp2exename); LogLine(strbuf); printf(strbuf); argv[0] = gp2exename; if (spawnv(P_WAIT, gp2exename, (void*)argv) < 0) { // cast to void* to avoid warning about double indirection constness sprintf(strbuf, "*** error loading %s: %s\n", gp2exename, strerror(errno)); LogLine(strbuf); fprintf(stderr, strbuf); } #ifdef TEST sprintf(strbuf, "flagfield = 0x%08x\n", flagfield); LogLine(strbuf); if (GP2_Found && ((flagfield & 0xFFF) != 0x7)) printf("\nflags == 0x%08X\n*** error flag field incorrect\n", flagfield); #endif //--- saying bye now ------ _strdate(&tmpbuf); sprintf(strbuf, GP2LAP_NAME" exiting on %s ", tmpbuf); _strtime(&tmpbuf); strcat(strbuf, tmpbuf); strcat(strbuf, "\n"); LogLine(strbuf); return 0; }
int main (int argc, char *argv[]) { int i; const char *commandLine_File = NULL; GtkWidget *pVBox; GtkWidget *pMenuBar; GtkWidget *pMenu, *pSubMenu; GtkWidget *pMenuItem, *pSubMenuItem; GtkAccelGroup * accel_group; if(argc == 2) commandLine_File = argv[1]; #ifdef DEBUG LogStart(); #endif gtk_init(&argc, &argv); SDL_Init(SDL_INIT_VIDEO); desmume_init(); dTools_running = (BOOL*)malloc(sizeof(BOOL) * dTools_list_size); for(i=0; i<dTools_list_size; i++) dTools_running[i]=FALSE; CONFIG_FILE = g_build_filename(g_get_home_dir(), ".desmume.ini", NULL); Read_ConfigFile(); /* Creation de la fenetre */ pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(pWindow), "Desmume"); gtk_window_set_policy (GTK_WINDOW (pWindow), FALSE, FALSE, FALSE); gtk_window_set_icon(GTK_WINDOW (pWindow), gdk_pixbuf_new_from_xpm_data(DeSmuME_xpm)); g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(pWindow), "key_press_event", G_CALLBACK(Key_Press), NULL); g_signal_connect(G_OBJECT(pWindow), "key_release_event", G_CALLBACK(Key_Release), NULL); /* Creation de la GtkVBox */ pVBox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pWindow), pVBox); accel_group = gtk_accel_group_new(); action_group = gtk_action_group_new("dui"); gtk_action_group_add_actions(action_group, action_entries, sizeof(action_entries) / sizeof(GtkActionEntry), pWindow); { GList * list = gtk_action_group_list_actions(action_group); g_list_foreach(list, dui_set_accel_group, accel_group); } gtk_window_add_accel_group(GTK_WINDOW(pWindow), accel_group); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "pause"), FALSE); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "run"), FALSE); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "reset"), FALSE); gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "printscreen"), FALSE); /**** Creation du menu ****/ pMenuBar = gtk_menu_bar_new(); /** Menu "Fichier" **/ pMenu = gtk_menu_new(); gtk_container_add(GTK_CONTAINER(pMenu), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "open"))); gtk_container_add(GTK_CONTAINER(pMenu), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "printscreen"))); gtk_container_add(GTK_CONTAINER(pMenu), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "quit"))); pMenuItem = gtk_menu_item_new_with_label("File"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), pMenu); gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem); /** Menu "Emulation" **/ GtkWidget *mEmulation; GtkWidget *mFrameskip; GtkWidget *mFrameskip_Radio[MAX_FRAMESKIP]; GtkWidget *mGraphics; GtkWidget *mSize; GtkWidget *mSize_Radio[MAX_SCREENCOEFF]; GtkWidget *mLayers; GtkWidget *mLayers_Radio[10]; mEmulation = gtk_menu_new(); pMenuItem = gtk_menu_item_new_with_label("Emulation"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mEmulation); gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem); gtk_container_add(GTK_CONTAINER(mEmulation), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "run"))); gtk_container_add(GTK_CONTAINER(mEmulation), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "pause"))); gtk_container_add(GTK_CONTAINER(mEmulation), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "reset"))); mFrameskip = gtk_menu_new(); pMenuItem = gtk_menu_item_new_with_label("Frameskip"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mFrameskip); gtk_menu_shell_append(GTK_MENU_SHELL(mEmulation), pMenuItem); for(i = 0; i < MAX_FRAMESKIP; i++) { char frameskipRadio_buf[16]; sprintf(frameskipRadio_buf, "%d", i); if(i>0) mFrameskip_Radio[i] = gtk_radio_menu_item_new_with_label_from_widget(GTK_RADIO_MENU_ITEM(mFrameskip_Radio[i-1]), frameskipRadio_buf); else mFrameskip_Radio[i] = gtk_radio_menu_item_new_with_label(NULL, frameskipRadio_buf); g_signal_connect(G_OBJECT(mFrameskip_Radio[i]), "activate", G_CALLBACK(Modify_Frameskip), GINT_TO_POINTER(i)); gtk_menu_shell_append(GTK_MENU_SHELL(mFrameskip), mFrameskip_Radio[i]); } gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mFrameskip_Radio[0]), TRUE); mGraphics = gtk_menu_new(); pMenuItem = gtk_menu_item_new_with_label("Graphics"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mGraphics); gtk_menu_shell_append(GTK_MENU_SHELL(mEmulation), pMenuItem); // TODO: Un jour, peut être... >< mSize = gtk_menu_new(); pMenuItem = gtk_menu_item_new_with_label("Size"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mSize); gtk_menu_shell_append(GTK_MENU_SHELL(mGraphics), pMenuItem); for(i = 1; i < MAX_SCREENCOEFF; i++) { char sizeRadio_buf[16]; sprintf(sizeRadio_buf, "x%d", i); if(i>1) mSize_Radio[i] = gtk_radio_menu_item_new_with_label_from_widget(GTK_RADIO_MENU_ITEM(mSize_Radio[i-1]), sizeRadio_buf); else mSize_Radio[i] = gtk_radio_menu_item_new_with_label(NULL, sizeRadio_buf); g_signal_connect(G_OBJECT(mSize_Radio[i]), "activate", G_CALLBACK(Modify_ScreenCoeff), GINT_TO_POINTER(i)); gtk_menu_shell_append(GTK_MENU_SHELL(mSize), mSize_Radio[i]); } gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mFrameskip_Radio[0]), TRUE); mLayers = gtk_menu_new(); pMenuItem = gtk_menu_item_new_with_label("Layers"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mLayers); gtk_menu_shell_append(GTK_MENU_SHELL(mGraphics), pMenuItem); for(i = 0; i < 10; i++) { mLayers_Radio[i] = gtk_check_menu_item_new_with_label(Layers_Menu[i]); g_signal_connect(G_OBJECT(mLayers_Radio[i]), "activate", G_CALLBACK(Modify_Layer), (void*)Layers_Menu[i]); gtk_menu_shell_append(GTK_MENU_SHELL(mLayers), mLayers_Radio[i]); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mLayers_Radio[i]), TRUE); } /** Menu "Options" **/ GtkWidget *mConfig = gtk_menu_new(); pMenuItem = gtk_menu_item_new_with_label("Config"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mConfig); gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem); pMenuItem = gtk_menu_item_new_with_label("Edit controls"); g_signal_connect(G_OBJECT(pMenuItem), "activate", G_CALLBACK(Edit_Controls), (GtkWidget*) pWindow); gtk_menu_shell_append(GTK_MENU_SHELL(mConfig), pMenuItem); #if 0 GtkWidget *mFirmware; mFirmware = gtk_menu_new(); pMenuItem = gtk_menu_item_new_with_label("Firmware"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mFirmware); gtk_menu_shell_append(GTK_MENU_SHELL(mConfig), pMenuItem); pMenuItem = gtk_menu_item_new_with_label("Select..."); g_signal_connect(G_OBJECT(pMenuItem), "activate", G_CALLBACK(SelectFirmwareFile), (gpointer)0); gtk_menu_shell_append(GTK_MENU_SHELL(mFirmware), pMenuItem); pMenuItem = gtk_menu_item_new_with_label("Config"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mConfig); gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem); #endif /** Menu "Outils" **/ pMenu = gtk_menu_new(); for(i = 0; i < dTools_list_size; i++) { pMenuItem = gtk_menu_item_new_with_label(dTools_list[i]->name); g_signal_connect(G_OBJECT(pMenuItem), "activate", G_CALLBACK(Start_dTool), GINT_TO_POINTER(i)); gtk_menu_shell_append(GTK_MENU_SHELL(pMenu), pMenuItem); } pMenuItem = gtk_menu_item_new_with_label("Tools"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), pMenu); gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem); /** Menu "?" **/ pMenu = gtk_menu_new(); #if ((GTK_MAJOR_VERSION >= 2) && (GTK_MINOR_VERSION >= 6)) pMenuItem = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT,NULL); #else pMenuItem = gtk_menu_item_new_with_label("About"); #endif g_signal_connect(G_OBJECT(pMenuItem), "activate", G_CALLBACK(About), (GtkWidget*) pWindow); gtk_menu_shell_append(GTK_MENU_SHELL(pMenu), pMenuItem); pMenuItem = gtk_menu_item_new_with_label("?"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), pMenu); gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem); /* Ajout du menu a la fenetre */ gtk_box_pack_start(GTK_BOX(pVBox), pMenuBar, FALSE, FALSE, 0); /* Création de la Toolbar */ pToolbar = gtk_toolbar_new(); gtk_box_pack_start(GTK_BOX(pVBox), pToolbar, FALSE, FALSE, 0); gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), GTK_TOOL_ITEM(gtk_action_create_tool_item(gtk_action_group_get_action(action_group, "open"))), -1); gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), GTK_TOOL_ITEM(gtk_action_create_tool_item(gtk_action_group_get_action(action_group, "run"))), -1); gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), GTK_TOOL_ITEM(gtk_action_create_tool_item(gtk_action_group_get_action(action_group, "pause"))), -1); gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), GTK_TOOL_ITEM(gtk_action_create_tool_item(gtk_action_group_get_action(action_group, "quit"))), -1); /* Création de l'endroit pour l'affichage des écrans */ pDrawingArea= gtk_drawing_area_new(); gtk_drawing_area_size(GTK_DRAWING_AREA(pDrawingArea), 256, 384); gtk_widget_set_usize (pDrawingArea, 256, 384); gtk_widget_set_events(pDrawingArea, GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK ); g_signal_connect(G_OBJECT(pDrawingArea), "button_press_event", G_CALLBACK(Stylus_Press), NULL); g_signal_connect(G_OBJECT(pDrawingArea), "button_release_event", G_CALLBACK(Stylus_Release), NULL); g_signal_connect(G_OBJECT(pDrawingArea), "motion_notify_event", G_CALLBACK(Stylus_Move), NULL); g_signal_connect( G_OBJECT(pDrawingArea), "realize", G_CALLBACK(Draw), NULL ) ; g_signal_connect( G_OBJECT(pDrawingArea), "expose_event", G_CALLBACK(gtkFloatExposeEvent), NULL ) ; gtk_box_pack_start(GTK_BOX(pVBox), pDrawingArea, FALSE, FALSE, 0); /* Création de la barre d'état */ pStatusBar = gtk_statusbar_new(); pStatusBar_Ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(pStatusBar), "Global"); pStatusBar_Change("Desmume"); gtk_box_pack_end(GTK_BOX(pVBox), pStatusBar, FALSE, FALSE, 0); gtk_widget_show_all(pWindow); //LoadFirmware("fw.bin"); /* Vérifie la ligne de commandes */ if(commandLine_File) { if(Open(commandLine_File) >= 0) { Launch(); } else { GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pWindow), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Unable to load :\n%s", commandLine_File); gtk_dialog_run(GTK_DIALOG(pDialog)); gtk_widget_destroy(pDialog); } } /* Boucle principale */ // gtk_idle_add(&EmuLoop, pWindow); // g_idle_add(&EmuLoop, pWindow); gtk_main(); desmume_free(); #ifdef DEBUG LogStop(); #endif SDL_Quit(); Write_ConfigFile(); return EXIT_SUCCESS; }
int XplServiceMain(int argc, char *argv[]) { BOOL recover; int ccode; int startupOpts; LogStart(); if (XplSetRealUser(MsgGetUnprivilegedUser()) < 0) { Log(LOG_ERROR, "Could not drop to unprivileged user '%s'", MsgGetUnprivilegedUser()); return -1; } XplInit(); /* Set the default port */ Agent.agent.port = BONGO_QUEUE_PORT; /* Initialize the Bongo libraries */ startupOpts = BA_STARTUP_CONNIO | BA_STARTUP_NMAP | BA_STARTUP_MSGLIB | BA_STARTUP_MSGAUTH; ccode = BongoAgentInit(&Agent.agent, AGENT_NAME, DEFAULT_CONNECTION_TIMEOUT, startupOpts); if (ccode == -1) { Log(LOG_ERROR, "Initialization failed exiting."); return -1; } XplRWLockInit(&Conf.lock); XplSafeWrite(Agent.activeThreads, 0); ReadConfiguration(&recover); BongoAgentAddConfigMonitor(&Agent.agent, CheckConfig); BongoAgentAddDiskMonitor(&Agent.agent, CheckDiskspace); // Load monitor disabled, see CheckLoad() //BongoAgentAddLoadMonitor(&Agent.agent, CheckLoad); Agent.clientListener = ServerSocketInit(Agent.agent.port); if (Agent.clientListener == NULL) { Log(LOG_ERROR, "Server Initialization failed exiting."); return -1; } if (QueueInit() == FALSE) { Log(LOG_ERROR, "Queue Initialization failed exiting."); return -1; } LoadProtocolCommandTree(&Agent.authCommands, authCommands); LoadProtocolCommandTree(&Agent.commands, commands); /* FIXME: We want to pool work on the command level rather than * the connection level. Until then the threadpool will have a * thread per client, so no (practical) limit */ Agent.clientThreadPool = BongoThreadPoolNew("Queue Clients", STACKSPACE_Q, 2, INT_MAX, 0); XplSignalHandler(SignalHandler); ccode = CreateQueueThreads(recover); BongoAgentStartMonitor(&Agent.agent); MsgSetRecoveryFlag("queue"); /* Start the server thread */ XplStartMainThread(AGENT_NAME, &id, QueueServer, 8192, NULL, ccode); LogShutdown(); XplUnloadApp(XplGetThreadID()); return 0; }