Help! Trying to hook timescale

nowhere_222

I am PLATINMODS!
Skilled
Hi, i'm wondering why my code didn't works on this hook..

C++:
//public void set_timeScale(float value) { } // class to hook

//the void *instance is a self-created variable.

void (*set_timeScale)(void *instance, float value);

float (*old_get_timeScale)(void *instance);
float get_timeScale(void *instance) {
    //Check if instance is NULL to prevent CRASH
    if (instance != NULL)
    {
        set_timeScale(instance, 9999); //Function Pointer mod
    }
    //return the original value (this code isn't really needed if you have a toggle/switch)
    return old_get_timeScale(instance);
}

MSHookFunction((void *) getAbsoluteAddress(targetLibName,
                                               string2Offset(OBFUSCATE_KEY("0x60e024", '?'))),
                   (void *)get_timeScale, (void **) &old_get_timeScale);

// Function pointer because we want to avoid crash when the il2cpp lib isn't loaded.

    set_timeScale = (void (*)(void *, float)) getAbsoluteAddress(targetLibName, 0x60e02c);

If someone can help me on this it would be great =))

nowhere222
 
Try this

void (*old_get_timeScale)(void *instance);
void get_timeScale(void *instance) {
if (instance != NULL) {
if (TimeScale) {
set_timeScale(instance, 9999.0f);
}
}
return old_get_timeScale(instance);
}
 
Try this

void (*old_get_timeScale)(void *instance);
void get_timeScale(void *instance) {
if (instance != NULL) {
if (TimeScale) {
set_timeScale(instance, 9999.0f);
}
}
return old_get_timeScale(instance);
}
First, since its a void Offset (non-returnable), it wont work with return in the hook, and specifying the ".0f", at the end of the value, i don't think it helps too much, only if the game confuses the offset as a double one, its good to be safe, but it might not help with anything.
 
How can i hook this Function..need help

public class Component : Object
[FreeFunctionAttribute] // RVA: 0x56101C Offset: 0x56101C VA: 0x56101C
// RVA: 0x1D955EC Offset: 0x1D955EC VA: 0x1D955EC
public Transform get_transform() { }

public class Transform : Component
// RVA: 0x2B4D720 Offset: 0x2B4D720 VA: 0x2B4D720
public void set_localScale(Vector3 value) { }
 
#include "Includes/Vector3.hpp"

float isLocalPlayerSize;
void *(*get_transform)(void *component);
void (*Transform_set_localScale)(void *transform, Vector3);

void SetPlayerSize(void *transform, Vector3 scale) {
return Transform_set_localScale(get_transform(transform), scale);
}

void (*old_playersizeUpdate)(void *instance);
void playersizeUpdate(void *instance) {
if (instance != NULL) {
if(isLocalPlayerSize){
SetPlayerSize(instance, Vector3(isLocalPlayerSize, isLocalPlayerSize, isLocalPlayerSize));
}
}
old_playersizeUpdate(instance);
}

MSHookFunction((void *)getAbsoluteAddress("libil2cpp.so", Your Player Update Offset), (void *) playersizeUpdate, (void **) &old_playersizeUpdate);

get_transform = (void *(*)(void *))getAbsoluteAddress(targetLibName, 0x1D955EC);
Transform_set_localScale = (void (*)(void*, Vector3))getAbsoluteAddress(targetLibName, 0x2B4D720);

OBFUSCATE("SeekBar_Player Size_1_50"), //0 Case

case 0:
if (value >= 1) {
isLocalPlayerSize = value;
}
break;
 
Try this

void (*old_get_timeScale)(void *instance);
void get_timeScale(void *instance) {
if (instance != NULL) {
if (TimeScale) {
set_timeScale(instance, 9999.0f);
}
}
return old_get_timeScale(instance);
}
how can includ this timescale on the lgl patch mod method? any advice? i already know how create the lgl mod floating
 
#include "Includes/Vector3.hpp"

float isLocalPlayerSize;
void *(*get_transform)(void *component);
void (*Transform_set_localScale)(void *transform, Vector3);

void SetPlayerSize(void *transform, Vector3 scale) {
return Transform_set_localScale(get_transform(transform), scale);
}

void (*old_playersizeUpdate)(void *instance);
void playersizeUpdate(void *instance) {
if (instance != NULL) {
if(isLocalPlayerSize){
SetPlayerSize(instance, Vector3(isLocalPlayerSize, isLocalPlayerSize, isLocalPlayerSize));
}
}
old_playersizeUpdate(instance);
}

MSHookFunction((void *)getAbsoluteAddress("libil2cpp.so", Your Player Update Offset), (void *) playersizeUpdate, (void **) &old_playersizeUpdate);

get_transform = (void *(*)(void *))getAbsoluteAddress(targetLibName, 0x1D955EC);
Transform_set_localScale = (void (*)(void*, Vector3))getAbsoluteAddress(targetLibName, 0x2B4D720);

OBFUSCATE("SeekBar_Player Size_1_50"), //0 Case

case 0:
if (value >= 1) {
isLocalPlayerSize = value;
}
break;
Is ios okay?I tried it on ios, but it crashed
 
I'm guessing you're trying to make speed hack with this. If you're modding an il2cpp unity game then there is a universally used function called timeScale that controls the game speed. It's static which means it doesn't have an instance. If it doesn't work then, in the same class, try deltaTime and FixedDeltaTime.


If you're not modding a unity game and your code didn't work then it could be that this isn't the method that controls the game speed or there are protections put in place or many other reasons, including: not the correct addresses, error with the function calling method, try an update method. Or an error with the inputted targetLibName.
 
I'm guessing you're trying to make speed hack with this. If you're modding an il2cpp unity game then there is a universally used function called timeScale that controls the game speed. It's static which means it doesn't have an instance. If it doesn't work then, in the same class, try deltaTime and FixedDeltaTime.


If you're not modding a unity game and your code didn't work then it could be that this isn't the method that controls the game speed or there are protections put in place or many other reasons, including: not the correct addresses, error with the function calling method, try an update method. Or an error with the inputted targetLibName.

yes get_deltaTime from Time Unity class can make some sort of speedhack, called time hack, but i wanted to make it with timescale but couldn't, anyway i find another way to make speedhack and this is fast way
thanks for the help
 
Back
Top Bottom