@@ -47,21 +47,29 @@ void Diag::Begin ( void )
47
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
+ // remove any compatibility mode settings on gta_sa.exe and/or Multi Theft Auto.exe
51
+ CompatRemoved1 = DeleteCompatibilityEntries ( CompatModeRegKey, HKEY_CURRENT_USER );
52
+ CompatRemoved2 = DeleteCompatibilityEntries ( CompatModeRegKey, HKEY_LOCAL_MACHINE );
53
+
50
54
// update MTA to latest nightly/unstable build, depending on the version
51
55
UpdateMTA ();
52
56
53
57
// write a bunch of information to the log file since we just collected it
54
- Log::WriteStringToLog ( " MTA path: " , MTAPath );
55
- Log::WriteStringToLog ( " Old MTA version: " , OriginalMTAVersion );
56
- Log::WriteStringToLog ( " New MTA version: " , MTAVersion );
57
- Log::WriteStringToLog ( " GTA path: " , GTAPath );
58
+ Log::WriteStringToLog ( " MTA path: " , MTAPath );
59
+ Log::WriteStringToLog ( " Old MTA version: " , OriginalMTAVersion );
60
+ Log::WriteStringToLog ( " New MTA version: " , MTAVersion );
61
+ Log::WriteStringToLog ( " GTA path: " , GTAPath );
62
+
58
63
std::string D3D9Present = ( CheckForFile ( GTAPath + " \\ D3D9.dll" ) ) ? " Yes" : " No" ;
59
- Log::WriteStringToLog ( " D3D9.dll present: " , D3D9Present );
64
+ Log::WriteStringToLog ( " D3D9.dll present: " , D3D9Present );
60
65
61
66
std::string DirectXState = ( CheckForFile ( files[4 ] ) ) ? " Yes" : " No" ;
62
- Log::WriteStringToLog ( " DirectX up-to-date: " , DirectXState );
63
- if ( DXUpdated == 1 )
64
- Log::WriteStringToLog ( " DirectX was updated: Yes" );
67
+ Log::WriteStringToLog ( " DirectX up-to-date: " , DirectXState );
68
+ if ( DXUpdated == 0 )
69
+ Log::WriteStringToLog ( " DirectX was updated: Yes" );
70
+
71
+ if ( CompatRemoved1 == true || CompatRemoved2 == true )
72
+ Log::WriteStringToLog ( " Compat. mode deleted: Yes" );
65
73
Log::WriteStringToLog ( " " );
66
74
67
75
// collect more information and output to log file
@@ -72,8 +80,6 @@ void Diag::Begin ( void )
72
80
DoSystemCommandWithOutput ( " dxdiag /t " );
73
81
#endif
74
82
DoSystemCommandWithOutput ( " tasklist >" );
75
- DoSystemCommandWithOutput ( " ipconfig /all >" );
76
- DoSystemCommandWithOutput ( " wevtutil qe Application /q:\" Event [System [(Level=2)] ] [EventData [(Data='Multi Theft Auto.exe')] ]\" /c:1 /f:text /rd:true >" );
77
83
78
84
// write some of MTA's logs to our log
79
85
Log::WriteFileToLog ( MTAPath + " \\ MTA\\ core.log" , " core.log" );
@@ -82,14 +88,9 @@ void Diag::Begin ( void )
82
88
Log::WriteFileToLog ( MTAPath + " \\ MTA\\ timings.log" , " timings.log" );
83
89
if ( IsVistaOrNewer () ) { Log::WriteFileToLog ( programData + " \\ MTA San Andreas All\\ " + MTAShortVersion + " \\ report.log" , " report.log" ); }
84
90
85
- // get some video controller information
86
- QueryWMIC ( " Path" , " Win32_VideoController" , " Get" );
87
-
88
- // export compatibility mode registry keys and export to log only if a match for MTA or GTA is found
89
- ExportRegKeyToFile ( CompatModeRegKey1 );
90
- TrimCompatabilityExport ();
91
- ExportRegKeyToFile ( CompatModeRegKey2 );
92
- TrimCompatabilityExport ();
91
+ DoSystemCommandWithOutput ( " ipconfig /all >" ); // get network configuration
92
+ DoSystemCommandWithOutput ( " wevtutil qe Application /q:\" Event [System [(Level=2)] ] [EventData [(Data='Multi Theft Auto.exe')] ]\" /c:1 /f:text /rd:true >" ); // might help resolve Visual C++ runtime issues
93
+ QueryWMIC ( " Path" , " Win32_VideoController" , " Get" ); // get some video controller information
93
94
94
95
// get directory listing of some folders
95
96
GetDir ( ( MTAPath + " \\ MTA" ) );
@@ -102,7 +103,7 @@ void Diag::Begin ( void )
102
103
// upload to PasteBin
103
104
std::cout << " Log file generated. Uploading to Pastebin..." << std::endl;
104
105
105
- PasteBinResult = Curl::CreatePasteBin ( files[0 ], logFileName ); // store the POST result into PasteBinResult
106
+ PasteBinResult = Curl::CreatePasteBin ( files[0 ], logFileName ); // store the HTTP POST result into PasteBinResult
106
107
107
108
// deal with a couple of errors in case there are any
108
109
if ( strstr ( PasteBinResult.c_str (), " Bad API request" ) || strstr ( PasteBinResult.c_str (), " Post limit" ) )
@@ -116,15 +117,15 @@ void Diag::Begin ( void )
116
117
else // upload successful; open the pasted log file in a browser window
117
118
{
118
119
std::cout << " Log file uploaded to Pastebin. Please include the Pastebin link in your forum post." << std::endl;
119
- ShellExecute ( NULL , " open" , PasteBinResult.c_str (), NULL , NULL , SW_SHOW );
120
+ ShellExecute ( NULL , " open" , " rundll32.exe " , ( " url.dll,FileProtocolHandler " + PasteBinResult ) .c_str (), NULL , SW_SHOW );
120
121
}
121
122
}
122
123
123
124
void Diag::Cleanup ( void )
124
125
{
125
126
// clean up after ourselves
126
127
// start at 1 since 0 is the generated log's path; we still need that
127
- for (int i = 1 ; i < ( signed ) files.size () - 1 ; i++) // don't delete D3DX9_43.dll
128
+ for ( unsigned int i = 1 ; i < files.size () - 1 ; i++) // don't delete D3DX9_43.dll
128
129
remove ( files[i].c_str () );
129
130
}
130
131
@@ -154,7 +155,7 @@ void Diag::GeneratePaths ( void )
154
155
155
156
// output contents of files vector
156
157
#ifdef DEBUGOUTPUT
157
- for ( int i = 0 ; i < ( signed ) files.size (); i++ )
158
+ for ( unsigned int i = 0 ; i < files.size (); i++ )
158
159
std::cout << i << " " << files[i] << std::endl;
159
160
#endif
160
161
}
@@ -418,44 +419,4 @@ void Diag::GetDir ( std::string directory )
418
419
system ( dirPath.c_str () ); // do it
419
420
420
421
Log::WriteFileToLog ( files[1 ].c_str (), ( directory + " directory listing" ) ); // write the result to the log file with a description
421
- }
422
-
423
- void Diag::ExportRegKeyToFile ( std::string subkey )
424
- {
425
- std::string ExportReg;
426
- std::stringstream ss; // create a stringstream
427
-
428
- ss << " regedit /e /a " << files[1 ] << " \" " << subkey << " \" " ; // regedit EXPORT ASCII <filename> <subkey>
429
- ExportReg = ss.str ();
430
-
431
- // clear the stringstream
432
- ss.str (" " );
433
- ss.clear ();
434
-
435
- system ( ExportReg.c_str () ); // do it
436
- }
437
-
438
- void Diag::TrimCompatabilityExport ( void )
439
- {
440
- std::ifstream file;
441
- std::string line;
442
-
443
- file.open ( files[1 ].c_str (), std::ios::in ); // open the file with the exported registry key
444
-
445
- if ( file ) // if file exists
446
- {
447
- while ( !file.eof () ) // while we haven't hit the end of the file
448
- {
449
- getline ( file, line ); // read one line
450
-
451
- if ( strstr ( line.c_str (), " gta_sa.exe" ) || strstr ( line.c_str (), " Multi Theft Auto.exe" ) ) // if we get a filename match, output it to the log file
452
- {
453
- Log::WriteStringToLog ( " Compatibility registry entry match:" , line );
454
- Log::WriteStringToLog ( " " );
455
- }
456
- }
457
- }
458
- Log::WriteStringToLog ( " " );
459
-
460
- file.close (); // close the file for writing
461
422
}
0 commit comments