typedef struct _monoString
{
void* klass;
void* monitor;
int length;
char chars[1];
int getLength()
{
return length;
}
char* getChars()
{
return chars;
}
}monoString;
monoString *CreateString(const char *str) {
monoString *(*CreateString)(void *_this, const char *str, int start, int length) = (monoString *(*)(void *, const char *, int, int))IL2CPP_H::Il2CppGetMethodOffset(OBFUSCATE("mscorlib.dll"), OBFUSCATE("System"), OBFUSCATE("String"), OBFUSCATE("CreateString"), 3);
int length = (int)strlen(str);
return CreateString(NULL, str, 0, length);
}
monoString *(*get_name)(void *inst);
void (*org_EntityListUpdate)(void *object);
void new_EntityListUpdate(void *object) {
if(player != NULL){
auto name = get_name(object);
if(name == CreateString("purple_coin_8")){
if (!objectFind(object))
{
objectList.push_back(object);
}
}
}
org_EntityListUpdate(object);
}
//hack thread
get_name = (monoString *(*)(void *))IL2CPP_H::Il2CppGetMethodOffset(OBFUSCATE("Scripts.dll"), OBFUSCATE("Oak"), OBFUSCATE("FieldObject"), OBFUSCATE("get_Name"), 0);
DobbyHook((void *)IL2CPP_H::Il2CppGetMethodOffset(OBFUSCATE("Scripts.dll"), OBFUSCATE("Oak"), OBFUSCATE("FieldObject") , OBFUSCATE("get_FieldObjectStatsBehaviour"), 0), (void *) new_EntityListUpdate , (void **) &org_EntityListUpdate);
Hi ty for reply me, im really new for this can you show me some example, Thank you== is checking the Pointer values not the string itself. make a function pointer to the string Equals method located in the string class hope this helps!
Solve thx mate it work== is checking the Pointer values not the string itself. make a function pointer to the string Equals method located in the string class hope this helps!
How did you solve it?Solve thx mate it work
How did you solve it?
bool (*get_equals)(monoString *a, monoString *b, int type);
bool (*old_IsSubUnit)(void *instance);
bool new_IsSubUnit(void *instance)
{
if(instance != NULL)
{
monoString *a = CreateString("Evan");
monoString *b = get_name(instance);
if(get_equals(a,b, 5)){
LOGD("Equals");
}else{
LOGD("Not Equals");
}
}
return old_IsSubUnit(instance);
}
//hack thread
get_equals = (bool (*)(monoString *, monoString *, int))Il2CppGetMethodOffset(OBFUSCATE("mscorlib.dll"), OBFUSCATE("System"), OBFUSCATE("String"), OBFUSCATE("Equals"), 3);
by using equals function
C++:bool (*get_equals)(monoString *a, monoString *b, int type); bool (*old_IsSubUnit)(void *instance); bool new_IsSubUnit(void *instance) { if(instance != NULL) { monoString *a = CreateString("Evan"); monoString *b = get_name(instance); if(get_equals(a,b, 5)){ LOGD("Equals"); }else{ LOGD("Not Equals"); } } return old_IsSubUnit(instance); } //hack thread get_equals = (bool (*)(monoString *, monoString *, int))Il2CppGetMethodOffset(OBFUSCATE("mscorlib.dll"), OBFUSCATE("System"), OBFUSCATE("String"), OBFUSCATE("Equals"), 3);
oh yeah you can also just hook Equals that has 2 param (string a, string b) i hook this equals cause il2cppgenerator hook diffrent equals
its enum class to comparisontypeWhat is the number 5 int *type parameter for?
public enum StringComparison
{
// Fields
public Int32 value__; // 0x10
public const StringComparison CurrentCulture = 0; // 0x0
public const StringComparison CurrentCultureIgnoreCase = 1; // 0x0
public const StringComparison InvariantCulture = 2; // 0x0
public const StringComparison InvariantCultureIgnoreCase = 3; // 0x0
public const StringComparison Ordinal = 4; // 0x0
public const StringComparison OrdinalIgnoreCase = 5; // 0x0
}
Okay thanksits enum class to comparisontype
like i said if u using absoluteaddress or BNM that has paramtype just hook Equals(String a, String b) but when i use il2cppgenerator i shoul hook this equals cause it have different paramC#:public enum StringComparison { // Fields public Int32 value__; // 0x10 public const StringComparison CurrentCulture = 0; // 0x0 public const StringComparison CurrentCultureIgnoreCase = 1; // 0x0 public const StringComparison InvariantCulture = 2; // 0x0 public const StringComparison InvariantCultureIgnoreCase = 3; // 0x0 public const StringComparison Ordinal = 4; // 0x0 public const StringComparison OrdinalIgnoreCase = 5; // 0x0 }
sureman thx for the createstringOkay thanks
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies