int run_address(void) { unsigned int i = 0; if (set_debug_mode() != 0) goto error_run; for (i = 0; gr_run_cmd[i].address != 0xDEADDEAD; ++i) { if (gr_run_cmd[i].value == 0x42424242) config.word = config.run_address; else if (gr_run_cmd[i].value == 0x42424242 + 4) config.word = config.run_address + 4; else config.word = gr_run_cmd[i].value; config.memory_address = gr_run_cmd[i].address; if (send_word() != 0) goto error_run; } return (0); error_run: fprintf(stderr, "Unable to run at address %08x.\n", config.memory_address); return (errno); }
static void inline_F10_60 (EIF_INTEGER_32 arg1) { #ifdef WORKBENCH set_debug_mode (arg1); #endif ; }
void StaticGame::WriteInt32(const char *address, intptr_t offset, int32_t val) { if (offset == 4 * sizeof(int32_t)) { // game.debug_mode set_debug_mode(val != 0); } else { *(int32_t*)(address + offset) = val; } }
static int poseidon_fm_open(struct file *filp) { struct video_device *vfd = video_devdata(filp); struct poseidon *p = video_get_drvdata(vfd); int ret = 0; if (!p) return -1; mutex_lock(&p->lock); if (p->state & POSEIDON_STATE_DISCONNECT) { ret = -ENODEV; goto out; } if (p->state && !(p->state & POSEIDON_STATE_FM)) { ret = -EBUSY; goto out; } usb_autopm_get_interface(p->interface); if (0 == p->state) { /* default pre-emphasis */ if (p->radio_data.pre_emphasis == 0) p->radio_data.pre_emphasis = TLG_TUNE_ASTD_FM_EUR; set_debug_mode(vfd, debug_mode); ret = poseidon_check_mode_radio(p); if (ret < 0) { usb_autopm_put_interface(p->interface); goto out; } p->state |= POSEIDON_STATE_FM; } p->radio_data.users++; kref_get(&p->kref); filp->private_data = p; out: mutex_unlock(&p->lock); return ret; }
/* * set debug mode */ void sa_set_debug_mode(int i) { set_debug_mode(i); }
/** * This function parses command line options. It sets the options in this * order. It means that the value used for an option is the one set in the * lastest step. * 0) default values are set into the options_t * structure * 1) reads the default configuration file if any. * 2) reads the configuration file mentionned on the command line. * 3) sets the command line options (except for the list of directories, * all other values are replaced by thoses in the command line) * @param argc : number of arguments given on the command line. * @param argv : an array of strings that contains command line arguments. * @returns options_t structure malloc'ed and filled upon choosen command * line's option */ options_t *manage_command_line_options(int argc, char **argv) { options_t *opt = NULL; /** Structure to manage program's options */ gchar *summary = NULL; /** Abstract for the program */ gchar *defaultconfigfilename = NULL; gboolean version = FALSE; /** True if -v was selected on the command line */ gint debug = -4; /** 0 == FALSE and other values == TRUE */ gint adaptive = -1; /** 0 == FALSE and other positive values == TRUE */ gchar **dirname_array = NULL; /** array of dirnames left on the command line */ gchar **exclude_array = NULL; /** array of dirnames and filenames to be excluded */ gchar *configfile = NULL; /** filename for the configuration file if any */ gint64 blocksize = 0; /** computed block size in bytes */ gint buffersize = 0; /** buffer size used to send data to server */ gchar *dircache = NULL; /** Directory used to store cache files */ gchar *dbname = NULL; /** Database filename where data and meta data are cached */ gchar *ip = NULL; /** IP address where is located server's program */ gint port = 0; /** Port number on which to send things to the server */ gshort cmptype = -1; /** compression type to be used when communicating */ gboolean noscan = FALSE; /** If set to TRUE then do not do the first directory scan */ srv_conf_t *srv_conf = NULL; GOptionEntry entries[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &version, N_("Prints program version"), NULL }, { "debug", 'd', 0, G_OPTION_ARG_INT, &debug, N_("Activates (1) or desactivates (0) debug mode."), N_("BOOLEAN")}, { "configuration", 'c', 0, G_OPTION_ARG_STRING, &configfile, N_("Specify an alternative configuration file."), N_("FILENAME")}, { "blocksize", 'b', 0, G_OPTION_ARG_INT64, &blocksize, N_("Fixed block SIZE used to compute hashs."), N_("SIZE")}, { "adaptive", 'a', 0, G_OPTION_ARG_INT, &adaptive, N_("Adapative block size used to compute hashs."), N_("BOOLEAN")}, { "buffersize", 's', 0, G_OPTION_ARG_INT, &buffersize, N_("SIZE of the cache used to send data to server."), N_("SIZE")}, { "dircache", 'r', 0, G_OPTION_ARG_STRING, &dircache, N_("Directory DIRNAME where to cache files."), N_("DIRNAME")}, { "dbname", 'f', 0, G_OPTION_ARG_STRING, &dbname, N_("Database FILENAME."), N_("FILENAME")}, { "ip", 'i', 0, G_OPTION_ARG_STRING, &ip, N_("IP address where server program is."), "IP"}, { "port", 'p', 0, G_OPTION_ARG_INT, &port, N_("Port NUMBER on which to listen."), N_("NUMBER")}, { "exclude", 'x', 0, G_OPTION_ARG_FILENAME_ARRAY, &exclude_array, N_("Exclude FILENAME from being saved."), N_("FILENAME")}, { "no-scan", 'n', 0, G_OPTION_ARG_NONE, &noscan, N_("Does not do the first directory scan."), NULL}, { "compression", 'z', 0, G_OPTION_ARG_INT, &cmptype, N_("Compression type to use: 0 is NONE, 1 is ZLIB"), N_("NUMBER")}, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &dirname_array, "", NULL}, { NULL } }; summary = g_strdup(_("This program is monitoring file changes in the filesystem and is hashing\nfiles with SHA256 algorithms from Glib.")); parse_command_line(argc, argv, entries, summary); set_debug_mode(ENABLE_DEBUG); /* 0) Setting default values */ opt = (options_t *) g_malloc0(sizeof(options_t)); opt->dirname_list = NULL; opt->exclude_list = NULL; opt->blocksize = CLIENT_BLOCK_SIZE; opt->configfile = NULL; opt->dircache = g_strdup("/var/tmp/cdpfgl"); opt->dbname = g_strdup("filecache.db"); opt->buffersize = -1; opt->adaptive = FALSE; opt->cmptype = 0; opt->srv_conf = NULL; srv_conf = new_srv_conf_t(); srv_conf->ip = g_strdup("localhost"); srv_conf->port = SERVER_PORT; /* 1) Reading options from default configuration file */ defaultconfigfilename = get_probable_etc_path(PROGRAM_NAME, "client.conf"); read_from_configuration_file(opt, defaultconfigfilename); free_variable(defaultconfigfilename); opt->version = version; /* only TRUE if -v or --version was invoked */ opt->noscan = noscan; /* only TRUE if -n or --no-scan was invoked */ /* 2) Reading the configuration from the configuration file specified * on the command line (if any). */ if (configfile != NULL) { read_from_configuration_file(opt, configfile); } if (opt->srv_conf != NULL) { free_srv_conf_t(srv_conf); srv_conf = NULL; } else { opt->srv_conf = srv_conf; } /* 3) retrieving other options from the command line. Directories are * added to the existing directory list and then the array is freed * as every string has been copied with g_strdup(). */ set_debug_mode_upon_cmdl(debug); opt->dirname_list = convert_gchar_array_to_GSList(dirname_array, opt->dirname_list); opt->exclude_list = convert_gchar_array_to_GSList(exclude_array, opt->exclude_list); if (cmptype >= 0) { set_compression_type(opt, cmptype); } g_strfreev(dirname_array); g_strfreev(exclude_array); if (blocksize > 0) { opt->blocksize = blocksize; } opt->dircache = set_option_str(dircache, opt->dircache); opt->dbname = set_option_str(dbname, opt->dbname); if (opt->srv_conf != NULL) { opt->srv_conf->ip = set_option_str(ip, opt->srv_conf->ip); if (port > 1024 && port < 65535) { opt->srv_conf->port = port; } } if (adaptive > 0) { opt->adaptive = TRUE; } else if (adaptive == 0) { opt->adaptive = FALSE; } if (buffersize > 0) { opt->buffersize = buffersize; } else if (opt->buffersize <= 0) { opt->buffersize = CLIENT_MIN_BUFFER; } free_variable(ip); free_variable(dbname); free_variable(dircache); free_variable(summary); return opt; }
/** * This function parses command line options. It sets the options in this * order. It means that the value used for an option is the one set in the * lastest step. * 0) default values are set into the options_t * structure * 1) reads the default configuration file if any. * 2) reads the configuration file mentionned on the command line. * 3) sets the command line options (except for the list of directories, * all other values are replaced by thoses in the command line) * @param argc : number of arguments given on the command line. * @param argv : an array of strings that contains command line arguments. * @returns options_t structure malloc'ed and filled upon choosen command * line's option */ static options_t *manage_command_line_options(int argc, char **argv) { gboolean version = FALSE; /** True if -v was selected on the command line */ gint debug = -4; /** 0 == FALSE and other values == TRUE */ gchar *configfile = NULL; /** filename for the configuration file if any */ gchar *ip = NULL; /** IP address where is located server's program */ gint port = 0; /** Port number on which to send things to the server */ gchar *list = NULL; /** Should contain a filename or a directory to filter out */ gchar *restore = NULL; /** Must contain a filename or a directory name to be restored */ gchar *date = NULL; /** date at which we want to restore a file or directory */ gchar *where = NULL; /** Contains the directory where to restore a file / directory */ gchar *afterdate = NULL; /** afterdate: we want to restore a file that has its mtime after this date */ gchar *beforedate = NULL; /** beforedate: we want to restore a file that has its mtime before this date */ GOptionEntry entries[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &version, N_("Prints program version."), NULL}, { "list", 'l', 0, G_OPTION_ARG_FILENAME, &list, N_("Gives a list of saved files that correspond to the given REGEX."), "REGEX"}, { "restore", 'r', 0, G_OPTION_ARG_FILENAME, &restore, N_("Restores requested filename (REGEX) (by default latest version)."), "REGEX"}, { "date", 't', 0, G_OPTION_ARG_STRING, &date, N_("Restores the selected file at that specific DATE (YYYY-MM-DD HH:MM:SS format)."), "DATE"}, { "after", 'a', 0, G_OPTION_ARG_STRING, &afterdate, N_("Restores the selected file with mtime after DATE (YYYY-MM-DD HH:MM:SS format)."), "DATE"}, { "before", 'b', 0, G_OPTION_ARG_STRING, &beforedate, N_("Restores the selected file with mtime before DATE (YYYY-MM-DD HH:MM:SS format)."), "DATE"}, { "debug", 'd', 0, G_OPTION_ARG_INT, &debug, N_("Activates (1) or desactivates (0) debug mode."), N_("BOOLEAN")}, { "configuration", 'c', 0, G_OPTION_ARG_STRING, &configfile, N_("Specify an alternative configuration file."), N_("FILENAME")}, { "where", 'w', 0, G_OPTION_ARG_STRING, &where, N_("Specify a DIRECTORY where to restore a file."), N_("DIRECTORY")}, { "ip", 'i', 0, G_OPTION_ARG_STRING, &ip, N_("IP address where server program is."), "IP"}, { "port", 'p', 0, G_OPTION_ARG_INT, &port, N_("Port NUMBER on which server program is listening."), N_("NUMBER")}, { NULL } }; GError *error = NULL; GOptionContext *context; options_t *opt = NULL; /** Structure to manage program's options */ gchar *bugreport = NULL; /** Bug Report message */ gchar *summary = NULL; /** Abstract for the program */ gchar *defaultconfigfilename = NULL; bugreport = g_strconcat(_("Please report bugs to: "), PACKAGE_BUGREPORT, NULL); summary = g_strdup(_("This program is restoring files from cdpfglserver's server.\n")); context = g_option_context_new(""); set_debug_mode(ENABLE_DEBUG); set_option_context_options(context, entries, TRUE, bugreport, summary); if (!g_option_context_parse(context, &argc, &argv, &error)) { g_print(_("Option parsing failed: %s\n"), error->message); exit(EXIT_FAILURE); } /* 0) Setting default values */ opt = (options_t *) g_malloc0(sizeof(options_t)); opt->configfile = NULL; opt->list = NULL; opt->restore = NULL; opt->ip = g_strdup("localhost"); opt->port = SERVER_PORT; opt->where = NULL; /* 1) Reading options from default configuration file * note: restore option will never be read into the configuration * file. */ defaultconfigfilename = get_probable_etc_path(PROGRAM_NAME, "restore.conf"); read_from_configuration_file(opt, defaultconfigfilename); defaultconfigfilename = free_variable(defaultconfigfilename); /* 2) Reading the configuration from the configuration file specified * on the command line (if any). * note: same note than 1) applies here too. */ if (configfile != NULL) { read_from_configuration_file(opt, configfile); } /* 3) retrieving other options from the command line. */ set_debug_mode_upon_cmdl(debug); opt->version = version; /* only TRUE if -v or --version was invoked */ if (date != NULL) { opt->date = g_strdup(date); } if (afterdate != NULL) { opt->afterdate = g_strdup(afterdate); } if (beforedate != NULL) { opt->beforedate = g_strdup(beforedate); } if (list != NULL) { opt->list = g_strdup(list); } if (restore != NULL) { opt->restore = g_strdup(restore); } if (ip != NULL) { free_variable(opt->ip); opt->ip = g_strdup(ip); } if (port > 1024 && port < 65535) { opt->port = port; } if (where != NULL) { opt->where = g_strdup(where); } g_option_context_free(context); free_variable(ip); free_variable(bugreport); free_variable(summary); free_variable(list); free_variable(restore); free_variable(date); free_variable(afterdate); free_variable(beforedate); free_variable(where); return opt; }
void StaticGame::WriteInt32(const char *address, intptr_t offset, int32_t val) { int index = offset / sizeof(int32_t); if (index >= 5 && index < 5 + MAXGLOBALVARS) { play.globalvars[index - 5] = val; return; } switch (index) { case 0: play.score = val; break; case 1: play.usedmode = val; break; case 2: play.disabled_user_interface = val; break; case 3: play.gscript_timer = val; break; case 4: set_debug_mode(val != 0); break; // play.debug_mode // 5 -> 54: play.globalvars case 55: play.messagetime = val; break; case 56: play.usedinv = val; break; case 57: play.inv_top = val; break; case 58: play.inv_numdisp = val; break; case 59: play.obsolete_inv_numorder = val; break; case 60: play.inv_numinline = val; break; case 61: play.text_speed = val; break; case 62: play.sierra_inv_color = val; break; case 63: play.talkanim_speed = val; break; case 64: play.inv_item_wid = val; break; case 65: play.inv_item_hit = val; break; case 66: play.speech_text_shadow = val; break; case 67: play.swap_portrait_side = val; break; case 68: play.speech_textwindow_gui = val; break; case 69: play.follow_change_room_timer = val; break; case 70: play.totalscore = val; break; case 71: play.skip_display = val; break; case 72: play.no_multiloop_repeat = val; break; case 73: play.roomscript_finished = val; break; case 74: play.used_inv_on = val; break; case 75: play.no_textbg_when_voice = val; break; case 76: play.max_dialogoption_width = val; break; case 77: play.no_hicolor_fadein = val; break; case 78: play.bgspeech_game_speed = val; break; case 79: play.bgspeech_stay_on_display = val; break; case 80: play.unfactor_speech_from_textlength = val; break; case 81: play.mp3_loop_before_end = val; break; case 82: play.speech_music_drop = val; break; case 83: case 84: case 85: case 86: cc_error("StaticGame: attempt to write readonly variable at offset %d", offset); break; case 87: play.game_speed_modifier = val; break; case 88: play.score_sound = val; break; case 89: play.takeover_data = val; break; case 90: play.replay_hotkey = val; break; case 91: play.dialog_options_x = val; break; case 92: play.dialog_options_y = val; break; case 93: play.narrator_speech = val; break; case 94: play.ambient_sounds_persist = val; break; case 95: play.lipsync_speed = val; break; case 96: play.close_mouth_speech_time = val; break; case 97: play.disable_antialiasing = val; break; case 98: play.text_speed_modifier = val; break; case 99: play.text_align = ReadScriptAlignment(val); break; case 100: play.speech_bubble_width = val; break; case 101: play.min_dialogoption_width = val; break; case 102: play.disable_dialog_parser = val; break; case 103: play.anim_background_speed = val; break; case 104: play.top_bar_backcolor = val; break; case 105: play.top_bar_textcolor = val; break; case 106: play.top_bar_bordercolor = val; break; case 107: play.top_bar_borderwidth = val; break; case 108: play.top_bar_ypos = val; break; case 109: play.screenshot_width = val; break; case 110: play.screenshot_height = val; break; case 111: play.top_bar_font = val; break; case 112: play.speech_text_align = ReadScriptAlignment(val); break; case 113: play.auto_use_walkto_points = val; break; case 114: play.inventory_greys_out = val; break; case 115: play.skip_speech_specific_key = val; break; case 116: play.abort_key = val; break; case 117: case 118: case 119: cc_error("StaticGame: attempt to write readonly variable at offset %d", offset); break; case 120: play.show_single_dialog_option = val; break; case 121: play.keep_screen_during_instant_transition = val; break; case 122: play.read_dialog_option_colour = val; break; case 123: play.stop_dialog_at_end = val; break; case 124: play.speech_portrait_placement = val; break; case 125: play.speech_portrait_x = val; break; case 126: play.speech_portrait_y = val; break; case 127: play.speech_display_post_time_ms = val; break; case 128: play.dialog_options_highlight_color = val; break; default: cc_error("StaticGame: unsupported variable offset %d", offset); } }
GSList *quick_search_filter(QuickSearch *qsearch, QSearchCondType type, const gchar *key) { SummaryView *summaryview = qsearch->summaryview; FilterCondType ftype; FilterRule *status_rule = NULL; FilterRule *rule = NULL; FilterCond *cond; FilterInfo fltinfo; GSList *cond_list = NULL; GSList *rule_list = NULL; GSList *flt_mlist = NULL; GSList *cur; gint count = 0, total = 0; gchar status_text[1024]; gboolean dmode; if (!summaryview->all_mlist) return NULL; debug_print("quick_search_filter: filtering summary (type: %d)\n", type); switch (type) { case QS_UNREAD: case QS_MARK: case QS_CLABEL: case QS_MIME: ftype = qsearch_cond_types[type].ftype; cond = filter_cond_new(ftype, 0, 0, NULL, NULL); cond_list = g_slist_append(cond_list, cond); status_rule = filter_rule_new("Status filter rule", FLT_OR, cond_list, NULL); break; case QS_W1DAY: cond = filter_cond_new(FLT_COND_AGE_GREATER, 0, FLT_NOT_MATCH, NULL, "1"); cond_list = g_slist_append(cond_list, cond); status_rule = filter_rule_new("Status filter rule", FLT_OR, cond_list, NULL); break; case QS_LAST5: cond = filter_cond_new(FLT_COND_AGE_GREATER, 0, FLT_NOT_MATCH, NULL, "5"); cond_list = g_slist_append(cond_list, cond); status_rule = filter_rule_new("Status filter rule", FLT_OR, cond_list, NULL); break; case QS_LAST7: cond = filter_cond_new(FLT_COND_AGE_GREATER, 0, FLT_NOT_MATCH, NULL, "7"); cond_list = g_slist_append(cond_list, cond); status_rule = filter_rule_new("Status filter rule", FLT_OR, cond_list, NULL); break; case QS_LAST30: cond = filter_cond_new(FLT_COND_AGE_GREATER, 0, FLT_NOT_MATCH, NULL, "30"); cond_list = g_slist_append(cond_list, cond); status_rule = filter_rule_new("Status filter rule", FLT_OR, cond_list, NULL); break; case QS_IN_ADDRESSBOOK: cond = filter_cond_new(FLT_COND_HEADER, FLT_IN_ADDRESSBOOK, 0, "From", NULL); cond_list = g_slist_append(cond_list, cond); status_rule = filter_rule_new("Status filter rule", FLT_OR, cond_list, NULL); break; case QS_ALL: default: break; } if (key) { gchar **keys; gint i; keys = g_strsplit(key, " ", -1); for (i = 0; keys[i] != NULL; i++) { cond_list = NULL; if (keys[i] == '\0') continue; cond = filter_cond_new(FLT_COND_HEADER, FLT_CONTAIN, 0, "Subject", keys[i]); cond_list = g_slist_append(cond_list, cond); cond = filter_cond_new(FLT_COND_HEADER, FLT_CONTAIN, 0, "From", keys[i]); cond_list = g_slist_append(cond_list, cond); if (FOLDER_ITEM_IS_SENT_FOLDER(summaryview->folder_item)) { cond = filter_cond_new(FLT_COND_TO_OR_CC, FLT_CONTAIN, 0, NULL, keys[i]); cond_list = g_slist_append(cond_list, cond); } if (cond_list) { rule = filter_rule_new("Quick search rule", FLT_OR, cond_list, NULL); rule_list = g_slist_append(rule_list, rule); } } g_strfreev(keys); } memset(&fltinfo, 0, sizeof(FilterInfo)); dmode = get_debug_mode(); set_debug_mode(FALSE); for (cur = summaryview->all_mlist; cur != NULL; cur = cur->next) { MsgInfo *msginfo = (MsgInfo *)cur->data; GSList *hlist = NULL; gboolean matched = TRUE; total++; if (status_rule) { if (type == QS_IN_ADDRESSBOOK) hlist = procheader_get_header_list_from_msginfo (msginfo); if (!filter_match_rule(status_rule, msginfo, hlist, &fltinfo)) { if (hlist) procheader_header_list_destroy(hlist); continue; } } if (rule_list) { GSList *rcur; if (!hlist) hlist = procheader_get_header_list_from_msginfo (msginfo); /* AND keyword match */ for (rcur = rule_list; rcur != NULL; rcur = rcur->next) { rule = (FilterRule *)rcur->data; if (!filter_match_rule(rule, msginfo, hlist, &fltinfo)) { matched = FALSE; break; } } } if (matched) { flt_mlist = g_slist_prepend(flt_mlist, msginfo); count++; } if (hlist) procheader_header_list_destroy(hlist); } flt_mlist = g_slist_reverse(flt_mlist); set_debug_mode(dmode); if (status_rule || rule) { if (count > 0) g_snprintf(status_text, sizeof(status_text), _("%1$d in %2$d matched"), count, total); else g_snprintf(status_text, sizeof(status_text), _("No messages matched")); gtk_label_set_text(GTK_LABEL(qsearch->status_label), status_text); } else gtk_label_set_text(GTK_LABEL(qsearch->status_label), ""); filter_rule_list_free(rule_list); filter_rule_free(status_rule); return flt_mlist; }