Exemplo n.º 1
0
// If the file .attach_pid<pid> exists in the working directory
// or /tmp then this is the trigger to start the attach mechanism
bool AttachListener::is_init_trigger() {
  if (init_at_startup() || is_initialized()) {
    return false;               // initialized at startup or already initialized
  }
  char path[PATH_MAX + 1];
  int ret;
  struct stat st;

  snprintf(path, PATH_MAX + 1, "%s/.attach_pid%d",
           os::get_temp_directory(), os::current_process_id());
  RESTARTABLE(::stat(path, &st), ret);
  if (ret == 0) {
    // simple check to avoid starting the attach mechanism when
    // a bogus user creates the file
    if (st.st_uid == geteuid()) {
      init();
      return true;
    }
  }
  return false;
}
Exemplo n.º 2
0
int main(void)
{
/* TODO
 cprintf("\n\rHello and welcome to Lacewing version 1.10!");
 cprintf("\n\rCopyright 2003 by Linley Henzell & Captain Pork.\n\r");
 cprintf("\n\rLacewing is free software published under the");
 cprintf("\n\rGeneral Public Licence. It can be modified and");
 cprintf("\n\rredistributed under certain conditions and comes");
 cprintf("\n\rwith no warranties of any kind.");
 cprintf("\n\rPlease read the LICENCE.TXT file for more information.\n\r");
 cprintf("\n\rPress Q to Quit, or any other key to continue...\n\r");

 char rkey;
*/
 int randcount; // doesn't matter if it's not initialised - better, actually
/*
 do
 {
   randcount ++;
 }
  while(kbhit() == 0);
  
 rkey = getch();
 if (rkey == 'q' || rkey == 'Q')
  return 0;
 if (rkey == 0)
  getch();
*/
 srandom(randcount);

 init_at_startup();

 menu_loop();
 
 return 0;

}
Exemplo n.º 3
0
int main(void)
{

/*
The following code is for use if your system is set up to prevent an application writing to its own directory.
Normally this will prevent highscores and key configurations being saved, but the following code puts the
initfile in a better place. This may be a default on some systems (eg Unixes and possibly Windows Vista)
and can be set on some other systems.

The only problem with this is that you'll have to manually type or copy the various other options (windowed,
vsync, joystick buttons etc) into the initfile in this new location (or just copy the initfile across, or
just rely on the default values and let the game make a new initfile).

Thanks to Thomas Harte for this code! I had no idea it was necessary (it isn't on my Windows XP computer, and
I haven't tested it).

*/




int allint =  allegro_init();
   if (allint == -1)
   {
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
      allegro_message("Failed to initialise Allegro! This isn't going to work, sorry.");
      exit(1);
   }

//#define UNIX_OSX_VISTA_ETC

#ifdef UNIX_OSX_VISTA_ETC

   {

//     char *HPath = getenv("HOME");

// use this if for some reason you're running Windows Vista:
        char *HPath = getenv("APPDATA");

	 char ConfigPath[2048];

	 sprintf(ConfigPath, "%s/.Hspider", HPath);
	 set_config_file(ConfigPath);

   }
#else
   set_config_file("init.txt");
#endif

   install_keyboard();
   install_timer();

   three_finger_flag = 0;
   key_led_flag = 0;

 init_at_startup();

// now we've initialised, let's play the game!
// game_loop();
 startup_menu();

 return 0;

}