Skip to content

Commit

Permalink
Plugins: Add more VR functions for aiming and recentering
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Feb 19, 2024
1 parent 516d625 commit eb1a29d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 5 deletions.
9 changes: 7 additions & 2 deletions include/uevr/API.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SOFTWARE.
#define UEVR_OUT

#define UEVR_PLUGIN_VERSION_MAJOR 2
#define UEVR_PLUGIN_VERSION_MINOR 7
#define UEVR_PLUGIN_VERSION_MINOR 8
#define UEVR_PLUGIN_VERSION_PATCH 0

#define UEVR_RENDERER_D3D11 0
Expand Down Expand Up @@ -407,10 +407,15 @@ typedef struct {
bool (*is_decoupled_pitch_enabled)();

unsigned int (*get_movement_orientation)();

unsigned int (*get_lowest_xinput_index)();

void (*recenter_view)();
void (*recenter_horizon)();

unsigned int (*get_aim_method)();
void (*set_aim_method)(unsigned int method);
bool (*is_aim_allowed)();
void (*set_aim_allowed)(bool allowed);
} UEVR_VRData;

typedef struct {
Expand Down
1 change: 0 additions & 1 deletion include/uevr/API.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ class API {
};

struct FFieldClass {
// TODO: stubbed out for now
inline UEVR_FFieldClassHandle to_handle() { return (UEVR_FFieldClassHandle)this; }
inline UEVR_FFieldClassHandle to_handle() const { return (UEVR_FFieldClassHandle)this; }

Expand Down
4 changes: 2 additions & 2 deletions src/CommitHash.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#define UEVR_COMMIT_HASH "81e77749037bd11ab11d84c9598901fc36e6b9b7"
#define UEVR_BUILD_DATE "17.02.2024"
#define UEVR_COMMIT_HASH "516d625bd2e00d4cb3c339a9c6da2b22e802a5fc"
#define UEVR_BUILD_DATE "18.02.2024"
#define UEVR_BUILD_TIME "00:00"
25 changes: 25 additions & 0 deletions src/mods/PluginLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,26 @@ unsigned int get_lowest_xinput_index() {
void recenter_view() {
VR::get()->recenter_view();
}

void recenter_horizon() {
VR::get()->recenter_horizon();
}

unsigned int get_aim_method() {
return (unsigned int)VR::get()->get_aim_method();
}

void set_aim_method(unsigned int method) {
VR::get()->set_aim_method((VR::AimMethod)method);
}

bool is_aim_allowed() {
return VR::get()->is_aim_allowed();
}

void set_aim_allowed(bool allowed) {
VR::get()->set_aim_allowed(allowed);
}
}
}

Expand Down Expand Up @@ -768,6 +788,11 @@ UEVR_VRData g_vr_data {
uevr::vr::get_movement_orientation,
uevr::vr::get_lowest_xinput_index,
uevr::vr::recenter_view,
uevr::vr::recenter_horizon,
uevr::vr::get_aim_method,
uevr::vr::set_aim_method,
uevr::vr::is_aim_allowed,
uevr::vr::set_aim_allowed
};


Expand Down
12 changes: 12 additions & 0 deletions src/mods/VR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ class VR : public Mod {
m_aim_temp_disabled = !value;
}

bool is_aim_allowed() const {
return !m_aim_temp_disabled;
}

AimMethod get_aim_method() const {
if (m_aim_temp_disabled) {
return AimMethod::GAME;
Expand All @@ -441,6 +445,14 @@ class VR : public Mod {
return (AimMethod)m_aim_method->value();
}

void set_aim_method(AimMethod method) {
if ((size_t)method >= s_aim_method_names.size()) {
method = AimMethod::GAME;
}

m_aim_method->value() = method;
}

AimMethod get_movement_orientation() const {
return (AimMethod)m_movement_orientation->value();
}
Expand Down

0 comments on commit eb1a29d

Please sign in to comment.