Exemplo n.º 1
0
ret_t
cherokee_init (void)
{
	ret_t ret;

	if (_cherokee_init)
		return ret_ok;

#ifdef _WIN32
	init_win32();
#endif

	/* Init the tracing facility
	 */
	cherokee_trace_init();

	/* Init the bogotime mechanism
	 */
	cherokee_bogotime_init();
	cherokee_bogotime_update();

	/* Init threading stuff
	 */
	cherokee_threading_init();

	/* Get the CPU number
	 */
	dcc_ncpus (&cherokee_cpu_number);
	if (cherokee_cpu_number < 1) {
		LOG_WARNING (CHEROKEE_ERROR_INIT_CPU_NUMBER, cherokee_cpu_number);
		cherokee_cpu_number = 1;
	}

	/* Try to figure the L2 cache line size
	 */
	cherokee_cacheline_size_get (&cherokee_cacheline_size);

	/* Get the file descriptor number limit
	 */
	ret = cherokee_sys_fdlimit_get (&cherokee_fdlimit);
	if (ret < ret_ok) {
		LOG_ERROR_S (CHEROKEE_ERROR_INIT_GET_FD_LIMIT);
		return ret;
	}

	/* Temp directory
	 */
	ret = init_tmp_dir();
	if (ret != ret_ok) {
		return ret;
	}

	cherokee_admin_child     = false;
	cherokee_readable_errors = NULLB_NULL;

	_cherokee_init = true;
	return ret_ok;
}
Exemplo n.º 2
0
int Win32Window::init()
{
    int rtval;

    rtval = init_win32();
    if(rtval != 0)
        return rtval;

    init_others();
    return 0;
}
Exemplo n.º 3
0
/*!
  Initialization routine. This is the only thing that doesn't
  get called via a function pointer. In fact *we* are the
  ones to set that up.
 */
