Skip to content

Commit

Permalink
UObjectHook: Add support for ByteProperty display
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 17, 2024
1 parent f8bf87c commit fdaf19f
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 @@ -1436,6 +1436,12 @@ void UObjectHook::update_persistent_states() {
boolprop->set_value_in_object(obj, prop_state->data.b);
}
break;
case "ByteProperty"_fnv:
{
auto& value = *(uint8_t*)(obj.as<uintptr_t>() + ((sdk::FProperty*)prop_desc)->get_offset());
value = prop_state->data.u8;
}
break;
default:
// OH NO!!!!! anyways
break;
Expand Down Expand Up @@ -3377,6 +3383,16 @@ void UObjectHook::ui_handle_properties(void* object, sdk::UStruct* uclass) {
display_context(value);
}
break;
case "ByteProperty"_fnv:
{
auto& value = *(uint8_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(), &converted, 0, 255)) {
value = (uint8_t)converted;
}
display_context(value);
}
break;
case "InterfaceProperty"_fnv:
case "ObjectProperty"_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 @@ -438,6 +438,7 @@ class UObjectHook : public Mod {
double d;
float f;
int32_t i;
uint8_t u8;
bool b;
} data;
};
Expand Down

0 comments on commit fdaf19f

Please sign in to comment.