From 8a0262335d91e77e1269d92b04795aae8ae59742 Mon Sep 17 00:00:00 2001 From: praydog Date: Fri, 18 Oct 2024 16:43:20 -0700 Subject: [PATCH] UObjectHook: Add UInt16Property support UObjectHook: Forgot to commit this --- src/mods/UObjectHook.cpp | 16 ++++++++++++++++ src/mods/UObjectHook.hpp | 1 + 2 files changed, 17 insertions(+) diff --git a/src/mods/UObjectHook.cpp b/src/mods/UObjectHook.cpp index bc66e844..a70dd96a 100644 --- a/src/mods/UObjectHook.cpp +++ b/src/mods/UObjectHook.cpp @@ -1442,6 +1442,12 @@ void UObjectHook::update_persistent_states() { value = prop_state->data.u8; } break; + case "UInt16Property"_fnv: + { + auto& value = *(uint16_t*)(obj.as() + ((sdk::FProperty*)prop_desc)->get_offset()); + value = prop_state->data.u16; + } + break; default: // OH NO!!!!! anyways break; @@ -3365,6 +3371,16 @@ void UObjectHook::ui_handle_properties(void* object, sdk::UStruct* uclass) { display_context(value); } break; + case "UInt16Property"_fnv: + { + auto& value = *(uint16_t*)((uintptr_t)object + ((sdk::FProperty*)prop)->get_offset()); + int converted = (int)value; + if (ImGui::SliderInt(utility::narrow(prop->get_field_name().to_string()).data(), (int*)&converted, 0, 65535)) { + value = (uint16_t)converted; + } + display_context(value); + } + break; case "UInt32Property"_fnv: case "IntProperty"_fnv: { diff --git a/src/mods/UObjectHook.hpp b/src/mods/UObjectHook.hpp index 3f6d946b..abd6c558 100644 --- a/src/mods/UObjectHook.hpp +++ b/src/mods/UObjectHook.hpp @@ -439,6 +439,7 @@ class UObjectHook : public Mod { float f; int32_t i; uint8_t u8; + uint16_t u16; bool b; } data; };