@@ -221,23 +221,29 @@ HookManager::Pattern pat_shouldTime{
221221
222222#else
223223// #FIXME
224- HookManager::Pattern pat_compileCacheIns{ // 1.88.145.302 profv1 013D40B3
225- " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?xxx????xxxx????xxxxx????xxxxxxxxxxxxxxxxxxxxxxxxx????xxx?????xxxx?x????xxxxxxxxxxxxxxxxxxxxx????xxxxxxxxxxxxxxxxx" sv,
226- " \x48\x89\x45\xB0\x8B\x43\x10\x89\x45\xB8\x48\x8B\x43\x18\x48\x85\xC0\x74\x03\xF0\xFF\x00\x48\x89\x45\xC0\x8B\x43\x20\x48\x8D\x54\x24\x00\x48\x8D\x0D\x00\x00\x00\x00\x89\x45\xC8\xE8\x00\x00\x00\x00\x48\x8D\x4D\xA8\xE8\x00\x00\x00\x00\x48\x8B\x4D\xA0\x48\x85\xC9\x74\x1C\x41\x8B\xC7\xF0\x0F\xC1\x01\xFF\xC8\x75\x09\x48\x8B\x4D\xA0\xE8\x00\x00\x00\x00\x48\xC7\x45\x00\x00\x00\x00\x00\x48\x8D\x4C\x24\x00\xE8\x00\x00\x00\x00\x4D\x85\xE4\x74\x1D\x41\x8B\xC7\xF0\x41\x0F\xC1\x04\x24\xFF\xC8\x75\x10\x48\x8B\x0D\x00\x00\x00\x00\x49\x8B\xD4\x48\x8B\x01\xFF\x50\x18\x4D\x85\xF6\x74\x1C\x41\x8B\xC7 " sv
227- };
224+ // HookManager::Pattern pat_compileCacheIns{ //1.88.145.302 profv1 013D40B3
225+ // "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?xxx????xxxx????xxxxx????xxxxxxxxxxxxxxxxxxxxxxxxx????xxx?????xxxx?x????xxxxxxxxxxxxxxxxxxxxx????xxxxxxxxxxxxxxxxx"sv,
226+ // "\x48\x89\x45\xB0\x8B\x43\x10\x89\x45\xB8\x48\x8B\x43\x18\x48\x85\xC0\x74\x03\xF0\xFF\x00\x48\x89\x45\xC0\x8B\x43\x20\x48\x8D\x54\x24\x00\x48\x8D\x0D\x00\x00\x00\x00\x89\x45\xC8\xE8\x00\x00\x00\x00\x48\x8D\x4D\xA8\xE8\x00\x00\x00\x00\x48\x8B\x4D\xA0\x48\x85\xC9\x74\x1C\x41\x8B\xC7\xF0\x0F\xC1\x01\xFF\xC8\x75\x09\x48\x8B\x4D\xA0\xE8\x00\x00\x00\x00\x48\xC7\x45\x00\x00\x00\x00\x00\x48\x8D\x4C\x24\x00\xE8\x00\x00\x00\x00\x4D\x85\xE4\x74\x1D\x41\x8B\xC7\xF0\x41\x0F\xC1\x04\x24\xFF\xC8\x75\x10\x48\x8B\x0D\x00\x00\x00\x00\x49\x8B\xD4\x48\x8B\x01\xFF\x50\x18\x4D\x85\xF6\x74\x1C\x41\x8B\xC7"sv
227+ // };
228228
229229
230230HookManager::Pattern pat_frameEnd{
231- " xxxxxxxxxxxxxxxxxxxxxxxxx ????xxxxxxxxxxxxxxxxxxxxxxxxxxxx ????? xxxxxx????x ????xxxxxxxxx ????xx ????xxxx?xxxxxxxxx ????xx ????xx ?????x?? ??" sv,
232- " \x48\x8B\xC4\x44\x89\x48\x20\ x56\x57\x41\x57\x48\x83 \xEC\x70\x48\x89\x58\x10\ x48\x8B\xF1\x0F\xB6\x99\ x00\x00\x00\x00\x48\x89\x68\xE0\x4C\ x89\x70\xC8\x45\ x8B\xF1\ x0F\x29\x78\xA8\ x0F\x28\xFA\x8B\ x41\x6C\x8B\x69\x68\x3B\xC5\xC6\x81\x00\x00\x00\x00\x00\x0F\x4E\xE8\x89\xAC\x24\ x00\x00\x00\x00\xE8\ x00\x00\x00\x00\x45\x33\xFF\x4C\x39\x7E\x60\x0F \x84\x00\x00\x00\x00\x8B\x86\ x00\x00\x00\x00\x4C\x89\x64\x24\x00\x85\xC0\x7E\x1B\x83\xE8\x01\x89\x86\x00\x00\x00\x00\x0F\x85 \x00\x00\x00\x00\xC6\x86\x00 \x00\x00\x00\x00\xE9\x00\x00 \x00\x00 " sv
231+ " xxxxxxxx ????xxx ????xxxxxx????xxxxxxxxxx ????xxxxxxxxxxxxxxxxxxxxxxxxxxxx ????xxx ????xxx? ???xxx? ???xxx? ???xxxxxxxxxxxxxxxxxxxx?xxxxxx?xxxxxxxxxxxxx ??" sv,
232+ " \x40\ x56\x57\x41\x57\x48\x81 \xEC\x00\x00\x00\x00\ x48\x8B\x81\ x00\x00\x00\x00\x48\x8B\xF9\x48\ x89\x81\x00\x00\x00\x00\ x8B\x41\x1C\x39\x41\x28\ x0F\x29\xB4\x24\x00\x00\x00\x00\ x0F\x28\xF1\x0F\x4E\ x41\x28\x33\xF6\x4C\x63\xF8\x85\xC0\x7E\x64\x8B\xD6\x4D\x8B\xC7\x48\x8B\x4F\x20\x48\x8D\x92\ x00\x00\x00\x00\x8B\x84\x0A\ x00\x00\x00\x00\x89\x84\x0A\x00\x00\x00\x00\x8B \x84\x0A\ x00\x00\x00\x00\x89\x84\x0A\ x00\x00\x00\x00\x49\x83\xE8\x01\x75\xD3\x48\x8B\xCE\x4D\x8B\xC7\x48\x8B\x57\x20\x40\x38\x74\x11 \x00\x75\x14\x40\x38\x74\x11 \x00\x75\x0D\x8B\x44\x11\x30\x85\xC0\x74\x05\xC6\x44\x11 \x00\x00 " sv
233233};
234234
235- // Just some scope start, so we can find the boss man
236- HookManager::Pattern pat_aScopeStart {
237- " xxxxxxxxx? ????xxxxxxxxxxxxxxxxxxxxxx? ???xxx????xxx????xxx????xxx????xxx????xxxxxx????xxxxx???? x????xx????xx?????xxx????xxxx????xxxxxx?xx?????xxxxxxxx?xxxxx????xxxxxxxx????xx????xx " sv,
238- " \x48\x8B\xC4\ x48\x83\xEC\x68 \x80\x3D\x00 \x00\x00\x00\x00\ x48\x89\x58\x10\x48\x89\x68\x18\x48\ x8B\xE9\x48\x89\x78\xF0\x4C\x89\x70\xE8\x4C\x8D\x35\ x00\x00\x00\x00\x75\x46\xE8\x00\x00\x00\x00\ x48\x8D\x15\x00\x00\x00\x00\x4C\x89\x35\ x00\x00\x00\x00\x4C\x8D\x05\ x00\x00\x00\x00\ x48\x89\x15\x00\x00\x00\x00\x44\x8B\xC8\x4C\x89\ x05\x00\x00\x00\x00\x49\x8B\xCE\x89\x05\x00\x00\x00\x00\ xE8\x00\x00\x00\x00\x89\x05\x00\x00\x00\x00\xC6\x05\x00\x00\x00\x00\x00\ x48\x8D\x1D \x00\x00\x00\x00\x48\x8B\xCB\xE8\x00\x00\x00\x00\x33\xFF\ x48\x89\x5C\x24\x00\x83\x3D\x00\x00\x00\x00\x00\x88\ x44\x24\x40\x48\x89\x7C\x24\ x00\x74\x45\x40\x38\x3D\ x00\x00\x00\x00\x75\x12\x84\xC0\x74\x38\xFF\x15\x00\x00\x00\x00\x39\x05\x00\x00\x00\x00\x75\x2A , " sv
235+ // This is destructor of a scope. Whereas scopeCompleted is what the destructor calls
236+ HookManager::Pattern pat_doEnd {
237+ " xxxx?xxxxxxxxxxxxxxxx ?????xxxxxxxxxx ?????xxxxxxxxxxxxxx????xxxxxxxxxxxxx????xxxxxxxxxxx? x????" sv,
238+ " \x48\x89\x5C\x24\x00\x57\ x48\x83\xEC\x30 \x80\x79\x11 \x00\x48\x8B\xD9\x75\x0F\x80\x3D\x00\ x00\x00\x00\x00\x75\x06\ x48\x8D\x79\x18\xEB\x3B\x80\x3D\ x00\x00\x00\x00\x00\x74\x0B\x0F\x31\ x48\xC1\xE2\x20\x48\x0B\xC2\xEB\ x05\xE8\x00\x00\x00\x00\x48\x8B\x13\x48\x8D\x7B\x18\x4C\x8B\xC0\ x48\x8D\x0D \x00\x00\x00\x00\x48\x8B\x43\x08\x4C\x8B\xCF\ x48\x89\x44\x24\x00\xE8\ x00\x00\x00\x00 " sv
239239};
240240
241+ // Just some scope start, so we can find the boss man
242+ // HookManager::Pattern pat_aScopeStart{
243+ // "xxxxxxxxx?????xxxxxxxxxxxxxxxxxxxxxx????xxx????xxx????xxx????xxx????xxx????xxxxxx????xxxxx????x????xx????xx?????xxx????xxxx????xxxxxx?xx?????xxxxxxxx?xxxxx????xxxxxxxx????xx????xx"sv,
244+ // "\x48\x8B\xC4\x48\x83\xEC\x68\x80\x3D\x00\x00\x00\x00\x00\x48\x89\x58\x10\x48\x89\x68\x18\x48\x8B\xE9\x48\x89\x78\xF0\x4C\x89\x70\xE8\x4C\x8D\x35\x00\x00\x00\x00\x75\x46\xE8\x00\x00\x00\x00\x48\x8D\x15\x00\x00\x00\x00\x4C\x89\x35\x00\x00\x00\x00\x4C\x8D\x05\x00\x00\x00\x00\x48\x89\x15\x00\x00\x00\x00\x44\x8B\xC8\x4C\x89\x05\x00\x00\x00\x00\x49\x8B\xCE\x89\x05\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x89\x05\x00\x00\x00\x00\xC6\x05\x00\x00\x00\x00\x00\x48\x8D\x1D\x00\x00\x00\x00\x48\x8B\xCB\xE8\x00\x00\x00\x00\x33\xFF\x48\x89\x5C\x24\x00\x83\x3D\x00\x00\x00\x00\x00\x88\x44\x24\x40\x48\x89\x7C\x24\x00\x74\x45\x40\x38\x3D\x00\x00\x00\x00\x75\x12\x84\xC0\x74\x38\xFF\x15\x00\x00\x00\x00\x39\x05\x00\x00\x00\x00\x75\x2A, "sv
245+ // };
246+
241247HookManager::Pattern pat_scopeCompleted{
242248 " xxxxxxxxxxxxxxxx????xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?xxxxxxxxx????xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx????xxx????xxxxxx????" sv,
243249 " \x40\x53\x56\x41\x54\x41\x55\x41\x57\x48\x83\xEC\x20\x48\x8B\x81\x00\x00\x00\x00\x49\x8B\xF0\x48\x3B\xD0\x4D\x8B\xE9\x48\x8B\xD9\x48\x0F\x4C\xD0\x48\xC1\xF8\x04\x48\xC1\xFA\x04\x48\xC1\xFE\x04\x44\x8B\xE2\x44\x2B\xE0\x2B\xF2\x48\x8B\x44\x24\x00\x4C\x63\x78\x18\x45\x85\xFF\x0F\x88\x00\x00\x00\x00\x8B\x41\x68\x8B\xC8\xD1\xF9\x66\x0F\x6E\xC6\x0F\x5B\xC0\x66\x0F\x6E\xD0\x8B\x43\x6C\x2B\xC1\x0F\x5B\xD2\x66\x0F\x6E\xC8\x42\x8D\x04\x26\xF3\x0F\x59\xD0\x66\x0F\x6E\xC0\x0F\x5B\xC0\x0F\x5B\xC9\xF3\x0F\x59\xC8\x0F\x2F\xD1\x73\x3C\x80\x3B\x00\x0F\x84\x00\x00\x00\x00\x49\x69\xD7\x00\x00\x00\x00\x48\x03\x53\x20\x0F\x84\x00\x00\x00\x00 " sv
@@ -378,22 +384,29 @@ void EngineProfiling::init() {
378384#ifdef __linux__
379385 auto found = hooks.findPattern (pat_doEnd, 0 );
380386
381- auto stuffByte = found + 0x2A ;
382- uint32_t base = *reinterpret_cast <uint32_t *>(stuffByte);
387+ if (found)
388+ {
389+ auto stuffByte = found + 0x2A ;
390+ uint32_t base = *reinterpret_cast <uint32_t *>(stuffByte);
383391#else
384- auto found = hooks.findPattern (pat_aScopeStart, 0x21 );
392+ auto found = hooks.findPattern (pat_doEnd, 0x45 );
385393
386- // lea r14, bossman
394+ if (found)
395+ {
396+ // lea r14, bossman
387397
388- uint64_t afterInstruction = found + 7 ;
389- uint32_t offs = *reinterpret_cast <uint32_t *>(found + 0x3 );
390- uint64_t addr = afterInstruction + offs;
391- uint64_t base = addr;
398+ uint64_t afterInstruction = found + 7 ;
399+ uint32_t offs = *reinterpret_cast <uint32_t *>(found + 0x3 );
400+ uint64_t addr = afterInstruction + offs;
401+ uint64_t base = addr;
392402#endif
393- armaP = reinterpret_cast <ArmaProf*>(base);
394- armaP->slowFrameScopeFilter .clear ();
395- armaP->forceCapture = true ;
396- armaP->capture = true ;
403+ armaP = reinterpret_cast <ArmaProf*>(base);
404+ armaP->slowFrameScopeFilter .clear ();
405+ armaP->forceCapture = true ;
406+ armaP->capture = true ;
407+ }
408+
409+
397410 // disable captureSlowFrame because it can set forceCapture to false
398411#ifndef _DEBUG
399412 static auto stuff = intercept::client::host::register_sqf_command (" diag_captureSlowFrame" sv, " " sv, [](game_state&, game_value_parameter) -> game_value
0 commit comments