Merge remote-tracking branch 'origin/master' into 1.10
# Conflicts: # Source/Engine/Networking/NetworkReplicator.cpp
This commit is contained in:
@@ -846,12 +846,12 @@ namespace
|
||||
|
||||
MMethod* ManagedBinaryModule::FindMethod(MClass* mclass, const ScriptingTypeMethodSignature& signature)
|
||||
{
|
||||
#if USE_CSHARP
|
||||
if (!mclass)
|
||||
return nullptr;
|
||||
const auto& methods = mclass->GetMethods();
|
||||
for (MMethod* method : methods)
|
||||
{
|
||||
#if USE_CSHARP
|
||||
if (method->IsStatic() != signature.IsStatic)
|
||||
continue;
|
||||
if (method->GetName() != signature.Name)
|
||||
@@ -872,8 +872,8 @@ MMethod* ManagedBinaryModule::FindMethod(MClass* mclass, const ScriptingTypeMeth
|
||||
}
|
||||
if (isValid && VariantTypeEquals(signature.ReturnType, method->GetReturnType()))
|
||||
return method;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -1274,6 +1274,7 @@ bool ManagedBinaryModule::InvokeMethod(void* method, const Variant& instance, Sp
|
||||
|
||||
// Marshal parameters
|
||||
void** params = (void**)alloca(parametersCount * sizeof(void*));
|
||||
void** outParams = nullptr;
|
||||
bool failed = false;
|
||||
bool hasOutParams = false;
|
||||
for (int32 paramIdx = 0; paramIdx < parametersCount; paramIdx++)
|
||||
@@ -1290,6 +1291,14 @@ bool ManagedBinaryModule::InvokeMethod(void* method, const Variant& instance, Sp
|
||||
LOG(Error, "Failed to marshal parameter {5}:{4} of method '{0}.{1}' (args count: {2}), value type: {6}, value: {3}", String(mMethod->GetParentClass()->GetFullName()), String(mMethod->GetName()), parametersCount, paramValue, MCore::Type::ToString(paramType), paramIdx, paramValue.Type);
|
||||
return true;
|
||||
}
|
||||
if (isOut && MCore::Type::IsReference(paramType) && MCore::Type::GetType(paramType) == MTypes::Object)
|
||||
{
|
||||
// Object passed as out param so pass pointer to the value storage for proper marshalling
|
||||
if (!outParams)
|
||||
outParams = (void**)alloca(parametersCount * sizeof(void*));
|
||||
outParams[paramIdx] = params[paramIdx];
|
||||
params[paramIdx] = &outParams[paramIdx];
|
||||
}
|
||||
}
|
||||
|
||||
// Invoke the method
|
||||
@@ -1354,6 +1363,13 @@ bool ManagedBinaryModule::InvokeMethod(void* method, const Variant& instance, Sp
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
MType* paramType = mMethod->GetParameterType(paramIdx);
|
||||
if (MCore::Type::IsReference(paramType) && MCore::Type::GetType(paramType) == MTypes::Object)
|
||||
paramValue = MUtils::UnboxVariant((MObject*)outParams[paramIdx]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user