t1f7 / scp-internal-il2cpp

il2cpp internal cheat for SCP SL
58 stars 15 forks source link

Async #11

Closed JosiahBeaulieu closed 4 years ago

JosiahBeaulieu commented 4 years ago

Is it possible to use async with an injected DLL? I've made a function that spits out some text on screen and after a while removes it, but when plugging it into std::async and running the function, I get a memory writing error. I presume this is because I'm injecting into an advanced application like a game and it cannot tack on an address or whatever onto something. Not really sure why its happening. If you have any hints or suggestions that would be much appreciated. Here's my code:

    std::async([]() {
        if (GetAsyncKeyState(VK_INSERT)) {
            bool boolTime = true;
            if (boolTime) il2cpp::draw_text(Rect{ 1280, 100, 100.0f, 100.0f }, "<color=yellow><size=30>Sleeping for 3 seconds...</color></size>");
            Sleep(3000);
            boolTime = false;
        }
        }
    );

Here's a screenshot of the error: Screenshot_1

JosiahBeaulieu commented 4 years ago

From further research, I think I need a pointer? But idk what to do with that information.

t1f7 commented 4 years ago

I guess you should update the offsets, probably. And try to get rid of Sleep, that's a bad idea.

JosiahBeaulieu commented 4 years ago

I don't know how to find those offsets, and yeah that sleep is bad but I don't know another way, that's why I'm using async as having that sleep froze everything, I'm looking into using system time to check when to remove the text. I'm trying to make a GUI in game for really no purpose but just to learn but now that I think of it, there's probably some address and offset that could be used to hook into Unity's GUI scripting thing.

t1f7 commented 4 years ago

I don't know how to find those offsets, and yeah that sleep is bad but I don't know another way, that's why I'm using async as having that sleep froze everything, I'm looking into using system time to check when to remove the text. I'm trying to make a GUI in game for really no purpose but just to learn but now that I think of it, there's probably some address and offset that could be used to hook into Unity's GUI scripting thing.

You're hooking GUI draw callback that is called each frame, you literally can't pause it. You should find another way to make it. For example, use chorono and variable (if (start - now).seconds < 3) { draw_text }

JosiahBeaulieu commented 4 years ago

That's a good idea! Looks like a better option than "GetTickCount()" of which I was using. Ill test it out but I need to get those new pointer values as the game just updated.

I've been working on getting them and I've been scanning the class number changes (the indexes from the table with all those class names) in CE and I've got a 26 addresses that Iv'e been using "Find out what accesses/writes to this address" on and getting what CE says might be the pointer but when searching for those addresses in CE again, I don't have any green addresses popping up they're all just black. Not sure what I'm doing wrong but I'm going to keep researching and fumbling. But if you have any tips or suggestions that would be phenomenal! Anyways, thanks for the help so far!