74 lines
No EOL
2.4 KiB
C++
74 lines
No EOL
2.4 KiB
C++
#include "ProtoCache.h"
|
|
#include "ProtoMetadata.h"
|
|
|
|
TypeCache TypeCache::init() {
|
|
TypeCache cache;
|
|
|
|
auto corlib = Il2CppApi::AssemblyGetImage(Il2CppApi::DomainAssemblyOpen("mscorlib.dll"));
|
|
auto assembly = Il2CppApi::AssemblyGetImage(Il2CppApi::DomainAssemblyOpen("Assembly-CSharp.dll"));
|
|
|
|
cache.type_map = std::map<std::size_t, CachedType> {
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "Object")),
|
|
Object,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "Boolean")),
|
|
Boolean,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "Byte")),
|
|
Byte,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "SByte")),
|
|
SByte,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "UInt16")),
|
|
UInt16,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "Int16")),
|
|
Int16,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "UInt32")),
|
|
UInt32,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "Int32")),
|
|
Int32,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "UInt64")),
|
|
UInt64,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "Int64")),
|
|
Int64,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "Single")),
|
|
Single,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "Double")),
|
|
Double,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "String")),
|
|
String,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(corlib, "System", "Enum")),
|
|
Enum,
|
|
},
|
|
{
|
|
reinterpret_cast<std::size_t>(Il2CppApi::ClassFromName(assembly, "", BYTE_STRING)),
|
|
ByteString,
|
|
},
|
|
};
|
|
|
|
return cache;
|
|
} |