Skip to content

Commit

Permalink
VR (MHWilds): Partial fixes (no more crashes)
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Nov 2, 2024
1 parent 294740f commit ba5f13a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions shared/sdk/RETransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Vector4f sdk::get_transform_position(RETransform* transform) {
glm::quat sdk::get_transform_rotation(RETransform* transform) {
static auto get_rotation_method = sdk::find_type_definition("via.Transform")->get_method("get_Rotation");

glm::quat out{};
__declspec(align(16)) glm::quat out{};
get_rotation_method->call<glm::quat*>(&out, sdk::get_thread_context(), transform);

return out;
Expand Down Expand Up @@ -106,19 +106,21 @@ uint32_t get_joint_hash(REJoint* joint) {
void sdk::set_joint_position(REJoint* joint, const Vector4f& position) {
static auto set_position_method = sdk::find_type_definition("via.Joint")->get_method("set_Position");

set_position_method->call<void*>(sdk::get_thread_context(), joint, &position);
__declspec(align(16)) Vector4f pos = position;
set_position_method->call<void*>(sdk::get_thread_context(), joint, &pos);
};

void sdk::set_joint_rotation(REJoint* joint, const glm::quat& rotation) {
static auto set_rotation_method = sdk::find_type_definition("via.Joint")->get_method("set_Rotation");

set_rotation_method->call<void*>(sdk::get_thread_context(), joint, &rotation);
__declspec(align(16)) glm::quat rot = rotation;
set_rotation_method->call<void*>(sdk::get_thread_context(), joint, &rot);
};

glm::quat sdk::get_joint_rotation(REJoint* joint) {
static auto get_rotation_method = sdk::find_type_definition("via.Joint")->get_method("get_Rotation");

glm::quat rotation{};
__declspec(align(16)) glm::quat rotation{};
get_rotation_method->call<glm::quat*>(&rotation, sdk::get_thread_context(), joint);

return rotation;
Expand All @@ -127,7 +129,7 @@ glm::quat sdk::get_joint_rotation(REJoint* joint) {
Vector4f sdk::get_joint_position(REJoint* joint) {
static auto get_position_method = sdk::find_type_definition("via.Joint")->get_method("get_Position");

Vector4f position{};
__declspec(align(16)) Vector4f position{};
get_position_method->call<Vector4f*>(&position, sdk::get_thread_context(), joint);

return position;
Expand All @@ -136,7 +138,7 @@ Vector4f sdk::get_joint_position(REJoint* joint) {
glm::quat sdk::get_joint_local_rotation(REJoint* joint) {
static auto get_local_rotation_method = sdk::find_type_definition("via.Joint")->get_method("get_LocalRotation");

glm::quat rotation{};
__declspec(align(16)) glm::quat rotation{};
get_local_rotation_method->call<glm::quat*>(&rotation, sdk::get_thread_context(), joint);

return rotation;
Expand All @@ -145,7 +147,7 @@ glm::quat sdk::get_joint_local_rotation(REJoint* joint) {
Vector4f sdk::get_joint_local_position(REJoint* joint) {
static auto get_local_position_method = sdk::find_type_definition("via.Joint")->get_method("get_LocalPosition");

Vector4f position{};
__declspec(align(16)) Vector4f position{};
get_local_position_method->call<Vector4f*>(&position, sdk::get_thread_context(), joint);

return position;
Expand Down
4 changes: 2 additions & 2 deletions src/mods/VR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#elif defined(RE4)
#include "sdk/regenny/re4/via/Window.hpp"
#include "sdk/regenny/re4/via/SceneView.hpp"
#elif defined(DD2)
#elif defined(DD2) || TDB_VER >= 74
#include "sdk/regenny/dd2/via/Window.hpp"
#include "sdk/regenny/dd2/via/SceneView.hpp"
#else
Expand Down Expand Up @@ -3131,7 +3131,7 @@ void VR::on_end_rendering(void* entry) {
"EndDynamics",
"EndPhysics",
"RenderDynamics",
#ifndef DD2
#if TDB_VER < 73
"RenderLandscape",
#endif
"DevelopRenderer",
Expand Down

0 comments on commit ba5f13a

Please sign in to comment.