File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,7 +85,9 @@ void ScoreCode::Patch() {
8585 fill_nop (m_pL4DStats + OP_JMP_SIZE, sizeof (AddSurvivorStats_orig) - OP_JMP_SIZE);
8686
8787 // prepare the trampoline
88- m_injectCompl = (unsigned char *)sengine->AllocatePageMemory (sizeof (GetVersusCompletion_patch) + OP_JMP_SIZE);
88+ // patch size: (division code size) + (original MOV (A1) to EAX) + (original short MOV (89)) + (JMP back)
89+ size_t compl_patch_size = sizeof (GetVersusCompletion_patch) + OP_MOV_SIZE + 3 + OP_JMP_SIZE;
90+ m_injectCompl = (unsigned char *)sengine->AllocatePageMemory (compl_patch_size);
8991 unsigned char *pInjectEnd = m_injectCompl;
9092 copy_bytes (GetVersusCompletion_patch, m_injectCompl, sizeof (GetVersusCompletion_patch)); pInjectEnd += sizeof (GetVersusCompletion_patch);
9193 copy_bytes (m_pCompletion + 3 , pInjectEnd, OP_MOV_SIZE); pInjectEnd += OP_MOV_SIZE;
@@ -110,4 +112,4 @@ void ScoreCode::Unpatch() {
110112 if (m_injectCompl) { copy_bytes (m_pCompletion, GetVersusCompletion_orig, sizeof (GetVersusCompletion_orig)); sengine->FreePageMemory (m_injectCompl); }
111113
112114 m_isPatched = false ;
113- }
115+ }
You can’t perform that action at this time.
0 commit comments