| 1027 | |
| 1028 | #ifndef WIN32 |
| 1029 | string_t *Callback_stringt(DHooksCallback *dg, void **argStack) |
| 1030 | { |
| 1031 | string_t *string_result = (string_t *)argStack[0]; // Save the result |
| 1032 | |
| 1033 | HookReturnStruct *returnStruct = NULL; |
| 1034 | HookParamsStruct *paramStruct = NULL; |
| 1035 | Handle_t rHndl; |
| 1036 | Handle_t pHndl; |
| 1037 | |
| 1038 | size_t argsize = GetStackArgsSize(dg); |
| 1039 | |
| 1040 | if(dg->thisType == ThisPointer_CBaseEntity || dg->thisType == ThisPointer_Address) |
| 1041 | { |
| 1042 | auto thisAddr = g_SHPtr->GetIfacePtr(); |
| 1043 | if (dg->thisType == ThisPointer_CBaseEntity) { |
| 1044 | if (thisAddr == nullptr) { |
| 1045 | dg->plugin_callback->PushCell(-1); |
| 1046 | } else { |
| 1047 | dg->plugin_callback->PushCell(gamehelpers->EntityToBCompatRef((CBaseEntity *)thisAddr)); |
| 1048 | } |
| 1049 | } else { |
| 1050 | if (dg->int64_address) { |
| 1051 | std::int64_t addr = reinterpret_cast<std::int64_t>(thisAddr); |
| 1052 | dg->plugin_callback->PushArray(reinterpret_cast<cell_t*>(&addr), 2); |
| 1053 | } else { |
| 1054 | dg->plugin_callback->PushCell((cell_t)thisAddr); |
| 1055 | } |
| 1056 | } |
| 1057 | } |
| 1058 | |
| 1059 | returnStruct = GetReturnStruct(dg); |
| 1060 | rHndl = handlesys->CreateHandle(g_HookReturnHandle, returnStruct, dg->plugin_callback->GetParentRuntime()->GetDefaultContext()->GetIdentity(), myself->GetIdentity(), NULL); |
| 1061 | |
| 1062 | if(!rHndl) |
| 1063 | { |
| 1064 | dg->plugin_callback->Cancel(); |
| 1065 | if(returnStruct) |
| 1066 | { |
| 1067 | delete returnStruct; |
| 1068 | } |
| 1069 | g_SHPtr->SetRes(MRES_IGNORED); |
| 1070 | return NULL; |
| 1071 | } |
| 1072 | dg->plugin_callback->PushCell(rHndl); |
| 1073 | |
| 1074 | if(argsize > 0) |
| 1075 | { |
| 1076 | paramStruct = GetParamStruct(dg, argStack, argsize); |
| 1077 | pHndl = handlesys->CreateHandle(g_HookParamsHandle, paramStruct, dg->plugin_callback->GetParentRuntime()->GetDefaultContext()->GetIdentity(), myself->GetIdentity(), NULL); |
| 1078 | if(!pHndl) |
| 1079 | { |
| 1080 | dg->plugin_callback->Cancel(); |
| 1081 | if(returnStruct) |
| 1082 | { |
| 1083 | delete returnStruct; |
| 1084 | } |
| 1085 | if(paramStruct) |
| 1086 | { |
nothing calls this directly
no test coverage detected