ibool Preferences::OnInitDialog(Param&)
		{
			for (uint i=0; i < 2; ++i)
			{
				MenuColorWindow& type = menuColorWindows[i];

				type.color = i ? settings.menuLookFullscreen.color : settings.menuLookDesktop.color;
				type.rect = dialog.Control(i ? IDC_PREFERENCES_MENUCOLOR_FULLSCREEN_CHANGE : IDC_PREFERENCES_MENUCOLOR_DESKTOP_CHANGE).GetWindow().Coordinates();
				type.rect.Position() -= Point(type.rect.Width()+8,0);
				type.rect.ClientTransform( dialog );
			}

			dialog.Control( IDC_PREFERENCES_MENUCOLOR_DESKTOP_CHANGE ).Enable( settings.menuLookDesktop.enabled );
			dialog.Control( IDC_PREFERENCES_MENUCOLOR_FULLSCREEN_CHANGE ).Enable( settings.menuLookFullscreen.enabled );

			dialog.CheckBox( IDC_PREFERENCES_MENUCOLOR_DESKTOP_DEFAULT ).Check( !settings.menuLookDesktop.enabled );
			dialog.CheckBox( IDC_PREFERENCES_MENUCOLOR_FULLSCREEN_DEFAULT ).Check( !settings.menuLookFullscreen.enabled );

			for (uint i=0; i < NUM_SETTINGS; ++i)
			{
				if (i != SAVE_SETTINGS)
					dialog.CheckBox( IDC_PREFERENCES_STARTUP_FULLSCREEN + i ).Check( settings[i] );
			}

			{
				Association association;

				for (uint i=0; i < Association::NUM_EXTENSIONS; ++i)
					dialog.CheckBox( IDC_PREFERENCES_ASSOCIATE_NES + i ).Check( association.Enabled(i) );
			}

			dialog.RadioButton( IDC_PREFERENCES_FAVORED_NES_NTSC ).Check( settings.favoredSystem == Nes::Machine::FAVORED_NES_NTSC );
			dialog.RadioButton( IDC_PREFERENCES_FAVORED_NES_PAL  ).Check( settings.favoredSystem == Nes::Machine::FAVORED_NES_PAL  );
			dialog.RadioButton( IDC_PREFERENCES_FAVORED_FAMICOM  ).Check( settings.favoredSystem == Nes::Machine::FAVORED_FAMICOM  );
			dialog.RadioButton( IDC_PREFERENCES_FAVORED_DENDY    ).Check( settings.favoredSystem == Nes::Machine::FAVORED_DENDY    );

			dialog.CheckBox( IDC_PREFERENCES_FAVORED_ALWAYS_ASK ).Check( settings.alwaysAskSystem );

			{
				Control::ComboBox priorities( dialog.ComboBox( IDC_PREFERENCES_PRIORITY ) );

				for (uint i=IDS_PRIORITY_NORMAL; i <= IDS_PRIORITY_HIGH; ++i)
					priorities.Add( Resource::String(i) );

				priorities[settings.priority].Select();
			}

			dialog.RadioButton( IDC_PREFERENCES_STYLE_NES ).Check( Application::Instance::GetIconStyle() == Application::Instance::ICONSTYLE_NES );
			dialog.RadioButton( IDC_PREFERENCES_STYLE_FAMICOM ).Check( Application::Instance::GetIconStyle() == Application::Instance::ICONSTYLE_FAMICOM );

			UpdateIconStyle();
			UpdateColors();

			return true;
		}
