Fix saving arguments in custom registers in combination with arguments on the stack

If a function was optimized to only pass one parameter in a register, but still pass other parameters on the stack, save the registers at the correct offset in the buffer.
This commit is contained in:
Peace-Maker 2018-01-23 13:39:37 +01:00
parent 38aca973db
commit 02e0545d75

View File

@ -599,8 +599,9 @@ HookParamsStruct *CDynamicHooksSourcePawn::GetParamStruct()
continue;
int size = argTypes[i].size;
void *paramAddr = (void *)((intptr_t)params->orgParams + offset);
void *regAddr = callingConvention->GetArgumentPtr(i + firstArg, m_pDetour->m_pRegisters);
memcpy(params->orgParams + offset, regAddr, size);
memcpy(paramAddr, regAddr, size);
offset += size;
}