Skip to content

Commit

Permalink
Fix build, fix resolvers
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNite committed Jan 1, 2024
1 parent 33b8e23 commit 436a554
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 15 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ target_link_libraries(regenny PRIVATE
taocpp::pegtl
unofficial::nativefiledialog::nfd
spdlog::spdlog
utf8cpp
SDL2::SDL2
SDL2::SDL2main
nlohmann_json::nlohmann_json
Expand Down
1 change: 0 additions & 1 deletion cmake.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ link-libraries = [
"taocpp::pegtl",
"unofficial::nativefiledialog::nfd",
"spdlog::spdlog",
"utf8cpp",
"SDL2::SDL2",
"SDL2::SDL2main",
"nlohmann_json::nlohmann_json",
Expand Down
2 changes: 1 addition & 1 deletion src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <glad/glad.h> // Initialize with gladLoadGL()
#include <imgui.h>
#include <imgui_impl_opengl3.h>
#include <imgui_impl_sdl.h>
#include <imgui_impl_sdl2.h>

#include "scope_guard.hpp"

Expand Down
17 changes: 10 additions & 7 deletions src/ReGenny.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <fmt/format.h>
#include <imgui.h>
#include <imgui_impl_opengl3.h>
#include <imgui_impl_sdl.h>
#include <imgui_impl_sdl2.h>
#include <imgui_internal.h>
#include <imgui_stdlib.h>
#include <nfd.h>
Expand Down Expand Up @@ -1105,8 +1105,11 @@ void ReGenny::memory_ui() {
}

void ReGenny::set_address() {
if (auto addr = query_address_resolvers(m_ui.address)) {
m_parsed_address = *addr;
for (auto address : query_address_resolvers(m_ui.address)) {
auto addr_str = fmt::format("0x{:x}", address);
if (auto addr = parse_address(addr_str)) {
m_parsed_address = *addr;
}
}

if (auto addr = parse_address(m_ui.address)) {
Expand Down Expand Up @@ -1216,15 +1219,15 @@ void ReGenny::reset_lua_state() {
return sol::make_object(s, rg->process().get());
},
"add_address_resolver", [](sol::this_state s, ReGenny* rg, sol::function f) {
auto id = rg->add_address_resolver([f](std::string input) -> uintptr_t {
return sol::make_object(s, rg->add_address_resolver([f](std::string input) -> uintptr_t {
auto result = f(input);

if (result.get_type(0) == sol::type::number) {
return result.get<uintptr_t>(0);
if (result.get_type(1) == sol::type::number) {
return result.get<uintptr_t>(1);
}

return 0;
});
}));
},
"remove_address_resolver", [](ReGenny* rg, uint32_t id) {
rg->remove_address_resolver(id);
Expand Down
5 changes: 3 additions & 2 deletions src/ReGenny.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ class ReGenny {
}
auto remove_address_resolver(uint32_t id) { m_address_resolvers.erase(id); }
auto query_address_resolvers(const std::string& name) {
auto addresses = std::vector<uintptr_t>{};
for (auto& resolver : m_address_resolvers | std::views::values) {
if (auto address = resolver(name)) {
return address;
addresses.push_back(address);
}
}

return 0;
return addresses;
}

auto& eval_history_index() { return m_eval_history_index; }
Expand Down
2 changes: 1 addition & 1 deletion src/node/Array.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <fmt/format.h>
#include <imgui.h>
#include <utf8.h>
#include <utf8cpp/utf8.h>

#include "Pointer.hpp"
#include "Struct.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/node/Pointer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <fmt/format.h>
#include <imgui.h>
#include <utf8.h>
#include <utf8cpp/utf8.h>

#include "Array.hpp"
#include "Struct.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/node/Variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <fmt/format.h>
#include <imgui.h>
#include <utf8.h>
#include <utf8cpp/utf8.h>

#include "Variable.hpp"

Expand Down

0 comments on commit 436a554

Please sign in to comment.