void on_menu_options_ignore_errors_activate(GtkMenuItem * menuitem, gpointer user_data) { options.ignore_errors=GTK_CHECK_MENU_ITEM(menuitem)->active; rc_save(PACKAGE,parsable_items); }
/* +-----------------------------------+ * | Preferences Related Functions | * +-----------------------------------+ */ void on_preferences_okbutton_clicked (GtkButton *button, gpointer user_data) { const gchar *string; GtkCombo *combo; // handle video mode selection combo = GTK_COMBO(lookup_widget(GTK_WIDGET(preferences_window), "video_output_driver_combo" )); string = gtk_entry_get_text(GTK_ENTRY(combo->entry)); options.video_driver_ptr = options.video_driver; g_snprintf(options.video_driver_ptr, 24, "%s", string); opt_videoout = options.video_driver_ptr; // load simple prefs from window handle_simple_preferences(false); gtk_widget_hide(preferences_window); // preference setting side-effects options.run_speed = options.default_run_speed; gtk_range_set_value(GTK_RANGE(slider_run_speed), options.run_speed); mpeg2parser->set_ignore_endcode(options.ignore_endcode); rc_save(PACKAGE,parsable_items); }
void cb_save(Fl_Widget* widget, void *pall){ char buf[80]; int ret; allspec *all; all = (allspec *)pall; ret = rc_save(all->serial, &all->op, &all->rc); if(ret < 0){ all->report_buf->text("Fail to save.\n"); return; } all->new_data = 0; all->memo_data = 0; all->not_saved = 0; all->serial = 0; all->btn_memo->deactivate(); all->btn_save->deactivate(); if(!all->op.lirc){ sprintf(buf, "Create %s/analyzer.conf.\n", all->op.dir); all->report_buf->text(buf); all->report_buf->append("saved in fl_analyzer standard format.\n\n"); } else { sprintf(buf, "Create %s/lirc.conf.\n", all->op.dir); all->report_buf->text(buf); if(all->rc.multi == 0 || all->rc.count1 == all->rc.count2){ all->report_buf->append("saved in lirc standard format.\n\n"); } else { all->report_buf->append("saved in lirc raw format.\n\n"); } } all->report_buf->append("fl_analyzer initialized and restart.\n"); all->report_buf->append("If you continue and resave,\nsaved data will be over written.\n"); }
void on_menu_options_adjust_timestamps_activate (GtkMenuItem *menuitem, gpointer user_data) { options.adjust_timestamps=GTK_CHECK_MENU_ITEM(menuitem)->active; rc_save(PACKAGE,parsable_items); }
void on_menu_options_drop_orphaned_frames_activate (GtkMenuItem *menuitem, gpointer user_data) { options.drop_orphaned_frames=GTK_CHECK_MENU_ITEM(menuitem)->active; rc_save(PACKAGE,parsable_items); }
int cli_frontend_init (int argc, char **argv) { machine_config drv; char buffer[128]; char *cmd_name; int game_index; int i; gamename = NULL; game_index = -1; /* clear all core options */ memset(&options,0,sizeof(options)); /* create the rc object */ rc = cli_rc_create(); if (!rc) { osd_die ("error on rc creation\n"); } /* parse the commandline */ got_gamename = 0; if (rc_parse_commandline(rc, argc, argv, 2, config_handle_arg)) { osd_die ("error while parsing cmdline\n"); } /* determine global configfile name */ cmd_name = win_strip_extension(win_basename(argv[0])); if (!cmd_name) { osd_die ("who am I? cannot determine the name I was called with\n"); } sprintf (buffer, "%s.ini", cmd_name); /* parse mame.ini/mess.ini even if called with another name */ if (mame_stricmp(cmd_name, APPNAME) != 0) { if (parse_config (APPNAME".ini", NULL)) exit(1); } /* parse cmd_name.ini */ if (parse_config (buffer, NULL)) exit(1); #ifdef MAME_DEBUG if (parse_config( "debug.ini", NULL)) exit(1); #endif /* if requested, write out cmd_name.ini (normally "mame.ini") */ if (createconfig) { rc_save(rc, buffer, 0); exit(0); } if (showconfig) { sprintf (buffer, " %s running parameters", cmd_name); rc_write(rc, stdout, buffer); exit(0); } if (showusage) { fprintf(stdout, "Usage: %s [" GAMENOUN "] [options]\n" "Options:\n", cmd_name); /* actual help message */ rc_print_help(rc, stdout); exit(0); } /* no longer needed */ free(cmd_name); /* handle playback */ if (playbackname != NULL) { options.playback = mame_fopen(playbackname,0,FILETYPE_INPUTLOG,0); if (!options.playback) { osd_die("failed to open %s for playback\n", playbackname); } } /* check for game name embedded in .inp header */ if (options.playback) { inp_header inp_header; /* read playback header */ mame_fread(options.playback, &inp_header, sizeof(inp_header)); if (!isalnum(inp_header.name[0])) /* If first byte is not alpha-numeric */ mame_fseek(options.playback, 0, SEEK_SET); /* old .inp file - no header */ else { for (i = 0; (drivers[i] != 0); i++) /* find game and play it */ { if (strcmp(drivers[i]->name, inp_header.name) == 0) { game_index = i; gamename = (char *)drivers[i]->name; printf("Playing back previously recorded " GAMENOUN " %s (%s) [press return]\n", drivers[game_index]->name,drivers[game_index]->description); getchar(); break; } } } } /* check for frontend options, horrible 1234 hack */ if (frontend_help(gamename) != 1234) exit(0); gamename = win_basename(gamename); gamename = win_strip_extension(gamename); /* if not given by .inp file yet */ if (game_index == -1) { /* do we have a driver for this? */ for (i = 0; drivers[i]; i++) if (mame_stricmp(gamename,drivers[i]->name) == 0) { game_index = i; break; } } #ifdef MAME_DEBUG if (game_index == -1) { /* pick a random game */ if (strcmp(gamename,"random") == 0) { i = 0; while (drivers[i]) i++; /* count available drivers */ srand(time(0)); /* call rand() once to get away from the seed */ rand(); game_index = rand() % i; fprintf(stderr, "running %s (%s) [press return]",drivers[game_index]->name,drivers[game_index]->description); getchar(); } } #endif /* we give up. print a few approximate matches */ if (game_index == -1) { fprintf(stderr, "\n\"%s\" approximately matches the following\n" "supported " GAMESNOUN " (best match first):\n\n", gamename); show_approx_matches(); exit(1); } /* ok, got a gamename */ /* if this is a vector game, parse vector.ini first */ expand_machine_driver(drivers[game_index]->drv, &drv); if (drv.video_attributes & VIDEO_TYPE_VECTOR) if (parse_config ("vector.ini", NULL)) exit(1); /* nice hack: load source_file.ini (omit if referenced later any) */ { const game_driver *tmp_gd; const char *start; /* remove the path and the .c suffix from the source file name */ start = strrchr(drivers[game_index]->source_file, '/'); if (!start) start = strrchr(drivers[game_index]->source_file, '\\'); if (!start) start = drivers[game_index]->source_file - 1; sprintf(buffer, "%s", start + 1); buffer[strlen(buffer) - 2] = 0; tmp_gd = drivers[game_index]; while (tmp_gd != NULL) { if (strcmp(tmp_gd->name, buffer) == 0) break; tmp_gd = tmp_gd->clone_of; } if (tmp_gd == NULL) /* not referenced later, so load it here */ { strcat(buffer, ".ini"); if (parse_config (buffer, NULL)) exit(1); } } /* now load gamename.ini */ /* this possibly checks for clonename.ini recursively! */ if (parse_config (NULL, drivers[game_index])) exit(1); /* handle record option */ if (recordname) { options.record = mame_fopen(recordname,0,FILETYPE_INPUTLOG,1); if (!options.record) { osd_die("failed to open %s for recording\n", recordname); } } if (options.record) { inp_header inp_header; memset(&inp_header, '\0', sizeof(inp_header)); strcpy(inp_header.name, drivers[game_index]->name); /* MAME32 stores the MAME version numbers at bytes 9 - 11 * MAME DOS keeps this information in a string, the * Windows code defines them in the Makefile. */ /* inp_header.version[0] = 0; inp_header.version[1] = VERSION; inp_header.version[2] = BETA_VERSION; */ mame_fwrite(options.record, &inp_header, sizeof(inp_header)); } if (statename) options.savegame = statename; #if defined(MAME_DEBUG) && defined(NEW_DEBUGGER) if (debugscript) debug_source_script(debugscript); #endif /* need a decent default for debug width/height */ if (options.debug_width == 0) options.debug_width = 640; if (options.debug_height == 0) options.debug_height = 480; options.debug_depth = 8; /* no sound is indicated by a 0 samplerate */ if (!enable_sound) options.samplerate = 0; /* set the artwork options */ options.use_artwork = ARTWORK_USE_ALL; if (use_backdrops == 0) options.use_artwork &= ~ARTWORK_USE_BACKDROPS; if (use_overlays == 0) options.use_artwork &= ~ARTWORK_USE_OVERLAYS; if (use_bezels == 0) options.use_artwork &= ~ARTWORK_USE_BEZELS; if (!use_artwork) options.use_artwork = ARTWORK_USE_NONE; { /* first start with the game's built in orientation */ int orientation = drivers[game_index]->flags & ORIENTATION_MASK; options.ui_orientation = orientation; if (options.ui_orientation & ORIENTATION_SWAP_XY) { /* if only one of the components is inverted, switch them */ if ((options.ui_orientation & ROT180) == ORIENTATION_FLIP_X || (options.ui_orientation & ROT180) == ORIENTATION_FLIP_Y) options.ui_orientation ^= ROT180; } /* override if no rotation requested */ if (video_norotate) orientation = options.ui_orientation = ROT0; /* rotate right */ if (video_ror) { /* if only one of the components is inverted, switch them */ if ((orientation & ROT180) == ORIENTATION_FLIP_X || (orientation & ROT180) == ORIENTATION_FLIP_Y) orientation ^= ROT180; orientation ^= ROT90; } /* rotate left */ if (video_rol) { /* if only one of the components is inverted, switch them */ if ((orientation & ROT180) == ORIENTATION_FLIP_X || (orientation & ROT180) == ORIENTATION_FLIP_Y) orientation ^= ROT180; orientation ^= ROT270; } /* auto-rotate right (e.g. for rotating lcds), based on original orientation */ if (video_autoror && (drivers[game_index]->flags & ORIENTATION_SWAP_XY) ) { /* if only one of the components is inverted, switch them */ if ((orientation & ROT180) == ORIENTATION_FLIP_X || (orientation & ROT180) == ORIENTATION_FLIP_Y) orientation ^= ROT180; orientation ^= ROT90; } /* auto-rotate left (e.g. for rotating lcds), based on original orientation */ if (video_autorol && (drivers[game_index]->flags & ORIENTATION_SWAP_XY) ) { /* if only one of the components is inverted, switch them */ if ((orientation & ROT180) == ORIENTATION_FLIP_X || (orientation & ROT180) == ORIENTATION_FLIP_Y) orientation ^= ROT180; orientation ^= ROT270; } /* flip X/Y */ if (video_flipx) orientation ^= ORIENTATION_FLIP_X; if (video_flipy) orientation ^= ORIENTATION_FLIP_Y; blit_flipx = ((orientation & ORIENTATION_FLIP_X) != 0); blit_flipy = ((orientation & ORIENTATION_FLIP_Y) != 0); blit_swapxy = ((orientation & ORIENTATION_SWAP_XY) != 0); if( options.vector_width == 0 && options.vector_height == 0 ) { options.vector_width = 640; options.vector_height = 480; } if( blit_swapxy ) { int temp; temp = options.vector_width; options.vector_width = options.vector_height; options.vector_height = temp; } } return game_index; }