Skip to content

Commit

Permalink
UObjectHook: Add some common global objects to examine
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 26, 2023
1 parent 5a4ea71 commit c52d818
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/mods/UObjectHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <sdk/FStructProperty.hpp>
#include <sdk/USceneComponent.hpp>
#include <sdk/UGameplayStatics.hpp>
#include <sdk/APlayerController.hpp>
#include <sdk/APawn.hpp>

#include "VR.hpp"

Expand Down Expand Up @@ -516,6 +518,50 @@ void UObjectHook::on_draw_ui() {
ImGui::TreePop();
}

// Display common objects like things related to the player
if (ImGui::TreeNode("Common Objects")) {
auto world = sdk::UGameEngine::get()->get_world();

if (world != nullptr) {
if (ImGui::TreeNode("PlayerController")) {
auto player_controller = sdk::UGameplayStatics::get()->get_player_controller(world, 0);

if (player_controller != nullptr) {
ui_handle_object(player_controller);
} else {
ImGui::Text("No player controller");
}

ImGui::TreePop();
}

if (ImGui::TreeNode("Acknowledged Pawn")) {
auto player_controller = sdk::UGameplayStatics::get()->get_player_controller(world, 0);

if (player_controller != nullptr) {
auto pawn = player_controller->get_acknowledged_pawn();

if (pawn != nullptr) {
ui_handle_object(pawn);
} else {
ImGui::Text("No pawn");
}
}

ImGui::TreePop();
}

if (ImGui::TreeNode("World")) {
ui_handle_object(world);
ImGui::TreePop();
}
} else {
ImGui::Text("No world");
}

ImGui::TreePop();
}

if (ImGui::TreeNode("Objects by class")) {
static char filter[256]{};
ImGui::InputText("Filter", filter, sizeof(filter));
Expand Down

0 comments on commit c52d818

Please sign in to comment.