From 97c3cdf304fadcf4a80efea78d7c56109b31c491 Mon Sep 17 00:00:00 2001 From: Dr!fter Date: Sun, 26 Jun 2016 13:00:27 -0400 Subject: [PATCH] Change Vector classname to SDKVector. --- natives.cpp | 38 +++++++++++++++++++------------------- sdk-hacks.h | 6 +++--- vfunc_call.h | 12 ++++++------ vhook.cpp | 34 +++++++++++++++++----------------- vhook.h | 12 ++++++------ 5 files changed, 51 insertions(+), 51 deletions(-) diff --git a/natives.cpp b/natives.cpp index 0aa95ef..6b103f1 100644 --- a/natives.cpp +++ b/natives.cpp @@ -439,9 +439,9 @@ cell_t Native_GetParamVector(IPluginContext *pContext, const cell_t *params) { cell_t *buffer; pContext->LocalToPhysAddr(params[3], &buffer); - buffer[0] = sp_ftoc(((Vector *)paramStruct->orgParams[index])->x); - buffer[1] = sp_ftoc(((Vector *)paramStruct->orgParams[index])->y); - buffer[2] = sp_ftoc(((Vector *)paramStruct->orgParams[index])->z); + buffer[0] = sp_ftoc(((SDKVector *)paramStruct->orgParams[index])->x); + buffer[1] = sp_ftoc(((SDKVector *)paramStruct->orgParams[index])->y); + buffer[2] = sp_ftoc(((SDKVector *)paramStruct->orgParams[index])->z); return 1; } } @@ -470,12 +470,12 @@ cell_t Native_SetParamVector(IPluginContext *pContext, const cell_t *params) case HookParamType_VectorPtr: { if(paramStruct->newParams[index] != NULL) - delete (Vector *)paramStruct->newParams[index]; + delete (SDKVector *)paramStruct->newParams[index]; cell_t *buffer; pContext->LocalToPhysAddr(params[3], &buffer); - paramStruct->newParams[index] = new Vector(sp_ctof(buffer[0]), sp_ctof(buffer[1]), sp_ctof(buffer[2])); + paramStruct->newParams[index] = new SDKVector(sp_ctof(buffer[0]), sp_ctof(buffer[1]), sp_ctof(buffer[2])); paramStruct->isChanged[index] = true; return 1; } @@ -817,11 +817,11 @@ cell_t Native_GetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t if((ObjectValueType)params[4] == ObjectValueType_VectorPtr || (ObjectValueType)params[4] == ObjectValueType_Vector) { - Vector *vec; + SDKVector *vec; if((ObjectValueType)params[4] == ObjectValueType_VectorPtr) { - vec = *(Vector **)(addr + params[3]); + vec = *(SDKVector **)(addr + params[3]); if(vec == NULL) { return pContext->ThrowNativeError("Trying to get value for null pointer."); @@ -829,7 +829,7 @@ cell_t Native_GetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t } else { - vec = (Vector *)(addr + params[3]); + vec = (SDKVector *)(addr + params[3]); } buffer[0] = sp_ftoc(vec->x); @@ -870,11 +870,11 @@ cell_t Native_SetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t if((ObjectValueType)params[4] == ObjectValueType_VectorPtr || (ObjectValueType)params[4] == ObjectValueType_Vector) { - Vector *vec; + SDKVector *vec; if((ObjectValueType)params[4] == ObjectValueType_VectorPtr) { - vec = *(Vector **)(addr + params[3]); + vec = *(SDKVector **)(addr + params[3]); if(vec == NULL) { return pContext->ThrowNativeError("Trying to set value for null pointer."); @@ -882,7 +882,7 @@ cell_t Native_SetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t } else { - vec = (Vector *)(addr + params[3]); + vec = (SDKVector *)(addr + params[3]); } vec->x = sp_ctof(buffer[0]); @@ -952,17 +952,17 @@ cell_t Native_GetReturnVector(IPluginContext *pContext, const cell_t *params) if(returnStruct->type == ReturnType_Vector) { - buffer[0] = sp_ftoc((*(Vector *)returnStruct->orgResult).x); - buffer[1] = sp_ftoc((*(Vector *)returnStruct->orgResult).y); - buffer[2] = sp_ftoc((*(Vector *)returnStruct->orgResult).z); + buffer[0] = sp_ftoc((*(SDKVector *)returnStruct->orgResult).x); + buffer[1] = sp_ftoc((*(SDKVector *)returnStruct->orgResult).y); + buffer[2] = sp_ftoc((*(SDKVector *)returnStruct->orgResult).z); return 1; } else if(returnStruct->type == ReturnType_VectorPtr) { - buffer[0] = sp_ftoc(((Vector *)returnStruct->orgResult)->x); - buffer[1] = sp_ftoc(((Vector *)returnStruct->orgResult)->y); - buffer[2] = sp_ftoc(((Vector *)returnStruct->orgResult)->z); + buffer[0] = sp_ftoc(((SDKVector *)returnStruct->orgResult)->x); + buffer[1] = sp_ftoc(((SDKVector *)returnStruct->orgResult)->y); + buffer[2] = sp_ftoc(((SDKVector *)returnStruct->orgResult)->z); return 1; } @@ -984,13 +984,13 @@ cell_t Native_SetReturnVector(IPluginContext *pContext, const cell_t *params) if(returnStruct->type == ReturnType_Vector) { - *(Vector *)returnStruct->newResult = Vector(sp_ctof(buffer[0]), sp_ctof(buffer[1]), sp_ctof(buffer[2])); + *(SDKVector *)returnStruct->newResult = SDKVector(sp_ctof(buffer[0]), sp_ctof(buffer[1]), sp_ctof(buffer[2])); return 1; } else if(returnStruct->type == ReturnType_VectorPtr) { - returnStruct->newResult = new Vector(sp_ctof(buffer[0]), sp_ctof(buffer[1]), sp_ctof(buffer[2])); + returnStruct->newResult = new SDKVector(sp_ctof(buffer[0]), sp_ctof(buffer[1]), sp_ctof(buffer[2])); } return pContext->ThrowNativeError("Return type is not a vector type"); } diff --git a/sdk-hacks.h b/sdk-hacks.h index c1e7897..f86a607 100644 --- a/sdk-hacks.h +++ b/sdk-hacks.h @@ -1,16 +1,16 @@ #ifndef _INCLUDE_SDK_HACKS_H_ #define _INCLUDE_SDK_HACKS_H_ -class Vector +class SDKVector { public: - Vector(float x1, float y1, float z1) + SDKVector(float x1, float y1, float z1) { this->x = x1; this->y = y1; this->z = z1; } - Vector(void) + SDKVector(void) { this->x = 0.0; this->y = 0.0; diff --git a/vfunc_call.h b/vfunc_call.h index f44510a..39943e3 100644 --- a/vfunc_call.h +++ b/vfunc_call.h @@ -95,7 +95,7 @@ T CallVFunction(DHooksCallback *dg, HookParamsStruct *paramStruct, void *iface) VSTK_PARAM_SWITCH(char *); case HookParamType_VectorPtr: PARAMINFO_SWITCH(PassType_Basic); - VSTK_PARAM_SWITCH(Vector *); + VSTK_PARAM_SWITCH(SDKVector *); case HookParamType_CBaseEntity: PARAMINFO_SWITCH(PassType_Basic); VSTK_PARAM_SWITCH(CBaseEntity *); @@ -133,7 +133,7 @@ T CallVFunction(DHooksCallback *dg, HookParamsStruct *paramStruct, void *iface) return ret; } template <> -Vector CallVFunction(DHooksCallback *dg, HookParamsStruct *paramStruct, void *iface) +SDKVector CallVFunction(DHooksCallback *dg, HookParamsStruct *paramStruct, void *iface) { SourceMod::PassInfo *paramInfo = NULL; SourceMod::PassInfo returnInfo; @@ -141,7 +141,7 @@ Vector CallVFunction(DHooksCallback *dg, HookParamsStruct *paramStruct, if(dg->returnType != ReturnType_Void) { returnInfo.flags = dg->returnFlag; - returnInfo.size = sizeof(Vector); + returnInfo.size = sizeof(SDKVector); returnInfo.type = PassType_Object; } @@ -182,7 +182,7 @@ Vector CallVFunction(DHooksCallback *dg, HookParamsStruct *paramStruct, VSTK_PARAM_SWITCH(char *); case HookParamType_VectorPtr: PARAMINFO_SWITCH(PassType_Basic); - VSTK_PARAM_SWITCH(Vector *); + VSTK_PARAM_SWITCH(SDKVector *); case HookParamType_CBaseEntity: PARAMINFO_SWITCH(PassType_Basic); VSTK_PARAM_SWITCH(CBaseEntity *); @@ -196,7 +196,7 @@ Vector CallVFunction(DHooksCallback *dg, HookParamsStruct *paramStruct, } } - Vector ret; + SDKVector ret; pCall = g_pBinTools->CreateVCall(dg->offset, 0, 0, &returnInfo, paramInfo, dg->params.size()); pCall->Execute(vstk, &ret); @@ -262,7 +262,7 @@ string_t CallVFunction(DHooksCallback *dg, HookParamsStruct *paramStru VSTK_PARAM_SWITCH(char *); case HookParamType_VectorPtr: PARAMINFO_SWITCH(PassType_Basic); - VSTK_PARAM_SWITCH(Vector *); + VSTK_PARAM_SWITCH(SDKVector *); case HookParamType_CBaseEntity: PARAMINFO_SWITCH(PassType_Basic); VSTK_PARAM_SWITCH(CBaseEntity *); diff --git a/vhook.cpp b/vhook.cpp index 7a2fbfe..8024cd3 100644 --- a/vhook.cpp +++ b/vhook.cpp @@ -61,7 +61,7 @@ DHooksManager::DHooksManager(HookSetup *setup, void *iface, IPluginFunction *rem } else if(this->callback->returnType == ReturnType_Vector) { - protoInfo.SetReturnType(sizeof(Vector), SourceHook::PassInfo::PassType_Object, setup->returnFlag, NULL, NULL, NULL, NULL); + protoInfo.SetReturnType(sizeof(SDKVector), SourceHook::PassInfo::PassType_Object, setup->returnFlag, NULL, NULL, NULL, NULL); } else { @@ -187,10 +187,10 @@ HookReturnStruct *GetReturnStruct(DHooksCallback *dg) break; case ReturnType_Vector: { - res->orgResult = malloc(sizeof(Vector)); - res->newResult = malloc(sizeof(Vector)); - Vector vec = META_RESULT_ORIG_RET(Vector); - *(Vector *)res->orgResult = vec; + res->orgResult = malloc(sizeof(SDKVector)); + res->newResult = malloc(sizeof(SDKVector)); + SDKVector vec = META_RESULT_ORIG_RET(SDKVector); + *(SDKVector *)res->orgResult = vec; break; } default: @@ -208,9 +208,9 @@ HookReturnStruct *GetReturnStruct(DHooksCallback *dg) *(string_t *)res->orgResult = NULL_STRING; break; case ReturnType_Vector: - res->orgResult = malloc(sizeof(Vector)); - res->newResult = malloc(sizeof(Vector)); - *(Vector *)res->orgResult = Vector(); + res->orgResult = malloc(sizeof(SDKVector)); + res->newResult = malloc(sizeof(SDKVector)); + *(SDKVector *)res->orgResult = SDKVector(); break; case ReturnType_Int: res->orgResult = malloc(sizeof(int)); @@ -581,12 +581,12 @@ float Callback_float(DHooksCallback *dg, void **argStack) return *(float *)ret; } #ifdef WIN32 -Vector *Callback_vector(DHooksCallback *dg, void **argStack, size_t *argsizep) +SDKVector *Callback_vector(DHooksCallback *dg, void **argStack, size_t *argsizep) #else -Vector *Callback_vector(DHooksCallback *dg, void **argStack) +SDKVector *Callback_vector(DHooksCallback *dg, void **argStack) #endif { - Vector *vec_result = (Vector *)argStack[0]; // Save the result + SDKVector *vec_result = (SDKVector *)argStack[0]; // Save the result HookReturnStruct *returnStruct = NULL; HookParamsStruct *paramStruct = NULL; @@ -658,14 +658,14 @@ Vector *Callback_vector(DHooksCallback *dg, void **argStack) g_SHPtr->DoRecall(); g_SHPtr->SetRes(MRES_SUPERCEDE); mres = MRES_SUPERCEDE; - *vec_result = CallVFunction(dg, paramStruct, g_SHPtr->GetIfacePtr()); + *vec_result = CallVFunction(dg, paramStruct, g_SHPtr->GetIfacePtr()); break; case MRES_ChangedOverride: if(dg->returnType != ReturnType_Void) { if(returnStruct->isChanged) { - *vec_result = **(Vector **)returnStruct->newResult; + *vec_result = **(SDKVector **)returnStruct->newResult; } else //Throw an error if no override was set { @@ -678,7 +678,7 @@ Vector *Callback_vector(DHooksCallback *dg, void **argStack) g_SHPtr->DoRecall(); g_SHPtr->SetRes(MRES_SUPERCEDE); mres = MRES_SUPERCEDE; - CallVFunction(dg, paramStruct, g_SHPtr->GetIfacePtr()); + CallVFunction(dg, paramStruct, g_SHPtr->GetIfacePtr()); break; case MRES_Override: if(dg->returnType != ReturnType_Void) @@ -687,7 +687,7 @@ Vector *Callback_vector(DHooksCallback *dg, void **argStack) { g_SHPtr->SetRes(MRES_OVERRIDE); mres = MRES_OVERRIDE; - *vec_result = **(Vector **)returnStruct->newResult; + *vec_result = **(SDKVector **)returnStruct->newResult; } else //Throw an error if no override was set { @@ -704,7 +704,7 @@ Vector *Callback_vector(DHooksCallback *dg, void **argStack) { g_SHPtr->SetRes(MRES_SUPERCEDE); mres = MRES_SUPERCEDE; - *vec_result = **(Vector **)returnStruct->newResult; + *vec_result = **(SDKVector **)returnStruct->newResult; } else //Throw an error if no override was set { @@ -826,7 +826,7 @@ string_t *Callback_stringt(DHooksCallback *dg, void **argStack) g_SHPtr->DoRecall(); g_SHPtr->SetRes(MRES_SUPERCEDE); mres = MRES_SUPERCEDE; - CallVFunction(dg, paramStruct, g_SHPtr->GetIfacePtr()); + CallVFunction(dg, paramStruct, g_SHPtr->GetIfacePtr()); break; case MRES_Override: if(dg->returnType != ReturnType_Void) diff --git a/vhook.h b/vhook.h index fb6260c..050be4c 100644 --- a/vhook.h +++ b/vhook.h @@ -104,7 +104,7 @@ public: } else if(this->type == ReturnType_VectorPtr) { - delete (Vector *)this->newResult; + delete (SDKVector *)this->newResult; } } @@ -150,11 +150,11 @@ public: #ifdef WIN32 void *Callback(DHooksCallback *dg, void **stack, size_t *argsizep); float Callback_float(DHooksCallback *dg, void **stack, size_t *argsizep); -Vector *Callback_vector(DHooksCallback *dg, void **stack, size_t *argsizep); +SDKVector *Callback_vector(DHooksCallback *dg, void **stack, size_t *argsizep); #else void *Callback(DHooksCallback *dg, void **stack); float Callback_float(DHooksCallback *dg, void **stack); -Vector *Callback_vector(DHooksCallback *dg, void **stack); +SDKVector *Callback_vector(DHooksCallback *dg, void **stack); string_t *Callback_stringt(DHooksCallback *dg, void **stack); #endif @@ -166,7 +166,7 @@ SourceHook::PassInfo::PassType GetParamTypePassType(HookParamType type); #ifndef WIN32 static void *GenerateThunk(ReturnType type) { - MacroAssemblerX86 masm; + sp::MacroAssemblerX86 masm; static const size_t kStackNeeded = (2) * 4; // 2 args max static const size_t kReserve = ke::Align(kStackNeeded+8, 16)-8; @@ -215,7 +215,7 @@ static void *GenerateThunk(ReturnType type) // HUGE THANKS TO BAILOPAN (dvander)! static void *GenerateThunk(ReturnType type) { - MacroAssemblerX86 masm; + sp::MacroAssemblerX86 masm; static const size_t kStackNeeded = (3 + 1) * 4; // 3 args max, 1 locals max static const size_t kReserve = ke::Align(kStackNeeded+8, 16)-8; @@ -294,7 +294,7 @@ public: if(dg->params.at(i).type == HookParamType_VectorPtr) { - delete (Vector *)this->newParams[i]; + delete (SDKVector *)this->newParams[i]; } else if(dg->params.at(i).type == HookParamType_CharPtr) {