Fix Haptics

This commit is contained in:
Simon 2022-12-14 12:50:07 +00:00
parent c509e29ee1
commit 7d99f83ae9
4 changed files with 21 additions and 28 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.jk2quest"
android:versionCode="30"
android:versionName="0.4.1" android:installLocation="auto" >
package="com.drbeef.jkquest"
android:versionCode="31"
android:versionName="0.5.0" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030002" android:required="true"/>

View file

@ -1,10 +1,10 @@
#include "VrInput.h"
#include "VrCvars.h"
extern ovrApp gAppState;
#ifdef META_QUEST
extern ovrApp gAppState;
XrSpace CreateActionSpace(XrAction poseAction, XrPath subactionPath) {
XrActionSpaceCreateInfo asci = {};
asci.type = XR_TYPE_ACTION_SPACE_CREATE_INFO;
@ -443,17 +443,17 @@ void JKVR_Vibrate( int duration, int chan, float intensity )
{
for (int i = 0; i < 2; ++i)
{
int channel = (i + 1) & chan;
if (channel)
int channel = 1-i;
if ((i + 1) & chan)
{
if (vibration_channel_duration[i] > 0.0f)
if (vibration_channel_duration[channel] > 0.0f)
return;
if (vibration_channel_duration[i] == -1.0f && duration != 0.0f)
if (vibration_channel_duration[channel] == -1.0f && duration != 0.0f)
return;
vibration_channel_duration[i] = duration;
vibration_channel_intensity[i] = intensity * vr_haptic_intensity->value;
vibration_channel_duration[channel] = duration;
vibration_channel_intensity[channel] = intensity * vr_haptic_intensity->value;
}
}
}

View file

@ -1,9 +1,9 @@
#include "VrInput.h"
#include "VrCvars.h"
extern ovrApp gAppState;
#ifdef PICO_XR
//#ifdef PICO_XR
extern ovrApp gAppState;
XrResult CheckXrResult(XrResult res, const char* originator) {
if (XR_FAILED(res)) {
@ -580,17 +580,17 @@ void JKVR_Vibrate( int duration, int chan, float intensity )
{
for (int i = 0; i < 2; ++i)
{
int channel = (i + 1) & chan;
if (channel)
int channel = 1-i;
if ((i + 1) & chan)
{
if (vibration_channel_duration[i] > 0.0f)
if (vibration_channel_duration[channel] > 0.0f)
return;
if (vibration_channel_duration[i] == -1.0f && duration != 0.0f)
if (vibration_channel_duration[channel] == -1.0f && duration != 0.0f)
return;
vibration_channel_duration[i] = duration;
vibration_channel_intensity[i] = intensity * vr_haptic_intensity->value;
vibration_channel_duration[channel] = duration;
vibration_channel_intensity[channel] = intensity * vr_haptic_intensity->value;
}
}
}
@ -638,4 +638,4 @@ void JKVR_processHaptics() {
}
}
}
//#endif
#endif //PICO_XR

View file

@ -153,7 +153,7 @@ OXR_CheckErrors(XrInstance instance, XrResult result, const char* function, bool
#if defined(DEBUG)
#define OXR(func) OXR_CheckErrors(ovrApp_GetInstance(), func, #func, true);
#else
#define OXR(func) OXR_CheckErrors(ovrApp_GetInstance(), func, #func, false);
#define OXR(func) func;
#endif
typedef struct {
@ -226,13 +226,6 @@ void ovrTrackedController_Clear(ovrTrackedController* controller);
ovrMatrix4f ovrMatrix4f_Multiply(const ovrMatrix4f* a, const ovrMatrix4f* b);
ovrMatrix4f ovrMatrix4f_CreateRotation(const float radiansX, const float radiansY, const float radiansZ);
ovrMatrix4f ovrMatrix4f_CreateFromQuaternion(const XrQuaternionf* q);
ovrMatrix4f ovrMatrix4f_CreateProjectionFov(
const float fovDegreesX,
const float fovDegreesY,
const float offsetX,
const float offsetY,
const float nearZ,
const float farZ);
XrVector4f XrVector4f_MultiplyMatrix4f(const ovrMatrix4f* a, const XrVector4f* v);