少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "il2cpp-config.h"
#include "il2cpp-api.h"
#include "icalls/mscorlib/System/Activator.h"
#include "il2cpp-object-internals.h"
#include "il2cpp-class-internals.h"
#include "il2cpp-runtime-metadata.h"
#include "vm/Image.h"
#include "vm/Class.h"
 
namespace il2cpp
{
namespace icalls
{
namespace mscorlib
{
namespace System
{
    Il2CppObject * Activator::CreateInstanceInternal(Il2CppReflectionType *type)
    {
        Il2CppClass* typeInfo = vm::Class::FromIl2CppType(type->type);
 
        if (typeInfo == NULL || il2cpp::vm::Class::IsNullable(typeInfo))
            return NULL;
 
        il2cpp::vm::Class::Init(typeInfo);
 
        //you could think "hey, shouldn't we call the constructor here? but we don't because this path is only hit for value
        //types, and they cannot have default constructors.  for reference types with constructors, the c# side of CreateInstance()
        //actually takes care of its own business by using reflection to create the object and invoke the constructor.
        return il2cpp_object_new(typeInfo);
    }
} /* namespace System */
} /* namespace mscorlib */
} /* namespace icalls */
} /* namespace il2cpp */