int Main::run() { if(!init()) return 1; frame_delay = 1000 / FRAMES_PER_SECOND; frame = 0; load_options(); fps_counter_timer->start(); Menu * menu; menu = new Menu(); running = true; menu->run(); delete menu; save_options(); clean_up(); #ifdef _DEBUG #ifdef WIN32 _CrtDumpMemoryLeaks(); #endif #endif return 0; }
void init_global_game_state() { PATH_INFO::init_base_path(""); PATH_INFO::init_user_dir("./"); PATH_INFO::set_standard_filenames(); init_options(); load_options(); init_colors(); g = new game; g->load_static_data(); g->load_core_data(); DynamicDataLoader::get_instance().finalize_loaded_data(); world_generator->set_active_world(NULL); world_generator->get_all_worlds(); WORLDPTR test_world = world_generator->make_new_world( false ); world_generator->set_active_world(test_world); g->u = player(); g->u.create(PLTYPE_NOW); g->m = std::move( map( static_cast<bool>( ACTIVE_WORLD_OPTIONS["ZLEVELS"] ) ) ); g->m.load( g->get_levx(), g->get_levy(), g->get_levz(), false ); }
software_config *software_config_alloc(int driver_index) //, hashfile_error_func error_proc) { const game_driver *driver; software_config *config; // allocate the software_config config = (software_config *)malloc(sizeof(software_config)); memset(config,0,sizeof(software_config)); // allocate the machine config windows_options pCurrentOpts; load_options(pCurrentOpts, OPTIONS_GLOBAL, driver_index); config->mconfig = global_alloc(machine_config(*drivers[driver_index],pCurrentOpts)); // allocate the hash file driver = drivers[driver_index]; while (driver) //&& (!config->hashfile)) { //config->hashfile = hashfile_open(*opts, driver->name, TRUE, error_proc); driver = driver_get_compatible(driver); } // other stuff config->driver_index = driver_index; config->gamedrv = drivers[driver_index]; return config; }
void device::work() { load_options(); create_client(); delegate_all(); initialize_device(); }
int main(int argc, char **argv) { t_data *data; data = load_options(argc, argv); ft_ls(data); if (data) ft_data_del(data); return (0); }
static void load_settings(void) { char *newname; if ((newname = locate(optname, L_LOADCFG)) != NULL) { free(optname); optname = newname; load_options(); } }
// seg000:0000 void far pop_main() { // debug only: check that the sequence table deobfuscation did not mess things up #ifdef CHECK_SEQTABLE_MATCHES_ORIGINAL check_seqtable_matches_original(); #endif load_options(); apply_seqtbl_patches(); char sprintf_temp[100]; int i; dathandle = open_dat("PRINCE.DAT", 0); /*video_mode =*/ parse_grmode(); init_timer(60); parse_cmdline_sound(); set_hc_pal(); current_target_surface = rect_sthg(onscreen_surface_, &screen_rect); show_loading(); set_joy_mode(); cheats_enabled = check_param("megahit") != NULL; #ifdef __DEBUG__ cheats_enabled = 1; // debug #endif draw_mode = check_param("draw") != NULL && cheats_enabled; demo_mode = check_param("demo") != NULL; init_copyprot_dialog(); #ifdef USE_REPLAY init_record_replay(); #endif if (cheats_enabled #ifdef USE_REPLAY || recording #endif ) { for (i = 14; i >= 0; --i) { snprintf(sprintf_temp, sizeof(sprintf_temp), "%d", i); if (check_param(sprintf_temp)) { start_level = i; break; } } } init_game_main(); }
int main(int argc, char *argv[]) { #ifdef ENABLE_LOGGING setupDebug(); #endif // ncurses stuff initscr(); // Initialize ncurses noecho(); // Don't echo keypresses cbreak(); // C-style breaks (e.g. ^C to SIGINT) keypad(stdscr, true); // Numpad is numbers init_colors(); // See color.cpp curs_set(0); // Invisible cursor std::srand(time(NULL)); bool quit_game = false; bool delete_world = false; game *g = new game; MAPBUFFER = mapbuffer(g); MAPBUFFER.load(); load_options(); do { g->setup(); while (!g->do_turn()) ; if (g->uquit == QUIT_DELETE_WORLD) delete_world = true; if (g->game_quit()) quit_game = true; } while (!quit_game); MAPBUFFER.save(); if (delete_world && (remove("save/") != 0)) { #if (defined _WIN32 || defined __WIN32__) system("rmdir /s /q save"); #else system("rm -rf save/*"); #endif } erase(); // Clear screen endwin(); // End ncurses #if (defined _WIN32 || defined WINDOWS) system("cls"); // Tell the terminal to clear itself system("color 07"); #else system("clear"); // Tell the terminal to clear itself #endif return 0; }
static void MessRemoveImage(int drvindex, const char *pszFilename) { const char *s; windows_options o; for (device_image_interface &dev : image_interface_iterator(s_config->mconfig->root_device())) { const char *opt_name = dev.instance_name(); load_options(o, OPTIONS_GAME, drvindex); s = o.value(opt_name); if ((s) && !strcmp(pszFilename, s)) MessSpecifyImage(drvindex, &dev, NULL); } }
int confload_toplevel(struct ConfParse *parse, void *data, const struct CF_Child *node) { struct Configuration *cfg = (struct Configuration *)data; if (node->token_count == 0) return 0; switch (lookup_name(node)) { case S_ACL: load_acl(cfg, parse, node); break; case S_INCLUDE: { struct CF_Token token = confparse_node_gettoken(parse, node, 1); char *filename; if (filename_is_absolute(token.name)) filename = filename_combine("", token.name); else filename = filename_combine(cfg->options.directory, token.name); token.name = filename; token.name_length = (unsigned)strlen(filename); confload_configuration(cfg, filename, &token); free(filename); } break; case S_KEY: conf_load_key(cfg, parse, node); break; case S_OPTIONS: load_options(cfg, parse, node); break; case S_ZONE: conf_load_zone(cfg, parse, node); break; default: //print_node(parse, stdout, node, 0); { struct CF_Token value = confparse_node_gettoken(parse, node, 0); CONF_OPTION_UNKNOWN(parse, &value); } break; } return 0; }
PlugReverb(float drytime, float wettime, float damping, float roomwidth, float roomsize) : AbstractPlugin() { PluginOption opt{}; opt.type = PluginOption::Type::Double; opt.id = DRYTIME; opt.description = "Dry time"; opt.d.min = 0.01; opt.d.max = 2.0; opt.d.current = drytime; opt.conf_name = "reverb_dry_time"; dsp_options.push_back(opt); opt.id = WETTIME; opt.description = "Wet time"; opt.d.min = 0.01; opt.d.max = 2.0; opt.d.current = wettime; opt.conf_name = "reverb_wet_time"; dsp_options.push_back(opt); opt.id = DAMPING; opt.description = "Damping"; opt.d.min = 0.01; opt.d.max = 2.0; opt.d.current = damping; opt.conf_name = "reverb_damping"; dsp_options.push_back(opt); opt.id = ROOMWIDTH; opt.description = "Room width"; opt.d.min = 0.01; opt.d.max = 2.0; opt.d.current = roomwidth; opt.conf_name = "reverb_room_width"; dsp_options.push_back(opt); opt.id = ROOMSIZE; opt.description = "Room size"; opt.d.min = 0.01; opt.d.max = 2.0; opt.d.current = roomsize; opt.conf_name = "reverb_room_size"; dsp_options.push_back(opt); load_options("rarch_effect.cfg"); }
int main(int argc, char** argv) { // This program recursively finds and builds all files in the source // directory, and then generates the output in the lib/bin directory. env->workspace_load(); env->output("."); env->make(true); env->monolithic_build(false); argp = new ArgParser(env, argc, argv); load_options(); parse_options(); save_options(); Builder::Ptr builder(new Builder(env)); return builder->errors(); }
// this is a wrapper call to wrap the idiosycracies of SetSelectedSoftware() static void InternalSetSelectedSoftware(int drvindex, const machine_config *config, const device_image_interface *device, const char *pszSoftware) { if (!pszSoftware) pszSoftware = ""; const char *s, *opt_name = device->instance_name(); windows_options o; load_options(o, OPTIONS_GAME, drvindex); s = o.value(opt_name); // only call SetSelectedSoftware() if this value is different if (strcmp(s, pszSoftware)!=0) { SetSelectedSoftware(drvindex, config, device, pszSoftware); } }
PlugEQ(float rate) : AbstractPlugin() { #ifdef PERF_TEST process_frames = 0; process_time = 0.0; #endif plug_layout = AbstractPlugin::Layout::Horizontal; const float bands[] = { 30, 80, 150, 250, 500, 800, 1000, 2000, 3000, 5000, 8000, 10000, 12000, 15000 }; eq_l = dsp_eq_new(rate, bands, sizeof(bands) / sizeof(bands[0])); eq_r = dsp_eq_new(rate, bands, sizeof(bands) / sizeof(bands[0])); PluginOption opt = {0}; opt.type = PluginOption::Type::Double; const char *desc[] = { "Lo-shelf", "80 Hz", "150 Hz", "250 Hz", "500 Hz", "800 Hz", "1.0 kHz", "2.0 kHz", "3.0 kHz", "5.0 kHz", "8.0 kHz", "10.0 kHz", "12.0 kHz", "Hi-shelf", }; for (unsigned i = 0; i < sizeof(desc) / sizeof(desc[0]); i++) { opt.id = i; opt.description = desc[i]; opt.d.min = -50.0; opt.d.max = 20.0; opt.d.current = 0.0; opt.conf_name = Utils::join("eq_band_", i); dsp_options.push_back(opt); } load_options("rarch_effect.cfg"); }
int main (int argc, char **argv) { DBusGConnection *conn; DBusGProxy *proxy; GError *error = NULL; guint32 request_name_ret; g_type_init (); mainloop = g_main_loop_new (NULL, FALSE); conn = dbus_g_bus_get (GEOCLUE_DBUS_BUS, &error); if (!conn) { g_error ("Error getting bus: %s", error->message); return 1; } proxy = dbus_g_proxy_new_for_name (conn, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); if (!org_freedesktop_DBus_request_name (proxy, GEOCLUE_MASTER_NAME, 0, &request_name_ret, &error)) { g_error ("Error registering D-Bus service %s: %s", GEOCLUE_MASTER_NAME, error->message); return 1; } /* Just quit if master is already running */ if (request_name_ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { return 1; } /* Load options */ options = load_options (); master = g_object_new (GC_TYPE_MASTER, NULL); dbus_g_connection_register_g_object (conn, "/org/freedesktop/Geoclue/Master", G_OBJECT (master)); g_main_loop_run (mainloop); return 0; }
void options_init(void) { char *path; xmlDoc *doc; loading = g_hash_table_new(g_str_hash, g_str_equal); option_hash = g_hash_table_new(g_str_hash, g_str_equal); widget_builder = g_hash_table_new(g_str_hash, g_str_equal); path = choices_find_xdg_path_load("Options", PROJECT, SITE); if (path) { /* Load in all the options set in the filer, storing them * temporarily in the loading hash table. * They get moved to option_hash when they're registered. */ doc = xmlParseFile(path); if (doc) { load_options(doc); xmlFreeDoc(doc); } else { parse_file(path, process_option_line); updating_file_format = TRUE; } g_free(path); } option_register_widget("label", build_label); option_register_widget("spacer", build_spacer); option_register_widget("frame", build_frame); option_register_widget("toggle", build_toggle); option_register_widget("slider", build_slider); option_register_widget("entry", build_entry); option_register_widget("numentry", build_numentry); option_register_widget("radio-group", build_radio_group); option_register_widget("colour", build_colour); option_register_widget("menu", build_menu); option_register_widget("font", build_font); }
static void MessRefreshPicker(void) { HWND hwndSoftware; int i = 0; LVFINDINFO lvfi; const char *s; windows_options o; hwndSoftware = GetDlgItem(GetMainWindow(), IDC_SWLIST); s_bIgnoreSoftwarePickerNotifies = TRUE; // Now clear everything out; this may call back into us but it should not // be problematic ListView_SetItemState(hwndSoftware, -1, 0, LVIS_SELECTED); for (device_image_interface &dev : image_interface_iterator(s_config->mconfig->root_device())) { const char *opt_name = dev.instance_name(); // get name of device slot load_options(o, OPTIONS_GAME, s_config->driver_index); s = o.value(opt_name); // get name of software in the slot if (s[0]) // if software is loaded { i = SoftwarePicker_LookupIndex(hwndSoftware, s); // see if its in the picker if (i < 0) // not there { // add already loaded software to picker, but not if its already there SoftwarePicker_AddFile(hwndSoftware, s, 1); i = SoftwarePicker_LookupIndex(hwndSoftware, s); // refresh pointer } if (i >= 0) // is there { memset(&lvfi, 0, sizeof(lvfi)); lvfi.flags = LVFI_PARAM; lvfi.lParam = i; i = ListView_FindItem(hwndSoftware, -1, &lvfi); ListView_SetItemState(hwndSoftware, i, LVIS_SELECTED, LVIS_SELECTED); // highlight it } } } s_bIgnoreSoftwarePickerNotifies = FALSE; }
static boolean init(void) { int error; char *fullname; xw_get(NULL, WF_WORKXYWH, &screen_info.dsk); if ((fullname = xshel_find(optname, &error)) != NULL) { free(optname); optname = fullname; } else { if ((error == EFILNF) && ((fullname = x_fullname(optname, &error)) != NULL)) { free(optname); optname = fullname; } if (error != 0) { xform_error(error); return TRUE; } } if (dsk_init() == TRUE) return TRUE; ft_init(); icnt_init(); app_init(); prg_init(); wd_init(); menu_bar(menu, 1); x_setpath("\\"); load_options(); return FALSE; }
static LPCTSTR DevView_GetSelectedSoftware(HWND hwndDevView, int nDriverIndex, const machine_config *config, const device_image_interface *dev, LPTSTR pszBuffer, UINT nBufferLength) { LPCTSTR t_buffer = NULL; TCHAR* t_s; LPCSTR s; const char *opt_name = dev->instance_name(); windows_options o; load_options(o, OPTIONS_GAME, nDriverIndex); s = o.value(opt_name); t_s = ui_wstring_from_utf8(s); if( !t_s ) return t_buffer; _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_s); free(t_s); t_buffer = pszBuffer; return t_buffer; }
int main(int argc, char *argv[]) { #ifdef ENABLE_LOGGING setupDebug(); #endif srand(time(NULL)); // ncurses stuff initscr(); // Initialize ncurses noecho(); // Don't echo keypresses cbreak(); // C-style breaks (e.g. ^C to SIGINT) keypad(stdscr, true); // Numpad is numbers init_colors(); // See color.cpp curs_set(0); // Invisible cursor rand(); // For some reason a call to rand() seems to be necessary to avoid // repetion. bool quit_game = false; game *g = new game; MAPBUFFER = mapbuffer(g); MAPBUFFER.load(); load_options(); do { g->setup(); while (!g->do_turn()); if (g->game_quit()) quit_game = true; } while (!quit_game); MAPBUFFER.save(); erase(); // Clear screen endwin(); // End ncurses #if (defined _WIN32 || defined WINDOWS) system("cls"); // Tell the terminal to clear itself system("color 07"); #else system("clear"); // Tell the terminal to clear itself #endif return 0; }
Mixer::Mixer ( int X, int Y, int W, int H, const char *L ) : Fl_Group( X, Y, W, H, L ) { Loggable::dirty_callback( &Mixer::handle_dirty, this ); _rows = 1; box( FL_FLAT_BOX ); labelsize( 96 ); { Fl_Group *o = new Fl_Group( X, Y, W, 24 ); { Fl_Menu_Bar *o = menubar = new Fl_Menu_Bar( X, Y, W, 24 ); o->add( "&Project/&New" ); o->add( "&Project/&Open" ); o->add( "&Project/&Save", FL_CTRL + 's', 0, 0 ); o->add( "&Project/&Quit", FL_CTRL + 'q', 0, 0 ); o->add( "&Mixer/&Add Strip", 'a', 0, 0 ); o->add( "&Mixer/Add &N Strips" ); o->add( "&Mixer/&Import Strip" ); o->add( "&Mixer/&Rows/One", '1', 0, 0 ); o->add( "&Mixer/&Rows/Two", '2', 0, 0 ); o->add( "&Mixer/&Rows/Three", '3', 0, 0 ); o->add( "&View/&Theme", 0, 0, 0 ); o->add( "_&Options/&Display/&Knobs/&Arc", 0, 0, 0, FL_MENU_RADIO ); o->add( "_&Options/&Display/&Knobs/&Burnished", 0, 0, 0, FL_MENU_RADIO ); o->add( "_&Options/&Display/&Knobs/&Plastic", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); o->add( "_&Options/&Display/&Sliders/&Nice", 0, 0, 0, FL_MENU_RADIO | FL_MENU_VALUE ); o->add( "_&Options/&Display/&Sliders/&Fill", 0, 0, 0, FL_MENU_RADIO ); o->add( "_&Options/&Display/&Sliders/&Simple", 0, 0, 0, FL_MENU_RADIO ); o->add( "_&Options/&Display/&Colors/&System", 0, 0, 0, FL_MENU_RADIO ); o->add( "&Help/&Manual" ); o->add( "&Help/&About" ); o->callback( cb_menu, this ); } { Fl_Box *o = project_name = new Fl_Box( X + 150, Y, W, 24 ); o->labelfont( FL_HELVETICA_ITALIC ); o->label( 0 ); o->align( FL_ALIGN_INSIDE | FL_ALIGN_CENTER ); o->labeltype( FL_SHADOW_LABEL ); Fl_Group::current()->resizable( o ); } { sm_blinker = new Fl_Button( ( X + W) - 37, Y + 4, 35, 15, "SM"); sm_blinker->box(FL_ROUNDED_BOX); sm_blinker->down_box(FL_ROUNDED_BOX); sm_blinker->color(FL_DARK2); sm_blinker->selection_color((Fl_Color)93); sm_blinker->labeltype(FL_NORMAL_LABEL); sm_blinker->labelfont(3); sm_blinker->labelsize(14); sm_blinker->labelcolor(FL_DARK3); sm_blinker->align(Fl_Align(FL_ALIGN_CENTER)); sm_blinker->when(FL_WHEN_RELEASE); sm_blinker->deactivate(); } // Fl_Blink_Button* sm_blinker o->end(); } { Fl_Scroll *o = scroll = new Fl_Scroll( X, Y + 24, W, H - 24 ); o->box( FL_FLAT_BOX ); // o->type( Fl_Scroll::HORIZONTAL_ALWAYS ); // o->box( Fl_Scroll::BOTH ); { Fl_Flowpack *o = mixer_strips = new Fl_Flowpack( X, Y + 24, W, H - 18 - 24 ); // label( "Non-Mixer" ); align( (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE) ); o->box( FL_FLAT_BOX ); o->type( Fl_Pack::HORIZONTAL ); o->hspacing( 2 ); o->vspacing( 2 ); o->end(); Fl_Group::current()->resizable( o ); } o->end(); Fl_Group::current()->resizable( o ); } end(); // Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this ); update_menu(); load_options(); }
int main(int argc,char ** argv){ if(al_init()<0){ //fonction d'initialisation fprintf(stderr,"Error at the initialisation of Allegro"); return -1; } if(!al_init_image_addon() ) { printf("addon Error"); return 0; } options=create_options(); load_options(options,"Options.txt"); screen=create_screen(options); control=create_control(screen); ALLEGRO_BITMAP * bg_picture=NULL; bg_picture = al_load_bitmap("./Ressources/Pictures/test.png"); ALLEGRO_BITMAP * image_titre_d=NULL; image_titre_d =al_load_bitmap("./Ressources/Pictures/play_d.png"); ALLEGRO_BITMAP * image_titre_s=NULL; image_titre_s=al_load_bitmap("./Ressources/Pictures/play_s.png"); /** DEBUT ALLEGRO_BITMAP * image_credit_d=NULL; image_credit_d =al_load_bitmap("./ressource/image/credit_d.png"); ALLEGRO_BITMAP * image_credit_s=NULL; image_credit_s=al_load_bitmap("./ressource/image/credit_s.png"); ALLEGRO_BITMAP * image_quitter_d=NULL; image_quitter_d =al_load_bitmap("./ressource/image/quitter_d.png"); ALLEGRO_BITMAP * image_quitter_s=NULL; image_quitter_s=al_load_bitmap("./ressource/image/quitter_s.png"); */ if (!bg_picture || !image_titre_d || !image_titre_s){ printf("bug image\n"); } struct Title *titles=malloc(sizeof(struct Title)*1); struct Menu * menu=create_menu(bg_picture,titles,create_column_position(1,200,300,300),1); //struct Control* control=creer_control(ecran); /** DEBUT void (*p)(void); void jouer(){ partie = creer_partie(); lancer_jeu(partie);} void credits(){ ALLEGRO_BITMAP * image_credits=NULL; image_credits = al_load_bitmap("./ressource/image/credits.png"); al_draw_bitmap(image_credits,0,0,0); al_flip_display(); al_rest(5.0); } void quitter(){quitter_jeu(partie);} p=jouer; titres[0]=*creer_titre(image_titre_s,image_titre_d,*p); p=credits; titres[1]=*creer_titre(image_credit_s,image_credit_d,*p); p=quitter; titres[2]=*creer_titre(image_quitter_s,image_quitter_d,*p); */ void (*p)(void); void f(){control_menu(menu,control);}
/* main */ int main (int argc, char *argv[]) { GOptionContext *context; gboolean window_arg = FALSE; gboolean area_arg = FALSE; gboolean include_border_arg = FALSE; gboolean disable_border_arg = FALSE; gboolean interactive_arg = FALSE; gchar *border_effect_arg = NULL; guint delay_arg = 0; GError *error = NULL; const GOptionEntry entries[] = { { "window", 'w', 0, G_OPTION_ARG_NONE, &window_arg, N_("Grab a window instead of the entire screen"), NULL }, { "area", 'a', 0, G_OPTION_ARG_NONE, &area_arg, N_("Grab an area of the screen instead of the entire screen"), NULL }, { "include-border", 'b', 0, G_OPTION_ARG_NONE, &include_border_arg, N_("Include the window border with the screenshot"), NULL }, { "remove-border", 'B', 0, G_OPTION_ARG_NONE, &disable_border_arg, N_("Remove the window border from the screenshot"), NULL }, { "delay", 'd', 0, G_OPTION_ARG_INT, &delay_arg, N_("Take screenshot after specified delay [in seconds]"), N_("seconds") }, { "border-effect", 'e', 0, G_OPTION_ARG_STRING, &border_effect_arg, N_("Effect to add to the border (shadow, border or none)"), N_("effect") }, { "interactive", 'i', 0, G_OPTION_ARG_NONE, &interactive_arg, N_("Interactively set options"), NULL }, { NULL }, }; setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); context = g_option_context_new (_("Take a picture of the screen")); g_option_context_set_ignore_unknown_options (context, FALSE); g_option_context_set_help_enabled (context, TRUE); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_parse (context, &argc, &argv, &error); if (error) { g_critical ("Unable to parse arguments: %s", error->message); g_error_free (error); g_option_context_free (context); exit (1); } g_option_context_free (context); if (window_arg && area_arg) { g_printerr (_("Conflicting options: --window and --area should not be " "used at the same time.\n")); exit (1); } gtk_window_set_default_icon_name (SCREENSHOOTER_ICON); screenshooter_init_stock_icons (); settings = g_settings_new (MATE_SCREENSHOT_SCHEMA); load_options (); /* allow the command line to override options */ if (window_arg) take_window_shot = TRUE; if (area_arg) take_area_shot = TRUE; if (include_border_arg) include_border = TRUE; if (disable_border_arg) include_border = FALSE; if (border_effect_arg) { g_free (border_effect); border_effect = border_effect_arg; } if (delay_arg > 0) delay = delay_arg; /* interactive mode overrides everything */ if (interactive_arg) { GtkWidget *dialog; gint response; dialog = create_interactive_dialog (); response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); switch (response) { case GTK_RESPONSE_DELETE_EVENT: case GTK_RESPONSE_CANCEL: return EXIT_SUCCESS; case GTK_RESPONSE_OK: break; default: g_assert_not_reached (); break; } } if (((delay > 0 && interactive_arg) || delay_arg > 0) && !take_area_shot) { g_timeout_add (delay * 1000, prepare_screenshot_timeout, NULL); } else { if (interactive_arg) { /* HACK: give time to the dialog to actually disappear. * We don't have any way to tell when the compositor has finished * re-drawing. */ g_timeout_add (200, prepare_screenshot_timeout, NULL); } else g_idle_add (prepare_screenshot_timeout, NULL); } gtk_main (); return EXIT_SUCCESS; }
int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int argc = __argc; char **argv = __argv; #else int main(int argc, char *argv[]) { #endif #ifdef ENABLE_LOGGING setupDebug(); #endif int seed = time(NULL); // set locale to system default setlocale(LC_ALL, ""); #ifdef LOCALIZE bindtextdomain("cataclysm-dda", "lang/mo"); bind_textdomain_codeset("cataclysm-dda", "UTF-8"); textdomain("cataclysm-dda"); #endif //args: world seeding only. argc--; argv++; while (argc){ if(std::string(argv[0]) == "--seed"){ argc--; argv++; if(argc){ seed = djb2_hash((unsigned char*)argv[0]); argc--; argv++; } } else // ignore unknown args. argc--; argv++; } // ncurses stuff initOptions(); load_options(); // For getting size options initscr(); // Initialize ncurses #ifdef SDLTILES init_tiles(); #endif // SDLTILES noecho(); // Don't echo keypresses cbreak(); // C-style breaks (e.g. ^C to SIGINT) keypad(stdscr, true); // Numpad is numbers init_colors(); // See color.cpp // curs_set(0); // Invisible cursor set_escdelay(10); // Make escape actually responsive std::srand(seed); bool quit_game = false; g = new game; g->init_data(); if(g->game_error()) exit_handler(-999); g->init_ui(); MAPBUFFER.set_game(g); if(g->game_error()) exit_handler(-999); curs_set(0); // Invisible cursor here, because MAPBUFFER.load() is crash-prone #if (!(defined _WIN32 || defined WINDOWS)) struct sigaction sigIntHandler; sigIntHandler.sa_handler = exit_handler; sigemptyset(&sigIntHandler.sa_mask); sigIntHandler.sa_flags = 0; sigaction(SIGINT, &sigIntHandler, NULL); #endif do { if(!g->opening_screen()) { quit_game = true; } while (!g->do_turn()) ; if (g->game_quit() || g->game_error()) quit_game = true; } while (!quit_game); exit_handler(-999); return 0; }
int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int argc = __argc; char **argv = __argv; #else int main(int argc, char *argv[]) { #endif int seed = time(NULL); bool verifyexit = false; bool check_all_mods = false; // Set default file paths #ifdef PREFIX #define Q(STR) #STR #define QUOTE(STR) Q(STR) init_base_path(std::string(QUOTE(PREFIX))); #else PATH_INFO::init_base_path(""); #endif #ifdef USE_HOME_DIR PATH_INFO::init_user_dir(); #else PATH_INFO::init_user_dir("./"); #endif PATH_INFO::set_standart_filenames(); MAP_SHARING::setDefaults(); // Process CLI arguments int saved_argc = --argc; // skip program name char **saved_argv = ++argv; while (argc) { if(std::string(argv[0]) == "--seed") { argc--; argv++; if(argc) { seed = djb2_hash((unsigned char *)argv[0]); argc--; argv++; } } else if(std::string(argv[0]) == "--jsonverify") { argc--; argv++; verifyexit = true; } else if(std::string(argv[0]) == "--check-mods") { argc--; argv++; check_all_mods = true; } else if(std::string(argv[0]) == "--basepath") { argc--; argv++; if(argc) { PATH_INFO::init_base_path(std::string(argv[0])); PATH_INFO::set_standart_filenames(); argc--; argv++; } } else if(std::string(argv[0]) == "--userdir") { argc--; argv++; if (argc) { PATH_INFO::init_user_dir( argv[0] ); PATH_INFO::set_standart_filenames(); argc--; argv++; } } else if(std::string(argv[0]) == "--username") { argc--; argv++; if (argc) { MAP_SHARING::setUsername(std::string(argv[0])); argc--; argv++; } } else if(std::string(argv[0]) == "--addadmin") { argc--; argv++; if (argc) { MAP_SHARING::addAdmin(std::string(argv[0])); argc--; argv++; } } else if(std::string(argv[0]) == "--adddebugger") { argc--; argv++; if (argc) { MAP_SHARING::addDebugger(std::string(argv[0])); argc--; argv++; } } else if(std::string(argv[0]) == "--shared") { argc--; argv++; MAP_SHARING::setSharing(true); MAP_SHARING::setCompetitive(true); MAP_SHARING::setWorldmenu(false); } else if(std::string(argv[0]) == "--competitive") { argc--; argv++; MAP_SHARING::setCompetitive(true); } else { // Skipping other options. argc--; argv++; } } while (saved_argc) { if(std::string(saved_argv[0]) == "--worldmenu") { saved_argc--; saved_argv++; MAP_SHARING::setWorldmenu(true); } else if(std::string(saved_argv[0]) == "--datadir") { saved_argc--; saved_argv++; if(saved_argc) { PATH_INFO::update_pathname("datadir", std::string(saved_argv[0])); PATH_INFO::update_datadir(); saved_argc--; saved_argv++; } } else if(std::string(saved_argv[0]) == "--savedir") { saved_argc--; saved_argv++; if(saved_argc) { PATH_INFO::update_pathname("savedir", std::string(saved_argv[0])); saved_argc--; saved_argv++; } } else if(std::string(saved_argv[0]) == "--configdir") { saved_argc--; saved_argv++; if(saved_argc) { PATH_INFO::update_pathname("config_dir", std::string(saved_argv[0])); PATH_INFO::update_config_dir(); saved_argc--; saved_argv++; } } else if(std::string(saved_argv[0]) == "--optionfile") { saved_argc--; saved_argv++; if(saved_argc) { PATH_INFO::update_pathname("options", std::string(saved_argv[0])); saved_argc--; saved_argv++; } } else if(std::string(saved_argv[0]) == "--keymapfile") { saved_argc--; saved_argv++; if(saved_argc) { PATH_INFO::update_pathname("keymap", std::string(saved_argv[0])); saved_argc--; saved_argv++; } } else if(std::string(saved_argv[0]) == "--autopickupfile") { saved_argc--; saved_argv++; if(saved_argc) { PATH_INFO::update_pathname("autopickup", std::string(saved_argv[0])); saved_argc--; saved_argv++; } } else if(std::string(saved_argv[0]) == "--motdfile") { saved_argc--; saved_argv++; if(saved_argc) { PATH_INFO::update_pathname("motd", std::string(saved_argv[0])); saved_argc--; saved_argv++; } } else { // ignore unknown args. saved_argc--; saved_argv++; } } // setup debug loggind #ifdef ENABLE_LOGGING setupDebug(); #endif // set locale to system default setlocale(LC_ALL, ""); #ifdef LOCALIZE const char *locale_dir; #ifdef __linux__ if (!FILENAMES["base_path"].empty()) { locale_dir = std::string(FILENAMES["base_path"] + "share/locale").c_str(); } else { locale_dir = "lang/mo"; } #else locale_dir = "lang/mo"; #endif // __linux__ bindtextdomain("cataclysm-dda", locale_dir); bind_textdomain_codeset("cataclysm-dda", "UTF-8"); textdomain("cataclysm-dda"); #endif // LOCALIZE // ncurses stuff initOptions(); load_options(); // For getting size options #ifdef LOCALIZE setlocale(LC_ALL, OPTIONS["USE_LANG"].getValue().c_str()); #endif // LOCALIZE if (initscr() == NULL) { // Initialize ncurses DebugLog() << "initscr failed!\n"; return 1; } init_interface(); noecho(); // Don't echo keypresses cbreak(); // C-style breaks (e.g. ^C to SIGINT) keypad(stdscr, true); // Numpad is numbers #if !(defined TILES || defined _WIN32 || defined WINDOWS) // For tiles or windows, this is handled already in initscr(). init_colors(); #endif // curs_set(0); // Invisible cursor set_escdelay(10); // Make escape actually responsive std::srand(seed); g = new game; // First load and initialize everything that does not // depend on the mods. try { if (!assure_dir_exist(FILENAMES["user_dir"].c_str())) { debugmsg("Can't open or create %s. Check permissions.", FILENAMES["user_dir"].c_str()); exit_handler(-999); } g->load_static_data(); if (verifyexit) { if(g->game_error()) { exit_handler(-999); } exit_handler(0); } if (check_all_mods) { // Here we load all the mods and check their // consistency (both is done in check_all_mod_data). g->init_ui(); popup_nowait("checking all mods"); g->check_all_mod_data(); if(g->game_error()) { exit_handler(-999); } // At this stage, the mods (and core game data) // are find and we could start playing, but this // is only for verifying that stage, so we exit. exit_handler(0); } } catch(std::string &error_message) { if(!error_message.empty()) { debugmsg("%s", error_message.c_str()); } exit_handler(-999); } // Now we do the actuall game g->init_ui(); if(g->game_error()) { exit_handler(-999); } curs_set(0); // Invisible cursor here, because MAPBUFFER.load() is crash-prone #if (!(defined _WIN32 || defined WINDOWS)) struct sigaction sigIntHandler; sigIntHandler.sa_handler = exit_handler; sigemptyset(&sigIntHandler.sa_mask); sigIntHandler.sa_flags = 0; sigaction(SIGINT, &sigIntHandler, NULL); #endif bool quit_game = false; do { if(!g->opening_screen()) { quit_game = true; } while (!quit_game && !g->do_turn()) ; if (g->game_quit() || g->game_error()) { quit_game = true; } } while (!quit_game); exit_handler(-999); return 0; }
int main(int argc, char *argv[]) { #ifdef ENABLE_LOGGING setupDebug(); #endif int seed = time(NULL); //args: world seeding only. argc--; argv++; while (argc){ if(std::string(argv[0]) == "--seed"){ argc--; argv++; if(argc){ seed = djb2_hash((unsigned char*)argv[0]); argc--; argv++; } } else // ignore unknown args. argc--; argv++; } // ncurses stuff load_options(); // For getting size options initscr(); // Initialize ncurses noecho(); // Don't echo keypresses cbreak(); // C-style breaks (e.g. ^C to SIGINT) keypad(stdscr, true); // Numpad is numbers init_colors(); // See color.cpp curs_set(0); // Invisible cursor set_escdelay(10); // Make escape actually responsive std::srand(seed); bool quit_game = false; bool delete_world = false; game *g = new game; g->init_ui(); MAPBUFFER.set_game(g); MAPBUFFER.load(); #if (!(defined _WIN32 || defined WINDOWS)) struct sigaction sigIntHandler; sigIntHandler.sa_handler = exit_handler; sigemptyset(&sigIntHandler.sa_mask); sigIntHandler.sa_flags = 0; sigaction(SIGINT, &sigIntHandler, NULL); #endif do { g->setup(); while (!g->do_turn()) ; if (g->uquit == QUIT_DELETE_WORLD) delete_world = true; if (g->game_quit()) quit_game = true; } while (!quit_game); if (delete_world) { g->delete_save(); } else { MAPBUFFER.save_if_dirty(); } exit_handler(-999); return 0; }
//-------------------------------------------------------------------------- void idaapi run(int arg) { if ( arg == -1 ) { load_options(); show_options(); return; } func_t *pfn = get_func(get_screen_ea()); if ( pfn == NULL ) { warning("Please position the cursor in a function first!"); return; } load_options(); qstring title; graph_info_t::get_title(pfn->startEA, &title); HWND hwnd = NULL; TForm *form = create_tform(title.c_str(), &hwnd); if ( hwnd != NULL ) { // window is new, but instance is in the list? graph_info_t *gi = graph_info_t::find(title.c_str()); if ( gi != NULL ) { // in that case let us "recycle" the instance gi->func_ea = pfn->startEA; } else { // we create a new instance gi = graph_info_t::create(pfn->startEA); } if ( gi != NULL ) { // get a unique graph id netnode id; id.create(); gi->mark_for_refresh(); gi->form = form; gi->gv = create_graph_viewer(form, id, gr_callback, gi, 0); open_tform(form, FORM_MDI|FORM_TAB|FORM_MENU); if ( gi->gv != NULL ) { viewer_fit_window(gi->gv); viewer_add_menu_item(gi->gv, "Options", menu_options_cb, gi, "O", 0); viewer_add_menu_item(gi->gv, "Goto to first node", menu_home_cb, gi, "H", 0); viewer_add_menu_item(gi->gv, "Refresh", menu_refresh_cb, gi, "R", 0); viewer_add_menu_item(gi->gv, "Search first", menu_searchfirst_cb, gi, "S", 0); viewer_add_menu_item(gi->gv, "Search next", menu_searchnext_cb, gi, "N", 0); } else { graph_info_t::destroy(gi); gi = NULL; } } // failed to creat a graph view? if ( gi == NULL ) { warning("Failed to create call graph window!\n"); return; } } else { graph_info_t *gi = graph_info_t::find(title.c_str()); if ( gi != NULL ) { gi->refresh(); open_tform(gi->form, FORM_MDI|FORM_TAB|FORM_MENU); } } }
int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int argc = __argc; char **argv = __argv; #else int main(int argc, char *argv[]) { #endif #ifdef ENABLE_LOGGING setupDebug(); #endif int seed = time(NULL); bool verifyexit = false; // set locale to system default setlocale(LC_ALL, ""); #ifdef LOCALIZE bindtextdomain("cataclysm-dda", "lang/mo"); bind_textdomain_codeset("cataclysm-dda", "UTF-8"); textdomain("cataclysm-dda"); #endif //args: world seeding only. argc--; argv++; while (argc) { if(std::string(argv[0]) == "--seed") { argc--; argv++; if(argc) { seed = djb2_hash((unsigned char *)argv[0]); argc--; argv++; } } else if(std::string(argv[0]) == "--jsonverify") { argc--; verifyexit = true; } else { // ignore unknown args. argc--; } argv++; } // ncurses stuff initOptions(); load_options(); // For getting size options initscr(); // Initialize ncurses init_interface(); noecho(); // Don't echo keypresses cbreak(); // C-style breaks (e.g. ^C to SIGINT) keypad(stdscr, true); // Numpad is numbers #if !(defined TILES || defined _WIN32 || defined WINDOWS) // For tiles or windows, this is handled already in initscr(). init_colors(); #endif // curs_set(0); // Invisible cursor set_escdelay(10); // Make escape actually responsive std::srand(seed); bool quit_game = false; g = new game; g->init_data(); if(g->game_error()) { exit_handler(-999); } if ( verifyexit ) { item_controller->check_itype_definitions(); item_controller->check_items_of_groups_exist(); MonsterGenerator::generator().check_monster_definitions(); MonsterGroupManager::check_group_definitions(); check_recipe_definitions(); exit_handler(0); } g->init_ui(); if(g->game_error()) { exit_handler(-999); } curs_set(0); // Invisible cursor here, because MAPBUFFER.load() is crash-prone #if (!(defined _WIN32 || defined WINDOWS)) struct sigaction sigIntHandler; sigIntHandler.sa_handler = exit_handler; sigemptyset(&sigIntHandler.sa_mask); sigIntHandler.sa_flags = 0; sigaction(SIGINT, &sigIntHandler, NULL); #endif do { if(!g->opening_screen()) { quit_game = true; } while (!quit_game && !g->do_turn()) ; if (g->game_quit() || g->game_error()) { quit_game = true; } } while (!quit_game); exit_handler(-999); return 0; }
GFigObj * gfig_load (const gchar *filename, const gchar *name) { GFigObj *gfig; FILE *fp; gchar load_buf[MAX_LOAD_LINE]; gchar str_buf[MAX_LOAD_LINE]; gint chk_count; gint load_count = 0; gdouble version; gchar magic1[20]; gchar magic2[20]; g_assert (filename != NULL); #ifdef DEBUG printf ("Loading %s (%s)\n", filename, name); #endif /* DEBUG */ fp = g_fopen (filename, "rb"); if (!fp) { g_message (_("Could not open '%s' for reading: %s"), gimp_filename_to_utf8 (filename), g_strerror (errno)); return NULL; } gfig = gfig_new (); gfig->name = g_strdup (name); gfig->filename = g_strdup (filename); /* HEADER * draw_name * version * obj_list */ get_line (load_buf, MAX_LOAD_LINE, fp, 1); sscanf (load_buf, "%10s %10s %lf", magic1, magic2, &version); if (strcmp (magic1, "GFIG") || strcmp (magic2, "Version")) { g_message ("File '%s' is not a gfig file", gimp_filename_to_utf8 (gfig->filename)); gfig_free (gfig); return NULL; } get_line (load_buf, MAX_LOAD_LINE, fp, 0); sscanf (load_buf, "Name: %100s", str_buf); gfig_name_decode (load_buf, str_buf); gfig->draw_name = g_strdup (load_buf); get_line (load_buf, MAX_LOAD_LINE, fp, 0); if (strncmp (load_buf, "Version: ", 9) == 0) gfig->version = g_ascii_strtod (load_buf + 9, NULL); get_line (load_buf, MAX_LOAD_LINE, fp, 0); sscanf (load_buf, "ObjCount: %d", &load_count); if (load_options (gfig, fp)) { g_message ("File '%s' corrupt file - Line %d Option section incorrect", gimp_filename_to_utf8 (filename), line_no); gfig_free (gfig); return NULL; } if (gfig_load_styles (gfig, fp)) { g_message ("File '%s' corrupt file - Line %d Option section incorrect", gimp_filename_to_utf8 (filename), line_no); gfig_free (gfig); return NULL; } gfig_load_objs (gfig, load_count, fp); /* Check count ? */ chk_count = g_list_length (gfig->obj_list); if (chk_count != load_count) { g_message ("File '%s' corrupt file - Line %d Object count to small", gimp_filename_to_utf8 (filename), line_no); gfig_free (gfig); return NULL; } fclose (fp); if (!gfig_context->current_obj) gfig_context->current_obj = gfig; gfig->obj_status = GFIG_OK; return gfig; }
void t_game::initialize() { t_window_ptr window; load_options(); //== writen by sunjun ==// // add_resource_file( "data/new.h4r" ); // add_resource_file( "data/updates.h4r" ); add_resource_file( "data/text.h4r" ); add_resource_file( "data/music.h4r" ); add_resource_file( "data/movies.h4r" ); add_resource_folder( "data" ); if (!add_resource_file( "data/heroes4.h4r" )) { fatal_error( "Unable to open data/heroes4.h4r" ); exit(0); } t_pointer_cache< t_string_table > string_table_cache( "text" ); t_pointer_cache< t_string_table > movie_string_table_cache( "intro voice over text" ); t_pointer_cache< t_string_table > credits_string_table_cache( "credits" ); t_external_string::add_table( *string_table_cache.get() ); t_external_string::add_table( *movie_string_table_cache.get() ); t_external_string::add_table( *credits_string_table_cache.get() ); // this is a once-off shutdown for pre-release code #ifdef k_useless_serialized_version fatal_error( k_text_serial_failure ); exit(0); #endif std::string cheat_text; if (get_command_line_argument( k_text_cheat_menu, cheat_text )) { set_show_cheat_menus( true ); } t_screen_point screen_size = get_desktop_size(); m_frame_window = new t_gray_window(t_screen_rect(0, 0, g_window_width, g_window_height)); t_mouse_window* cursor = new t_mouse_window; t_window* animation = new t_animated_window( g_sample_cursor.get(), t_screen_point(0,0), 100, cursor ); m_frame_window->set_cursor( cursor ); set_resolution(g_window_width, g_window_height, false); initialize_platform(); // Play the logo cinematics t_sound_cache music = get_music_playing(); stop_music(); play_music( music ); t_main_menu* main_menu = new t_main_menu( m_frame_window ); }