Skip to content

Commit

Permalink
REGlobals: Minor adjustment to scan logic
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Mar 24, 2024
1 parent f9aeefd commit 5154ccb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion shared/sdk/REGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ REGlobals::REGlobals() {
auto start = (uintptr_t)mod;
auto end = (uintptr_t)start + *utility::get_module_size(mod);

end -= 0x1000;

spdlog::info("start: {:x}", start);
spdlog::info("end: {:x}", end);

// generic pattern used for all these globals
auto pat = std::string{ "48 8D ? ? ? ? ? 48 B8 00 00 00 00 00 00 00 80" };

// find all the globals
for (auto i = utility::scan(start, end - start, pat); i.has_value(); i = utility::scan(*i + 1, end - (*i + 1), pat)) {
for (auto i = utility::scan(start, end - start, pat); i.has_value(); i = utility::scan(*i + 1, end - (*i + 1), pat)) try {
auto ptr = utility::calculate_absolute(*i + 3);

// Make sure the global is within the module boundaries
Expand All @@ -56,6 +61,8 @@ REGlobals::REGlobals() {

m_objects.insert(obj_ptr);
m_object_list.push_back(obj_ptr);
} catch(...) {

}

// Create a list of getter functions instead
Expand Down

0 comments on commit 5154ccb

Please sign in to comment.