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

[Feature request] Add the ability to scan bytes within the range #15

Closed
Nukoooo opened this issue Jul 21, 2023 · 2 comments
Closed

[Feature request] Add the ability to scan bytes within the range #15

Nukoooo opened this issue Jul 21, 2023 · 2 comments

Comments

@Nukoooo
Copy link
Contributor

Nukoooo commented Jul 21, 2023

For example I have this struct

struct Foo 0x100
{
}

and there is an array of byte E0 A1 A2 A3 in it, but the struct has too much "junk" data that it is hard to find it by eyes, so making it able to scan bytes from FooAddress to FooAddress+0x100 will save some time.
It would be great if it supports wildcard(?) too

@Narutoleo15
Copy link

#include
#include

// Define the struct Foo
struct Foo {
// Add fields as needed
uint8_t data[0x100];
};

int main() {
// Initialize your struct Foo
Foo foo;

// Simulate loading data into foo.data
// Replace this with actual data loading logic
for (int i = 0; i < 0x100; i++) {
    foo.data[i] = 0xE0 + i;
}

// Specify the byte pattern you're searching for
uint8_t pattern[] = {0xE0, 0xA1, 0xA2, 0xA3};

// Search for the pattern within Foo's data
for (int i = 0; i <= 0x100 - sizeof(pattern); i++) {
    bool found = true;
    for (int j = 0; j < sizeof(pattern); j++) {
        if (foo.data[i + j] != pattern[j]) {
            found = false;
            break;
        }
    }
    if (found) {
        std::cout << "Pattern found at offset " << i << std::endl;
    }
}

return 0;

}

@Nukoooo
Copy link
Contributor Author

Nukoooo commented Nov 10, 2023

Closing because I can literally do it in cheat engine 🤦

@Nukoooo Nukoooo closed this as completed Nov 10, 2023
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