2024-05-09 07:23:06 +08:00
|
|
|
|
#include"def_mono.hpp"
|
|
|
|
|
#include"def_il2cpp.hpp"
|
|
|
|
|
|
|
|
|
|
inline void commonsolvemonostring(uintptr_t offset,uintptr_t *data, size_t*len){
|
|
|
|
|
MonoString* string = (MonoString*)offset;
|
|
|
|
|
if(string==0)return;
|
|
|
|
|
*data = (uintptr_t)string->chars;
|
|
|
|
|
if(wcslen((wchar_t*)string->chars)!=string->length)return;
|
|
|
|
|
*len = string->length * 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline void unity_ui_string_hook_after(uintptr_t *offset,void* data, size_t len)
|
|
|
|
|
{
|
|
|
|
|
MonoString* string = (MonoString*)*offset;
|
|
|
|
|
if(string==0)return;
|
|
|
|
|
if(wcslen((wchar_t*)string->chars)!=string->length)return;
|
|
|
|
|
|
|
|
|
|
//其实也可以直接覆写到原来的String上,但重新创建一个是更安全的操作。
|
|
|
|
|
auto newstring=(MonoString*)malloc(sizeof(MonoString)+len+2);
|
|
|
|
|
memcpy(newstring,string,sizeof(MonoString));
|
|
|
|
|
wcscpy((wchar_t*)newstring->chars,(wchar_t*)data);
|
|
|
|
|
newstring->length=len/2;
|
|
|
|
|
*offset=(uintptr_t)newstring;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-14 10:32:10 +08:00
|
|
|
|
|
2024-05-09 07:23:06 +08:00
|
|
|
|
void load_mono_functions_from_dll(HMODULE dll);
|
|
|
|
|
|
2024-05-14 10:32:10 +08:00
|
|
|
|
uintptr_t getmonofunctionptr(const char *_dll, const char *_namespace, const char *_class, const char *_method, int paramCount,bool strict);
|
2024-05-09 14:22:19 +08:00
|
|
|
|
|
|
|
|
|
|
2024-05-14 10:32:10 +08:00
|
|
|
|
inline uintptr_t tryfindmonoil2cpp(const char *_dll, const char *_namespace, const char *_class, const char *_method, int paramCoun,bool strict=false){
|
|
|
|
|
auto addr=il2cpp_symbols::get_method_pointer(_dll,_namespace,_class,_method,paramCoun,strict);
|
2024-05-09 14:22:19 +08:00
|
|
|
|
if(addr)return addr;
|
2024-05-14 10:32:10 +08:00
|
|
|
|
return getmonofunctionptr(_dll,_namespace,_class,_method,paramCoun,strict);
|
2024-05-09 14:22:19 +08:00
|
|
|
|
}
|