Dont break old versions with new gamedata
This commit is contained in:
		
							parent
							
								
									0c294e9e95
								
							
						
					
					
						commit
						9a93124207
					
				| @ -53,24 +53,6 @@ | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	"csgo" |  | ||||||
| 	{ |  | ||||||
| 		"Signatures" |  | ||||||
| 		{ |  | ||||||
| 			"GetSpew" |  | ||||||
| 			{ |  | ||||||
| 				"library" "engine" |  | ||||||
| 				"windows" "\x55\x8B\xEC\x51\x53\x56\x57\x8B\xFA\x8B\xD9" |  | ||||||
| 				"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\x8B\x5D\x08\xE8\x2A\x2A\x2A\x2A\x89\xC2\xA1\x2A\x2A\x2A\x2A" |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		 |  | ||||||
| 		"Keys" |  | ||||||
| 		{ |  | ||||||
| 			"UseFastcall"	"yes" |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	"hl2mp" | 	"hl2mp" | ||||||
| 	{ | 	{ | ||||||
| 		"Signatures" | 		"Signatures" | ||||||
| @ -94,4 +76,27 @@ | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	"csgo" | ||||||
|  | 	{ | ||||||
|  | 		"Keys" | ||||||
|  | 		{ | ||||||
|  | 			"UseFastcall"	"yes" | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		"Signatures" | ||||||
|  | 		{ | ||||||
|  | 			"GetSpew" | ||||||
|  | 			{ | ||||||
|  | 				"library" "engine" | ||||||
|  | 				"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\x8B\x5D\x08\xE8\x2A\x2A\x2A\x2A\x89\xC2\xA1\x2A\x2A\x2A\x2A" | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			"GetSpewFastcall" | ||||||
|  | 			{ | ||||||
|  | 				"library" "engine" | ||||||
|  | 				"windows" "\x55\x8B\xEC\x51\x53\x56\x57\x8B\xFA\x8B\xD9" | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  | |||||||
| @ -46,8 +46,8 @@ IGameConfig *gameconfig; | |||||||
| typedef void (*GetSpew_t)(char *buffer, unsigned int length); | typedef void (*GetSpew_t)(char *buffer, unsigned int length); | ||||||
| GetSpew_t GetSpew; | GetSpew_t GetSpew; | ||||||
| #if defined _WINDOWS | #if defined _WINDOWS | ||||||
| typedef void(__fastcall *GetSpewf_t)(char *buffer, unsigned int length); | typedef void(__fastcall *GetSpewFastcall_t)(char *buffer, unsigned int length); | ||||||
| GetSpewf_t GetSpewf; | GetSpewFastcall_t GetSpewFastcall; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| char spewBuffer[65536]; // Hi.
 | char spewBuffer[65536]; // Hi.
 | ||||||
| @ -135,6 +135,7 @@ static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, | |||||||
| 
 | 
 | ||||||
| 	if (GetSpew) { | 	if (GetSpew) { | ||||||
| 		GetSpew(spewBuffer, sizeof(spewBuffer)); | 		GetSpew(spewBuffer, sizeof(spewBuffer)); | ||||||
|  | 
 | ||||||
| 		if (my_strlen(spewBuffer) > 0) { | 		if (my_strlen(spewBuffer) > 0) { | ||||||
| 			sys_write(extra, "-------- CONSOLE HISTORY BEGIN --------\n", 40); | 			sys_write(extra, "-------- CONSOLE HISTORY BEGIN --------\n", 40); | ||||||
| 			sys_write(extra, spewBuffer, my_strlen(spewBuffer)); | 			sys_write(extra, spewBuffer, my_strlen(spewBuffer)); | ||||||
| @ -290,18 +291,19 @@ static bool dumpCallback(const wchar_t* dump_path, | |||||||
| 	fprintf(extra, "%s", steamInf); | 	fprintf(extra, "%s", steamInf); | ||||||
| 	fprintf(extra, "\n-------- CONFIG END --------\n"); | 	fprintf(extra, "\n-------- CONFIG END --------\n"); | ||||||
| 
 | 
 | ||||||
| 	if (GetSpew || GetSpewf) { | 	if (GetSpew || GetSpewFastcall) { | ||||||
| 		if (GetSpew) | 		if (GetSpew) { | ||||||
| 			GetSpew(spewBuffer, sizeof(spewBuffer)); | 			GetSpew(spewBuffer, sizeof(spewBuffer)); | ||||||
| 		else if (GetSpewf) | 		} else if (GetSpewFastcall) { | ||||||
| 			GetSpewf(spewBuffer, sizeof(spewBuffer)); | 			GetSpewFastcall(spewBuffer, sizeof(spewBuffer)); | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
| 		if (strlen(spewBuffer) > 0) { | 		if (strlen(spewBuffer) > 0) { | ||||||
| 			fprintf(extra, "-------- CONSOLE HISTORY BEGIN --------\n%s-------- CONSOLE HISTORY END --------\n", spewBuffer); | 			fprintf(extra, "-------- CONSOLE HISTORY BEGIN --------\n%s-------- CONSOLE HISTORY END --------\n", spewBuffer); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|   fclose(extra); | 	fclose(extra); | ||||||
| 
 | 
 | ||||||
| 	return succeeded; | 	return succeeded; | ||||||
| } | } | ||||||
| @ -476,24 +478,43 @@ bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late) | |||||||
| 
 | 
 | ||||||
| 	threader->MakeThread(&uploadThread); | 	threader->MakeThread(&uploadThread); | ||||||
| 
 | 
 | ||||||
| 	char gameconfigError[256]; | 	do { | ||||||
| 	if (!gameconfs->LoadGameConfigFile("accelerator.games", &gameconfig, gameconfigError, sizeof(gameconfigError))) { | 		char gameconfigError[256]; | ||||||
| 		smutils->LogMessage(myself, "WARNING: Failed to load gamedata file, console output and command line will not be included in crash reports: %s", gameconfigError); | 		if (!gameconfs->LoadGameConfigFile("accelerator.games", &gameconfig, gameconfigError, sizeof(gameconfigError))) { | ||||||
| 	} else if (!gameconfig->GetMemSig("GetSpew", (void **)&GetSpew)) { | 			smutils->LogMessage(myself, "WARNING: Failed to load gamedata file, console output and command line will not be included in crash reports: %s", gameconfigError); | ||||||
| 		smutils->LogMessage(myself, "WARNING: GetSpew not found in gamedata, console output will not be included in crash reports."); | 			break; | ||||||
| 	} else if (!GetSpew) { | 		} | ||||||
| 		smutils->LogMessage(myself, "WARNING: Sigscan for GetSpew failed, console output will not be included in crash reports."); | 
 | ||||||
| 	} | 		bool useFastcall = false; | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| #if defined _WINDOWS | #if defined _WINDOWS | ||||||
| 	const char *fastcall = gameconfig->GetKeyValue("UseFastcall"); | 		const char *fastcall = gameconfig->GetKeyValue("UseFastcall"); | ||||||
| 	if (fastcall && !strcmp(fastcall, "yes")) | 		if (fastcall && strcmp(fastcall, "yes") == 0) { | ||||||
| 	{ | 			useFastcall = true; | ||||||
| 		GetSpewf = (GetSpewf_t)GetSpew; | 		} | ||||||
| 		GetSpew = nullptr; | 
 | ||||||
| 	} | 		if (useFastcall && !gameconfig->GetMemSig("GetSpewFastcall", (void **)&GetSpewFastcall)) { | ||||||
|  | 			smutils->LogMessage(myself, "WARNING: GetSpewFastcall not found in gamedata, console output will not be included in crash reports."); | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | 		if (!useFastcall && !gameconfig->GetMemSig("GetSpew", (void **)&GetSpew)) { | ||||||
|  | 			smutils->LogMessage(myself, "WARNING: GetSpew not found in gamedata, console output will not be included in crash reports."); | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		if (!GetSpew | ||||||
|  | #if defined _WINDOWS | ||||||
|  | 			&& !GetSpewFastcall | ||||||
|  | #endif | ||||||
|  | 		) { | ||||||
|  | 			smutils->LogMessage(myself, "WARNING: Sigscan for GetSpew failed, console output will not be included in crash reports."); | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
|  | 	} while(false); | ||||||
|  | 
 | ||||||
| #if defined _LINUX | #if defined _LINUX | ||||||
| 	google_breakpad::MinidumpDescriptor descriptor(dumpStoragePath); | 	google_breakpad::MinidumpDescriptor descriptor(dumpStoragePath); | ||||||
| 	handler = new google_breakpad::ExceptionHandler(descriptor, NULL, dumpCallback, NULL, true, -1); | 	handler = new google_breakpad::ExceptionHandler(descriptor, NULL, dumpCallback, NULL, true, -1); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user