Skip to content

Commit

Permalink
Compatibility: Add Skip UObjectArray Init
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Nov 29, 2023
1 parent f103287 commit 3e36763
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/mods/VR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2087,6 +2087,7 @@ void VR::on_draw_sidebar_entry(std::string_view name) {
if (selected_page == PAGE_COMPATIBILITY) {
ImGui::SetNextItemOpen(true, ImGuiCond_::ImGuiCond_Once);
if (ImGui::TreeNode("Compatibility Options")) {
m_compatibility_skip_uobjectarray_init->draw("Skip UObjectArray Init");
m_compatibility_skip_pip->draw("Skip PostInitProperties");
m_sceneview_compatibility_mode->draw("SceneView Compatibility Mode");
m_extreme_compat_mode->draw("Extreme Compatibility Mode");
Expand Down
6 changes: 6 additions & 0 deletions src/mods/VR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ class VR : public Mod {
bool should_skip_post_init_properties() const {
return m_compatibility_skip_pip->value();
}

bool should_skip_uobjectarray_init() const {
return m_compatibility_skip_uobjectarray_init->value();
}

bool is_extreme_compatibility_mode_enabled() const {
return m_extreme_compat_mode->value();
Expand Down Expand Up @@ -735,6 +739,7 @@ class VR : public Mod {
const ModToggle::Ptr m_sceneview_compatibility_mode{ ModToggle::create(generate_name("Compatibility_SceneView"), false) };

const ModToggle::Ptr m_compatibility_skip_pip{ ModToggle::create(generate_name("Compatibility_SkipPostInitProperties"), false) };
const ModToggle::Ptr m_compatibility_skip_uobjectarray_init{ ModToggle::create(generate_name("Compatibility_SkipUObjectArrayInit"), false) };

struct DecoupledPitchData {
mutable std::shared_mutex mtx{};
Expand Down Expand Up @@ -793,6 +798,7 @@ class VR : public Mod {
*m_splitscreen_compatibility_mode,
*m_splitscreen_view_index,
*m_compatibility_skip_pip,
*m_compatibility_skip_uobjectarray_init,
*m_sceneview_compatibility_mode,
};

Expand Down
8 changes: 5 additions & 3 deletions src/mods/vr/FFakeStereoRenderingHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ void FFakeStereoRenderingHook::on_frame() {
attempt_hook_fsceneview_constructor();

// TODO: see if this can be threaded; it might not be able to because of TLS or something
sdk::FName::get_constructor();
sdk::FName::get_to_string();
sdk::FUObjectArray::get();
if (!VR::get()->should_skip_uobjectarray_init()) {
sdk::FName::get_constructor();
sdk::FName::get_to_string();
sdk::FUObjectArray::get();
}

// Ideally we want to do all hooking
// from game engine tick. if it fails
Expand Down

0 comments on commit 3e36763

Please sign in to comment.