Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get base address? #132

Closed
DiddoBoi opened this issue Feb 13, 2022 · 3 comments
Closed

How to get base address? #132

DiddoBoi opened this issue Feb 13, 2022 · 3 comments

Comments

@DiddoBoi
Copy link

DiddoBoi commented Feb 13, 2022

AOBScan doesn't show the base address.

Ex: long MemoryScan = mem.AoBScan(AOB).Result.Sum();

Output: 7FF74441CCB7
In CE:(Cheat Engine) Growtopia.exe+54CCB7

@hollow87
Copy link
Contributor

You can take mProc.MainModule.BaseAddress and subtract that from the AoB output to get the offset from the base address.

long offset = aobResult - mem.mProc.MainModule.BaseAddress;
string CEOutputEquiv = $"Growtopia.exe+{offset:X}";

In reality though both are equivalent to each other.

You can use the output of the aob scan by converting it to a hex string easy way to do that is to use string interpolation like similar to this.

long aobResultRaw = (await m.AoBScan(AOB)).FirstOrDefault();
string aobResultString = $"0x{aobResultRaw:X}";

Also please do note that AoB scans are async tasks so you really should await on them to get the result instead of accessing the result directly. Also some calls may return 0 or more results so using Sum() on the result may not do what you intend.

@DiddoBoi
Copy link
Author

You can take mProc.MainModule.BaseAddress and subtract that from the AoB output to get the offset from the base address.

long offset = aobResult - mem.mProc.MainModule.BaseAddress;
string CEOutputEquiv = $"Growtopia.exe+{offset:X}";

In reality though both are equivalent to each other.

You can use the output of the aob scan by converting it to a hex string easy way to do that is to use string interpolation like similar to this.

long aobResultRaw = (await m.AoBScan(AOB)).FirstOrDefault();
string aobResultString = $"0x{aobResultRaw:X}";

Also please do note that AoB scans are async tasks so you really should await on them to get the result instead of accessing the result directly. Also some calls may return 0 or more results so using Sum() on the result may not do what you intend.

Thanks for the answer @hollow87. Unfortunately my output (aobresult) is a string. VS Gives this error "Operator '-' cannot be applied to operands of type 'string' and 'IntPtr' ". How do i convert IntPtr to string? Or is there any other solution to this error? Thanks!

@hollow87
Copy link
Contributor

This is beyond the scope of an github issue. I can suggest joining the discord to see if someone will help you with programming in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants