Fixed initializing the OpenVR driver
This commit is contained in:
@@ -22,7 +22,9 @@
|
|||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_OPENVR
|
#ifdef SDL_VIDEO_DRIVER_OPENVR
|
||||||
|
|
||||||
|
#if 0
|
||||||
#define DEBUG_OPENVR
|
#define DEBUG_OPENVR
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../../events/SDL_mouse_c.h"
|
#include "../../events/SDL_mouse_c.h"
|
||||||
#include "../../events/SDL_keyboard_c.h"
|
#include "../../events/SDL_keyboard_c.h"
|
||||||
@@ -445,7 +447,7 @@ static void OPENVR_VirtualControllerUpdate(void *userdata)
|
|||||||
static bool OPENVR_SetupJoystickBasedOnLoadedActionManifest(SDL_VideoData * videodata)
|
static bool OPENVR_SetupJoystickBasedOnLoadedActionManifest(SDL_VideoData * videodata)
|
||||||
{
|
{
|
||||||
SDL_VirtualJoystickDesc desc;
|
SDL_VirtualJoystickDesc desc;
|
||||||
int virtual_index;
|
SDL_JoystickID virtual_id;
|
||||||
|
|
||||||
EVRInputError e = 0;
|
EVRInputError e = 0;
|
||||||
|
|
||||||
@@ -537,9 +539,9 @@ static bool OPENVR_SetupJoystickBasedOnLoadedActionManifest(SDL_VideoData * vide
|
|||||||
desc.RumbleTriggers = OPENVR_VirtualControllerRumbleTriggers;
|
desc.RumbleTriggers = OPENVR_VirtualControllerRumbleTriggers;
|
||||||
desc.Update = OPENVR_VirtualControllerUpdate;
|
desc.Update = OPENVR_VirtualControllerUpdate;
|
||||||
desc.userdata = videodata;
|
desc.userdata = videodata;
|
||||||
virtual_index = SDL_AttachVirtualJoystick(&desc);
|
virtual_id = SDL_AttachVirtualJoystick(&desc);
|
||||||
|
|
||||||
if (virtual_index < 0) {
|
if (!virtual_id) {
|
||||||
return SDL_SetError("OPENVR: Couldn't open virtual joystick device: %s", SDL_GetError());
|
return SDL_SetError("OPENVR: Couldn't open virtual joystick device: %s", SDL_GetError());
|
||||||
} else {
|
} else {
|
||||||
videodata->virtual_joystick = SDL_OpenJoystick(virtual_index);
|
videodata->virtual_joystick = SDL_OpenJoystick(virtual_index);
|
||||||
@@ -552,7 +554,7 @@ static bool OPENVR_SetupJoystickBasedOnLoadedActionManifest(SDL_VideoData * vide
|
|||||||
SDL_Log("Loaded virtual joystick with %d buttons and %d axes", videodata->input_action_handles_buttons_count, videodata->input_action_handles_axes_count);
|
SDL_Log("Loaded virtual joystick with %d buttons and %d axes", videodata->input_action_handles_buttons_count, videodata->input_action_handles_axes_count);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool OPENVR_InitializeOverlay(SDL_VideoDevice *_this,SDL_Window *window)
|
static bool OPENVR_InitializeOverlay(SDL_VideoDevice *_this,SDL_Window *window)
|
||||||
|
|||||||
Reference in New Issue
Block a user