XXDestroyer89 Posted May 9, 2020 Share Posted May 9, 2020 Hello I am want to determine how to do this? could someone help? I cant find native Link to comment Share on other sites More sharing options...
Jitnaught Posted May 9, 2020 Share Posted May 9, 2020 You may have to do this by reading memory directly. Here is some code for getting the hover transform ratio: https://github.com/E66666666/GTAVManualTransmission/blob/master/Gears/Memory/VehicleExtensions.cpp#L246 https://github.com/E66666666/GTAVManualTransmission/blob/master/Gears/Memory/VehicleExtensions.cpp#L57 ikt 1 Link to comment Share on other sites More sharing options...
XXDestroyer89 Posted May 10, 2020 Author Share Posted May 10, 2020 Thank you but I do not know C++ I only now C#.. Link to comment Share on other sites More sharing options...
ikt Posted May 10, 2020 Share Posted May 10, 2020 It's also possible in C#, here's a stripped and modified version of my VehicleExtensions class with only GetHoverTransformRatio. Initialize the offset at your script start and call it with myVehicle.GetHoverTransformRatio. using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; using System.Xml; using GTA; namespace YourModNamespace { static class VehicleExtensions { private static SerializableDictionary<string, uint> Offsets = new SerializableDictionary<string, uint>(); public static unsafe int GetHoverTransformRatio(this Vehicle v) { return *(int*)((ulong)v.MemoryAddress + Offsets["HoverTransformRatioOffset"]); } static unsafe ulong FindPattern(string pattern, string mask) { ProcessModule module = Process.GetCurrentProcess().MainModule; ulong address = (ulong)module.BaseAddress.ToInt64(); ulong endAddress = address + (ulong)module.ModuleMemorySize; for (; address < endAddress; address++) { for (int i = 0; i < pattern.Length; i++) { if (mask[i] != '?' && ((byte*)address)[i] != pattern[i]) break; else if (i + 1 == pattern.Length) return address; } } return 0; } private static unsafe void GetAndSetOffset(string field, string pattern, string mask, long off1, long off2) { ulong addr = FindPattern(pattern, mask); Offsets[field] = addr == 0 ? 0 : (uint)(*(uint*)((long)addr + off1) + off2); } public static void InitializeOffsets() { GetAndSetOffset("HoverTransformRatioOffset", "\xF3\x0F\x11\xB3\x00\x00\x00\x00\x44\x88\x00\x00\x00\x00\x00\x48\x85\xC9", "xxxx????xx?????xxx", 4, 0); } } } XXDestroyer89, LeeC22, suicidal_banana and 1 other 4 Link to comment Share on other sites More sharing options...
XXDestroyer89 Posted May 11, 2020 Author Share Posted May 11, 2020 Thank you this is really cool but I get the following error: The type or namespace name 'SerializableDictionary<,>' could not be found (are you missing a using directive or an assembly reference?) I have tried searching for it but I found: Namespace: Microsoft.WindowsServerSolutions.Administration.ObjectModel But I can not access this in my project. It does not exist.. Link to comment Share on other sites More sharing options...
ikt Posted May 11, 2020 Share Posted May 11, 2020 (edited) You can also use a map, I just took it from code where I deserialized stuff. If you want to keep it simple, you can hardcode the offset, but it will break if Rockstar updates the vehicle class. public static unsafe int GetHoverTransformRatio(this Vehicle v) { return *(int*)((ulong)v.MemoryAddress + 0x36C); } (For future reference: This probably works for 1604+, currently works for 1868) Edited May 11, 2020 by ikt Jitnaught, XXDestroyer89 and suicidal_banana 3 Link to comment Share on other sites More sharing options...
XXDestroyer89 Posted May 11, 2020 Author Share Posted May 11, 2020 Yes this works. Thank you very much! ikt 1 Link to comment Share on other sites More sharing options...
stef538 Posted November 4, 2020 Share Posted November 4, 2020 (edited) Hi @ikt, It seems that 0x36 does no longer work and I also have the The type or namespace name 'SerializableDictionary<,>' could not be found (are you missing a using directive or an assembly reference?) issue. Is it possible for you to explain how the SerializableDictionary works so that we don't need 0x36 anymore and that we can continue to use this in the future. Edit: It seems that private static Dictionary<string, uint> Offsets = new Dictionary<string, uint>(); Might fix the issue. Edited November 4, 2020 by stef538 Link to comment Share on other sites More sharing options...
ikt Posted November 7, 2020 Share Posted November 7, 2020 2060: [12:13:01.647] [ DEBUG ] Hover Transform Active Offset: 0x358 [12:13:01.650] [ DEBUG ] Hover Transform Ratio Offset: 0x380 stef538 and LeeC22 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now