void play_movie_if_onefiler() { #ifdef TEST_FOO load_foo(); #endif // TEST_FOO if (movie.speed[0]) { play_movie(); // load_foo may fail if this function has local variables. } }
int vm_main(int argc, char *argv[]) { // Enable native language support, i.e. internationalization #ifdef ENABLE_NLS std::setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); #endif int c; // scan for the two main standard GNU options for (c = 0; c < argc; c++) { if (strcmp("--help", argv[c]) == 0) { exit(EXIT_SUCCESS); } if (strcmp("--version", argv[c]) == 0) { printf (_("Gnash gprocessor version: %s, Gnash version: %s\n"), GPROC_VERSION, VERSION); exit(EXIT_SUCCESS); } } std::vector<std::string> infiles; //RcInitFile& rcfile = RcInitFile::getDefaultInstance(); //rcfile.loadFiles(); if (rcfile.verbosityLevel() > 0) { dbglogfile.setVerbosity(rcfile.verbosityLevel()); } dbglogfile.setLogFilename(rcfile.getDebugLog()); if (rcfile.useWriteLog()) { dbglogfile.setWriteDisk(true); } if (rcfile.useActionDump()) { dbglogfile.setActionDump(true); dbglogfile.setVerbosity(); } if (rcfile.useParserDump()) { dbglogfile.setParserDump(true); dbglogfile.setVerbosity(); } while ((c = getopt (argc, argv, ":hwvapr:gf:d:")) != -1) { switch (c) { case 'h': dbglogfile.removeLog(); exit(EXIT_SUCCESS); case 'w': s_do_output = true; break; case 'v': dbglogfile.setVerbosity(); log_debug (_("Verbose output turned on")); break; case 'g': #ifdef USE_DEBUGGER debugger.enabled(true); debugger.console(); log_debug (_("Setting debugger ON")); #else log_error (_("The debugger has been disabled at configuration time")); #endif case 'a': #if VERBOSE_ACTION dbglogfile.setActionDump(true); #else log_error (_("Verbose actions disabled at compile time")); #endif break; case 'p': #if VERBOSE_PARSE dbglogfile.setParserDump(true); #else log_error (_("Verbose parsing disabled at compile time")); #endif break; case 'r': allowed_end_hits = strtol(optarg, NULL, 0); break; case 'd': delay = strtol(optarg, NULL, 0)*1000; // delay is in microseconds // this will be recognized as a request to run at FPS speed if ( delay < 0 ) delay = -1; break; case 'f': limit_advances = strtol(optarg, NULL, 0); break; case ':': fprintf(stderr, "Missing argument for switch ``%c''\n", optopt); exit(EXIT_FAILURE); case '?': default: fprintf(stderr, "Unknown switch ``%c''\n", optopt); exit(EXIT_FAILURE); } } // get the file name from the command line while (optind < argc) { infiles.push_back(argv[optind]); optind++; } // No file names were supplied if (infiles.empty()) { std::cerr << "no input files" << std::endl; dbglogfile.removeLog(); exit(EXIT_FAILURE); } if (infiles.size() > 1) { // We're not ready for multiple runs yet. std::cerr << "Multiple input files not supported." << std::endl; dbglogfile.removeLog(); exit(EXIT_FAILURE); } #ifdef USE_FFMPEG std::auto_ptr<media::MediaHandler> handler( new gnash::media::ffmpeg::MediaHandlerFfmpeg() ); #elif defined(USE_GST) std::auto_ptr<media::MediaHandler> handler( new gnash::media::gst::MediaHandlerGst() ); #else std::cerr << "Neither SOUND_SDL nor SOUND_GST defined" << std::endl; exit(EXIT_FAILURE); #endif gnash::media::MediaHandler::set(handler); boost::shared_ptr<sound::sound_handler> soundHandler( new sound::NullSoundHandler()); std::vector<movie_data> data; // Play through all the movies. for (std::vector<std::string>::const_iterator i = infiles.begin(), e = infiles.end(); i != e; ++i) { RunResources runResources(*i); runResources.setSoundHandler(soundHandler); boost::intrusive_ptr<gnash::movie_definition> m = play_movie(*i, runResources); if (!m) { if (s_stop_on_errors) { // Fail. std::cerr << "error playing through movie " << *i << std::endl; std::exit(EXIT_FAILURE); } } movie_data md; md.m_movie = m.get(); md.m_filename = *i; data.push_back(md); } return 0; }
int main(int argc, char *argv[]) { assert(tu_types_validate()); array<const char*> infiles; for (int arg = 1; arg < argc; arg++) { if (argv[arg][0] == '-') { // Looks like an option. if (argv[arg][1] == 'h') { // Help. print_usage(); exit(1); } else if (argv[arg][1] == 'w') { // Write cache files. s_do_output = true; } else if (argv[arg][1] == 'v') { // Be verbose; i.e. print log messages to stdout. s_verbose = true; if (argv[arg][2] == 'a') { // Enable spew re: action. gameswf::set_verbose_action(true); } else if (argv[arg][2] == 'p') { // Enable parse spew. gameswf::set_verbose_parse(true); } // ... } } else { infiles.push_back(argv[arg]); } } if (infiles.size() == 0) { printf("no input files\n"); print_usage(); exit(1); } gameswf::gc_ptr<gameswf::player> player = new gameswf::player(); gameswf::register_file_opener_callback(file_opener); gameswf::register_log_callback(log_callback); gameswf::set_use_cache_files(false); // don't load old cache files! array<movie_data> data; // Play through all the movies. for (int i = 0, n = infiles.size(); i < n; i++) { gameswf::movie_definition* m = play_movie(player.get_ptr(), infiles[i]); if (m == NULL) { if (s_stop_on_errors) { // Fail. fprintf(stderr, "error playing through movie '%s', quitting\n", infiles[i]); exit(1); } } movie_data md; md.m_movie = m; md.m_filename = infiles[i]; data.push_back(md); } // Now append processed data. if (s_do_output) { for (int i = 0, n = data.size(); i < n; i++) { int error = write_cache_file(data[i]); if (error) { if (s_stop_on_errors) { // Fail. fprintf(stderr, "error processing movie '%s', quitting\n", data[i].m_filename.c_str()); exit(1); } } } } return 0; }
/* * Nutella CLIENT */ int main(int argc, char** argv) { request_address = M_REQ_ADDR; request_port = M_REQ_PORT; response_address = M_RES_ADDR; response_port = M_RES_PORT; int c; while((c = getopt(argc, argv, "q:s:h")) != EOF){ switch(c){ case 'q': request_address = optarg; request_port = get_port(request_address); break; case 's': response_address = optarg; response_port = get_port(response_address); break; case 'h': default: usage(argv); break; } } char message[MESSAGE_SIZE]; int reqSock, resSock; fd_set fds; if((reqSock = msockcreate(SEND, request_address, request_port)) < 0){ fprintf(stderr, "Unable to bind multicast %s:%d\n", request_address, request_port); exit(1); } if((resSock = msockcreate(RECV, response_address, response_port)) < 0){ fprintf(stderr, "Unable to bind multicast %s:%d\n", response_address, response_port); exit(1); } char* line = NULL; size_t len = 0; ssize_t read = 0; struct timeval timeout; char* host = NULL; int port; char* search_req = NULL; int again = 0; while(1){ again = 0; printf("\nSearch > "); read = getline(&line, &len, stdin); line[read-1] = '\0';//remove newline if(strcmp(line, AGAIN) != 0){ printf("Requesting \"%s\"...\n", line); msend(reqSock, line, strlen(line)); host = discoverHost(resSock, line); search_req = strdup(line); } else { again = 1; } if(host != NULL){ if(!again){ port = get_port(host); printf("%s : %d has \"%s\"\n", host, port, search_req); } int sock = socket_connect(host, port); socket_write(sock, search_req); FILE* sock_file = fdopen(sock, "r"); play_movie(sock_file, 0); close(sock); } else if(!again){ printf("Not found after %dms\n", TIMEOUT); } } return 0; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HINSTANCE v4; // esi //int v11; // ecx char Filename[260]; // [esp+8h] [ebp-10Ch] char value_name[8]; // [esp+10Ch] [ebp-8h] v4 = hInstance; #ifndef DEBUGGER diablo_reload_process(hInstance); #endif ghInst = v4; if ( RestrictedTest() ) ErrDlg(TEMPLATE_ERR_RESTRICTED, 0, "C:\\Src\\Diablo\\Source\\DIABLO.CPP", 877); if ( ReadOnlyTest() ) { if ( !GetModuleFileNameA(ghInst, Filename, 0x104u) ) *Filename = '\0'; DirErrDlg(Filename); } ShowCursor(FALSE); srand(GetTickCount()); encrypt_init_lookup_table(); exception_get_filter(); if ( !diablo_find_window("DIABLO") && diablo_get_not_running() ) { diablo_init_screen(); diablo_parse_flags(lpCmdLine); init_create_window(); sound_init(); UiInitialize(); #ifdef _DEBUG if ( showintrodebug ) play_movie("gendata\\logo.smk", 1); #else play_movie("gendata\\logo.smk", 1); #endif strcpy(value_name, "Intro"); if ( !SRegLoadValue("Diablo", value_name, 0, (int *)&hInstance) ) hInstance = (HINSTANCE)1; if ( hInstance ) play_movie("gendata\\diablo1.smk", 1); SRegSaveValue("Diablo", value_name, 0, 0); #ifdef _DEBUG if ( showintrodebug ) { UiTitleDialog(7); BlackPalette(); } #else UiTitleDialog(7); BlackPalette(); #endif mainmenu_action(0); /* v11 fix unused arg */ UiDestroy(); palette_save_gamme(); if ( ghMainWnd ) { Sleep(300); DestroyWindow(ghMainWnd); } } return 0; }