Fix CS:GO GetSpew support

GetSpew is implemented in the current engine, but uses the fastcall calling convention on windows now.

Add gamedata for CS:GO back in as well as a "UseFastcall" key to indicate the calling convention for the GetSpew call.
This commit is contained in:
Peace-Maker 2017-09-12 22:10:10 +02:00 committed by Asher Baker
parent 8056b5c1a1
commit 0c294e9e95
2 changed files with 37 additions and 2 deletions

View File

@ -52,6 +52,24 @@
}
}
}
"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"
{

View File

@ -45,6 +45,10 @@ IGameConfig *gameconfig;
typedef void (*GetSpew_t)(char *buffer, unsigned int length);
GetSpew_t GetSpew;
#if defined _WINDOWS
typedef void(__fastcall *GetSpewf_t)(char *buffer, unsigned int length);
GetSpewf_t GetSpewf;
#endif
char spewBuffer[65536]; // Hi.
@ -286,8 +290,12 @@ static bool dumpCallback(const wchar_t* dump_path,
fprintf(extra, "%s", steamInf);
fprintf(extra, "\n-------- CONFIG END --------\n");
if (GetSpew) {
GetSpew(spewBuffer, sizeof(spewBuffer));
if (GetSpew || GetSpewf) {
if (GetSpew)
GetSpew(spewBuffer, sizeof(spewBuffer));
else if (GetSpewf)
GetSpewf(spewBuffer, sizeof(spewBuffer));
if (strlen(spewBuffer) > 0) {
fprintf(extra, "-------- CONSOLE HISTORY BEGIN --------\n%s-------- CONSOLE HISTORY END --------\n", spewBuffer);
}
@ -477,6 +485,15 @@ bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late)
smutils->LogMessage(myself, "WARNING: Sigscan for GetSpew failed, console output will not be included in crash reports.");
}
#if defined _WINDOWS
const char *fastcall = gameconfig->GetKeyValue("UseFastcall");
if (fastcall && !strcmp(fastcall, "yes"))
{
GetSpewf = (GetSpewf_t)GetSpew;
GetSpew = nullptr;
}
#endif
#if defined _LINUX
google_breakpad::MinidumpDescriptor descriptor(dumpStoragePath);
handler = new google_breakpad::ExceptionHandler(descriptor, NULL, dumpCallback, NULL, true, -1);