Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
SomeCrazyGuy committed Sep 19, 2023
1 parent 635dd7f commit 235d316
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
5 changes: 4 additions & 1 deletion LiveINI/aobscan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ extern void aob_free(AOB_SIG sig) {


extern unsigned aob_scan(const void* buffer, unsigned buffer_size, unsigned starting_offset, AOB_SIG sig) {
assert(starting_offset < buffer_size);
//assert(starting_offset < buffer_size);
if (starting_offset >= buffer_size) {
return AOB_NO_MATCH;
}

const unsigned char* haystack = (const unsigned char*)buffer + starting_offset;
const unsigned count = buffer_size - starting_offset;
Expand Down
24 changes: 8 additions & 16 deletions LiveINI/method_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@


struct Result {
std::string name; //rtti name
const char* name; //rtti name
uint32_t method_number; //index into the array of methods on the vtable
uint32_t method_count; //count of methods in class
uint32_t offset; //imagebase offset of vtable method
};

void draw_method_window() {
extern void draw_method_window() {
static char buffer[64];
static std::vector<Result> Results{};

Expand All @@ -30,19 +31,10 @@ void draw_method_window() {
for (const auto& x : GameProcessInfo.rtti_map) {
const uintptr_t* methods = (uintptr_t*)((char*)GameProcessInfo.buffer + x.second.vtable_offset);

uint32_t method_num = 0;
while (is_text_ptr(methods[method_num])) {


if (ptr == methods[method_num]) {
for (uint32_t i = 0; i < x.second.func_count; ++i) {
if (ptr == methods[i]) {
Log("Found Method");
Results.push_back(Result{x.first, method_num, x.second.vtable_offset + (method_num * 8)});
}

++method_num;

if (x.second.vtable_offset == 0x44DD370) {
Log("Testing Method %u (%p)", method_num, methods[method_num]);
Results.push_back(Result{ x.second.name, i, x.second.func_count, x.second.vtable_offset + (i * 8) });
}
}
}
Expand All @@ -59,9 +51,9 @@ void draw_method_window() {
for (int i = clip.DisplayStart; i < clip.DisplayEnd; ++i) {
ImGui::PushID(i);
const auto r = Results[i];
if (ImGui::CollapsingHeader(r.name.c_str())) {
if (ImGui::CollapsingHeader(r.name)) {
char text[64];
snprintf(text, sizeof(text), "Starfield.exe+0x%X (method %u)", r.offset, r.method_number);
snprintf(text, sizeof(text), "Starfield.exe+0x%X (method %u of %u)", r.offset, r.method_number, r.method_count);
ImGui::InputText("Info", text, sizeof(text), ImGuiInputTextFlags_ReadOnly);
}
ImGui::PopID();
Expand Down
2 changes: 1 addition & 1 deletion LiveINI/method_window.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#pragma once

void draw_method_window();
extern void draw_method_window();

0 comments on commit 235d316

Please sign in to comment.