Skip to content

Commit 6c040c0

Browse files
committed
Fixes for 1.5
1 parent c50450e commit 6c040c0

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

MTADiag/Diag.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void Diag::Begin ( void )
6565
if ( !( CheckForFile ( GTAPath + szFilename ) ) )
6666
{
6767
std::cout << "Missing GTA file: " << fileList[i].szFilename << std::endl; // output any messed up file
68-
bQuit = true; // we need to quit since the user's GTA install is probably screwed up
68+
//bQuit = true; // we need to quit since the user's GTA install is probably screwed up
6969
}
7070
std::cout << "\rChecking " << ( i + 1 ) << " out of " << ( sizeof ( fileList ) / sizeof ( fileList[0] ) ) << "...";
7171
}
@@ -158,9 +158,16 @@ void Diag::Begin ( void )
158158

159159
// write some of MTA's logs to our log
160160
Log::WriteFileToLog ( MTAPath + "\\MTA\\core.log", "core.log" );
161+
162+
// 1.4
161163
Log::WriteFileToLog ( MTAPath + "\\MTA\\logfile.txt", "logfile.txt" );
162164
Log::WriteFileToLog ( MTAPath + "\\MTA\\logfile_old.txt", "logfile_old.txt" );
163165
Log::WriteFileToLog ( MTAPath + "\\MTA\\CEGUI.log", "CEGUI.log" );
166+
// 1.5
167+
Log::WriteFileToLog ( MTAPath + "\\MTA\\logs\\logfile.txt", "logfile.txt" );
168+
Log::WriteFileToLog ( MTAPath + "\\MTA\\logs\\logfile.txt.1", "logfile.txt.1" );
169+
Log::WriteFileToLog ( MTAPath + "\\MTA\\logs\\CEGUI.log", "CEGUI.log" );
170+
164171
Log::WriteFileToLog ( MTAPath + "\\timings.log", "timings.log" );
165172
Log::WriteFileToLog ( MTAPath + "\\mods\\deathmatch\\resources\\benchmark\\output\\bench.log", "bench.log" ); // FPS benchmark log
166173
if ( IsVistaOrNewer() ) { Log::WriteFileToLog ( programData + "\\MTA San Andreas All\\" + MTAShortVersion + "\\report.log", "report.log" ); }
@@ -203,7 +210,7 @@ void Diag::Begin ( void )
203210
PasteBinResult = Curl::CreateMTAPasteBin ( files[0], logFileName ); // store the HTTP POST result into PasteBinResult
204211

205212
// upload successful; copy URL to clipboard
206-
if ( HasDigits ( PasteBinResult ) && !( strstr ( PasteBinResult.c_str(), "DOCTYPE" ) ) )
213+
if ( HasDigits ( PasteBinResult ) && !( strstr ( PasteBinResult.c_str(), "DOCTYPE" ) ) && !( strstr ( PasteBinResult.c_str(), "error" ) ) )
207214
{
208215
PasteBinResult.insert ( 0, "http://pastebin.mtasa.com/" );
209216
if ( CopyToClipboard ( PasteBinResult ) ) // was copying to clipboard successful?
@@ -220,7 +227,7 @@ void Diag::Begin ( void )
220227
{
221228
std::cout << std::endl << std::endl << "Failed to upload log file to MTA Pastebin." << std::endl;
222229
std::cout << "Error code: \"" << PasteBinResult << "\"" << std::endl;
223-
std::cout << "Please paste the contents of the opened Wordpad window at www.pastebin.mtasa.com." << std::endl;
230+
std::cout << "Please paste the contents of the opened Wordpad window at http://pastebin.mtasa.com" << std::endl;
224231
std::cout << "Include the MTA Pastebin link in your forum post." << std::endl << std::endl;
225232
ShellExecute ( NULL, "open", "wordpad.exe", files[0].c_str(), NULL, SW_SHOW );
226233
}
@@ -322,7 +329,7 @@ void Diag::UserPickVersion ( void )
322329
std::cout << "You have multiple versions of MTA installed." << std::endl << "Please pick which version to diagnose by entering the number within the brackets:" << std::endl;
323330

324331
// iterate through currently installed MTA versions and output them
325-
for (int i = 1; i < CUR_MTA_VERSIONS; i++)
332+
for (int i = 1; i <= CUR_MTA_VERSIONS; i++)
326333
{
327334
if ( !MTAVersionsInstalled[i].empty() )
328335
std::cout << "[" << i << "] 1." << i << std::endl;
@@ -332,10 +339,10 @@ void Diag::UserPickVersion ( void )
332339
std::cout << "Enter version choice: ";
333340
std::cin >> MTAVerChoice;
334341

335-
if ( MTAVersionsInstalled[MTAVerChoice].empty() || MTAVerChoice >= CUR_MTA_VERSIONS )
342+
if ( MTAVersionsInstalled[MTAVerChoice].empty() || MTAVerChoice > CUR_MTA_VERSIONS )
336343
std::cout << "Invalid choice entered." << std::endl;
337344

338-
} while ( MTAVersionsInstalled[MTAVerChoice].empty() || MTAVerChoice >= CUR_MTA_VERSIONS );
345+
} while ( MTAVersionsInstalled[MTAVerChoice].empty() || MTAVerChoice > CUR_MTA_VERSIONS );
339346
}
340347

341348
std::string Diag::GetMTAPath ( void )
@@ -494,9 +501,13 @@ void Diag::UpdateDirectX ( void )
494501

495502
void Diag::DoSystemCommandWithOutput ( std::string command )
496503
{
497-
system ( ( command + files[1] ).c_str() ); // do the command
504+
Log::WriteStringToLog ( "----------------------------------------------------------------------------------" );
505+
int iCommandReturn = system ( ( command + files[1] ).c_str() ); // do the command
506+
507+
std::stringstream ss;
508+
ss << command << " (returned " << iCommandReturn << ")";
498509

499-
Log::WriteFileToLog ( files[1], command ); // write the result to the log file with the passed command argument as a description
510+
Log::WriteFileToLog ( files[1], ss.str() ); // write the result to the log file with the passed command argument as a description
500511
}
501512

502513
void Diag::QueryWMIC ( std::string arg1, std::string arg2, std::string arg3, std::string arg4 )

MTADiag/md5.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ std::string MD5::hexdigest() const
337337
if (!finalized)
338338
return "";
339339

340-
char buf[33];
340+
char buf[133];
341341
for (int i=0; i<16; i++)
342342
sprintf_s(buf+i*2, 65, "%02x", digest[i]);
343343
buf[32]=0;

0 commit comments

Comments
 (0)