Пример #1
0
int main()
{
  usb_init();
  SetLogFilename("snooper.log");

  g_return_on_error = 1;

  while(1) {
    while (!OpenProxmark(0)) { sleep(1); }
    while (1) {
      UsbCommand cmdbuf;
      CommandReceived("hf 14a snoop");
      HANDLE_ERROR;
      ReceiveCommand(&cmdbuf);
      HANDLE_ERROR;
      for (int i = 0; i < 5; ++i) {
        ReceiveCommandPoll(&cmdbuf);
      }
      HANDLE_ERROR;
      CommandReceived("hf 14a list");
      HANDLE_ERROR;
    }
  }

  CloseProxmark();
  return 0;
}
Пример #2
0
Logger::Logger()
{
	logLevel = LEVEL_FRAMEWORK;
	SetLogFilename(String());
    
    consoleModeEnabled = false;
}
Пример #3
0
bool CModelViewerApp::OnInit()
{
	SetAppDisplayName( HLMV_TITLE );
	SetLogFilename( HLMV_TITLE );

	return CBaseWXToolApp::OnInit();
}
Пример #4
0
int main(int argc, char **argv)
{
    if (argc != 3 && argc != 4)
    {
        printf("\n\tusage: cli <command 1> <command 2> [logfile (default cli.log)]\n");
        printf("\n");
        printf("\texample: cli hi14asnoop hi14alist h14a.log\n");
        printf("\n");
        return -1;
    }

    usb_init();
    if (argc == 4)
        SetLogFilename(argv[3]);
    else
        SetLogFilename("cli.log");

    return_on_error = 1;

    while (1) {
        while (!OpenProxmark(0)) {
            sleep(1);
        }
        while (1) {
            UsbCommand cmdbuf;
            CommandReceived(argv[1]);
            HANDLE_ERROR;
            ReceiveCommand(&cmdbuf);
            HANDLE_ERROR;
            for (int i = 0; i < 5; ++i) {
                ReceiveCommandPoll(&cmdbuf);
            }
            HANDLE_ERROR;
            CommandReceived(argv[2]);
            HANDLE_ERROR;
        }
    }

    CloseProxmark();
    return 0;
}
Пример #5
0
bool DarunGrim::CreateDGF( 
	char *storage_filename, 
	char *log_filename, 
	char *ida_log_filename_for_source,
	char *ida_log_filename_for_target,
	unsigned long start_address_for_source, unsigned long end_address_for_source, 
	unsigned long start_address_for_target, unsigned long end_address_for_target )
{
	Logger.Log(10, "%s: entry\n", __FUNCTION__ );

	SetOutputFilename(storage_filename);
	SetLogFilename( log_filename );
	SetIDALogFilename( ida_log_filename_for_source );
	RunIDAToCreateDGF( SourceFilename.c_str(), start_address_for_source, end_address_for_source );
	SetIDALogFilename( ida_log_filename_for_target );
	RunIDAToCreateDGF( TargetFilename.c_str(), start_address_for_target, end_address_for_target );
	return OpenDatabase(storage_filename);
}
Пример #6
0
int main(int argc, char *argv[])
{
bool inhibit_loadfade = false;
bool error = false;
bool freshstart;
	
	SetLogFilename("debug.txt");
	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0)
	{
		staterr("ack, sdl_init failed: %s.", SDL_GetError());
		return 1;
	}
	atexit(SDL_Quit);
	
	// start up inputs first thing because settings_load may remap them
	input_init();
	
	// load settings, or at least get the defaults,
	// so we know the initial screen resolution.
	settings_load();
	
	if (Graphics::init(settings->resolution)) { staterr("Failed to initialize graphics."); return 1; }
	if (font_init()) { staterr("Failed to load font."); return 1; }
	
	//speed_test();
	//return 1;
	
	#ifdef CONFIG_DATA_EXTRACTOR
	if (!settings->files_extracted)
	{
		if (extract_main())
		{
			Graphics::close();
			font_close();
			return 0;
		}
		else
		{
			settings->files_extracted = true;
			settings_save();
		}
	}
	#endif
	
	if (check_data_exists())
	{
		return 1;
	}
	
	Graphics::ShowLoadingScreen();
	if (sound_init()) { fatal("Failed to initialize sound."); return 1; }
	if (trig_init()) { fatal("Failed trig module init."); return 1; }
	
	if (tsc_init()) { fatal("Failed to initialize script engine."); return 1; }
	if (textbox.Init()) { fatal("Failed to initialize textboxes."); return 1; }
	if (Carets::init()) { fatal("Failed to initialize carets."); return 1; }
	
	if (game.init()) return 1;
	game.setmode(GM_NORMAL);
	// set null stage just to have something to do while we go to intro
	game.switchstage.mapno = 0;
	
	//#define REPLAY
	#ifdef REPLAY
		game.switchstage.mapno = START_REPLAY;
		//Replay::set_ffwd(6000);
		//Replay::set_stopat(3500);
		game.switchstage.param = 1;
	#else
		//game.switchstage.mapno = LOAD_GAME;
		//game.pause(GP_OPTIONS);
		
		if (settings->skip_intro && file_exists(GetProfileName(settings->last_save_slot)))
			game.switchstage.mapno = LOAD_GAME;
		else
			game.setmode(GM_INTRO);
	#endif
	
	// for debug
	if (game.paused) { game.switchstage.mapno = 0; game.switchstage.eventonentry = 0; }
	if (game.switchstage.mapno == LOAD_GAME) inhibit_loadfade = true;
	
	game.running = true;
	freshstart = true;
	
	stat("Entering main loop...");
	#ifdef __SDLSHIM__
		set_console_visible(false);
	#endif
	
	//speed_test();
	//return 1;
	
	while(game.running)
	{
		// SSS/SPS persists across stage transitions until explicitly
		// stopped, or you die & reload. It seems a bit risky to me,
		// but that's the spec.
		if (game.switchstage.mapno >= MAPNO_SPECIALS)
		{
			StopLoopSounds();
		}
		
		// enter next stage, whatever it may be
		if (game.switchstage.mapno == LOAD_GAME || \
			game.switchstage.mapno == LOAD_GAME_FROM_MENU)
		{
			if (game.switchstage.mapno == LOAD_GAME_FROM_MENU)
				freshstart = true;
			
			stat("= Loading game =");
			if (game_load(settings->last_save_slot))
			{
				fatal("savefile error");
				goto ingame_error;
			}
			
			Replay::OnGameStarting();
			
			if (!inhibit_loadfade) fade.Start(FADE_IN, FADE_CENTER);
			else inhibit_loadfade = false;
		}
		else if (game.switchstage.mapno == START_REPLAY)
		{
			stat(">> beginning replay '%s'", GetReplayName(game.switchstage.param));
			
			StopScripts();
			if (Replay::begin_playback(GetReplayName(game.switchstage.param)))
			{
				fatal("error starting playback");
				goto ingame_error;
			}
		}
		else
		{
			if (game.switchstage.mapno == NEW_GAME || \
				game.switchstage.mapno == NEW_GAME_FROM_MENU)
			{
				bool show_intro = (game.switchstage.mapno == NEW_GAME_FROM_MENU);
				InitNewGame(show_intro);
			}
			
			// slide weapon bar on first intro to Start Point
			if (game.switchstage.mapno == STAGE_START_POINT && \
				game.switchstage.eventonentry == 91)
			{
				freshstart = true;
			}
			
			// switch maps
			if (load_stage(game.switchstage.mapno)) goto ingame_error;
			
			player->x = (game.switchstage.playerx * TILE_W) << CSF;
			player->y = (game.switchstage.playery * TILE_H) << CSF;
		}
		
		// start the level
		if (game.initlevel()) return 1;
		
		if (freshstart)
			weapon_introslide();
		
		gameloop();
		game.stageboss.OnMapExit();
		freshstart = false;
	}
	
