JoakimCarlsson / EscapeFromTarkov-Cheat

12 stars 13 forks source link

In Game Null Reference Exception #3

Closed Ferrarie closed 4 years ago

Ferrarie commented 4 years ago

Here is my hack process:

    public void InsertCode()
    {
        string filePath = @"Somewhere\EscapeFromTarkovCheat.dll";

        if (File.Exists(filePath))
        {
            Assembly SampleAssembly = Assembly.LoadFrom(filePath);
            Type type = SampleAssembly.GetType("EscapeFromTarkovCheat.Loader");
            MethodInfo methodInfo = type.GetMethod("Load");
            try
            {
                object obj2 = methodInfo.Invoke(methodInfo.ReturnType, BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);
            }
            catch (Exception e)
            {
                Debug.LogWarning(e);
            }

        }
    }

After successfully insert those codes in DLL, I can see The GUI menu in Game. Those codes called moment is UnityEngine.Cursor.SetCursor(Texture2D texture, Vector2hotspot, CursorModecursorMode)

When enable Draw Players and Draw Loot Items the game Console will start to log a lot of Null Reference Exception.

skram commented 4 years ago

Whats your process on injecting? New to this trying to figure that out.

JoakimCarlsson commented 4 years ago

Are you trying too Iterate over objects while you are not ingame, do you still get null references if you are in game?

Ferrarie commented 4 years ago

The console Log that the exception comes from PlayerESP.DrawPlayerESP(). I think is _camera == null. I will check this later.

Ferrarie commented 4 years ago

What's your process of injecting? New to this trying to figure that out.

Sorry, the process is quite a bit difficult I am unable to explain that.

JoakimCarlsson commented 4 years ago

Instead of using _camers you can Use Camera.main but it takes more time to execute.

Camera.main returns the first camera that's is called "MainCamera" so it will be slower if there are additional cameras. Even though there is none a direct reference too the camera will be faster.

May I ask you how you load your dll?

On Mon, 9 Mar 2020, 01:36 Ferrarie, notifications@github.com wrote:

What's your process of injecting? New to this trying to figure that out.

Sorry, the process is quite a bit difficult I am unable to explain that.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JoakimCarlsson/EscapeFromTarkov-Cheat/issues/3?email_source=notifications&email_token=ABVJPVNU7NH4QH663FDMX43RGQ2YFA5CNFSM4LD3ZHOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOFGMQA#issuecomment-596272704, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVJPVP2Z3DP7OSIPMLN53DRGQ2YFANCNFSM4LD3ZHOA .

Ferrarie commented 4 years ago
  1. Maybe I should Find all cameras with Debug.Log to see them Tags or a better way to ensure the code can lock-on the correct camera.

  2. I edit the "Managed\UnityEngine.CoreModule.dll" file because it has no digitally signed.

Function locate in UnityEngine(namespace).Cursor(class).SetCursor(function). The function insert result :

public static void SetCursor(Texture2D texture, Vector2 hotspot, CursorMode cursorMode)
{
    //____________the insert code⬇
    string filePath = @"Somewhere\EscapeFromTarkovCheat.dll";
    if (File.Exists(filePath))
    {
        Assembly SampleAssembly = Assembly.LoadFrom(filePath);
        Type type = SampleAssembly.GetType("EscapeFromTarkovCheat.Loader");
        MethodInfo methodInfo = type.GetMethod("Load");
        try
        {
            object obj2 = methodInfo.Invoke(methodInfo.ReturnType, BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public, null, null, null);
        }
        catch (Exception e)
        {
            Debug.LogWarning(e);
        }
    }
    //__________the insert code⬆

    Cursor.SetCursor_Injected(texture, ref hotspot, cursorMode);
}
JoakimCarlsson commented 4 years ago

Dosen't BE do integrity checks? So you have too restore your assembly once the cheat assembly loaded?

Ferrarie commented 4 years ago

I edit theBattlestate Games Launcher too. Make the launcher doesn't check the file consistency. 😝

JoakimCarlsson commented 4 years ago

Is there a way I can contact you regarding this. I would like too follow up on this if you don't mind?

Ferrarie commented 4 years ago

Only on email or wechat

JoakimCarlsson commented 4 years ago

I do have WeChat.

On Mon, 9 Mar 2020 at 13:11, Ferrarie notifications@github.com wrote:

Only on email or wechat

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JoakimCarlsson/EscapeFromTarkov-Cheat/issues/3?email_source=notifications&email_token=ABVJPVONPSRFOBXMDHLAL43RGTTHBA5CNFSM4LD3ZHOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOHBQEI#issuecomment-596514833, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVJPVIGEUZYXXUNCJWWT6DRGTTHBANCNFSM4LD3ZHOA .

Ferrarie commented 4 years ago

SoKingwah

my wechatID