@@ -44,7 +44,7 @@ void Diag::Begin ( void )
44
44
OriginalMTAVersion = GetMTAVersion (); // store the original version to dump in the log file later on
45
45
46
46
// check whether DirectX is up to date (actually whether D3DX9_43.dll is present in %systemroot%\system32)
47
- if ( CheckForFile ( files[5 ].c_str () ) ) { std::cout << " DirectX is up-to-date." << std::endl << std::endl; }
47
+ if ( CheckForFile ( files[4 ].c_str () ) ) { std::cout << " DirectX is up-to-date." << std::endl << std::endl; }
48
48
else { UpdateDirectX (); DXUpdated = 1 ; }
49
49
50
50
// update MTA to latest nightly/unstable build, depending on the version
@@ -58,7 +58,7 @@ void Diag::Begin ( void )
58
58
std::string D3D9Present = ( CheckForFile ( GTAPath + " \\ D3D9.dll" ) ) ? " Yes" : " No" ;
59
59
Log::WriteStringToLog ( " D3D9.dll present: " , D3D9Present );
60
60
61
- std::string DirectXState = ( CheckForFile ( files[5 ] ) ) ? " Yes" : " No" ;
61
+ std::string DirectXState = ( CheckForFile ( files[4 ] ) ) ? " Yes" : " No" ;
62
62
Log::WriteStringToLog ( " DirectX up-to-date: " , DirectXState );
63
63
if ( DXUpdated == 1 )
64
64
Log::WriteStringToLog ( " DirectX was updated: Yes" );
@@ -80,10 +80,10 @@ void Diag::Begin ( void )
80
80
81
81
QueryWMIC ( " Path" , " Win32_VideoController" , " Get" );
82
82
83
- ExportRegKeyToFile ( CompatModeRegKey1, files[ 4 ] );
84
- TrimCompatabilityExport ( files[4 ] );
85
- ExportRegKeyToFile ( CompatModeRegKey2, files[ 4 ] );
86
- TrimCompatabilityExport ( files[4 ] );
83
+ ExportRegKeyToFile ( CompatModeRegKey1 );
84
+ TrimCompatabilityExport ( files[1 ] );
85
+ ExportRegKeyToFile ( CompatModeRegKey2 );
86
+ TrimCompatabilityExport ( files[1 ] );
87
87
88
88
GetDir ( ( MTAPath + " \\ MTA" ) );
89
89
GetDir ( GTAPath );
@@ -115,7 +115,7 @@ void Diag::Cleanup ( void )
115
115
{
116
116
// clean up after ourselves
117
117
// start at 1 since 0 is the generated log's path; we still need that
118
- for (int i = 1 ; i < ( signed ) files.size (); i++)
118
+ for (int i = 1 ; i < ( signed ) files.size () - 1 ; i++)
119
119
remove ( files[i].c_str () );
120
120
}
121
121
@@ -138,12 +138,9 @@ void Diag::GeneratePaths ( void )
138
138
139
139
files.push_back ( tempDir + " \\ " + logFileName + " .txt" ); // files [0] ...
140
140
files.push_back ( tempDir + " \\ tempoutput.txt" );
141
- files.push_back ( tempDir + " \\ WMIC.txt" );
142
- files.push_back ( tempDir + " \\ directory.txt" );
143
- files.push_back ( tempDir + " \\ regexport.txt" );
144
- files.push_back ( systemRoot + " \\ system32\\ D3DX9_43.dll" );
145
141
files.push_back ( tempDir + " \\ MTANightly.exe" );
146
142
files.push_back ( tempDir + " \\ WMICUni.txt" );
143
+ files.push_back ( systemRoot + " \\ system32\\ D3DX9_43.dll" );
147
144
148
145
#ifdef DEBUGOUTPUT
149
146
for ( int i = 0 ; i < ( signed ) files.size (); i++ )
@@ -306,14 +303,14 @@ void Diag::UpdateMTA ( void )
306
303
}
307
304
308
305
#ifndef SKIPUPDATE
309
- if ( Curl::DownloadFile (url, files[6 ].c_str () ) )
306
+ if ( Curl::DownloadFile (url, files[2 ].c_str () ) )
310
307
{
311
- std::ifstream ifile ( files[6 ].c_str () );
308
+ std::ifstream ifile ( files[2 ].c_str () );
312
309
if ( ifile )
313
310
{
314
311
std::cout << std::endl << " Launching the installer..." << std::endl;
315
312
std::cout << " Run MTA once the installer has finished to see if it works now." << std::endl;
316
- system ( files[6 ].c_str () );
313
+ system ( files[2 ].c_str () );
317
314
}
318
315
}
319
316
else
@@ -341,9 +338,7 @@ void Diag::UpdateMTA ( void )
341
338
342
339
void Diag::UpdateDirectX ( void )
343
340
{
344
- std::string DXWebSetupPath = tempDir;
345
-
346
- DXWebSetupPath.append ( " \\ dxwebsetup.exe" );
341
+ std::string DXWebSetupPath = ( tempDir + " \\ dxwebsetup.exe" );
347
342
348
343
std::string DXWebSetupURL = " http://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe" ;
349
344
@@ -379,7 +374,7 @@ void Diag::QueryWMIC ( std::string arg1, std::string arg2, std::string arg3, std
379
374
std::string WMIC;
380
375
std::stringstream ss; // create a stringstream
381
376
382
- ss << " wmic " << arg1 << " " << arg2 << " " << arg3 << " " << arg4 << " >" << files[7 ].c_str ();
377
+ ss << " wmic " << arg1 << " " << arg2 << " " << arg3 << " " << arg4 << " >" << files[3 ].c_str ();
383
378
WMIC = ss.str ();
384
379
385
380
// clear the stringstream
@@ -388,19 +383,19 @@ void Diag::QueryWMIC ( std::string arg1, std::string arg2, std::string arg3, std
388
383
389
384
system ( WMIC.c_str () );
390
385
391
- ConvertUnicodeToASCII ( files[7 ], files[2 ] );
386
+ ConvertUnicodeToASCII ( files[3 ], files[1 ] );
392
387
393
- remove ( files[7 ].c_str () );
388
+ remove ( files[3 ].c_str () );
394
389
395
- Log::WriteFileToLog ( files[2 ], ( " WMIC " + arg1 + " " + arg2 + " " + arg3 + " " + arg4 ) );
390
+ Log::WriteFileToLog ( files[1 ], ( " WMIC " + arg1 + " " + arg2 + " " + arg3 + " " + arg4 ) );
396
391
}
397
392
398
393
void Diag::GetDir ( std::string directory )
399
394
{
400
395
std::string dirPath;
401
396
std::stringstream ss; // create a stringstream
402
397
403
- ss << " dir \" " << directory << " \" >\" " << files[3 ].c_str () << " \" " ;
398
+ ss << " dir \" " << directory << " \" >\" " << files[1 ].c_str () << " \" " ;
404
399
dirPath = ss.str ();
405
400
406
401
// clear the stringstream
@@ -409,15 +404,15 @@ void Diag::GetDir ( std::string directory )
409
404
410
405
system ( dirPath.c_str () );
411
406
412
- Log::WriteFileToLog ( files[3 ].c_str (), ( directory + " directory listing" ) );
407
+ Log::WriteFileToLog ( files[1 ].c_str (), ( directory + " directory listing" ) );
413
408
}
414
409
415
- void Diag::ExportRegKeyToFile ( std::string subkey, std::string filePath )
410
+ void Diag::ExportRegKeyToFile ( std::string subkey )
416
411
{
417
412
std::string ExportReg;
418
413
std::stringstream ss; // create a stringstream
419
414
420
- ss << " regedit /e /a " << filePath << " \" " << subkey << " \" " ;
415
+ ss << " regedit /e /a " << files[ 1 ] << " \" " << subkey << " \" " ;
421
416
ExportReg = ss.str ();
422
417
423
418
// clear the stringstream
0 commit comments