CdIo_t *
cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
{

#ifdef HAVE_WIN32_CDROM
  CdIo_t *ret;
  _img_private_t *_data;
  char *psz_source;

  cdio_funcs_t _funcs;

  memset( &_funcs, 0, sizeof(_funcs) );

  _funcs.audio_get_volume       = audio_get_volume_win32;
  _funcs.audio_pause            = audio_pause_win32;
  _funcs.audio_play_msf         = audio_play_msf_win32;
#if 0
  _funcs.audio_play_track_index = audio_play_track_index_win32;
#endif
  _funcs.audio_read_subchannel  = audio_read_subchannel_win32;
  _funcs.audio_resume           = audio_resume_win32;
  _funcs.audio_set_volume       = audio_set_volume_win32;
  _funcs.audio_stop             = audio_stop_win32;
  _funcs.eject_media            = eject_media_win32;
  _funcs.free                   = free_win32;
  _funcs.get_arg                = get_arg_win32;
  _funcs.get_cdtext             = get_cdtext_generic;
  _funcs.get_cdtext_raw         = read_cdtext_generic;
  _funcs.get_default_device     = cdio_get_default_device_win32;
  _funcs.get_devices            = cdio_get_devices_win32;
  _funcs.get_disc_last_lsn      = get_disc_last_lsn_win32;
  _funcs.get_discmode           = get_discmode_win32;
  _funcs.get_drive_cap          = get_drive_cap_mmc;
  _funcs.get_first_track_num    = get_first_track_num_generic;
  _funcs.get_hwinfo             = NULL;
  _funcs.get_media_changed      = get_media_changed_mmc;
  _funcs.get_mcn                = _cdio_get_mcn;
  _funcs.get_num_tracks         = get_num_tracks_generic;
  _funcs.get_track_channels     = get_track_channels_generic,
  _funcs.get_track_copy_permit  = get_track_copy_permit_generic,
  _funcs.get_track_format       = _cdio_get_track_format;
  _funcs.get_track_green        = _cdio_get_track_green;
  _funcs.get_track_lba          = NULL; /* This could be done if need be. */
  _funcs.get_track_msf          = _cdio_get_track_msf;
  _funcs.get_track_preemphasis  = get_track_preemphasis_generic,
  _funcs.lseek                  = NULL;
  _funcs.read                   = NULL;
  _funcs.read_audio_sectors     = read_audio_sectors;
  _funcs.read_data_sectors      = read_data_sectors_win32;
  _funcs.read_mode1_sector      = read_mode1_sector_win32;
  _funcs.read_mode1_sectors     = read_mode1_sectors_win32;
  _funcs.read_mode2_sector      = read_mode2_sector_win32;
  _funcs.read_mode2_sectors     = read_mode2_sectors_win32;
  _funcs.read_toc               = read_toc_win32;
  _funcs.run_mmc_cmd            = run_mmc_cmd_win32;
  _funcs.set_arg                = set_arg_win32;
  _funcs.set_blocksize          = set_blocksize_mmc;
  _funcs.set_speed              = set_drive_speed_mmc;

  _data                 = calloc(1, sizeof (_img_private_t));
  _data->access_mode    = str_to_access_mode_win32(psz_access_mode);
  _data->gen.init       = false;
  _data->gen.fd         = -1;

  if (NULL == psz_orig_source) {
    psz_source=cdio_get_default_device_win32();
    if (NULL == psz_source) return NULL;
    set_arg_win32(_data, "source", psz_source);
    free(psz_source);
  } else {
    if (cdio_is_device_win32(psz_orig_source))
      set_arg_win32(_data, "source", psz_orig_source);
    else {
      /* The below would be okay as an info message if all device
	 drivers worked this way. */
      cdio_debug ("source %s is a not a device", psz_orig_source);
      free(_data);
      return NULL;
    }
  }

  ret = cdio_new ((void *)_data, &_funcs);
  if (ret == NULL) return NULL;

  if (init_win32(_data))
    return ret;
  else {
    free_win32 (_data);
    return NULL;
  }
  
#else 
  return NULL;
#endif /* HAVE_WIN32_CDROM */

}
Exemplo n.º 4
0
int main(int argc, char **argv) {
	unsigned int vflags = SDL_OPENGL | SDL_DOUBLEBUF; // | SDL_RESIZABLE
	unsigned int scr_width = 1200, scr_height = 800;

	if(SDL_Init(SDL_INIT_EVERYTHING)) return 1;
	SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

	/*Uint32 colorKey;
	SDL_Surface *image;
	image = SDL_LoadBMP("icon32.bmp");
	colorKey = SDL_MapRGB(image->format, 255, 0, 0);
	SDL_SetColorKey(image, SDL_SRCCOLORKEY, colorKey);*/
	//SDL_WM_SetIcon(DEFAULT_ICO, NULL);
	SDL_WM_SetCaption("HAVOC", "HAVOC");
	#ifdef WINDOWS__
	init_win32();
	#endif
	
	if(!SDL_SetVideoMode(scr_width, scr_height, 0, vflags)) return 2;
	

	glClearColor(0.0f, 0.0f, 0.3f, 1.0f);
	//glClearDepth(1.0f);
	glViewport(0, 0, scr_width, scr_height);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0.0f, (float)scr_width, (float)scr_height, 0.0f, 1.0f, -1.0f);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	//glEnable(GL_TEXTURE_2D);
	//glEnable(GL_DEPTH_TEST);
	//glDepthFunc(GL_LESS);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA);

	//ttf alianna("AltamonteNF.ttf", 64);
	animations all_animations("anim.ani");
	if(!all_animations.isOk()) return 7;
	
	
	unsigned int t_start = SDL_GetTicks(), t_diff = 0, t_span = 0;
	unsigned int t_prev = t_start, t_now = t_start, t_before = t_start;
	srand(t_start);
	game havoc(&all_animations, scr_width, scr_height);
	SDL_Event event;
	bool cont = true;
	std::stringstream ss;
	unsigned int score = 0;
	while(cont) {
		while(SDL_PollEvent(&event) && cont) cont = havoc.handle(&event);
		havoc.refresh(t_diff);
		havoc.draw();
		
		t_prev = t_now;
		t_now = SDL_GetTicks();
		t_diff = t_now - t_prev;
		t_span = t_now - t_before;
		if(t_span < YY_SPF) SDL_Delay(YY_SPF - t_span);
		t_before = SDL_GetTicks();
	}
	SDL_Quit();
	#ifdef WINDOWS__
	done_win32();
	#endif
	return 0;
}