Exemplo n.º 2
0
static vk::Device create_device(
		vk::PhysicalDevice physical,
		const core::ArrayView<QueueFamily>& queue_families,
		const DebugParams& debug) {

	auto queue_create_infos = core::vector_with_capacity<vk::DeviceQueueCreateInfo>(queue_families.size());

	auto prio_count = std::max_element(queue_families.begin(), queue_families.end(),
			[](const auto& a, const auto& b) { return a.count() < b.count(); })->count();
	core::Vector<float> priorities(prio_count, 1.0f);
	std::transform(queue_families.begin(), queue_families.end(), std::back_inserter(queue_create_infos), [&](const auto& q) {
		return vk::DeviceQueueCreateInfo()
				.setQueueFamilyIndex(q.index())
				.setPQueuePriorities(priorities.begin())
				.setQueueCount(q.count())
			;
		});

	auto required = vk::PhysicalDeviceFeatures();
	required.multiDrawIndirect = true;
	required.drawIndirectFirstInstance = true;
	required.fullDrawIndexUint32 = true;
	required.textureCompressionBC = true;
	required.shaderStorageImageExtendedFormats = true;
	required.shaderUniformBufferArrayDynamicIndexing = true;
	required.shaderSampledImageArrayDynamicIndexing = true;
	required.shaderStorageBufferArrayDynamicIndexing = true;
	required.shaderStorageImageArrayDynamicIndexing = true;

	if(debug.debug_features_enabled()) {
		required.robustBufferAccess = true;
	}

	check_features(physical.getFeatures(), required);

	auto exts = extensions(debug);

	return physical.createDevice(vk::DeviceCreateInfo()
			.setEnabledExtensionCount(u32(exts.size()))
			.setPpEnabledExtensionNames(exts.begin())
			.setEnabledLayerCount(u32(debug.device_layers().size()))
			.setPpEnabledLayerNames(debug.device_layers().begin())
			.setQueueCreateInfoCount(queue_create_infos.size())
			.setPQueueCreateInfos(queue_create_infos.begin())
			.setPEnabledFeatures(&required)
		);
}
Exemplo n.º 3
0
/**
 * @brief Print a log message
 *
 * @param log_module : the name of the part of MuMuDVB which send the message
 * @param type : message type MSG_*
 * @param psz_format : the message in the printf format
*/
void log_message( char* log_module, int type,
                    const char *psz_format, ... )
{
  va_list args;
  int priority=0;
  char *tempchar;
  int message_size;
  mumu_string_t log_string;
  log_string.string=NULL;
  log_string.length=0;

  /*****************************************/
  //if the log header is not initialised
  // we do it
  /*****************************************/

  if(log_params.log_header==NULL)
  {
    log_params.log_header=malloc((strlen(DEFAULT_LOG_HEADER)+1)*sizeof(char));
    if(log_params.log_header==NULL)
    {
      if (log_params.log_type == LOGGING_FILE)
        fprintf( log_params.log_file,"Problem with malloc : %s file : %s line %d\n",strerror(errno),__FILE__,__LINE__);
      else if (log_params.log_type == LOGGING_SYSLOG)
        syslog (MSG_ERROR,"Problem with malloc : %s file : %s line %d\n",strerror(errno),__FILE__,__LINE__);
      else
        fprintf( stderr,"Problem with malloc : %s file : %s line %d\n",strerror(errno),__FILE__,__LINE__);
      va_end( args );
      Interrupted=ERROR_MEMORY<<8;
      return;
    }
    sprintf(log_params.log_header,"%s",DEFAULT_LOG_HEADER);

  }
  /*****************************************/
  //We apply the templates to the header
  /*****************************************/
  mumu_string_append(&log_string, "%s",log_params.log_header);
  log_string.string=mumu_string_replace(log_string.string,&log_string.length,1,"%priority",priorities(type));
  if(log_module!=NULL)
    log_string.string=mumu_string_replace(log_string.string,&log_string.length,1,"%module",log_module);
  else
    log_string.string=mumu_string_replace(log_string.string,&log_string.length,1,"%module","");

  char timestring[40];
  time_t actual_time;
  actual_time=time(NULL);
  sprintf(timestring,"%jd", (intmax_t)actual_time);
  log_string.string=mumu_string_replace(log_string.string,&log_string.length,1,"%timeepoch",timestring);
  asctime_r(localtime(&actual_time),timestring);
  timestring[strlen(timestring)-1]='\0'; //In order to remove the final '\n' but by asctime
  log_string.string=mumu_string_replace(log_string.string,&log_string.length,1,"%date",timestring);

  char pidstring[10];
  sprintf (pidstring, "%d", getpid ());
  log_string.string=mumu_string_replace(log_string.string,&log_string.length,1,"%pid",pidstring);


  /*****************************************/
  //We append the log message
  /*****************************************/
  //The length returned by mumu_string_replace is the allocated length not the string length
  //If we want mumu_string_append to work we need to update the length to the string length
  log_string.length=strlen(log_string.string);
  va_start( args, psz_format );
  message_size=vsnprintf(NULL, 0, psz_format, args);
  va_end( args );
  tempchar=malloc((message_size+1)*sizeof(char));
  if(tempchar==NULL)
  {
    if (log_params.log_type == LOGGING_FILE)
      fprintf( log_params.log_file,"Problem with malloc : %s file : %s line %d\n",strerror(errno),__FILE__,__LINE__);
    else if (log_params.log_type == LOGGING_SYSLOG)
      syslog (MSG_ERROR,"Problem with malloc : %s file : %s line %d\n",strerror(errno),__FILE__,__LINE__);
    else
      fprintf( stderr,"Problem with malloc : %s file : %s line %d\n",strerror(errno),__FILE__,__LINE__);
    va_end( args );
    Interrupted=ERROR_MEMORY<<8;
    return;
  }

  va_start( args, psz_format );
  vsprintf(tempchar, psz_format, args );
  va_end( args );
  //If there is no \n at the end of the message we add it
  char terminator='\0';
  if(tempchar[strlen(tempchar)-1] != '\n')
    terminator='\n';
  mumu_string_append(&log_string,"%s%c",tempchar,terminator);
  free(tempchar);

  /*****************************************/
  //We "display" the log message
  /*****************************************/
  if(type<log_params.verbosity)
    {
      if ( log_params.log_type & LOGGING_FILE)
	fprintf(log_params.log_file,"%s",log_string.string);
      if((log_params.log_type & LOGGING_SYSLOG) && (log_params.syslog_initialised))
	{
	  //what is the priority ?
	  switch(type)
	    {
	    case MSG_ERROR:
	      priority|=LOG_ERR;
	      break;
	    case MSG_WARN:
	      priority|=LOG_WARNING;
	      break;
	    case MSG_INFO:
	      priority|=LOG_INFO;
	      break;
	    case MSG_DETAIL:
	      priority|=LOG_NOTICE;
	    break;
	    case MSG_DEBUG:
	    case MSG_FLOOD:
	      priority|=LOG_DEBUG;
	      break;
            default:
              priority=LOG_USER;
	    }
	  syslog (priority,"%s",log_string.string);
	}
	if((log_params.log_type == LOGGING_UNDEFINED) ||
          (log_params.log_type & LOGGING_CONSOLE) ||
          ((log_params.log_type & LOGGING_SYSLOG) && (log_params.syslog_initialised==0)))
          fprintf(stderr,"%s",log_string.string);
    }
  mumu_free_string(&log_string);

}