Skip to content

Commit

Permalink
UObjectHook: Add UInt16Property support
Browse files Browse the repository at this point in the history
UObjectHook: Forgot to commit this
  • Loading branch information
praydog committed Oct 18, 2024
1 parent 9ed8f96 commit 8a02623
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/mods/UObjectHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,12 @@ void UObjectHook::update_persistent_states() {
value = prop_state->data.u8;
}
break;
case "UInt16Property"_fnv:
{
auto& value = *(uint16_t*)(obj.as<uintptr_t>() + ((sdk::FProperty*)prop_desc)->get_offset());
value = prop_state->data.u16;
}
break;
default:
// OH NO!!!!! anyways
break;
Expand Down Expand Up @@ -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:
{
Expand Down
1 change: 1 addition & 0 deletions src/mods/UObjectHook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ class UObjectHook : public Mod {
float f;
int32_t i;
uint8_t u8;
uint16_t u16;
bool b;
} data;
};
Expand Down

0 comments on commit 8a02623

Please sign in to comment.