Subversion Repositories spk

Rev

Rev 212 | Rev 224 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 212 Rev 222
Line 130... Line 130...
130
			_lRemoveDirs->pushBack(_packages->getGameRunExe((*itr)->str.toString()), (*itr)->data);
130
			_lRemoveDirs->pushBack(_packages->getGameRunExe((*itr)->str.toString()), (*itr)->data);
131
	}
131
	}
132
 
132
 
133
	// find other dirs
133
	// find other dirs
134
	System::String ^progfile = Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles);
134
	System::String ^progfile = Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles);
135
	Utils::CStringList gameDirs;		
135
	Utils::WStringList gameDirs;		
136
	gameDirs.pushBack("HKCU\\Software\\Deepsilver\\X2 The Threat", "INSTALL_DIR");
136
	gameDirs.pushBack(L"HKCU\\Software\\Deepsilver\\X2 The Threat", L"INSTALL_DIR");
137
	gameDirs.pushBack("HKCU\\Software\\Deepsilver\\X3 Reunion", "INSTALL_DIR");
137
	gameDirs.pushBack(L"HKCU\\Software\\Deepsilver\\X3 Reunion", L"INSTALL_DIR");
138
	gameDirs.pushBack("HKCU\\Software\\Egosoft\\X3TC", "INSTALL_DIR");
138
	gameDirs.pushBack(L"HKCU\\Software\\Egosoft\\X3TC", L"INSTALL_DIR");
139
	gameDirs.pushBack("Steam\\x2 - the threat");
139
	gameDirs.pushBack(L"Steam\\x2 - the threat");
140
	gameDirs.pushBack("Steam\\x3 - reunion");
140
	gameDirs.pushBack(L"Steam\\x3 - reunion");
141
	gameDirs.pushBack("Steam\\x3 terran conflict");
141
	gameDirs.pushBack(L"Steam\\x3 terran conflict");
142
	// some custom directories to look for
142
	// some custom directories to look for
143
	gameDirs.pushBack("%PROGRAMFILES%\\Egosoft\\X2 The Threat");
143
	gameDirs.pushBack(L"%PROGRAMFILES%\\Egosoft\\X2 The Threat");
144
	gameDirs.pushBack("%PROGRAMFILES%\\Egosoft\\X3 Reunion");
144
	gameDirs.pushBack(L"%PROGRAMFILES%\\Egosoft\\X3 Reunion");
145
	gameDirs.pushBack("%PROGRAMFILES%\\Egosoft\\X3 Terran Conflict");
145
	gameDirs.pushBack(L"%PROGRAMFILES%\\Egosoft\\X3 Terran Conflict");
146
	gameDirs.pushBack("C:\\Games\\X2");
146
	gameDirs.pushBack(L"C:\\Games\\X2");
147
	gameDirs.pushBack("C:\\Games\\X3");
147
	gameDirs.pushBack(L"C:\\Games\\X3");
148
	gameDirs.pushBack("C:\\Games\\X3TC");
148
	gameDirs.pushBack(L"C:\\Games\\X3TC");
149
	gameDirs.pushBack("D:\\Games\\X2");
149
	gameDirs.pushBack(L"D:\\Games\\X2");
150
	gameDirs.pushBack("D:\\Games\\X3");
150
	gameDirs.pushBack(L"D:\\Games\\X3");
151
	gameDirs.pushBack("D:\\Games\\X3TC");	
151
	gameDirs.pushBack(L"D:\\Games\\X3TC");	
152
	for (Utils::SStringList *strNode = gameDirs.first(); strNode; strNode = gameDirs.next())
152
	for (Utils::WStringNode *strNode = gameDirs.first(); strNode; strNode = gameDirs.next())
153
	{
153
	{
154
		Utils::String sFirst = strNode->str.token("\\", 1);
154
		Utils::WString sFirst = strNode->str.token(L"\\", 1);
155
		Utils::String sRest = strNode->str.tokens("\\", 2);
155
		Utils::WString sRest = strNode->str.tokens(L"\\", 2);
156
 
156
 
157
		if (sFirst.Compare("HKCU") || sFirst.Compare("HKLM"))
157
		if (sFirst.Compare(L"HKCU") || sFirst.Compare(L"HKLM"))
158
		{
158
		{
159
			RegistryKey ^searchKey = nullptr;
159
			RegistryKey ^searchKey = nullptr;
160
			if (sFirst.Compare("HKCU"))
160
			if (sFirst.Compare(L"HKCU"))
161
				searchKey = Registry::CurrentUser->OpenSubKey(_US(sRest));
161
				searchKey = Registry::CurrentUser->OpenSubKey(_US(sRest));
162
			else if (sFirst.Compare("HKLM"))
162
			else if (sFirst.Compare(L"HKLM"))
163
				searchKey = Registry::LocalMachine->OpenSubKey(_US(sRest));
163
				searchKey = Registry::LocalMachine->OpenSubKey(_US(sRest));
164
 
164
 
165
			if (searchKey)
165
			if (searchKey)
166
			{
166
			{
167
				System::String ^regRead = System::Convert::ToString(searchKey->GetValue(_US(strNode->data)));
167
				System::String ^regRead = System::Convert::ToString(searchKey->GetValue(_US(strNode->data)));
Line 178... Line 178...
178
				if (regRead)
178
				if (regRead)
179
				{
179
				{
180
					Utils::WString steamDir = _WS(regRead);
180
					Utils::WString steamDir = _WS(regRead);
181
					if (!steamDir.empty())
181
					if (!steamDir.empty())
182
					{
182
					{
183
						Utils::WString dir = steamDir + L"\\steamapps\\common\\" + sRest.toWString();
183
						Utils::WString dir = steamDir + L"\\steamapps\\common\\" + sRest;
184
						AddFoundDir(_packages->GetGameExe()->gameRunExe(dir.findReplace(L"\\", L"/").findReplace(L"//", L"/")));
184
						AddFoundDir(_packages->GetGameExe()->gameRunExe(dir.findReplace(L"\\", L"/").findReplace(L"//", L"/")));
185
					}
185
					}
186
				}
186
				}
187
			}
187
			}
188
		}
188
		}