MCPcopy Create free account
hub / github.com/axhlzy/Il2CppHookScripts / cModule

Method cModule

Il2cppHook/_Ufunc.js:9674–10067  ·  view source on GitHub ↗

@internal

()

Source from the content-addressed store, hash-verified

9672 }
9673 /** @internal */
9674 static get cModule() {
9675 if (versioning_1.default.lt(Il2Cpp.unityVersion, "5.3.0") || versioning_1.default.gte(Il2Cpp.unityVersion, "2022.2.0")) {
9676 (0, console_1.warn)(`current Unity version ${Il2Cpp.unityVersion} is not supported, expect breakage`);
9677 }
9678 const offsetsFinderCModule = new CModule(`\
9679#include <stdint.h>
9680
9681#define OFFSET_OF(name, type) \
9682 int16_t name (char * p,\
9683 type e)\
9684 {\
9685 for (int16_t i = 0; i < 512; i++) if (* ((type *) p + i) == e) return i;\
9686 return -1;\
9687 }
9688
9689OFFSET_OF (offset_of_int32, int32_t)
9690OFFSET_OF (offset_of_pointer, void *)
9691 `);
9692 const offsetOfInt32 = new NativeFunction(offsetsFinderCModule.offset_of_int32, "int16", ["pointer", "int32"]);
9693 const offsetOfPointer = new NativeFunction(offsetsFinderCModule.offset_of_pointer, "int16", ["pointer", "pointer"]);
9694 const SystemString = Il2Cpp.Image.corlib.class("System.String");
9695 const SystemDateTime = Il2Cpp.Image.corlib.class("System.DateTime");
9696 const SystemReflectionModule = Il2Cpp.Image.corlib.class("System.Reflection.Module");
9697 SystemDateTime.initialize();
9698 SystemReflectionModule.initialize();
9699 const DaysToMonth365 = (SystemDateTime.tryField("daysmonth") ??
9700 SystemDateTime.tryField("DaysToMonth365") ??
9701 SystemDateTime.field("s_daysToMonth365")).value;
9702 const FilterTypeName = SystemReflectionModule.field("FilterTypeName").value;
9703 const FilterTypeNameMethodPointer = FilterTypeName.field("method_ptr").value;
9704 const FilterTypeNameMethod = FilterTypeName.field("method").value;
9705 const source = `\
9706#include <stdint.h>
9707#include <string.h>
9708
9709
9710typedef struct _Il2CppObject Il2CppObject;
9711typedef enum _Il2CppTypeEnum Il2CppTypeEnum;
9712typedef struct _Il2CppReflectionMethod Il2CppReflectionMethod;
9713typedef struct _Il2CppManagedMemorySnapshot Il2CppManagedMemorySnapshot;
9714typedef struct _Il2CppMetadataType Il2CppMetadataType;
9715
9716
9717struct _Il2CppObject
9718{
9719 void * class;
9720 void * monitor;
9721};
9722
9723enum _Il2CppTypeEnum
9724{
9725 IL2CPP_TYPE_END = 0x00,
9726 IL2CPP_TYPE_VOID = 0x01,
9727 IL2CPP_TYPE_BOOLEAN = 0x02,
9728 IL2CPP_TYPE_CHAR = 0x03,
9729 IL2CPP_TYPE_I1 = 0x04,
9730 IL2CPP_TYPE_U1 = 0x05,
9731 IL2CPP_TYPE_I2 = 0x06,

Callers

nothing calls this directly

Calls 5

classMethod · 0.45
initializeMethod · 0.45
tryFieldMethod · 0.45
fieldMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected