Fix linux build

This commit is contained in:
Peace-Maker 2018-01-27 17:24:02 +01:00
parent aa3018a27d
commit b365b775c9
4 changed files with 18 additions and 17 deletions

View File

@ -193,9 +193,9 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
else if(!twoByte) else if(!twoByte)
{ {
if((opcode & 0xC4) == 0x00 || if((opcode & 0xC4) == 0x00 ||
(opcode & 0xF4) == 0x60 && ((opcode & 0x0A) == 0x02 || (opcode & 0x09) == 0x09) || ((opcode & 0xF4) == 0x60 && ((opcode & 0x0A) == 0x02 || (opcode & 0x09) == 0x09)) ||
(opcode & 0xF0) == 0x80 || (opcode & 0xF0) == 0x80 ||
(opcode & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02 || ((opcode & 0xF8) == 0xC0 && (opcode & 0x0E) != 0x02) ||
(opcode & 0xFC) == 0xD0 || (opcode & 0xFC) == 0xD0 ||
(opcode & 0xF6) == 0xF6) (opcode & 0xF6) == 0xF6)
{ {
@ -206,11 +206,11 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
} }
else else
{ {
if((opcode & 0xF0) == 0x00 && (opcode & 0x0F) >= 0x04 && (opcode & 0x0D) != 0x0D || if(((opcode & 0xF0) == 0x00 && (opcode & 0x0F) >= 0x04 && (opcode & 0x0D) != 0x0D) ||
(opcode & 0xF0) == 0x30 || (opcode & 0xF0) == 0x30 ||
opcode == 0x77 || opcode == 0x77 ||
(opcode & 0xF0) == 0x80 || (opcode & 0xF0) == 0x80 ||
(opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02 || ((opcode & 0xF0) == 0xA0 && (opcode & 0x07) <= 0x02) ||
(opcode & 0xF8) == 0xC8) (opcode & 0xF8) == 0xC8)
{ {
// No mod R/M byte // No mod R/M byte
@ -286,7 +286,7 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
(opcode & 0xFE) == 0xD4 || // AAD/AAM (opcode & 0xFE) == 0xD4 || // AAD/AAM
(opcode & 0xF8) == 0xE0 || // LOOP/JCXZ (opcode & 0xF8) == 0xE0 || // LOOP/JCXZ
opcode == 0xEB || opcode == 0xEB ||
opcode == 0xF6 && (modRM & 0x30) == 0x00) // TEST (opcode == 0xF6 && (modRM & 0x30) == 0x00)) // TEST
{ {
if (dest) if (dest)
*dest++ = *func++; *dest++ = *func++;
@ -311,7 +311,7 @@ int copy_bytes(unsigned char *func, unsigned char* dest, int required_len) {
(opcode & 0xFC) == 0xA0 || (opcode & 0xFC) == 0xA0 ||
(opcode & 0xEE) == 0xA8 || (opcode & 0xEE) == 0xA8 ||
opcode == 0xC7 || opcode == 0xC7 ||
opcode == 0xF7 && (modRM & 0x30) == 0x00) (opcode == 0xF7 && (modRM & 0x30) == 0x00))
{ {
if (dest) { if (dest) {
//Fix CALL/JMP offset //Fix CALL/JMP offset
@ -406,7 +406,7 @@ void* eval_jump(void* src) {
else if (addr[0] == OP_JMP_BYTE) { else if (addr[0] == OP_JMP_BYTE) {
addr = &addr[OP_JMP_BYTE_SIZE] + *(char*)&addr[1]; addr = &addr[OP_JMP_BYTE_SIZE] + *(char*)&addr[1];
//mangled 32bit jump? //mangled 32bit jump?
if (addr[0] = OP_JMP) { if (addr[0] == OP_JMP) {
addr = addr + *(int*)&addr[1]; addr = addr + *(int*)&addr[1];
} }
return addr; return addr;

View File

@ -95,7 +95,8 @@ CHook::~CHook()
copy_bytes((unsigned char *) m_pTrampoline, (unsigned char *) m_pFunc, JMP_SIZE); copy_bytes((unsigned char *) m_pTrampoline, (unsigned char *) m_pFunc, JMP_SIZE);
// Free the trampoline array // Free the trampoline array
delete [] m_pTrampoline; unsigned char* pTrampoline = (unsigned char *)m_pTrampoline;
delete [] pTrampoline;
// Free the asm bridge and new return address // Free the asm bridge and new return address
smutils->GetScriptingEngine()->FreePageMemory(m_pBridge); smutils->GetScriptingEngine()->FreePageMemory(m_pBridge);

View File

@ -266,7 +266,7 @@ ReturnAction_t HandleDetour(HookType_t hookType, CHook* pDetour)
int argNum = pDetour->m_pCallingConvention->m_vecArgTypes.length(); int argNum = pDetour->m_pCallingConvention->m_vecArgTypes.length();
ReturnAction_t finalRet = ReturnAction_Ignored; ReturnAction_t finalRet = ReturnAction_Ignored;
ke::AutoPtr<void> finalRetBuf(new uint8_t[pDetour->m_pCallingConvention->m_returnType.size]); ke::AutoPtr<uint8_t> finalRetBuf(new uint8_t[pDetour->m_pCallingConvention->m_returnType.size]);
// Call all the plugin functions.. // Call all the plugin functions..
for (size_t i = 0; i < wrappers->length(); i++) for (size_t i = 0; i < wrappers->length(); i++)
@ -274,7 +274,7 @@ ReturnAction_t HandleDetour(HookType_t hookType, CHook* pDetour)
CDynamicHooksSourcePawn *pWrapper = wrappers->at(i); CDynamicHooksSourcePawn *pWrapper = wrappers->at(i);
IPluginFunction *pCallback = pWrapper->plugin_callback; IPluginFunction *pCallback = pWrapper->plugin_callback;
ReturnAction_t tempRet = ReturnAction_Ignored; ReturnAction_t tempRet = ReturnAction_Ignored;
ke::AutoPtr<void> tempRetBuf(new uint8_t[pDetour->m_pCallingConvention->m_returnType.size]); ke::AutoPtr<uint8_t> tempRetBuf(new uint8_t[pDetour->m_pCallingConvention->m_returnType.size]);
// Find the this pointer. // Find the this pointer.
if (pWrapper->callConv == CallConv_THISCALL && pWrapper->thisType != ThisPointer_Ignore) if (pWrapper->callConv == CallConv_THISCALL && pWrapper->thisType != ThisPointer_Ignore)
@ -349,7 +349,7 @@ ReturnAction_t HandleDetour(HookType_t hookType, CHook* pDetour)
{ {
if (pWrapper->returnType == ReturnType_String || pWrapper->returnType == ReturnType_Int || pWrapper->returnType == ReturnType_Bool) if (pWrapper->returnType == ReturnType_String || pWrapper->returnType == ReturnType_Int || pWrapper->returnType == ReturnType_Bool)
{ {
tempRetBuf = *(void **)returnStruct->newResult; tempRetBuf = *(uint8_t **)returnStruct->newResult;
} }
else if (pWrapper->returnType == ReturnType_Float) else if (pWrapper->returnType == ReturnType_Float)
{ {
@ -357,7 +357,7 @@ ReturnAction_t HandleDetour(HookType_t hookType, CHook* pDetour)
} }
else else
{ {
tempRetBuf = returnStruct->newResult; tempRetBuf = (uint8_t *)returnStruct->newResult;
} }
} }
else //Throw an error if no override was set else //Throw an error if no override was set
@ -378,7 +378,7 @@ ReturnAction_t HandleDetour(HookType_t hookType, CHook* pDetour)
tempRet = ReturnAction_Override; tempRet = ReturnAction_Override;
if (pWrapper->returnType == ReturnType_String || pWrapper->returnType == ReturnType_Int || pWrapper->returnType == ReturnType_Bool) if (pWrapper->returnType == ReturnType_String || pWrapper->returnType == ReturnType_Int || pWrapper->returnType == ReturnType_Bool)
{ {
tempRetBuf = *(void **)returnStruct->newResult; tempRetBuf = *(uint8_t **)returnStruct->newResult;
} }
else if (pWrapper->returnType == ReturnType_Float) else if (pWrapper->returnType == ReturnType_Float)
{ {
@ -386,7 +386,7 @@ ReturnAction_t HandleDetour(HookType_t hookType, CHook* pDetour)
} }
else else
{ {
tempRetBuf = returnStruct->newResult; tempRetBuf = (uint8_t *)returnStruct->newResult;
} }
} }
else //Throw an error if no override was set else //Throw an error if no override was set
@ -404,7 +404,7 @@ ReturnAction_t HandleDetour(HookType_t hookType, CHook* pDetour)
tempRet = ReturnAction_Supercede; tempRet = ReturnAction_Supercede;
if (pWrapper->returnType == ReturnType_String || pWrapper->returnType == ReturnType_Int || pWrapper->returnType == ReturnType_Bool) if (pWrapper->returnType == ReturnType_String || pWrapper->returnType == ReturnType_Int || pWrapper->returnType == ReturnType_Bool)
{ {
tempRetBuf = *(void **)returnStruct->newResult; tempRetBuf = *(uint8_t **)returnStruct->newResult;
} }
else if (pWrapper->returnType == ReturnType_Float) else if (pWrapper->returnType == ReturnType_Float)
{ {
@ -412,7 +412,7 @@ ReturnAction_t HandleDetour(HookType_t hookType, CHook* pDetour)
} }
else else
{ {
tempRetBuf = returnStruct->newResult; tempRetBuf = (uint8_t *)returnStruct->newResult;
} }
} }
else //Throw an error if no override was set else //Throw an error if no override was set

View File

@ -270,7 +270,7 @@ SMCResult SignatureGameConfig::ReadSMC_KeyValue(const SMCStates *states, const c
} }
else if (!strcmp(key, "flags")) else if (!strcmp(key, "flags"))
{ {
size_t flags; size_t flags = 0;
if (strstr(value, "byval")) if (strstr(value, "byval"))
flags |= PASSFLAG_BYVAL; flags |= PASSFLAG_BYVAL;
else if (strstr(value, "byref")) else if (strstr(value, "byref"))