This commit is contained in:
test123456654321 2024-10-26 02:23:45 +08:00
parent 311a38a474
commit 4eb1985c98
8 changed files with 690 additions and 590 deletions

View File

@ -1,43 +1,54 @@
#include"NNNConfig.h"
bool NNNConfig::attach_function() {
//blackcyc
//夢幻廻廊
//復讐の女仕官ハイネ ~肢体に刻まれる淫欲のプログラム~
//https://vndb.org/v24955
#include "NNNConfig.h"
bool NNNConfig::attach_function()
{
// blackcyc
// 夢幻廻廊
// 復讐の女仕官ハイネ ~肢体に刻まれる淫欲のプログラム~
// https://vndb.org/v24955
const BYTE bytes[] = {
0x68,0xE8,0x03,0x00,0x00,0x6a,0x00,
//clang-format off
0x68, 0xE8, 0x03, 0x00, 0x00, 0x6a, 0x00,
//clang-format on
};
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
if (addr == 0)return false;
if (addr == 0)
return false;
addr = addr + sizeof(bytes);
for (int i = 0; i < 5; i++) {
if (*(BYTE*)addr == 0xe8) {
for (int i = 0; i < 5; i++)
{
if (*(BYTE *)addr == 0xe8)
{
addr += 1;
break;
}
addr += 1;
}
uintptr_t offset = *(uintptr_t*)(addr);
uintptr_t offset = *(uintptr_t *)(addr);
uintptr_t funcaddr = offset + addr + 4;
const BYTE check[] = { 0x83 ,0xEC ,0x1C };
auto checkoffset = MemDbg::findBytes(check, sizeof(check), funcaddr, funcaddr +0x20);
const BYTE check[] = {0x83, 0xEC, 0x1C};
auto checkoffset = MemDbg::findBytes(check, sizeof(check), funcaddr, funcaddr + 0x20);
if (checkoffset == 0)offset = get_stack(5);
else offset = get_stack(6);
if (checkoffset == 0)
offset = get_stack(5);
else
offset = get_stack(6);
HookParam hp;
hp.address = funcaddr;
hp.offset = offset;
hp.type = USING_STRING;
hp.text_fun=[](hook_stack* stack, HookParam *, uintptr_t *data, uintptr_t *split, size_t *len){
//当前文本可以过滤重复,上一条文本会按照换行符切分不停刷新。
static std::unordered_map<uintptr_t,std::string>everythreadlast;
if(everythreadlast.find(stack->retaddr)==everythreadlast.end())everythreadlast[stack->retaddr]="";
auto thisstr=std::string((char*)*data);
if(everythreadlast[stack->retaddr]==thisstr)return;
everythreadlast[stack->retaddr]=thisstr;
*len=everythreadlast[stack->retaddr].size();
};
hp.text_fun = [](hook_stack *stack, HookParam *, uintptr_t *data, uintptr_t *split, size_t *len)
{
// 当前文本可以过滤重复,上一条文本会按照换行符切分不停刷新。
static std::unordered_map<uintptr_t, std::string> everythreadlast;
if (everythreadlast.find(stack->retaddr) == everythreadlast.end())
everythreadlast[stack->retaddr] = "";
auto thisstr = std::string((char *)*data);
if (everythreadlast[stack->retaddr] == thisstr)
return;
everythreadlast[stack->retaddr] = thisstr;
*len = everythreadlast[stack->retaddr].size();
};
return NewHook(hp, "NNNhook");
}

View File

@ -42,9 +42,9 @@ public:
unsigned int rgba;
};
// UnityEngine.ScreenOrientation
enum class ScreenOrientation {
enum class ScreenOrientation
{
Unknown,
Portrait,
PortraitUpsideDown,
@ -122,7 +122,7 @@ struct TextGenerationSettings_t
{
public:
// UnityEngine.Font UnityEngine.TextGenerationSettings::font
void* font;
void *font;
// UnityEngine.Color UnityEngine.TextGenerationSettings::color
Color_t color;
// System.Int32 UnityEngine.TextGenerationSettings::fontSize
@ -152,16 +152,16 @@ public:
// UnityEngine.HorizontalWrapMode UnityEngine.TextGenerationSettings::horizontalOverflow
int32_t horizontalOverflow;
// UnityEngine.Vector2 UnityEngine.TextGenerationSettings::generationExtents
Vector2_t generationExtents;
Vector2_t generationExtents;
// UnityEngine.Vector2 UnityEngine.TextGenerationSettings::pivot
Vector2_t pivot;
Vector2_t pivot;
// System.Boolean UnityEngine.TextGenerationSettings::generateOutOfBounds
bool generateOutOfBounds;
};
enum Il2CppTypeEnum
{
IL2CPP_TYPE_END = 0x00, /* End of List */
IL2CPP_TYPE_END = 0x00, /* End of List */
IL2CPP_TYPE_VOID = 0x01,
IL2CPP_TYPE_BOOLEAN = 0x02,
IL2CPP_TYPE_CHAR = 0x03,
@ -203,7 +203,7 @@ enum Il2CppTypeEnum
typedef struct Il2CppType
{
void* dummy;
void *dummy;
unsigned int attrs : 16;
Il2CppTypeEnum type : 8;
unsigned int num_mods : 6;
@ -213,9 +213,9 @@ typedef struct Il2CppType
typedef struct FieldInfo
{
const char* name;
const Il2CppType* type;
void* parent;
const char *name;
const Il2CppType *type;
void *parent;
int32_t offset; // If offset is -1, then it's thread static
uint32_t token;
} FieldInfo;
@ -225,37 +225,37 @@ struct MethodInfo;
typedef struct Il2CppClass
{
// The following fields are always valid for a Il2CppClass structure
const void* image;
void* gc_desc;
const char* name;
const char* namespaze;
const void *image;
void *gc_desc;
const char *name;
const char *namespaze;
Il2CppType byval_arg;
Il2CppType this_arg;
Il2CppClass* element_class;
Il2CppClass* castClass;
Il2CppClass* declaringType;
Il2CppClass* parent;
void* generic_class;
void* typeMetadataHandle; // non-NULL for Il2CppClass's constructed from type defintions
const void* interopData;
Il2CppClass* klass; // hack to pretend we are a MonoVTable. Points to ourself
Il2CppClass *element_class;
Il2CppClass *castClass;
Il2CppClass *declaringType;
Il2CppClass *parent;
void *generic_class;
void *typeMetadataHandle; // non-NULL for Il2CppClass's constructed from type defintions
const void *interopData;
Il2CppClass *klass; // hack to pretend we are a MonoVTable. Points to ourself
// End always valid fields
// The following fields need initialized before access. This can be done per field or as an aggregate via a call to Class::Init
FieldInfo* fields; // Initialized in SetupFields
const void* events; // Initialized in SetupEvents
const void* properties; // Initialized in SetupProperties
const MethodInfo** methods; // Initialized in SetupMethods
Il2CppClass** nestedTypes; // Initialized in SetupNestedTypes
Il2CppClass** implementedInterfaces; // Initialized in SetupInterfaces
void* interfaceOffsets; // Initialized in Init
void* static_fields; // Initialized in Init
const void* rgctx_data; // Initialized in Init
FieldInfo *fields; // Initialized in SetupFields
const void *events; // Initialized in SetupEvents
const void *properties; // Initialized in SetupProperties
const MethodInfo **methods; // Initialized in SetupMethods
Il2CppClass **nestedTypes; // Initialized in SetupNestedTypes
Il2CppClass **implementedInterfaces; // Initialized in SetupInterfaces
void *interfaceOffsets; // Initialized in Init
void *static_fields; // Initialized in Init
const void *rgctx_data; // Initialized in Init
// used for fast parent checks
Il2CppClass** typeHierarchy; // Initialized in SetupTypeHierachy
Il2CppClass **typeHierarchy; // Initialized in SetupTypeHierachy
// End initialization required fields
void* unity_user_data;
void *unity_user_data;
uint32_t initializationExceptionGCHandle;
@ -264,7 +264,7 @@ typedef struct Il2CppClass
size_t cctor_thread;
// Remaining fields are always valid except where noted
void* genericContainerHandle;
void *genericContainerHandle;
uint32_t instance_size; // valid when size_inited is true
uint32_t actualSize;
uint32_t element_size;
@ -288,7 +288,7 @@ typedef struct Il2CppClass
uint8_t genericRecursionDepth;
uint8_t rank;
uint8_t minimumAlignment; // Alignment of this type
uint8_t naturalAligment; // Alignment of this type without accounting for packing
uint8_t naturalAligment; // Alignment of this type without accounting for packing
uint8_t packingSize;
// this is critical for performance of Class::InitFromCodegen. Equals to initialized && !has_initialization_error at all times.
@ -309,15 +309,15 @@ typedef struct Il2CppClass
uint8_t is_import_or_windows_runtime : 1;
uint8_t is_vtable_initialized : 1;
uint8_t has_initialization_error : 1;
void* vtable[0];
void *vtable[0];
} Il2CppClass;
struct ParameterInfo
{
const char* name;
const char *name;
int32_t position;
uint32_t token;
const Il2CppType* parameter_type;
const Il2CppType *parameter_type;
};
typedef struct Il2CppGenericContainer
@ -335,10 +335,10 @@ struct MethodInfo
{
uintptr_t methodPointer;
uintptr_t invoker_method;
const char* name;
Il2CppClass* klass;
const Il2CppType* return_type;
const ParameterInfo* parameters;
const char *name;
Il2CppClass *klass;
const Il2CppType *return_type;
const ParameterInfo *parameters;
union
{
uintptr_t rgctx_data;
@ -347,7 +347,7 @@ struct MethodInfo
union
{
uintptr_t genericMethod;
Il2CppGenericContainer* genericContainer;
Il2CppGenericContainer *genericContainer;
};
uint32_t token;
uint16_t flags;
@ -364,25 +364,26 @@ struct Il2CppObject
{
union
{
Il2CppClass* klass;
void* vtable;
Il2CppClass *klass;
void *vtable;
};
void* monitor;
void *monitor;
};
// not real Il2CppString class
struct Il2CppString
{
Il2CppObject object;
int32_t length; ///< Length of string *excluding* the trailing null (which is included in 'chars').
int32_t length; ///< Length of string *excluding* the trailing null (which is included in 'chars').
Il2CppChar start_char[0];
};
typedef struct PropertyInfo {
Il2CppClass* parent;
const char* name;
const MethodInfo* get;
const MethodInfo* set;
typedef struct PropertyInfo
{
Il2CppClass *parent;
const char *name;
const MethodInfo *get;
const MethodInfo *set;
uint32_t attrs;
uint32_t token;
} PropertyInfo;
@ -390,23 +391,22 @@ typedef struct PropertyInfo {
typedef struct Il2CppArraySize
{
Il2CppObject obj;
void* bounds;
void *bounds;
uintptr_t max_length;
alignas(8)
void* vector[0];
alignas(8) void *vector[0];
} Il2CppArraySize;
static const size_t kIl2CppSizeOfArray = (offsetof(Il2CppArraySize, vector));
struct CourseBaseObjectContext
{
Il2CppObject* coursePrefab;
Il2CppObject* courseGrassFurPrefab;
Il2CppObject* monitorRenderTexture;
Il2CppArraySize* swapTextures;
Il2CppArraySize* swapSubTextures;
Il2CppObject* postFilmSetGroup;
Il2CppObject* grassParam;
Il2CppObject *coursePrefab;
Il2CppObject *courseGrassFurPrefab;
Il2CppObject *monitorRenderTexture;
Il2CppArraySize *swapTextures;
Il2CppArraySize *swapSubTextures;
Il2CppObject *postFilmSetGroup;
Il2CppObject *grassParam;
};
struct RaceLoaderManagerCourceContext
@ -429,8 +429,8 @@ struct RaceLoaderManagerCourceContext
int treeTimeEnum;
int RotationCategoryEnum;
int lightProbeId;
Il2CppArraySize* materialTeturePairs;
Il2CppArraySize* materialSubTexturePairs;
Il2CppArraySize *materialTeturePairs;
Il2CppArraySize *materialSubTexturePairs;
bool halfStartGate;
int CourseStartGateBaseId;
};
@ -451,7 +451,7 @@ typedef struct Il2CppReflectionMethod Il2CppReflectionMethod;
typedef void (*Il2CppMethodPointer)();
typedef void* (*InvokerMethod)(Il2CppMethodPointer, const MethodInfo*, void*, void**);
typedef void *(*InvokerMethod)(Il2CppMethodPointer, const MethodInfo *, void *, void **);
typedef struct Il2CppDelegate
{
@ -460,10 +460,10 @@ typedef struct Il2CppDelegate
Il2CppMethodPointer method_ptr;
/* The invoke code */
InvokerMethod invoke_impl;
Il2CppObject* target;
const MethodInfo* method;
Il2CppObject *target;
const MethodInfo *method;
void* delegate_trampoline;
void *delegate_trampoline;
intptr_t extraArg;
@ -471,19 +471,19 @@ typedef struct Il2CppDelegate
* If non-NULL, this points to a memory location which stores the address of
* the compiled code of the method, or NULL if it is not yet compiled.
*/
uint8_t** method_code;
Il2CppReflectionMethod* method_info;
Il2CppReflectionMethod* original_method_info;
Il2CppObject* data;
uint8_t **method_code;
Il2CppReflectionMethod *method_info;
Il2CppReflectionMethod *original_method_info;
Il2CppObject *data;
bool method_is_virtual;
} Il2CppDelegate;
typedef struct MulticastDelegate : Il2CppDelegate {
Il2CppArraySize* delegates;
typedef struct MulticastDelegate : Il2CppDelegate
{
Il2CppArraySize *delegates;
} MulticastDelegate;
// UnityEngine.Quaternion
struct Quaternion_t
{
@ -494,109 +494,106 @@ public:
float z;
};
template <typename T>
struct TypedField
{
FieldInfo* Field;
FieldInfo *Field;
constexpr FieldInfo* operator->() const noexcept
constexpr FieldInfo *operator->() const noexcept
{
return Field;
}
};
struct Il2CppClassHead
{
const void* image;
void* gc_desc;
const char* name;
const char* namespaze;
const void *image;
void *gc_desc;
const char *name;
const char *namespaze;
};
struct Il2CppReflectionType
{
Il2CppObject object;
const Il2CppType* type;
const Il2CppType *type;
};
inline void** (*il2cpp_domain_get_assemblies)(void* domain, std::size_t* size);
inline Il2CppClass* (*il2cpp_class_from_name)(void* image, const char* namespaze, const char* name);
inline MethodInfo* (*il2cpp_class_get_methods)(Il2CppClass* klass, void** iter);
inline MethodInfo* (*il2cpp_class_get_method_from_name)(Il2CppClass* klass, const char* name, int argsCount);
inline MethodInfo* (*il2cpp_method_get_from_reflection)(Il2CppObject* ref);
inline const Il2CppType* (*il2cpp_method_get_param)(const MethodInfo* method, uint32_t index);
inline Il2CppObject* (*il2cpp_object_new)(Il2CppClass* klass);
inline void (*il2cpp_add_internal_call)(const char* name, uintptr_t pointer);
inline Il2CppArraySize* (*il2cpp_array_new)(Il2CppClass* klass, uintptr_t count);
inline const Il2CppType* (*il2cpp_class_get_type)(Il2CppClass* klass);
inline uint32_t(*il2cpp_class_get_type_token)(Il2CppClass* klass);
inline FieldInfo* (*il2cpp_class_get_field_from_name)(Il2CppClass* klass, const char* name);
inline void (*il2cpp_field_get_value)(Il2CppObject* obj, FieldInfo* field, void* value);
inline void (*il2cpp_field_set_value)(Il2CppObject* obj, FieldInfo* field, void* value);
inline void (*il2cpp_field_static_get_value)(FieldInfo* field, void* value);
inline void (*il2cpp_field_static_set_value)(FieldInfo* field, void* value);
inline const Il2CppType* (*il2cpp_field_get_type)(FieldInfo* field);
inline Il2CppObject* (*il2cpp_type_get_object)(const Il2CppType* type);
inline const char* (*il2cpp_image_get_name)(void* image);
inline size_t(*il2cpp_image_get_class_count)(void* image);
inline const Il2CppClass* (*il2cpp_image_get_class)(void* image, size_t index);
inline bool (*il2cpp_type_is_byref)(const Il2CppType* type);
inline uint32_t(*il2cpp_method_get_flags)(const MethodInfo* mehod, uint32_t* iflags);
inline const Il2CppType* (*il2cpp_method_get_return_type)(const MethodInfo* method);
inline Il2CppClass* (*il2cpp_class_from_type)(const Il2CppType* type);
inline const char* (*il2cpp_class_get_name)(Il2CppClass* klass);
inline const PropertyInfo* (*il2cpp_class_get_properties)(Il2CppClass* klass, void** iter);
inline bool (*il2cpp_class_is_enum)(const Il2CppClass* klass);
inline FieldInfo* (*il2cpp_class_get_fields)(Il2CppClass* klass, void** iter);
inline const char* (*il2cpp_method_get_name)(const MethodInfo* method);
inline uint32_t(*il2cpp_method_get_param_count)(const MethodInfo* method);
inline const char* (*il2cpp_method_get_param_name)(const MethodInfo* method, uint32_t index);
inline Il2CppClass* (*il2cpp_class_get_parent)(Il2CppClass* klass);
inline Il2CppClass* (*il2cpp_class_get_interfaces)(Il2CppClass* klass, void** iter);
inline const char* (*il2cpp_class_get_namespace)(Il2CppClass* klass);
inline void* (*il2cpp_class_get_image)(Il2CppClass* klass);
inline int (*il2cpp_class_get_flags)(const Il2CppClass* klass);
inline bool (*il2cpp_class_is_valuetype)(const Il2CppClass* klass);
inline uint32_t(*il2cpp_property_get_flags) (PropertyInfo* prop);
inline const MethodInfo* (*il2cpp_property_get_get_method) (const PropertyInfo* prop);
inline const MethodInfo* (*il2cpp_property_get_set_method) (const PropertyInfo* prop);
inline const char* (*il2cpp_property_get_name) (const PropertyInfo* prop);
inline Il2CppClass* (*il2cpp_property_get_parent) (const PropertyInfo* prop);
inline int (*il2cpp_field_get_flags)(FieldInfo* field);
inline const char* (*il2cpp_field_get_name)(FieldInfo* field);
inline Il2CppClass* (*il2cpp_field_get_parent)(FieldInfo* field);
inline size_t (*il2cpp_field_get_offset)(FieldInfo* field);
inline const PropertyInfo* (*il2cpp_class_get_property_from_name)(Il2CppClass* klass, const char* name);
inline void (*il2cpp_runtime_object_init)(Il2CppObject* obj);
inline Il2CppObject* (*il2cpp_value_box)(Il2CppClass* klass, void* data);
inline void* (*il2cpp_object_unbox)(Il2CppObject* obj);
inline Il2CppString* (*il2cpp_string_new_utf16)(const wchar_t* str, unsigned int len);
inline Il2CppString* (*il2cpp_string_new)(const char* str);
inline void* (*il2cpp_domain_get)();
inline void* (*il2cpp_domain_assembly_open)(void* domain, const char* name);
inline void* (*il2cpp_assembly_get_image)(void* assembly);
inline void* (*il2cpp_resolve_icall)(const char* name);
inline void* (*il2cpp_thread_attach)(void* domain);
inline void (*il2cpp_thread_detach)(void* thread);
inline bool (*il2cpp_class_is_assignable_from)(void* klass, void* oklass);
inline void (*il2cpp_class_for_each)(void(*klassReportFunc)(Il2CppClass* klass, void* userData), void* userData);
inline void* (*il2cpp_class_get_nested_types)(void* klass, void** iter);
inline uint32_t(*il2cpp_gchandle_new)(void* obj, bool pinned);
inline void **(*il2cpp_domain_get_assemblies)(void *domain, std::size_t *size);
inline Il2CppClass *(*il2cpp_class_from_name)(void *image, const char *namespaze, const char *name);
inline MethodInfo *(*il2cpp_class_get_methods)(Il2CppClass *klass, void **iter);
inline MethodInfo *(*il2cpp_class_get_method_from_name)(Il2CppClass *klass, const char *name, int argsCount);
inline MethodInfo *(*il2cpp_method_get_from_reflection)(Il2CppObject *ref);
inline const Il2CppType *(*il2cpp_method_get_param)(const MethodInfo *method, uint32_t index);
inline Il2CppObject *(*il2cpp_object_new)(Il2CppClass *klass);
inline void (*il2cpp_add_internal_call)(const char *name, uintptr_t pointer);
inline Il2CppArraySize *(*il2cpp_array_new)(Il2CppClass *klass, uintptr_t count);
inline const Il2CppType *(*il2cpp_class_get_type)(Il2CppClass *klass);
inline uint32_t (*il2cpp_class_get_type_token)(Il2CppClass *klass);
inline FieldInfo *(*il2cpp_class_get_field_from_name)(Il2CppClass *klass, const char *name);
inline void (*il2cpp_field_get_value)(Il2CppObject *obj, FieldInfo *field, void *value);
inline void (*il2cpp_field_set_value)(Il2CppObject *obj, FieldInfo *field, void *value);
inline void (*il2cpp_field_static_get_value)(FieldInfo *field, void *value);
inline void (*il2cpp_field_static_set_value)(FieldInfo *field, void *value);
inline const Il2CppType *(*il2cpp_field_get_type)(FieldInfo *field);
inline Il2CppObject *(*il2cpp_type_get_object)(const Il2CppType *type);
inline const char *(*il2cpp_image_get_name)(void *image);
inline size_t (*il2cpp_image_get_class_count)(void *image);
inline const Il2CppClass *(*il2cpp_image_get_class)(void *image, size_t index);
inline bool (*il2cpp_type_is_byref)(const Il2CppType *type);
inline uint32_t (*il2cpp_method_get_flags)(const MethodInfo *mehod, uint32_t *iflags);
inline const Il2CppType *(*il2cpp_method_get_return_type)(const MethodInfo *method);
inline Il2CppClass *(*il2cpp_class_from_type)(const Il2CppType *type);
inline const char *(*il2cpp_class_get_name)(Il2CppClass *klass);
inline const PropertyInfo *(*il2cpp_class_get_properties)(Il2CppClass *klass, void **iter);
inline bool (*il2cpp_class_is_enum)(const Il2CppClass *klass);
inline FieldInfo *(*il2cpp_class_get_fields)(Il2CppClass *klass, void **iter);
inline const char *(*il2cpp_method_get_name)(const MethodInfo *method);
inline uint32_t (*il2cpp_method_get_param_count)(const MethodInfo *method);
inline const char *(*il2cpp_method_get_param_name)(const MethodInfo *method, uint32_t index);
inline Il2CppClass *(*il2cpp_class_get_parent)(Il2CppClass *klass);
inline Il2CppClass *(*il2cpp_class_get_interfaces)(Il2CppClass *klass, void **iter);
inline const char *(*il2cpp_class_get_namespace)(Il2CppClass *klass);
inline void *(*il2cpp_class_get_image)(Il2CppClass *klass);
inline int (*il2cpp_class_get_flags)(const Il2CppClass *klass);
inline bool (*il2cpp_class_is_valuetype)(const Il2CppClass *klass);
inline uint32_t (*il2cpp_property_get_flags)(PropertyInfo *prop);
inline const MethodInfo *(*il2cpp_property_get_get_method)(const PropertyInfo *prop);
inline const MethodInfo *(*il2cpp_property_get_set_method)(const PropertyInfo *prop);
inline const char *(*il2cpp_property_get_name)(const PropertyInfo *prop);
inline Il2CppClass *(*il2cpp_property_get_parent)(const PropertyInfo *prop);
inline int (*il2cpp_field_get_flags)(FieldInfo *field);
inline const char *(*il2cpp_field_get_name)(FieldInfo *field);
inline Il2CppClass *(*il2cpp_field_get_parent)(FieldInfo *field);
inline size_t (*il2cpp_field_get_offset)(FieldInfo *field);
inline const PropertyInfo *(*il2cpp_class_get_property_from_name)(Il2CppClass *klass, const char *name);
inline void (*il2cpp_runtime_object_init)(Il2CppObject *obj);
inline Il2CppObject *(*il2cpp_value_box)(Il2CppClass *klass, void *data);
inline void *(*il2cpp_object_unbox)(Il2CppObject *obj);
inline Il2CppString *(*il2cpp_string_new_utf16)(const wchar_t *str, unsigned int len);
inline Il2CppString *(*il2cpp_string_new)(const char *str);
inline void *(*il2cpp_domain_get)();
inline void *(*il2cpp_domain_assembly_open)(void *domain, const char *name);
inline void *(*il2cpp_assembly_get_image)(void *assembly);
inline void *(*il2cpp_resolve_icall)(const char *name);
inline void *(*il2cpp_thread_attach)(void *domain);
inline void (*il2cpp_thread_detach)(void *thread);
inline bool (*il2cpp_class_is_assignable_from)(void *klass, void *oklass);
inline void (*il2cpp_class_for_each)(void (*klassReportFunc)(Il2CppClass *klass, void *userData), void *userData);
inline void *(*il2cpp_class_get_nested_types)(void *klass, void **iter);
inline uint32_t (*il2cpp_gchandle_new)(void *obj, bool pinned);
inline void (*il2cpp_gchandle_free)(uint32_t gchandle);
inline void* (*il2cpp_gchandle_get_target)(uint32_t gchandle);
inline void (*il2cpp_runtime_class_init)(void* klass);
inline void* (*il2cpp_runtime_invoke)(MethodInfo* method, void* obj, void** params, Il2CppObject** exc);
inline Il2CppChar* (*il2cpp_string_chars)(Il2CppString* str);
inline int (*il2cpp_string_length)(Il2CppString* str);
inline void *(*il2cpp_gchandle_get_target)(uint32_t gchandle);
inline void (*il2cpp_runtime_class_init)(void *klass);
inline void *(*il2cpp_runtime_invoke)(MethodInfo *method, void *obj, void **params, Il2CppObject **exc);
inline Il2CppChar *(*il2cpp_string_chars)(Il2CppString *str);
inline int (*il2cpp_string_length)(Il2CppString *str);
namespace il2cppfunctions{
void init(HMODULE dll);
uintptr_t get_method_pointer(const char* assemblyName, const char* namespaze,
const char* klassName, const char* name, int argsCount,bool strict);
std::optional<std::wstring_view> get_string(void*);
void* create_string(std::wstring_view ws);
namespace il2cppfunctions
{
void init(HMODULE dll);
uintptr_t get_method_pointer(const char *assemblyName, const char *namespaze,
const char *klassName, const char *name, int argsCount, bool strict);
std::optional<std::wstring_view> get_string(void *);
void *create_string(std::wstring_view ws);
}

View File

@ -29,32 +29,39 @@ struct MonoReflectionMethod;
struct MonoAppDomain;
struct MonoCustomAttrInfo;
struct MonoTableInfo;
struct MonoReflectionType { UInt32 offset[2]; MonoType* type;};
struct MonoReflectionType
{
UInt32 offset[2];
MonoType *type;
};
typedef void* gconstpointer;
typedef void* gpointer;
typedef void *gconstpointer;
typedef void *gpointer;
typedef int gboolean;
typedef unsigned int guint32;
typedef int gint32;
typedef long gint64;
typedef unsigned char guchar;
typedef unsigned char guchar;
typedef UInt16 gunichar2;
struct MonoObject {
MonoVTable *vtable;
MonoThreadsSync *synchronisation;
struct MonoObject
{
MonoVTable *vtable;
MonoThreadsSync *synchronisation;
};
typedef MonoObject* MonoStruct;
typedef MonoObject** MonoStruct_out;
typedef MonoObject *MonoStruct;
typedef MonoObject **MonoStruct_out;
struct MonoString {
MonoObject object;
gint32 length;
gunichar2 chars[0];
struct MonoString
{
MonoObject object;
gint32 length;
gunichar2 chars[0];
};
struct MonoMethod {
struct MonoMethod
{
UInt16 flags;
UInt16 iflags;
};
@ -67,22 +74,25 @@ typedef enum
MONO_VERIFIER_MODE_STRICT
} MiniVerifierMode;
typedef enum {
typedef enum
{
MONO_SECURITY_MODE_NONE,
MONO_SECURITY_MODE_CORE_CLR,
MONO_SECURITY_MODE_CAS,
MONO_SECURITY_MODE_SMCS_HACK
} MonoSecurityMode;
typedef void GFuncRef (void*, void*);
typedef GFuncRef* GFunc;
typedef void GFuncRef(void *, void *);
typedef GFuncRef *GFunc;
typedef enum {
typedef enum
{
MONO_UNHANDLED_POLICY_LEGACY,
MONO_UNHANDLED_POLICY_CURRENT
} MonoRuntimeUnhandledExceptionPolicy;
struct MonoMethodDesc {
struct MonoMethodDesc
{
char *namespace2;
char *klass;
char *name;
@ -91,7 +101,6 @@ struct MonoMethodDesc {
gboolean include_namespace, klass_glob, name_glob;
};
struct MonoJitInfo;
struct MonoAssemblyName;
struct MonoDebugSourceLocation;
@ -101,53 +110,56 @@ struct LivenessState;
struct MonoBreakPolicy;
typedef bool (*MonoCoreClrPlatformCB) (const char *image_name);
typedef bool (*MonoCoreClrPlatformCB)(const char *image_name);
typedef unsigned int guint;
typedef void (*register_object_callback)(gpointer* arr, int size, void* callback_userdata);
typedef gboolean (*MonoStackWalk) (MonoMethod *method, gint32 native_offset, gint32 il_offset, gboolean managed, gpointer data);
typedef MonoBreakPolicy (*MonoBreakPolicyFunc) (MonoMethod *method);
typedef void* (*MonoDlFallbackLoad) (const char *name, int flags, char **err, void *user_data);
typedef void* (*MonoDlFallbackSymbol) (void *handle, const char *name, char **err, void *user_data);
typedef void* (*MonoDlFallbackClose) (void *handle, void *user_data);
typedef void (*register_object_callback)(gpointer *arr, int size, void *callback_userdata);
typedef gboolean (*MonoStackWalk)(MonoMethod *method, gint32 native_offset, gint32 il_offset, gboolean managed, gpointer data);
typedef MonoBreakPolicy (*MonoBreakPolicyFunc)(MonoMethod *method);
typedef void *(*MonoDlFallbackLoad)(const char *name, int flags, char **err, void *user_data);
typedef void *(*MonoDlFallbackSymbol)(void *handle, const char *name, char **err, void *user_data);
typedef void *(*MonoDlFallbackClose)(void *handle, void *user_data);
typedef enum {
typedef enum
{
MONO_TYPE_NAME_FORMAT_IL,
MONO_TYPE_NAME_FORMAT_REFLECTION,
MONO_TYPE_NAME_FORMAT_FULL_NAME,
MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED
} MonoTypeNameFormat;
//typedef void (*vprintf_func)(const char* msg, va_list args);
// typedef void (*vprintf_func)(const char* msg, va_list args);
struct MonoProfiler;
typedef void (*MonoProfileFunc) (MonoProfiler *prof);
typedef void (*MonoProfileFunc)(MonoProfiler *prof);
typedef enum {
typedef enum
{
MONO_PROFILE_NONE = 0,
MONO_PROFILE_APPDOMAIN_EVENTS = 1 << 0,
MONO_PROFILE_ASSEMBLY_EVENTS = 1 << 1,
MONO_PROFILE_MODULE_EVENTS = 1 << 2,
MONO_PROFILE_CLASS_EVENTS = 1 << 3,
MONO_PROFILE_JIT_COMPILATION = 1 << 4,
MONO_PROFILE_INLINING = 1 << 5,
MONO_PROFILE_EXCEPTIONS = 1 << 6,
MONO_PROFILE_ALLOCATIONS = 1 << 7,
MONO_PROFILE_GC = 1 << 8,
MONO_PROFILE_THREADS = 1 << 9,
MONO_PROFILE_REMOTING = 1 << 10,
MONO_PROFILE_TRANSITIONS = 1 << 11,
MONO_PROFILE_ENTER_LEAVE = 1 << 12,
MONO_PROFILE_COVERAGE = 1 << 13,
MONO_PROFILE_INS_COVERAGE = 1 << 14,
MONO_PROFILE_STATISTICAL = 1 << 15,
MONO_PROFILE_METHOD_EVENTS = 1 << 16,
MONO_PROFILE_MONITOR_EVENTS = 1 << 17,
MONO_PROFILE_ASSEMBLY_EVENTS = 1 << 1,
MONO_PROFILE_MODULE_EVENTS = 1 << 2,
MONO_PROFILE_CLASS_EVENTS = 1 << 3,
MONO_PROFILE_JIT_COMPILATION = 1 << 4,
MONO_PROFILE_INLINING = 1 << 5,
MONO_PROFILE_EXCEPTIONS = 1 << 6,
MONO_PROFILE_ALLOCATIONS = 1 << 7,
MONO_PROFILE_GC = 1 << 8,
MONO_PROFILE_THREADS = 1 << 9,
MONO_PROFILE_REMOTING = 1 << 10,
MONO_PROFILE_TRANSITIONS = 1 << 11,
MONO_PROFILE_ENTER_LEAVE = 1 << 12,
MONO_PROFILE_COVERAGE = 1 << 13,
MONO_PROFILE_INS_COVERAGE = 1 << 14,
MONO_PROFILE_STATISTICAL = 1 << 15,
MONO_PROFILE_METHOD_EVENTS = 1 << 16,
MONO_PROFILE_MONITOR_EVENTS = 1 << 17,
MONO_PROFILE_IOMAP_EVENTS = 1 << 18, /* this should likely be removed, too */
MONO_PROFILE_GC_MOVES = 1 << 19
} MonoProfileFlags;
typedef enum {
typedef enum
{
MONO_GC_EVENT_START,
MONO_GC_EVENT_MARK_START,
MONO_GC_EVENT_MARK_END,
@ -160,16 +172,15 @@ typedef enum {
MONO_GC_EVENT_POST_START_WORLD
} MonoGCEvent;
typedef void (*MonoProfileMethodFunc) (MonoProfiler *prof, MonoMethod *method);
typedef void (*MonoProfileGCFunc) (MonoProfiler *prof, MonoGCEvent event, int generation);
typedef void (*MonoProfileGCMoveFunc) (MonoProfiler *prof, void **objects, int num);
typedef void (*MonoProfileGCResizeFunc) (MonoProfiler *prof, gint64 new_size);
typedef void (*MonoProfileAllocFunc) (MonoProfiler *prof, MonoObject *obj, MonoClass *klass);
typedef void (*MonoProfileJitResult) (MonoProfiler *prof, MonoMethod *method, MonoJitInfo* jinfo, int result);
typedef void (*MonoProfileExceptionFunc) (MonoProfiler *prof, MonoObject *object);
typedef void (*MonoProfileExceptionClauseFunc) (MonoProfiler *prof, MonoMethod *method, int clause_type, int clause_num);
typedef void (*MonoProfileThreadFunc) (MonoProfiler *prof, uint32_t tid);
typedef void (*MonoProfileMethodFunc)(MonoProfiler *prof, MonoMethod *method);
typedef void (*MonoProfileGCFunc)(MonoProfiler *prof, MonoGCEvent event, int generation);
typedef void (*MonoProfileGCMoveFunc)(MonoProfiler *prof, void **objects, int num);
typedef void (*MonoProfileGCResizeFunc)(MonoProfiler *prof, gint64 new_size);
typedef void (*MonoProfileAllocFunc)(MonoProfiler *prof, MonoObject *obj, MonoClass *klass);
typedef void (*MonoProfileJitResult)(MonoProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo, int result);
typedef void (*MonoProfileExceptionFunc)(MonoProfiler *prof, MonoObject *object);
typedef void (*MonoProfileExceptionClauseFunc)(MonoProfiler *prof, MonoMethod *method, int clause_type, int clause_num);
typedef void (*MonoProfileThreadFunc)(MonoProfiler *prof, uint32_t tid);
inline void (*mono_thread_suspend_all_other_threads)();
inline void (*mono_thread_pool_cleanup)();
@ -329,7 +340,7 @@ inline char *(*mono_method_full_name)(MonoMethod *method, gboolean signature);
inline MonoObject *(*mono_object_isinst)(MonoObject *obj, MonoClass *klass);
inline MonoString *(*mono_string_new_len)(MonoDomain *domain, const char *text, guint length);
inline MonoString *(*mono_string_from_utf16)(gunichar2 *data);
inline MonoString* (*mono_string_new_utf16)(MonoDomain *domain, const gunichar2 *text, int32_t len);
inline MonoString *(*mono_string_new_utf16)(MonoDomain *domain, const gunichar2 *text, int32_t len);
inline MonoException *(*mono_get_exception_argument_null)(const char *arg);
inline MonoClass *(*mono_get_boolean_class)();
inline MonoClass *(*mono_get_byte_class)();
@ -399,18 +410,18 @@ inline void (*mono_profiler_install_allocation)(MonoProfileAllocFunc callback);
inline void (*mono_profiler_install_jit_end)(MonoProfileJitResult end);
inline void (*mono_profiler_install_exception)(MonoProfileExceptionFunc throw_callback, MonoProfileMethodFunc exc_method_leave, MonoProfileExceptionClauseFunc clause_callback);
inline void (*mono_profiler_install_thread)(MonoProfileThreadFunc start, MonoProfileThreadFunc end);
inline uint64_t* (*mono_compile_method)(MonoMethod*);
inline MonoTableInfo*(*mono_image_get_table_info)(MonoImage*,int);
inline int (*mono_table_info_get_rows)(MonoTableInfo*);
inline gunichar2* (*mono_string_chars)(MonoString* str);
inline int (*mono_string_length)(MonoString* str);
inline uint64_t *(*mono_compile_method)(MonoMethod *);
inline MonoTableInfo *(*mono_image_get_table_info)(MonoImage *, int);
inline int (*mono_table_info_get_rows)(MonoTableInfo *);
inline gunichar2 *(*mono_string_chars)(MonoString *str);
inline int (*mono_string_length)(MonoString *str);
namespace monofunctions
{
void init(HMODULE dll);
uintptr_t get_method_pointer(const char *assemblyName, const char *namespaze,
const char *klassName, const char *name, int argsCount, bool strict);
namespace monofunctions{
void init(HMODULE dll);
uintptr_t get_method_pointer(const char* assemblyName, const char* namespaze,
const char* klassName, const char* name, int argsCount,bool strict);
std::optional<std::wstring_view> get_string(void*);
void* create_string(std::wstring_view ws);
std::optional<std::wstring_view> get_string(void *);
void *create_string(std::wstring_view ws);
}

View File

@ -1,84 +1,108 @@
#include"def_il2cpp.hpp"
namespace{
#include "def_il2cpp.hpp"
namespace
{
Il2CppClass* get_il2cppclass1(const char* assemblyName, const char* namespaze,
const char* klassName,bool strict)
Il2CppClass *get_il2cppclass1(const char *assemblyName, const char *namespaze,
const char *klassName, bool strict)
{
auto il2cpp_domain=(SafeFptr(il2cpp_domain_get))();
if (!il2cpp_domain) return NULL;
void* assembly=0;
do{
auto il2cpp_domain = (SafeFptr(il2cpp_domain_get))();
if (!il2cpp_domain)
return NULL;
void *assembly = 0;
do
{
assembly = (SafeFptr(il2cpp_domain_assembly_open))(il2cpp_domain, assemblyName);
if(!assembly)break;
if (!assembly)
break;
auto image = (SafeFptr(il2cpp_assembly_get_image))(assembly);
if(!image)break;
if (!image)
break;
auto klass = (SafeFptr(il2cpp_class_from_name))(image, namespaze, klassName);
if(klass)return klass;
}while(0);
if(strict)return NULL;
if (klass)
return klass;
} while (0);
if (strict)
return NULL;
int _ = 0;
size_t sz = 0;
auto assemblies = (SafeFptr(il2cpp_domain_get_assemblies))(il2cpp_domain, &sz);
if(assemblies)
for (auto i = 0; i < sz; i++, assemblies++) {
auto image = (SafeFptr(il2cpp_assembly_get_image))(*assemblies);
if(!image)continue;
auto cls = (SafeFptr(il2cpp_class_from_name))(image, namespaze, klassName);
if(cls)return cls;
}
if (assemblies)
for (auto i = 0; i < sz; i++, assemblies++)
{
auto image = (SafeFptr(il2cpp_assembly_get_image))(*assemblies);
if (!image)
continue;
auto cls = (SafeFptr(il2cpp_class_from_name))(image, namespaze, klassName);
if (cls)
return cls;
}
return NULL;
}
void foreach_func(Il2CppClass* klass, void* userData){
auto st=(std::vector<Il2CppClass*>*)userData;
st->push_back(klass);
}
std::vector<Il2CppClass*> get_il2cppclass2(const char* namespaze,
const char* klassName)
void foreach_func(Il2CppClass *klass, void *userData)
{
std::vector<Il2CppClass*>maybes;
std::vector<Il2CppClass*>klasses;
(SafeFptr(il2cpp_class_for_each))(foreach_func,&klasses);
auto st = (std::vector<Il2CppClass *> *)userData;
st->push_back(klass);
}
std::vector<Il2CppClass *> get_il2cppclass2(const char *namespaze,
const char *klassName)
{
std::vector<Il2CppClass *> maybes;
std::vector<Il2CppClass *> klasses;
(SafeFptr(il2cpp_class_for_each))(foreach_func, &klasses);
for(auto klass:klasses){
for (auto klass : klasses)
{
auto classname = (SafeFptr(il2cpp_class_get_name))(klass);
if(!classname)continue;
if(strcmp(classname,klassName)!=0)continue;
if (!classname)
continue;
if (strcmp(classname, klassName) != 0)
continue;
maybes.push_back(klass);
auto namespacename=(SafeFptr(il2cpp_class_get_namespace))(klass);
if(!namespacename)continue;
if(strlen(namespaze)&&(strcmp(namespacename,namespaze)==0)){
auto namespacename = (SafeFptr(il2cpp_class_get_namespace))(klass);
if (!namespacename)
continue;
if (strlen(namespaze) && (strcmp(namespacename, namespaze) == 0))
{
return {klass};
}
}
return maybes;
}
struct AutoThread{
void*thread=NULL;
AutoThread(){
auto il2cpp_domain=(SafeFptr(il2cpp_domain_get))();
if (!il2cpp_domain) return;
thread= (SafeFptr(il2cpp_thread_attach))(il2cpp_domain);
struct AutoThread
{
void *thread = NULL;
AutoThread()
{
auto il2cpp_domain = (SafeFptr(il2cpp_domain_get))();
if (!il2cpp_domain)
return;
thread = (SafeFptr(il2cpp_thread_attach))(il2cpp_domain);
}
~AutoThread(){
if(!thread)return;
~AutoThread()
{
if (!thread)
return;
(SafeFptr(il2cpp_thread_detach))(thread);
}
};
void tryprintimage(Il2CppClass* klass){
auto image=(SafeFptr(il2cpp_class_get_image))(klass);
if(!image)return;
auto imagen=(SafeFptr(il2cpp_image_get_name))(image);
auto names=(SafeFptr(il2cpp_class_get_namespace))(klass);
if(imagen&&names)
ConsoleOutput("%s:%s",imagen,names);
void tryprintimage(Il2CppClass *klass)
{
auto image = (SafeFptr(il2cpp_class_get_image))(klass);
if (!image)
return;
auto imagen = (SafeFptr(il2cpp_image_get_name))(image);
auto names = (SafeFptr(il2cpp_class_get_namespace))(klass);
if (imagen && names)
ConsoleOutput("%s:%s", imagen, names);
}
uintptr_t getmethodofklass(Il2CppClass* klass,const char* name, int argsCount){
if(!klass)return NULL;
uintptr_t getmethodofklass(Il2CppClass *klass, const char *name, int argsCount)
{
if (!klass)
return NULL;
auto ret = (SafeFptr(il2cpp_class_get_method_from_name))(klass, name, argsCount);
if(!ret)return NULL;
if (!ret)
return NULL;
tryprintimage(klass);
return ret->methodPointer;
}
@ -120,32 +144,40 @@ void il2cppfunctions::init(HMODULE game_module)
RESOLVE_IMPORT(il2cpp_class_get_namespace);
RESOLVE_IMPORT(il2cpp_domain_get_assemblies);
}
uintptr_t il2cppfunctions::get_method_pointer(const char* assemblyName, const char* namespaze,
const char* klassName, const char* name, int argsCount,bool strict)
uintptr_t il2cppfunctions::get_method_pointer(const char *assemblyName, const char *namespaze,
const char *klassName, const char *name, int argsCount, bool strict)
{
auto thread=AutoThread();
if(!thread.thread)return NULL;
auto thread = AutoThread();
if (!thread.thread)
return NULL;
auto klass=get_il2cppclass1(assemblyName,namespaze,klassName,strict);//正向查询assemblyName可以为空
if(klass)
return getmethodofklass(klass,name,argsCount);
if(strict)return NULL;
auto klasses=get_il2cppclass2(namespaze,klassName);//反向查询namespace可以为空
for(auto klass:klasses){
auto method= getmethodofklass(klass,name,argsCount);
if(method)return method;
auto klass = get_il2cppclass1(assemblyName, namespaze, klassName, strict); // 正向查询assemblyName可以为空
if (klass)
return getmethodofklass(klass, name, argsCount);
if (strict)
return NULL;
auto klasses = get_il2cppclass2(namespaze, klassName); // 反向查询namespace可以为空
for (auto klass : klasses)
{
auto method = getmethodofklass(klass, name, argsCount);
if (method)
return method;
}
return NULL;
}
std::optional<std::wstring_view> il2cppfunctions::get_string(void* ptr){
auto str=reinterpret_cast<Il2CppString*>(ptr);
if(!str)return {};
auto wc=(SafeFptr(il2cpp_string_chars))(str);
auto len=(SafeFptr(il2cpp_string_length))(str);
if(!(wc&&len))return {};
return std::wstring_view(wc,len);
std::optional<std::wstring_view> il2cppfunctions::get_string(void *ptr)
{
auto str = reinterpret_cast<Il2CppString *>(ptr);
if (!str)
return {};
auto wc = (SafeFptr(il2cpp_string_chars))(str);
auto len = (SafeFptr(il2cpp_string_length))(str);
if (!(wc && len))
return {};
return std::wstring_view(wc, len);
}
void* il2cppfunctions::create_string(std::wstring_view ws){
return (SafeFptr(il2cpp_string_new_utf16))(ws.data(),ws.length());
void *il2cppfunctions::create_string(std::wstring_view ws)
{
return (SafeFptr(il2cpp_string_new_utf16))(ws.data(), ws.length());
}

View File

@ -1,82 +1,110 @@
#include"def_mono.hpp"
namespace{
#include "def_mono.hpp"
namespace
{
void MonoCallBack(void* assembly, void* userData) {
auto Image=(SafeFptr(mono_assembly_get_image))((MonoAssembly*)assembly);
if(!Image)return;
auto st=reinterpret_cast<std::vector<MonoImage*>*>(userData);
void MonoCallBack(void *assembly, void *userData)
{
auto Image = (SafeFptr(mono_assembly_get_image))((MonoAssembly *)assembly);
if (!Image)
return;
auto st = reinterpret_cast<std::vector<MonoImage *> *>(userData);
st->push_back(Image);
}
std::vector<MonoImage*>mono_loop_images(){
std::vector<MonoImage*>images;
(SafeFptr(mono_assembly_foreach))(MonoCallBack,(void*)&images);
std::vector<MonoImage *> mono_loop_images()
{
std::vector<MonoImage *> images;
(SafeFptr(mono_assembly_foreach))(MonoCallBack, (void *)&images);
return images;
}
MonoClass* mono_findklassby_ass_namespace(std::vector<MonoImage*>& images,const char *_dll, const char *_namespace,const char *_class,bool strict){
MonoClass* maybe=NULL;
MonoClass *mono_findklassby_ass_namespace(std::vector<MonoImage *> &images, const char *_dll, const char *_namespace, const char *_class, bool strict)
{
MonoClass *maybe = NULL;
for(auto Image:images){
auto tmp=(SafeFptr(mono_class_from_name))(Image, _namespace,_class);
if(!tmp)continue;
maybe=tmp;
auto name=(SafeFptr(mono_image_get_name))(Image);
if(!name)continue;
if(strcmp(_dll,name)==0)return tmp;
for (auto Image : images)
{
auto tmp = (SafeFptr(mono_class_from_name))(Image, _namespace, _class);
if (!tmp)
continue;
maybe = tmp;
auto name = (SafeFptr(mono_image_get_name))(Image);
if (!name)
continue;
if (strcmp(_dll, name) == 0)
return tmp;
}
if(strict)return NULL;
if (strict)
return NULL;
return maybe;
}
std::vector<MonoClass*> mono_findklassby_class(std::vector<MonoImage*>& images,const char *_namespace,const char *_class){
std::vector<MonoClass *> mono_findklassby_class(std::vector<MonoImage *> &images, const char *_namespace, const char *_class)
{
std::vector<MonoClass*>maybes;
for(auto image:images){
auto _1=(SafeFptr(mono_image_get_table_info))(image,MONO_TABLE_TYPEDEF);
if(!_1)continue;
auto tdefcount=(SafeFptr(mono_table_info_get_rows))(_1);
if(!tdefcount)continue;
std::vector<MonoClass *> maybes;
for (auto image : images)
{
auto _1 = (SafeFptr(mono_image_get_table_info))(image, MONO_TABLE_TYPEDEF);
if (!_1)
continue;
auto tdefcount = (SafeFptr(mono_table_info_get_rows))(_1);
if (!tdefcount)
continue;
for (int i = 0; i < tdefcount; i++)
{
auto klass = (MonoClass*)(SafeFptr(mono_class_get))(image, MONO_TOKEN_TYPE_DEF | i+1);
if(!klass)continue;
auto name=(SafeFptr(mono_class_get_name))(klass);
if(!name)continue;
if(strcmp(name,_class)!=0)continue;
auto klass = (MonoClass *)(SafeFptr(mono_class_get))(image, MONO_TOKEN_TYPE_DEF | i + 1);
if (!klass)
continue;
auto name = (SafeFptr(mono_class_get_name))(klass);
if (!name)
continue;
if (strcmp(name, _class) != 0)
continue;
maybes.push_back(klass);
auto namespacename=(SafeFptr(mono_class_get_namespace))(klass);
if(!namespacename)continue;
if(strlen(_namespace)&&(strcmp(namespacename,_namespace)==0)){
auto namespacename = (SafeFptr(mono_class_get_namespace))(klass);
if (!namespacename)
continue;
if (strlen(_namespace) && (strcmp(namespacename, _namespace) == 0))
{
return {klass};
}
}
}
return maybes;
}
void tryprintimage(MonoClass* klass){
auto image=(SafeFptr(mono_class_get_image))(klass);
if(!image)return;
auto imagen=(SafeFptr(mono_image_get_name))(image);
auto names=(SafeFptr(mono_class_get_namespace))(klass);
if(imagen&&names)
ConsoleOutput("%s:%s",imagen,names);
void tryprintimage(MonoClass *klass)
{
auto image = (SafeFptr(mono_class_get_image))(klass);
if (!image)
return;
auto imagen = (SafeFptr(mono_image_get_name))(image);
auto names = (SafeFptr(mono_class_get_namespace))(klass);
if (imagen && names)
ConsoleOutput("%s:%s", imagen, names);
}
uintptr_t getmethodofklass(MonoClass* klass,const char* name, int argsCount){
if(!klass)return NULL;
uintptr_t getmethodofklass(MonoClass *klass, const char *name, int argsCount)
{
if (!klass)
return NULL;
auto MonoClassMethod = (SafeFptr(mono_class_get_method_from_name))(klass, name, argsCount);
if(!MonoClassMethod)return NULL;
if (!MonoClassMethod)
return NULL;
tryprintimage(klass);
return (uintptr_t)(SafeFptr(mono_compile_method))(MonoClassMethod);
}
struct AutoThread{
MonoThread *thread=NULL;
AutoThread(){
auto _root=(SafeFptr(mono_get_root_domain))();
if(!_root)return ;
thread= (SafeFptr(mono_thread_attach))(_root);
struct AutoThread
{
MonoThread *thread = NULL;
AutoThread()
{
auto _root = (SafeFptr(mono_get_root_domain))();
if (!_root)
return;
thread = (SafeFptr(mono_thread_attach))(_root);
}
~AutoThread(){
if(!thread)return;
~AutoThread()
{
if (!thread)
return;
(SafeFptr(mono_thread_detach))(thread);
}
};
@ -88,158 +116,168 @@ void monofunctions::init(HMODULE game_module)
RESOLVE_IMPORT(mono_table_info_get_rows);
RESOLVE_IMPORT(mono_image_get_table_info);
RESOLVE_IMPORT(mono_compile_method);
RESOLVE_IMPORT(mono_class_from_name );
RESOLVE_IMPORT(mono_domain_get );
RESOLVE_IMPORT(mono_get_root_domain );
RESOLVE_IMPORT(mono_assembly_foreach );
RESOLVE_IMPORT(mono_image_get_name );
RESOLVE_IMPORT(mono_assembly_get_image );
RESOLVE_IMPORT(mono_class_is_valuetype );
RESOLVE_IMPORT(mono_signature_get_param_count );
RESOLVE_IMPORT(mono_string_to_utf8 );
RESOLVE_IMPORT(mono_string_new_wrapper );
RESOLVE_IMPORT(mono_class_get_parent );
RESOLVE_IMPORT(mono_class_get_namespace );
RESOLVE_IMPORT(mono_class_is_subclass_of );
RESOLVE_IMPORT(mono_class_get_name );
RESOLVE_IMPORT(mono_type_get_name );
RESOLVE_IMPORT(mono_type_get_class );
RESOLVE_IMPORT(mono_exception_from_name_msg );
RESOLVE_IMPORT(mono_raise_exception );
RESOLVE_IMPORT(mono_get_exception_class );
RESOLVE_IMPORT(mono_get_array_class );
RESOLVE_IMPORT(mono_get_string_class );
RESOLVE_IMPORT(mono_get_int32_class );
RESOLVE_IMPORT(mono_array_new );
RESOLVE_IMPORT(mono_array_new_full );
RESOLVE_IMPORT(mono_array_class_get );
RESOLVE_IMPORT(mono_class_array_element_size );
RESOLVE_IMPORT(mono_type_get_object );
RESOLVE_IMPORT(mono_thread_attach );
RESOLVE_IMPORT(mono_thread_detach );
RESOLVE_IMPORT(mono_thread_exit );
RESOLVE_IMPORT(mono_thread_current );
RESOLVE_IMPORT(mono_thread_set_main );
RESOLVE_IMPORT(mono_set_find_plugin_callback );
RESOLVE_IMPORT(mono_security_enable_core_clr );
RESOLVE_IMPORT(mono_security_set_core_clr_platform_callback );
RESOLVE_IMPORT(mono_runtime_unhandled_exception_policy_get );
RESOLVE_IMPORT(mono_runtime_unhandled_exception_policy_set );
RESOLVE_IMPORT(mono_class_get_nesting_type );
RESOLVE_IMPORT(mono_class_vtable );
RESOLVE_IMPORT(mono_method_get_object );
RESOLVE_IMPORT(mono_method_signature );
RESOLVE_IMPORT(mono_signature_get_params );
RESOLVE_IMPORT(mono_signature_get_return_type );
RESOLVE_IMPORT(mono_class_get_type );
RESOLVE_IMPORT(mono_set_ignore_version_and_key_when_finding_assemblies_already_loaded );
RESOLVE_IMPORT(mono_debug_init );
RESOLVE_IMPORT(mono_debug_open_image_from_memory );
RESOLVE_IMPORT(mono_field_get_flags );
RESOLVE_IMPORT(mono_image_open_from_data_full );
RESOLVE_IMPORT(mono_image_open_from_data_with_name );
RESOLVE_IMPORT(mono_assembly_load_from );
RESOLVE_IMPORT(mono_value_box );
RESOLVE_IMPORT(mono_class_get_image );
RESOLVE_IMPORT(mono_signature_is_instance );
RESOLVE_IMPORT(mono_method_get_last_managed );
RESOLVE_IMPORT(mono_get_enum_class );
RESOLVE_IMPORT(mono_class_get_byref_type );
RESOLVE_IMPORT(mono_field_static_get_value );
RESOLVE_IMPORT(mono_unity_set_embeddinghostname );
RESOLVE_IMPORT(mono_set_assemblies_path );
RESOLVE_IMPORT(mono_gchandle_new );
RESOLVE_IMPORT(mono_gchandle_get_target );
RESOLVE_IMPORT(mono_gchandle_new_weakref );
RESOLVE_IMPORT(mono_assembly_get_object );
RESOLVE_IMPORT(mono_gchandle_free );
RESOLVE_IMPORT(mono_class_get_properties );
RESOLVE_IMPORT(mono_property_get_get_method );
RESOLVE_IMPORT(mono_object_new_alloc_specific );
RESOLVE_IMPORT(mono_object_new_specific );
RESOLVE_IMPORT(mono_gc_collect );
RESOLVE_IMPORT(mono_gc_max_generation );
RESOLVE_IMPORT(mono_image_get_assembly );
RESOLVE_IMPORT(mono_assembly_open );
RESOLVE_IMPORT(mono_class_is_enum );
RESOLVE_IMPORT(mono_class_instance_size );
RESOLVE_IMPORT(mono_object_get_size );
RESOLVE_IMPORT(mono_image_get_filename );
RESOLVE_IMPORT(mono_assembly_load_from_full );
RESOLVE_IMPORT(mono_class_get_interfaces );
RESOLVE_IMPORT(mono_assembly_close );
RESOLVE_IMPORT(mono_class_get_property_from_name );
RESOLVE_IMPORT(mono_class_get_method_from_name );
RESOLVE_IMPORT(mono_class_from_mono_type );
RESOLVE_IMPORT(mono_domain_set );
RESOLVE_IMPORT(mono_thread_push_appdomain_ref );
RESOLVE_IMPORT(mono_thread_pop_appdomain_ref );
RESOLVE_IMPORT(mono_runtime_exec_main );
RESOLVE_IMPORT(mono_get_corlib );
RESOLVE_IMPORT(mono_class_get_field_from_name );
RESOLVE_IMPORT(mono_class_get_flags );
RESOLVE_IMPORT(mono_parse_default_optimizations );
RESOLVE_IMPORT(mono_set_defaults );
RESOLVE_IMPORT(mono_set_dirs );
RESOLVE_IMPORT(mono_jit_parse_options );
RESOLVE_IMPORT(mono_object_unbox );
RESOLVE_IMPORT(mono_custom_attrs_get_attr );
RESOLVE_IMPORT(mono_custom_attrs_has_attr );
RESOLVE_IMPORT(mono_custom_attrs_from_field );
RESOLVE_IMPORT(mono_custom_attrs_from_method );
RESOLVE_IMPORT(mono_custom_attrs_from_class );
RESOLVE_IMPORT(mono_custom_attrs_free );
RESOLVE_IMPORT(g_free );
RESOLVE_IMPORT(mono_runtime_is_shutting_down );
RESOLVE_IMPORT(mono_object_get_virtual_method );
RESOLVE_IMPORT(mono_jit_info_get_code_start );
RESOLVE_IMPORT(mono_jit_info_get_code_size );
RESOLVE_IMPORT(mono_class_from_name_case );
RESOLVE_IMPORT(mono_class_get_nested_types );
RESOLVE_IMPORT(mono_class_get_userdata_offset );
RESOLVE_IMPORT(mono_class_get_userdata );
RESOLVE_IMPORT(mono_class_set_userdata );
RESOLVE_IMPORT(mono_set_signal_chaining );
RESOLVE_IMPORT(mono_unity_set_unhandled_exception_handler );
RESOLVE_IMPORT(mono_runtime_invoke_array );
RESOLVE_IMPORT(mono_array_addr_with_size );
RESOLVE_IMPORT(mono_string_to_utf16 );
RESOLVE_IMPORT(mono_field_get_parent );
RESOLVE_IMPORT(mono_method_full_name );
RESOLVE_IMPORT(mono_object_isinst );
RESOLVE_IMPORT(mono_string_new_len );
RESOLVE_IMPORT(mono_string_from_utf16 );
RESOLVE_IMPORT(mono_class_get );
RESOLVE_IMPORT(mono_string_new_utf16 );
RESOLVE_IMPORT(mono_class_from_name);
RESOLVE_IMPORT(mono_domain_get);
RESOLVE_IMPORT(mono_get_root_domain);
RESOLVE_IMPORT(mono_assembly_foreach);
RESOLVE_IMPORT(mono_image_get_name);
RESOLVE_IMPORT(mono_assembly_get_image);
RESOLVE_IMPORT(mono_class_is_valuetype);
RESOLVE_IMPORT(mono_signature_get_param_count);
RESOLVE_IMPORT(mono_string_to_utf8);
RESOLVE_IMPORT(mono_string_new_wrapper);
RESOLVE_IMPORT(mono_class_get_parent);
RESOLVE_IMPORT(mono_class_get_namespace);
RESOLVE_IMPORT(mono_class_is_subclass_of);
RESOLVE_IMPORT(mono_class_get_name);
RESOLVE_IMPORT(mono_type_get_name);
RESOLVE_IMPORT(mono_type_get_class);
RESOLVE_IMPORT(mono_exception_from_name_msg);
RESOLVE_IMPORT(mono_raise_exception);
RESOLVE_IMPORT(mono_get_exception_class);
RESOLVE_IMPORT(mono_get_array_class);
RESOLVE_IMPORT(mono_get_string_class);
RESOLVE_IMPORT(mono_get_int32_class);
RESOLVE_IMPORT(mono_array_new);
RESOLVE_IMPORT(mono_array_new_full);
RESOLVE_IMPORT(mono_array_class_get);
RESOLVE_IMPORT(mono_class_array_element_size);
RESOLVE_IMPORT(mono_type_get_object);
RESOLVE_IMPORT(mono_thread_attach);
RESOLVE_IMPORT(mono_thread_detach);
RESOLVE_IMPORT(mono_thread_exit);
RESOLVE_IMPORT(mono_thread_current);
RESOLVE_IMPORT(mono_thread_set_main);
RESOLVE_IMPORT(mono_set_find_plugin_callback);
RESOLVE_IMPORT(mono_security_enable_core_clr);
RESOLVE_IMPORT(mono_security_set_core_clr_platform_callback);
RESOLVE_IMPORT(mono_runtime_unhandled_exception_policy_get);
RESOLVE_IMPORT(mono_runtime_unhandled_exception_policy_set);
RESOLVE_IMPORT(mono_class_get_nesting_type);
RESOLVE_IMPORT(mono_class_vtable);
RESOLVE_IMPORT(mono_method_get_object);
RESOLVE_IMPORT(mono_method_signature);
RESOLVE_IMPORT(mono_signature_get_params);
RESOLVE_IMPORT(mono_signature_get_return_type);
RESOLVE_IMPORT(mono_class_get_type);
RESOLVE_IMPORT(mono_set_ignore_version_and_key_when_finding_assemblies_already_loaded);
RESOLVE_IMPORT(mono_debug_init);
RESOLVE_IMPORT(mono_debug_open_image_from_memory);
RESOLVE_IMPORT(mono_field_get_flags);
RESOLVE_IMPORT(mono_image_open_from_data_full);
RESOLVE_IMPORT(mono_image_open_from_data_with_name);
RESOLVE_IMPORT(mono_assembly_load_from);
RESOLVE_IMPORT(mono_value_box);
RESOLVE_IMPORT(mono_class_get_image);
RESOLVE_IMPORT(mono_signature_is_instance);
RESOLVE_IMPORT(mono_method_get_last_managed);
RESOLVE_IMPORT(mono_get_enum_class);
RESOLVE_IMPORT(mono_class_get_byref_type);
RESOLVE_IMPORT(mono_field_static_get_value);
RESOLVE_IMPORT(mono_unity_set_embeddinghostname);
RESOLVE_IMPORT(mono_set_assemblies_path);
RESOLVE_IMPORT(mono_gchandle_new);
RESOLVE_IMPORT(mono_gchandle_get_target);
RESOLVE_IMPORT(mono_gchandle_new_weakref);
RESOLVE_IMPORT(mono_assembly_get_object);
RESOLVE_IMPORT(mono_gchandle_free);
RESOLVE_IMPORT(mono_class_get_properties);
RESOLVE_IMPORT(mono_property_get_get_method);
RESOLVE_IMPORT(mono_object_new_alloc_specific);
RESOLVE_IMPORT(mono_object_new_specific);
RESOLVE_IMPORT(mono_gc_collect);
RESOLVE_IMPORT(mono_gc_max_generation);
RESOLVE_IMPORT(mono_image_get_assembly);
RESOLVE_IMPORT(mono_assembly_open);
RESOLVE_IMPORT(mono_class_is_enum);
RESOLVE_IMPORT(mono_class_instance_size);
RESOLVE_IMPORT(mono_object_get_size);
RESOLVE_IMPORT(mono_image_get_filename);
RESOLVE_IMPORT(mono_assembly_load_from_full);
RESOLVE_IMPORT(mono_class_get_interfaces);
RESOLVE_IMPORT(mono_assembly_close);
RESOLVE_IMPORT(mono_class_get_property_from_name);
RESOLVE_IMPORT(mono_class_get_method_from_name);
RESOLVE_IMPORT(mono_class_from_mono_type);
RESOLVE_IMPORT(mono_domain_set);
RESOLVE_IMPORT(mono_thread_push_appdomain_ref);
RESOLVE_IMPORT(mono_thread_pop_appdomain_ref);
RESOLVE_IMPORT(mono_runtime_exec_main);
RESOLVE_IMPORT(mono_get_corlib);
RESOLVE_IMPORT(mono_class_get_field_from_name);
RESOLVE_IMPORT(mono_class_get_flags);
RESOLVE_IMPORT(mono_parse_default_optimizations);
RESOLVE_IMPORT(mono_set_defaults);
RESOLVE_IMPORT(mono_set_dirs);
RESOLVE_IMPORT(mono_jit_parse_options);
RESOLVE_IMPORT(mono_object_unbox);
RESOLVE_IMPORT(mono_custom_attrs_get_attr);
RESOLVE_IMPORT(mono_custom_attrs_has_attr);
RESOLVE_IMPORT(mono_custom_attrs_from_field);
RESOLVE_IMPORT(mono_custom_attrs_from_method);
RESOLVE_IMPORT(mono_custom_attrs_from_class);
RESOLVE_IMPORT(mono_custom_attrs_free);
RESOLVE_IMPORT(g_free);
RESOLVE_IMPORT(mono_runtime_is_shutting_down);
RESOLVE_IMPORT(mono_object_get_virtual_method);
RESOLVE_IMPORT(mono_jit_info_get_code_start);
RESOLVE_IMPORT(mono_jit_info_get_code_size);
RESOLVE_IMPORT(mono_class_from_name_case);
RESOLVE_IMPORT(mono_class_get_nested_types);
RESOLVE_IMPORT(mono_class_get_userdata_offset);
RESOLVE_IMPORT(mono_class_get_userdata);
RESOLVE_IMPORT(mono_class_set_userdata);
RESOLVE_IMPORT(mono_set_signal_chaining);
RESOLVE_IMPORT(mono_unity_set_unhandled_exception_handler);
RESOLVE_IMPORT(mono_runtime_invoke_array);
RESOLVE_IMPORT(mono_array_addr_with_size);
RESOLVE_IMPORT(mono_string_to_utf16);
RESOLVE_IMPORT(mono_field_get_parent);
RESOLVE_IMPORT(mono_method_full_name);
RESOLVE_IMPORT(mono_object_isinst);
RESOLVE_IMPORT(mono_string_new_len);
RESOLVE_IMPORT(mono_string_from_utf16);
RESOLVE_IMPORT(mono_class_get);
RESOLVE_IMPORT(mono_string_new_utf16);
}
uintptr_t monofunctions::get_method_pointer(const char *_dll, const char *_namespace, const char *_class, const char *_method, int paramCount,bool strict) {
auto thread=AutoThread();
if(!thread.thread)return NULL;
uintptr_t monofunctions::get_method_pointer(const char *_dll, const char *_namespace, const char *_class, const char *_method, int paramCount, bool strict)
{
auto thread = AutoThread();
if (!thread.thread)
return NULL;
auto images=mono_loop_images();
auto images = mono_loop_images();
auto pClass=mono_findklassby_ass_namespace(images,_dll,_namespace,_class,strict);//dll可以为空
if(pClass)
return getmethodofklass(pClass,_method,paramCount);
if(strict)return NULL;
auto klasses=mono_findklassby_class(images,_namespace,_class);//namespace可以为空
for(auto klass:klasses){
auto method= getmethodofklass(klass,_method,paramCount);
if(method)return method;
auto pClass = mono_findklassby_ass_namespace(images, _dll, _namespace, _class, strict); // dll可以为空
if (pClass)
return getmethodofklass(pClass, _method, paramCount);
if (strict)
return NULL;
auto klasses = mono_findklassby_class(images, _namespace, _class); // namespace可以为空
for (auto klass : klasses)
{
auto method = getmethodofklass(klass, _method, paramCount);
if (method)
return method;
}
return NULL;
}
std::optional<std::wstring_view> monofunctions::get_string(void* ptr){
auto str=reinterpret_cast<MonoString*>(ptr);
if(!str)return {};
auto wc=(SafeFptr(mono_string_chars))(str);
auto len=(SafeFptr(mono_string_length))(str);
if(!(wc&&len))return {};
return std::wstring_view((wchar_t*)wc,len);
std::optional<std::wstring_view> monofunctions::get_string(void *ptr)
{
auto str = reinterpret_cast<MonoString *>(ptr);
if (!str)
return {};
auto wc = (SafeFptr(mono_string_chars))(str);
auto len = (SafeFptr(mono_string_length))(str);
if (!(wc && len))
return {};
return std::wstring_view((wchar_t *)wc, len);
}
void* monofunctions::create_string(std::wstring_view ws){
auto domain=(SafeFptr(mono_domain_get))();
if(!domain)return nullptr;
return (SafeFptr(mono_string_new_utf16))(domain,(gunichar2*)ws.data(),ws.length());
void *monofunctions::create_string(std::wstring_view ws)
{
auto domain = (SafeFptr(mono_domain_get))();
if (!domain)
return nullptr;
return (SafeFptr(mono_string_new_utf16))(domain, (gunichar2 *)ws.data(), ws.length());
}

View File

@ -1,48 +1,63 @@
#include"def_mono.hpp"
#include"def_il2cpp.hpp"
namespace{
std::optional<std::wstring_view> readmonostring(void* ptr){
if(!ptr)return {};
MonoString* string = (MonoString*)ptr;
auto data = (wchar_t*)string->chars;
auto len=string->length;
if(!(len&&data))return {};
if(wcslen(data)!=len)return {};
return std::wstring_view(data,len);
#include "def_mono.hpp"
#include "def_il2cpp.hpp"
namespace
{
std::optional<std::wstring_view> readmonostring(void *ptr)
{
if (!ptr)
return {};
MonoString *string = (MonoString *)ptr;
auto data = (wchar_t *)string->chars;
auto len = string->length;
if (!(len && data))
return {};
if (wcslen(data) != len)
return {};
return std::wstring_view(data, len);
}
void *createmonostring(std::wstring_view ws, MonoString *origin)
{
auto newstring = (MonoString *)malloc(sizeof(MonoString) + ws.size() + 2);
memcpy(newstring, origin, sizeof(MonoString));
memcpy((wchar_t *)newstring->chars, ws.data(), ws.size() * 2);
newstring->length = ws.size();
return newstring;
}
}
void* createmonostring(std::wstring_view ws,MonoString* origin){
auto newstring=(MonoString*)malloc(sizeof(MonoString)+ws.size()+2);
memcpy(newstring,origin,sizeof(MonoString));
memcpy((wchar_t*)newstring->chars,ws.data(),ws.size()*2);
newstring->length=ws.size();
return newstring;
}
}
void commonsolvemonostring(uintptr_t offset,uintptr_t *data, size_t*len){
auto sw=il2cppfunctions::get_string((void*)offset);
if(!sw)sw=monofunctions::get_string((void*)offset);
if(!sw)sw=readmonostring((void*)offset);
if(!sw)return;
auto sw_v=sw.value();
*data=(uintptr_t)sw_v.data();
*len=sw_v.length()*sizeof(wchar_t);
if(*len>TEXT_BUFFER_SIZE){
*len=0;
void commonsolvemonostring(uintptr_t offset, uintptr_t *data, size_t *len)
{
auto sw = il2cppfunctions::get_string((void *)offset);
if (!sw)
sw = monofunctions::get_string((void *)offset);
if (!sw)
sw = readmonostring((void *)offset);
if (!sw)
return;
auto sw_v = sw.value();
*data = (uintptr_t)sw_v.data();
*len = sw_v.length() * sizeof(wchar_t);
if (*len > TEXT_BUFFER_SIZE)
{
*len = 0;
return;
}
}
void unity_ui_string_hook_after(uintptr_t *offset,void* data, size_t len)
void unity_ui_string_hook_after(uintptr_t *offset, void *data, size_t len)
{
auto view=std::wstring_view((wchar_t*)data,len/2);
auto newstring=il2cppfunctions::create_string(view);
if(!newstring)newstring=monofunctions::create_string(view);
if(!newstring)newstring=createmonostring(view,(MonoString*)*offset);
*offset=(uintptr_t)newstring;
auto view = std::wstring_view((wchar_t *)data, len / 2);
auto newstring = il2cppfunctions::create_string(view);
if (!newstring)
newstring = monofunctions::create_string(view);
if (!newstring)
newstring = createmonostring(view, (MonoString *)*offset);
*offset = (uintptr_t)newstring;
}
uintptr_t tryfindmonoil2cpp(const char *_dll, const char *_namespace, const char *_class, const char *_method, int paramCoun,bool strict){
auto addr=il2cppfunctions::get_method_pointer(_dll,_namespace,_class,_method,paramCoun,strict);
if(addr)return addr;
return monofunctions::get_method_pointer(_dll,_namespace,_class,_method,paramCoun,strict);
uintptr_t tryfindmonoil2cpp(const char *_dll, const char *_namespace, const char *_class, const char *_method, int paramCoun, bool strict)
{
auto addr = il2cppfunctions::get_method_pointer(_dll, _namespace, _class, _method, paramCoun, strict);
if (addr)
return addr;
return monofunctions::get_method_pointer(_dll, _namespace, _class, _method, paramCoun, strict);
}

View File

@ -1,9 +1,7 @@
#define RESOLVE_IMPORT(name) name = (decltype(name))(GetProcAddress(game_module, #name))
void commonsolvemonostring(uintptr_t offset,uintptr_t *data, size_t*len);
void commonsolvemonostring(uintptr_t offset, uintptr_t *data, size_t *len);
void unity_ui_string_hook_after(uintptr_t *offset, void *data, size_t len);
void unity_ui_string_hook_after(uintptr_t *offset,void* data, size_t len);
uintptr_t tryfindmonoil2cpp(const char *_dll, const char *_namespace, const char *_class, const char *_method, int paramCoun,bool strict=false);
uintptr_t tryfindmonoil2cpp(const char *_dll, const char *_namespace, const char *_class, const char *_method, int paramCoun, bool strict = false);

View File

@ -108,10 +108,8 @@ void TextThread::Flush()
std::vector<std::wstring> sentences;
queuedSentences->swap(sentences);
int totalSize = 0;
for (auto &sentence : sentences)
{
totalSize += sentence.size();
sentence.erase(std::remove(sentence.begin(), sentence.end(), 0), sentence.end());
if (Output(*this, sentence))
storage->append(sentence + L"\n");