Skip to content

Commit d357aa2

Browse files
committed
Fixed initializing the OpenVR driver
1 parent f8c7790 commit d357aa2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/video/openvr/SDL_openvrvideo.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
#ifdef SDL_VIDEO_DRIVER_OPENVR
2424

25+
#if 0
2526
#define DEBUG_OPENVR
27+
#endif
2628

2729
#include "../../events/SDL_mouse_c.h"
2830
#include "../../events/SDL_keyboard_c.h"
@@ -445,7 +447,7 @@ static void OPENVR_VirtualControllerUpdate(void *userdata)
445447
static bool OPENVR_SetupJoystickBasedOnLoadedActionManifest(SDL_VideoData * videodata)
446448
{
447449
SDL_VirtualJoystickDesc desc;
448-
int virtual_index;
450+
SDL_JoystickID virtual_id;
449451

450452
EVRInputError e = 0;
451453

@@ -537,9 +539,9 @@ static bool OPENVR_SetupJoystickBasedOnLoadedActionManifest(SDL_VideoData * vide
537539
desc.RumbleTriggers = OPENVR_VirtualControllerRumbleTriggers;
538540
desc.Update = OPENVR_VirtualControllerUpdate;
539541
desc.userdata = videodata;
540-
virtual_index = SDL_AttachVirtualJoystick(&desc);
542+
virtual_id = SDL_AttachVirtualJoystick(&desc);
541543

542-
if (virtual_index < 0) {
544+
if (!virtual_id) {
543545
return SDL_SetError("OPENVR: Couldn't open virtual joystick device: %s", SDL_GetError());
544546
} else {
545547
videodata->virtual_joystick = SDL_OpenJoystick(virtual_index);
@@ -552,7 +554,7 @@ static bool OPENVR_SetupJoystickBasedOnLoadedActionManifest(SDL_VideoData * vide
552554
SDL_Log("Loaded virtual joystick with %d buttons and %d axes", videodata->input_action_handles_buttons_count, videodata->input_action_handles_axes_count);
553555
#endif
554556

555-
return false;
557+
return true;
556558
}
557559

558560
static bool OPENVR_InitializeOverlay(SDL_VideoDevice *_this,SDL_Window *window)

0 commit comments

Comments
 (0)