shutdown: ;
	Replay::close();
	game.close();
	Carets::close();
	
	Graphics::close();
	input_close();
	font_close();
	sound_close();
	tsc_close();
	textbox.Deinit();
	return error;
	
ingame_error: ;
	stat("");
	stat(" ************************************************");
	stat(" * An in-game error occurred. Game shutting down.");
	stat(" ************************************************");
	error = true;
	goto shutdown;
}
Пример #7
0
Logger::Logger()
{
	logLevel = LEVEL_DEBUG;
	SetLogFilename("");
}
Пример #8
0
void pre_main(void)
{
#ifdef DEBUG_LOG
char debug_fname[1024];
retro_create_path_string(debug_fname, sizeof(debug_fname), g_dir, "debug.txt");
SetLogFilename(debug_fname);
#endif
	// start up inputs first thing because settings_load may remap them
	input_init();
	
	// load settings, or at least get the defaults,
	// so we know the initial screen resolution.
	settings_load();

   char filename[1024];
	FILE *fp;

	NX_LOG("= Extracting Files =\n");

	retro_create_path_string(filename, sizeof(filename), g_dir, "Doukutsu.exe");
	fp = fopen(filename, "rb");

   extract_files(fp);

	if (sound_init()) { fatal("Failed to initialize sound."); error = 1; return; }
   
	extract_stages(fp);

	fclose(fp);
	
   settings->files_extracted = true;
   settings_save();
	
	if (Graphics::init(settings->resolution)) { NX_ERR("Failed to initialize graphics.\n"); error = 1; return; }
	if (font_init()) { NX_ERR("Failed to load font.\n"); error = 1; return; }
	
	//return;
	
	if (check_data_exists())
	{
		error = 1;
		return;
	}
	
	//Graphics::ShowLoadingScreen();
	if (trig_init()) { fatal("Failed trig module init."); error = 1; return; }
	
	if (tsc_init()) { fatal("Failed to initialize script engine."); error = 1; return; }
	if (textbox.Init()) { fatal("Failed to initialize textboxes."); error = 1; return; }
	if (Carets::init()) { fatal("Failed to initialize carets."); error = 1; return; }
	
	if (game.init())
	{
		error = 1;
		return;
	}
	game.setmode(GM_NORMAL);
	// set null stage just to have something to do while we go to intro
	game.switchstage.mapno = 0;
	
	//#define REPLAY
	#ifdef REPLAY
		game.switchstage.mapno = START_REPLAY;
		//Replay::set_ffwd(6000);
		//Replay::set_stopat(3500);
		game.switchstage.param = 1;
	#else
		//game.switchstage.mapno = LOAD_GAME;
		//game.pause(GP_OPTIONS);
		
		if (settings->skip_intro && file_exists(GetProfileName(settings->last_save_slot)))
			game.switchstage.mapno = LOAD_GAME;
		else
			game.setmode(GM_INTRO);
	#endif
	
	// for debug
	if (game.paused) { game.switchstage.mapno = 0; game.switchstage.eventonentry = 0; }
	if (game.switchstage.mapno == LOAD_GAME) inhibit_loadfade = true;
	
	game.running = true;
	freshstart = true;
	
	NX_LOG("Entering main loop...\n");
	
	//return;
}