Include steam.inf in crash metadata
This commit is contained in:
		
							parent
							
								
									d2ad4eb071
								
							
						
					
					
						commit
						e4a0c190ab
					
				| @ -54,6 +54,7 @@ char crashCommandLine[1024]; | |||||||
| char crashSourceModPath[512]; | char crashSourceModPath[512]; | ||||||
| char crashGameDirectory[256]; | char crashGameDirectory[256]; | ||||||
| char crashExtensionVersion[32]; | char crashExtensionVersion[32]; | ||||||
|  | char steamInf[512]; | ||||||
| 
 | 
 | ||||||
| char dumpStoragePath[512]; | char dumpStoragePath[512]; | ||||||
| char logPath[512]; | char logPath[512]; | ||||||
| @ -124,13 +125,16 @@ static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, | |||||||
| 	sys_write(extra, crashGameDirectory, my_strlen(crashGameDirectory)); | 	sys_write(extra, crashGameDirectory, my_strlen(crashGameDirectory)); | ||||||
| 	sys_write(extra, "\nExtensionVersion=", 18); | 	sys_write(extra, "\nExtensionVersion=", 18); | ||||||
| 	sys_write(extra, crashExtensionVersion, my_strlen(crashExtensionVersion)); | 	sys_write(extra, crashExtensionVersion, my_strlen(crashExtensionVersion)); | ||||||
|  | 	sys_write(extra, steamInf, my_strlen(steamInf)); | ||||||
| 	sys_write(extra, "\n-------- CONFIG END --------\n", 30); | 	sys_write(extra, "\n-------- CONFIG END --------\n", 30); | ||||||
| 
 | 
 | ||||||
