예제 #1
0
파일: ZipRegistry.cpp 프로젝트: Dabil/puNES
void CInfo::Load()
{
  ArcPaths.Clear();
  Formats.Clear();

  Level = 5;
  ArcType = L"7z";
  ShowPassword = false;
  EncryptHeaders = false;

  CS_LOCK
  CKey key;

  if (OpenMainKey(key, kKeyName) != ERROR_SUCCESS)
    return;

  key.GetValue_Strings(kArcHistory, ArcPaths);
  
  {
    CKey optionsKey;
    if (optionsKey.Open(key, kOptionsKeyName, KEY_READ) == ERROR_SUCCESS)
    {
      CSysStringVector formatIDs;
      optionsKey.EnumKeys(formatIDs);
      for (int i = 0; i < formatIDs.Size(); i++)
      {
        CKey fk;
        CFormatOptions fo;
        fo.FormatID = formatIDs[i];
        if (fk.Open(optionsKey, fo.FormatID, KEY_READ) == ERROR_SUCCESS)
        {
          GetRegString(fk, kOptions, fo.Options);
          GetRegString(fk, kMethod, fo.Method);
          GetRegString(fk, kEncryptionMethod, fo.EncryptionMethod);

          GetRegUInt32(fk, kLevel, fo.Level);
          GetRegUInt32(fk, kDictionary, fo.Dictionary);
          GetRegUInt32(fk, kOrder, fo.Order);
          GetRegUInt32(fk, kBlockSize, fo.BlockLogSize);
          GetRegUInt32(fk, kNumThreads, fo.NumThreads);

          Formats.Add(fo);
        }
      }
    }
  }

  UString a;
  if (key.QueryValue(kArchiver, a) == ERROR_SUCCESS)
    ArcType = a;
  key.GetValue_IfOk(kLevel, Level);
  key.GetValue_IfOk(kShowPassword, ShowPassword);
  key.GetValue_IfOk(kEncryptHeaders, EncryptHeaders);
}
//获取szSubKey键下的DisplayName,并将值存储到lpSI中
BOOL GetSoftDisplayName(HKEY hkey , LPCTSTR szSubKey , LPSOFTWARE_INFO lpSI )
{
	TCHAR	szDisplayName[MAX_PATH] = {0}; //存储子项中DisplayName的键值

	DWORD	dwSystemComponent = -1;   //存储子项中SystemComponent的键值
	DWORD	dwWindowsInstaller = -1;  //存储子项中WindowsInstaller的键值
	TCHAR	szUninstallString[MAX_PATH] = {0};  //存储子项中UninstallString的键值
	TCHAR   szParentKeyName[MAX_PATH] = {0};    //存储子项中ParentKeyName的键值

	//获取szSubKey子项中SystemComponent的键值,为1返回FALSE
	if(GetRegDWORD(hkey, szSubKey, _T("SystemComponent"), dwSystemComponent) && 1 == dwSystemComponent)
		return FALSE;

	//获取szSubKey子项中WindowsInstaller的键值,为1可以通过MSI SDK来获取MSI安装信息
	if(GetRegDWORD(hkey, szSubKey, _T("WindowsInstaller"), dwWindowsInstaller) && 1 == dwWindowsInstaller)
	{
		if( !GetSoftwareFromMSI(szSubKey, szDisplayName) )
			return FALSE;
	}
	//获取DisplayName键值,成功的话值存到szDisplayName数组中
	else if(GetRegString(hkey, szSubKey, _T("DisplayName"), szDisplayName) 
		&& lstrlen(szDisplayName) > 0
		&& GetRegString(hkey, szSubKey, _T("UninstallString"), szUninstallString)
		&& !GetRegString(hkey, szSubKey, _T("ParentKeyName"), szParentKeyName)
		)
	{
		;
	}
	else
		return FALSE;

	//复制szDisplayName数组中的值到lpSI->szDisplayName中
	lstrcpy(lpSI->szDisplayName, szDisplayName);

	return TRUE;
}
void CApp::DoSomeNagging()
{
	CString Magic = GetRegString(HKEY_CURRENT_USER, DCGF_TOOLS_REG_PATH, "BBID");
	CNumEncoder Enc;
	Enc.DecodeFromString(Magic);

	CTime Time = CTime::GetCurrentTime();
	
	int Year     = Enc.GetNumber(0, Time.GetYear());
	int Month    = Enc.GetNumber(1, Time.GetMonth());
	int Day      = Enc.GetNumber(2, Time.GetDay());
	int DaysUsed = Enc.GetNumber(3, 1);
	int Answer   = Enc.GetNumber(4, 0); // 0..remind later, 1..done already, 2..don't wanna

	// we started a new day
	if(Year != Time.GetYear() || Month != Time.GetMonth() || Day != Time.GetDay())
	{
		DaysUsed++;

		// nag every 10th day
		if(DaysUsed % 10 == 0 && Answer == 0)
		{
			// display dialog
			CReminderDlg Dlg;
			Dlg.DoModal();
			Answer = Dlg.m_SelectedOption;
		}
	}

	Enc.SetNumber(0, Time.GetYear());
	Enc.SetNumber(1, Time.GetMonth());
	Enc.SetNumber(2, Time.GetDay());
	Enc.SetNumber(3, DaysUsed);
	Enc.SetNumber(4, Answer);

	Magic = Enc.EncodeToString();
	SetRegString(HKEY_CURRENT_USER, DCGF_TOOLS_REG_PATH, "BBID", Magic);
}
예제 #4
0
void Flasher::SetDefaults(bool fromMouseClick)
{
   HRESULT hr;
   float fTmp;
   int iTmp;

   hr = GetRegStringAsFloat("DefaultProps\\Flasher", "Height", &fTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_height = fTmp;
   else
      m_d.m_height = 50.0f;

   hr = GetRegStringAsFloat("DefaultProps\\Flasher", "RotX", &fTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_rotX = fTmp;
   else
      m_d.m_rotX = 0.0f;

   hr = GetRegStringAsFloat("DefaultProps\\Flasher", "RotY", &fTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_rotY = fTmp;
   else
      m_d.m_rotY = 0.0f;

   hr = GetRegStringAsFloat("DefaultProps\\Flasher", "RotZ", &fTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_rotZ = fTmp;
   else
      m_d.m_rotZ = 0.0f;

   hr = GetRegInt("DefaultProps\\Flasher", "Color", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_color = iTmp;
   else
      m_d.m_color = RGB(50, 200, 50);

   hr = GetRegInt("DefaultProps\\Flasher", "TimerEnabled", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_tdr.m_fTimerEnabled = iTmp == 0 ? false : true;
   else
      m_d.m_tdr.m_fTimerEnabled = false;

   hr = GetRegInt("DefaultProps\\Flasher", "TimerInterval", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_tdr.m_TimerInterval = iTmp;
   else
      m_d.m_tdr.m_TimerInterval = 100;

   hr = GetRegString("DefaultProps\\Flasher", "ImageA", m_d.m_szImageA, MAXTOKEN);
   if ((hr != S_OK) || !fromMouseClick)
      m_d.m_szImageA[0] = 0;

   hr = GetRegString("DefaultProps\\Flasher", "ImageB", m_d.m_szImageB, MAXTOKEN);
   if ((hr != S_OK) || !fromMouseClick)
      m_d.m_szImageB[0] = 0;

   hr = GetRegInt("DefaultProps\\Flasher", "Opacity", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fAlpha = iTmp;
   else
      m_d.m_fAlpha = 100;

   m_d.m_intensity_scale = 1.0f;

   hr = GetRegStringAsFloat("DefaultProps\\Flasher", "ModulateVsAdd", &fTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_modulate_vs_add = fTmp;
   else
      m_d.m_modulate_vs_add = 0.9f;

   hr = GetRegInt("DefaultProps\\Flasher", "FilterAmount", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fFilterAmount = iTmp;
   else
      m_d.m_fFilterAmount = 100;

   hr = GetRegInt("DefaultProps\\Flasher", "Visible", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_IsVisible = iTmp == 0 ? false : true;
   else
      m_d.m_IsVisible = true;

   hr = GetRegInt("DefaultProps\\Flasher", "AddBlend", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fAddBlend = iTmp == 0 ? false : true;
   else
      m_d.m_fAddBlend = false;

   hr = GetRegInt("DefaultProps\\Flasher", "DMD", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
	   m_d.m_IsDMD = iTmp == 0 ? false : true;
   else
	   m_d.m_IsDMD = false;

   hr = GetRegInt("DefaultProps\\Flasher", "DisplayTexture", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fDisplayTexture = (iTmp == 0) ? false : true;
   else
      m_d.m_fDisplayTexture = false;

   m_d.m_imagealignment = fromMouseClick ? (RampImageAlignment)GetRegIntWithDefault("DefaultProps\\Flasher", "ImageMode", ImageModeWrap) : ImageModeWrap;
   m_d.m_filter = fromMouseClick ? (Filters)GetRegIntWithDefault("DefaultProps\\Flasher", "Filter", Filter_Overlay) : Filter_Overlay;
}
예제 #5
0
파일: FileIO.cpp 프로젝트: jjf28/Chkdraft
bool GetRegScPath(char* dest, u32 destSize)
{
    return false; // TODO remove me
    return GetRegString(dest, destSize, "SOFTWARE\\Blizzard Entertainment\\Starcraft", "InstallPath");
}
HRESULT CMainFrame::GetWMEVersionHttp(CString& WMEVersion)
{
	HRESULT RetCode = S_OK;
	WMEVersion = "0.0.0";

	CString Magic = GetRegString(HKEY_CURRENT_USER, DCGF_TOOLS_REG_PATH, "BBID");

	CInternetSession Session;
	CHttpConnection* Server = NULL;
	CHttpFile* File = NULL;

	DWORD HttpRequestFlags = INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT;
	const TCHAR Headers[] = _T("Accept: text/*\r\nUser-Agent: WME ProjectMan\r\n");


	CString Url = LOC("/str1086/http://www.dead-code.org/vercheck.php");
	
	CString CurrVer;
	CurrVer.Format("%d.%d.%03d", DCGF_VER_MAJOR, DCGF_VER_MINOR, DCGF_VER_BUILD);
	
	Url += "?product=wme&ver=" + CurrVer;
	Url += "&bbid=" + Magic;
	if(DCGF_VER_BETA) Url += "&beta=1";

	bool DotNet = RegKeyExists(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\.NETFramework\\policy\\v2.0");
	Url += "&dotnet=" + CString(DotNet?"1":"0");
		
	CString ServerName;
	CString Object;
	INTERNET_PORT Port;
	DWORD ServiceType;

	try{
		if(!AfxParseURL(Url, ServiceType, ServerName, Object, Port) || ServiceType != INTERNET_SERVICE_HTTP){
			return E_FAIL;
		}


		Server = Session.GetHttpConnection(ServerName, Port);

		File = Server->OpenRequest(CHttpConnection::HTTP_VERB_GET, Object, NULL, 1, NULL, NULL, HttpRequestFlags);
		File->AddRequestHeaders(Headers);
		if(File->SendRequest()){
			TCHAR sz[1024];
			if(File->ReadString(sz, 1023)){
				WMEVersion = Entry(1, CString(sz), '\n');
			}			
		}

		File->Close();
		Server->Close();
	}
	catch (CInternetException* pEx)
	{
		// catch errors from WinINet
		//TCHAR szErr[1024];
		//pEx->GetErrorMessage(szErr, 1024);
		//MessageBox(szErr, LOC("/str1002/Error"), MB_OK|MB_ICONERROR);

		RetCode = E_FAIL;
		pEx->Delete();
	}

	if (File != NULL) delete File;
	if (Server != NULL) delete Server;
	Session.Close();

	return RetCode;
}
예제 #7
0
// set the defaults for the objects persistent data (m_d.*) in case this
// is a new instance of this object or there is a backwards compatability
// issue (old version of object doesn't contain all the needed fields)
//
void DispReel::SetDefaults(bool fromMouseClick)
{
   // object is only available on the backglass
   m_fBackglass = true;

   // set all the Data defaults
   HRESULT hr;
   float fTmp;
   int iTmp;

   hr = GetRegString("DefaultProps\\Ramp", "Image", m_d.m_szImage, MAXTOKEN);
   if ((hr != S_OK) || !fromMouseClick)
      m_d.m_szImage[0] = 0;

   hr = GetRegString("DefaultProps\\Ramp", "Sound", m_d.m_szSound, MAXTOKEN);
   if ((hr != S_OK) || !fromMouseClick)
      m_d.m_szSound[0] = 0;

   hr = GetRegInt("DefaultProps\\EMReel", "UseImageGrid", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fUseImageGrid = iTmp == 0 ? false : true;
   else
      m_d.m_fUseImageGrid = false;

   hr = GetRegInt("DefaultProps\\EMReel", "Visible", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fVisible = iTmp == 0 ? false : true;
   else
      m_d.m_fVisible = true;

   hr = GetRegInt("DefaultProps\\EMReel", "ImagesPerRow", &iTmp);
   m_d.m_imagesPerGridRow = (hr == S_OK) && fromMouseClick ? iTmp : 1;

   hr = GetRegInt("DefaultProps\\EMReel", "Transparent", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fTransparent = iTmp == 0 ? false : true;
   else
      m_d.m_fTransparent = false;

   hr = GetRegInt("DefaultProps\\EMReel", "ReelCount", &iTmp);
   m_d.m_reelcount = (hr == S_OK) && fromMouseClick ? iTmp : 5;

   hr = GetRegStringAsFloat("DefaultProps\\EMReel", "Width", &fTmp);
   m_d.m_width = (hr == S_OK) && fromMouseClick ? fTmp : 30.0f;

   hr = GetRegStringAsFloat("DefaultProps\\EMReel", "Height", &fTmp);
   m_d.m_height = (hr == S_OK) && fromMouseClick ? fTmp : 40.0f;

   hr = GetRegStringAsFloat("DefaultProps\\EMReel", "ReelSpacing", &fTmp);
   m_d.m_reelspacing = (hr == S_OK) && fromMouseClick ? fTmp : 4.0f;

   hr = GetRegStringAsFloat("DefaultProps\\EMReel", "MotorSteps", &fTmp);
   m_d.m_motorsteps = (hr == S_OK) && fromMouseClick ? fTmp : 2.0f;

   hr = GetRegInt("DefaultProps\\EMReel", "DigitRange", &iTmp);
   m_d.m_digitrange = (hr == S_OK) && fromMouseClick ? iTmp : 9;

   hr = GetRegInt("DefaultProps\\EMReel", "UpdateInterval", &iTmp);
   m_d.m_updateinterval = (hr == S_OK) && fromMouseClick ? iTmp : 50;

   hr = GetRegInt("DefaultProps\\EMReel", "BackColor", &iTmp);
   m_d.m_backcolor = (hr == S_OK) && fromMouseClick ? iTmp : RGB(64, 64, 64);

   hr = GetRegInt("DefaultProps\\EMReel", "TimerEnabled", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_tdr.m_fTimerEnabled = iTmp == 0 ? false : true;
   else
      m_d.m_tdr.m_fTimerEnabled = 0;

   hr = GetRegInt("DefaultProps\\EMReel", "TimerInterval", &iTmp);
   m_d.m_tdr.m_TimerInterval = (hr == S_OK) && fromMouseClick ? iTmp : 100;
}
예제 #8
0
DWORD
GetOpenvpnSettings (settings_t *s)
{
  TCHAR priority[64];
  TCHAR append[2];
  DWORD error;
  HKEY key;

  LONG status = RegOpenKeyEx (HKEY_LOCAL_MACHINE, REG_KEY, 0, KEY_READ, &key);
  if (status != ERROR_SUCCESS)
    {
      SetLastError (status);
      return MsgToEventLog (M_SYSERR, TEXT("Could not open Registry key HKLM\\%s not found"), REG_KEY);
    }

  error = GetRegString (key, TEXT("exe_path"), s->exe_path, sizeof (s->exe_path));
  if (error != ERROR_SUCCESS)
    goto out;

  error = GetRegString (key, TEXT("config_dir"), s->config_dir, sizeof (s->config_dir));
  if (error != ERROR_SUCCESS)
    goto out;

  error = GetRegString (key, TEXT("config_ext"), s->ext_string, sizeof (s->ext_string));
  if (error != ERROR_SUCCESS)
    goto out;

  error = GetRegString (key, TEXT("log_dir"), s->log_dir, sizeof (s->log_dir));
  if (error != ERROR_SUCCESS)
    goto out;

  error = GetRegString (key, TEXT("priority"), priority, sizeof (priority));
  if (error != ERROR_SUCCESS)
    goto out;

  error = GetRegString (key, TEXT("log_append"), append, sizeof (append));
  if (error != ERROR_SUCCESS)
    goto out;

  /* read if present, else use default */
  error = GetRegString (key, TEXT("ovpn_admin_group"), s->ovpn_admin_group, sizeof (s->ovpn_admin_group));
  if (error != ERROR_SUCCESS)
  {
    openvpn_sntprintf(s->ovpn_admin_group, _countof(s->ovpn_admin_group), OVPN_ADMIN_GROUP);
    error = 0; /* this error is not fatal */
  }
  /* set process priority */
  if (!_tcsicmp (priority, TEXT("IDLE_PRIORITY_CLASS")))
    s->priority = IDLE_PRIORITY_CLASS;
  else if (!_tcsicmp (priority, TEXT("BELOW_NORMAL_PRIORITY_CLASS")))
    s->priority = BELOW_NORMAL_PRIORITY_CLASS;
  else if (!_tcsicmp (priority, TEXT("NORMAL_PRIORITY_CLASS")))
    s->priority = NORMAL_PRIORITY_CLASS;
  else if (!_tcsicmp (priority, TEXT("ABOVE_NORMAL_PRIORITY_CLASS")))
    s->priority = ABOVE_NORMAL_PRIORITY_CLASS;
  else if (!_tcsicmp (priority, TEXT("HIGH_PRIORITY_CLASS")))
    s->priority = HIGH_PRIORITY_CLASS;
  else
    {
      SetLastError (ERROR_INVALID_DATA);
      error = MsgToEventLog (M_SYSERR, TEXT("Unknown priority name: %s"), priority);
      goto out;
    }

  /* set log file append/truncate flag */
  if (append[0] == TEXT('0'))
    s->append = FALSE;
  else if (append[0] == TEXT('1'))
    s->append = TRUE;
  else
    {
      SetLastError (ERROR_INVALID_DATA);
      error = MsgToEventLog (M_ERR, TEXT("Log file append flag (given as '%s') must be '0' or '1'"), append);
      goto out;
    }

out:
  RegCloseKey (key);
  return error;
}
예제 #9
0
파일: common.cpp 프로젝트: AdesChacal/bwapi
std::string GetBWAPIDataDirectory()
{
  std::string sInstallPath = GetRegString("SOFTWARE\\Blizzard Entertainment\\Starcraft", "InstallPath");
  return sInstallPath + "\\bwapi-data";
}
예제 #10
0
void Bumper::SetDefaults(bool fromMouseClick)
{
   HRESULT hr;
   float fTmp;
   int iTmp;

   hr = GetRegStringAsFloat("DefaultProps\\Bumper", "Radius", &fTmp);
   m_d.m_radius = (hr == S_OK) && fromMouseClick ? fTmp : 45.f;

   SetDefaultPhysics(fromMouseClick);

   hr = GetRegStringAsFloat("DefaultProps\\Bumper", "HeightScale", &fTmp);
   m_d.m_heightScale = (hr == S_OK) && fromMouseClick ? fTmp : 90.0f;

   hr = GetRegStringAsFloat("DefaultProps\\Bumper", "RingSpeed", &fTmp);
   m_d.m_ringSpeed = (hr == S_OK) && fromMouseClick ? fTmp : 0.5f;

   hr = GetRegStringAsFloat("DefaultProps\\Bumper", "Orientation", &fTmp);
   m_d.m_orientation = (hr == S_OK) && fromMouseClick ? fTmp : 0.0f;

   hr = GetRegStringAsFloat("DefaultProps\\Bumper", "Threshold", &fTmp);
   m_d.m_threshold = (hr == S_OK) && fromMouseClick ? fTmp : 1.f;

   hr = GetRegString("DefaultProps\\Bumper", "Surface", m_d.m_szSurface, MAXTOKEN);
   if (hr != S_OK || !fromMouseClick)
      m_d.m_szSurface[0] = 0;

   hr = GetRegInt("DefaultProps\\Bumper", "TimerEnabled", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_tdr.m_fTimerEnabled = iTmp == 0 ? false : true;
   else
      m_d.m_tdr.m_fTimerEnabled = false;

   hr = GetRegInt("DefaultProps\\Bumper", "TimerInterval", &iTmp);
   m_d.m_tdr.m_TimerInterval = (hr == S_OK) && fromMouseClick ? iTmp : 100;

   hr = GetRegInt("DefaultProps\\Bumper", "CapVisible", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fCapVisible = iTmp == 0 ? false : true;
   else
      m_d.m_fCapVisible = true;

   hr = GetRegInt("DefaultProps\\Bumper", "BaseVisible", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fBaseVisible = iTmp == 0 ? false : true;
   else
      m_d.m_fBaseVisible = true;

   hr = GetRegInt("DefaultProps\\Bumper", "RingVisible", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fRingVisible = iTmp == 0 ? false : true;
   else
      m_d.m_fRingVisible = true;

   hr = GetRegInt("DefaultProps\\Bumper", "SkirtVisible", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fSkirtVisible = iTmp == 0 ? false : true;
   else
      m_d.m_fSkirtVisible = true;

   hr = GetRegInt("DefaultProps\\Bumper", "ReflectionEnabled", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fReflectionEnabled = iTmp == 0 ? false : true;
   else
      m_d.m_fReflectionEnabled = true;

   hr = GetRegInt("DefaultProps\\Bumper", "HasHitEvent", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
       m_d.m_fHitEvent= iTmp == 0 ? false : true;
   else
       m_d.m_fHitEvent = true;

   hr = GetRegInt("DefaultProps\\Bumper", "Collidable", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
       m_d.m_fCollidable = iTmp == 0 ? false : true;
   else
       m_d.m_fCollidable = true;
}
예제 #11
0
void Flipper::SetDefaults(bool fromMouseClick)
{
   HRESULT hr;
   float fTmp;
   int iTmp;

   hr = GetRegStringAsFloat("DefaultProps\\Flipper","StartAngle", &fTmp);
   m_d.m_StartAngle = (hr == S_OK) && fromMouseClick ? fTmp : 121;

   hr = GetRegStringAsFloat("DefaultProps\\Flipper","EndAngle", &fTmp);
   m_d.m_EndAngle = (hr == S_OK) && fromMouseClick ? fTmp : 70;

   hr = GetRegStringAsFloat("DefaultProps\\Flipper","BaseRadius", &fTmp);
   m_d.m_BaseRadius = (hr == S_OK) && fromMouseClick ? fTmp : 21.5f;		// 15

   hr = GetRegStringAsFloat("DefaultProps\\Flipper","EndRadius", &fTmp);
   m_d.m_EndRadius = (hr == S_OK) && fromMouseClick ? fTmp : 13.f;		// 6

   hr = GetRegStringAsFloat("DefaultProps\\Flipper","Length", &fTmp);
   m_d.m_FlipperRadiusMax = (hr == S_OK) && fromMouseClick ? fTmp : 130.f;	// 80

   hr = GetRegStringAsFloat("DefaultProps\\Flipper","MaxDifLength", &fTmp);
   m_d.m_FlipperRadiusMin = (hr == S_OK) && fromMouseClick ? fTmp : 0;

   m_d.m_FlipperRadius = m_d.m_FlipperRadiusMax;

   //m_d.m_angleEOS = 0; //!! reenable?

   SetDefaultPhysics(fromMouseClick);

   hr = GetRegInt("DefaultProps\\Flipper","TimerEnabled", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_tdr.m_fTimerEnabled = iTmp == 0 ? false : true;
   else
      m_d.m_tdr.m_fTimerEnabled = false;

   hr = GetRegInt("DefaultProps\\Flipper","TimerInterval", &iTmp);
   m_d.m_tdr.m_TimerInterval = (hr == S_OK) && fromMouseClick ? iTmp : 100;

   hr = GetRegInt("DefaultProps\\Flipper","Color", &iTmp);
   m_d.m_color = (hr == S_OK) && fromMouseClick ? iTmp : RGB(255,255,255);

   hr = GetRegInt("DefaultProps\\Flipper","RubberColor", &iTmp);
   m_d.m_rubbercolor = (hr == S_OK) && fromMouseClick ? iTmp : RGB(128,50,50);

   hr = GetRegString("DefaultProps\\Flipper", "Surface", &m_d.m_szSurface, MAXTOKEN);
   if ((hr != S_OK) || !fromMouseClick)
      m_d.m_szSurface[0] = 0;

   hr = GetRegStringAsFloat("DefaultProps\\Flipper","Strength", &fTmp);
   m_d.m_strength = (hr == S_OK) && fromMouseClick ? fTmp : 2200.0f;

   hr = GetRegStringAsFloat("DefaultProps\\Flipper","Height", &fTmp);
   m_d.m_height = (hr == S_OK) && fromMouseClick ? fTmp : 50;

   hr = GetRegInt("DefaultProps\\Flipper","RubberThickness", &iTmp);
   m_d.m_rubberthickness = (hr == S_OK) && fromMouseClick ? iTmp : 7;

   hr = GetRegInt("DefaultProps\\Flipper","RubberHeight", &iTmp);
   m_d.m_rubberheight = (hr == S_OK) && fromMouseClick ? iTmp : 19;

   hr = GetRegInt("DefaultProps\\Flipper","RubberWidth", &iTmp);
   m_d.m_rubberwidth = (hr == S_OK) && fromMouseClick ? iTmp : 24;

   hr = GetRegInt("DefaultProps\\Flipper","Visible", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fVisible = iTmp == 0 ? false : true;
   else
      m_d.m_fVisible = true;

   hr = GetRegInt("DefaultProps\\Flipper","Enabled", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fEnabled = iTmp == 0 ? false : true;
   else
      m_d.m_fEnabled = true;
}
예제 #12
0
파일: bumper.cpp 프로젝트: c-f-h/vpinball
void Bumper::SetDefaults(bool fromMouseClick)
{
   HRESULT hr;
   float fTmp;
   int iTmp;

   hr = GetRegStringAsFloat("DefaultProps\\Bumper","Radius", &fTmp);
   m_d.m_radius = (hr == S_OK) && fromMouseClick ? fTmp : 45;

   hr = GetRegStringAsFloat("DefaultProps\\Bumper","Force", &fTmp);
   m_d.m_force = (hr == S_OK) && fromMouseClick ? fTmp : 15;

   hr = GetRegStringAsFloat("DefaultProps\\Bumper","HeightOffset", &fTmp);
   m_d.m_heightoffset = (hr == S_OK) && fromMouseClick ? fTmp : 0;

   hr = GetRegStringAsFloat("DefaultProps\\Bumper","Threshold", &fTmp);
   m_d.m_threshold = (hr == S_OK) && fromMouseClick ? fTmp : 1;

   hr = GetRegStringAsFloat("DefaultProps\\Bumper","Overhang", &fTmp);
   m_d.m_overhang = (hr == S_OK) && fromMouseClick ? fTmp : 25;

   hr = GetRegInt("DefaultProps\\Bumper","Color", &iTmp);
   m_d.m_color = (hr == S_OK) && fromMouseClick ? iTmp : RGB(255,0,0);

   hr = GetRegInt("DefaultProps\\Bumper","SideColor", &iTmp);
   m_d.m_sidecolor = (hr == S_OK) && fromMouseClick ? iTmp : RGB(255,255,255);

   hr = GetRegString("DefaultProps\\Bumper","Image", m_d.m_szImage, MAXTOKEN);
   if ((hr != S_OK) || !fromMouseClick)
      m_d.m_szImage[0] = 0;

   hr = GetRegString("DefaultProps\\Bumper","Surface", m_d.m_szSurface, MAXTOKEN);
   if (hr != S_OK || !fromMouseClick )	
      m_d.m_szSurface[0] = 0;

   hr = GetRegInt("DefaultProps\\Bumper","TimerEnabled", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_tdr.m_fTimerEnabled = iTmp == 0 ? fFalse : fTrue;
   else
      m_d.m_tdr.m_fTimerEnabled = fFalse;

   hr = GetRegInt("DefaultProps\\Bumper","TimerInterval", &iTmp);
   m_d.m_tdr.m_TimerInterval = (hr == S_OK) && fromMouseClick ? iTmp : 100;

   hr = GetRegInt("DefaultProps\\Bumper","LightState", &iTmp);
   m_d.m_state = (hr == S_OK) && fromMouseClick ? (enum LightState)iTmp : LightStateOff;

   hr = GetRegString("DefaultProps\\Bumper","BlinkPattern", m_rgblinkpattern, MAXTOKEN);
   if ((hr != S_OK) || !fromMouseClick)
      strcpy_s(m_rgblinkpattern, sizeof(m_rgblinkpattern), "10");

   hr = GetRegInt("DefaultProps\\Bumper","BlinkInterval", &iTmp);
   m_blinkinterval = (hr == S_OK) && fromMouseClick ? iTmp : 125;

   hr = GetRegInt("DefaultProps\\Bumper","FlashWhenHit", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fFlashWhenHit = iTmp == 0 ? false : true;
   else
      m_d.m_fFlashWhenHit = fTrue;

   hr = GetRegInt("DefaultProps\\Bumper","CastsShadow", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fCastsShadow = iTmp == 0 ? false : true;
   else
      m_d.m_fCastsShadow = fTrue;

   hr = GetRegInt("DefaultProps\\Bumper","Visible", &iTmp);
   if ((hr == S_OK)&& fromMouseClick)
      m_d.m_fVisible = iTmp == 0 ? false : true;
   else
      m_d.m_fVisible = fTrue;

   hr = GetRegInt("DefaultProps\\Bumper","SideVisible", &iTmp);
   if ((hr == S_OK) && fromMouseClick)
      m_d.m_fSideVisible = iTmp == 0 ? false : true;
   else
      m_d.m_fSideVisible = fTrue;
}