| 	if (GetSpew) { | 	if (GetSpew) { | ||||||
| 		GetSpew(spewBuffer, sizeof(spewBuffer)); | 		GetSpew(spewBuffer, sizeof(spewBuffer)); | ||||||
|                 sys_write(extra, "-------- CONSOLE HISTORY BEGIN --------\n", 40); | 		if (my_strlen(spewBuffer) > 0) { | ||||||
| 		sys_write(extra, spewBuffer, my_strlen(spewBuffer)); | 			sys_write(extra, "-------- CONSOLE HISTORY BEGIN --------\n", 40); | ||||||
| 		sys_write(extra, "-------- CONSOLE HISTORY END --------\n", 38); | 			sys_write(extra, spewBuffer, my_strlen(spewBuffer)); | ||||||
|  | 			sys_write(extra, "-------- CONSOLE HISTORY END --------\n", 38); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| #if 0 | #if 0 | ||||||
| @ -270,12 +274,24 @@ static bool dumpCallback(const wchar_t* dump_path, | |||||||
| 		return succeeded; | 		return succeeded; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	fprintf(extra, "-------- CONFIG BEGIN --------"); | ||||||
|  | 	fprintf(extra, "\nMap=%s", crashMap); | ||||||
|  | 	fprintf(extra, "\nGamePath=%s", crashGamePath); | ||||||
|  | 	fprintf(extra, "\nCommandLine=%s", crashCommandLine); | ||||||
|  | 	fprintf(extra, "\nSourceModPath=%s", crashSourceModPath); | ||||||
|  | 	fprintf(extra, "\nGameDirectory=%s", crashGameDirectory); | ||||||
|  | 	fprintf(extra, "\nExtensionVersion=%s", crashExtensionVersion); | ||||||
|  | 	fprintf(extra, "%s", steamInf); | ||||||
|  | 	fprintf(extra, "\n-------- CONFIG END --------\n"); | ||||||
|  | 
 | ||||||
| 	if (GetSpew) { | 	if (GetSpew) { | ||||||
| 		GetSpew(spewBuffer, sizeof(spewBuffer)); | 		GetSpew(spewBuffer, sizeof(spewBuffer)); | ||||||
| 		fprintf(extra, "-------- CONSOLE HISTORY BEGIN --------\n%s-------- CONSOLE HISTORY END --------\n", spewBuffer); | 		if (strlen(spewBuffer) > 0) { | ||||||
|  | 			fprintf(extra, "-------- CONSOLE HISTORY BEGIN --------\n%s-------- CONSOLE HISTORY END --------\n", spewBuffer); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|         fclose(extra); |   fclose(extra); | ||||||
| 
 | 
 | ||||||
| 	return succeeded; | 	return succeeded; | ||||||
| } | } | ||||||
| @ -417,7 +433,7 @@ bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late) | |||||||
| 	if (!gameconfs->LoadGameConfigFile("accelerator.games", &gameconfig, gameconfigError, sizeof(gameconfigError))) { | 	if (!gameconfs->LoadGameConfigFile("accelerator.games", &gameconfig, gameconfigError, sizeof(gameconfigError))) { | ||||||
| 		smutils->LogError(myself, "WARNING: Failed to load gamedata file, console output and command line will not be included in crash reports: %s", gameconfigError); | 		smutils->LogError(myself, "WARNING: Failed to load gamedata file, console output and command line will not be included in crash reports: %s", gameconfigError); | ||||||
| 	} else if (!gameconfig->GetMemSig("GetSpew", (void **)&GetSpew)) { | 	} else if (!gameconfig->GetMemSig("GetSpew", (void **)&GetSpew)) { | ||||||
| 		smutils->LogError(myself, "WARNING: GetSpew not found in gamedata, console output will not be included in crash reports."); | 		smutils->LogMessage(myself, "WARNING: GetSpew not found in gamedata, console output will not be included in crash reports."); | ||||||
| 	} else if (!GetSpew) { | 	} else if (!GetSpew) { | ||||||
| 		smutils->LogError(myself, "WARNING: Sigscan for GetSpew failed, console output will not be included in crash reports."); | 		smutils->LogError(myself, "WARNING: Sigscan for GetSpew failed, console output will not be included in crash reports."); | ||||||
| 	} | 	} | ||||||
| @ -534,5 +550,38 @@ void Accelerator::OnCoreMapStart(edict_t *pEdictList, int edictCount, int client | |||||||
| 	strncpy(crashSourceModPath, g_pSM->GetSourceModPath(), sizeof(crashSourceModPath) - 1); | 	strncpy(crashSourceModPath, g_pSM->GetSourceModPath(), sizeof(crashSourceModPath) - 1); | ||||||
| 	strncpy(crashGameDirectory, g_pSM->GetGameFolderName(), sizeof(crashGameDirectory) - 1); | 	strncpy(crashGameDirectory, g_pSM->GetGameFolderName(), sizeof(crashGameDirectory) - 1); | ||||||
| 	strncpy(crashExtensionVersion, SMEXT_CONF_VERSION, sizeof(crashExtensionVersion) - 1); | 	strncpy(crashExtensionVersion, SMEXT_CONF_VERSION, sizeof(crashExtensionVersion) - 1); | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
|  | 	char steamInfPath[512]; | ||||||
|  | 	g_pSM->BuildPath(Path_Game, steamInfPath, sizeof(steamInfPath), "steam.inf"); | ||||||
|  | 
 | ||||||
|  | 	char steamInfTemp[256] = {0}; | ||||||
|  | 	FILE *f = fopen(steamInfPath, "rb"); | ||||||
|  | 	fread(steamInfTemp, sizeof(char), sizeof(steamInfTemp) - 1, f); | ||||||
|  | 	fclose(f); | ||||||
|  | 
 | ||||||
|  | 	// This is horrible, but I'm busy and this is
 | ||||||
|  | 	// the first thing I thought of that would work.
 | ||||||
|  | 	unsigned source = 0; | ||||||
|  | 	strcat(steamInf, "\nSteam_"); | ||||||
|  | 	unsigned target = strlen(steamInf); | ||||||
|  | 	while (true) { | ||||||
|  | 		if (steamInfTemp[source] == '\0') { | ||||||
|  | 			source++; | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
|  | 		if (steamInfTemp[source] == '\r') { | ||||||
|  | 			source++; | ||||||
|  | 			continue; | ||||||
|  | 		} | ||||||
|  | 		if (steamInfTemp[source] == '\n') { | ||||||
|  | 			source++; | ||||||
|  | 			if (steamInfTemp[source] == '\0') { | ||||||
|  | 				break; | ||||||
|  | 			} | ||||||
|  | 			strcat(steamInf, "\nSteam_"); | ||||||
|  | 			target = strlen(steamInf); | ||||||
|  | 			continue; | ||||||
|  | 		} | ||||||
|  | 		steamInf[target++] = steamInfTemp[source++]; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | |||||||
| @ -18,9 +18,9 @@ | |||||||
| 
 | 
 | ||||||
| #define SM_BUILD_TAG		"-manual" | #define SM_BUILD_TAG		"-manual" | ||||||
| #define SM_BUILD_UNIQUEID	"[MANUAL BUILD]" | #define SM_BUILD_UNIQUEID	"[MANUAL BUILD]" | ||||||
| #define SM_VERSION			"2.2.1" | #define SM_VERSION			"2.3.0" | ||||||
| #define SM_FULL_VERSION		SM_VERSION SM_BUILD_TAG | #define SM_FULL_VERSION		SM_VERSION SM_BUILD_TAG | ||||||
| #define SM_FILE_VERSION		2,2,1,0 | #define SM_FILE_VERSION		2,3,0,0 | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1 +1 @@ | |||||||
| 2.2.1 | 2.3.0 | ||||||
|  | |||||||
| @ -28,7 +28,6 @@ int main(int argc, char *argv[]) | |||||||
| 	// Test shit here.
 | 	// Test shit here.
 | ||||||
| 	__builtin_trap(); | 	__builtin_trap(); | ||||||
| 
 | 
 | ||||||
|         delete handler; | 	delete handler; | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 |  | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user