Line data Source code
1 : //========= Copyright Valve Corporation ============//
2 : #include "openvr.h"
3 : #include "hmderrors_public.h"
4 : #include <stdio.h>
5 : #include <algorithm>
6 :
7 : using namespace vr;
8 :
9 : #define RETURN_ENUM_AS_STRING(enumValue) case enumValue: return #enumValue;
10 :
11 :
12 0 : const char *GetEnglishStringForHmdError( vr::EVRInitError eError )
13 : {
14 0 : switch( eError )
15 : {
16 0 : case VRInitError_None: return "No Error (0)";
17 :
18 0 : case VRInitError_Init_InstallationNotFound: return "Installation Not Found (100)";
19 0 : case VRInitError_Init_InstallationCorrupt: return "Installation Corrupt (101)";
20 0 : case VRInitError_Init_VRClientDLLNotFound: return "vrclient Shared Lib Not Found (102)";
21 0 : case VRInitError_Init_FileNotFound: return "File Not Found (103)";
22 0 : case VRInitError_Init_FactoryNotFound: return "Factory Function Not Found (104)";
23 0 : case VRInitError_Init_InterfaceNotFound: return "Interface Not Found (105)";
24 0 : case VRInitError_Init_InvalidInterface: return "Invalid Interface (106)";
25 0 : case VRInitError_Init_UserConfigDirectoryInvalid: return "User Config Directory Invalid (107)";
26 0 : case VRInitError_Init_HmdNotFound: return "Hmd Not Found (108)";
27 0 : case VRInitError_Init_NotInitialized: return "Not Initialized (109)";
28 0 : case VRInitError_Init_PathRegistryNotFound: return "Installation path could not be located (110)";
29 0 : case VRInitError_Init_NoConfigPath: return "Config path could not be located (111)";
30 0 : case VRInitError_Init_NoLogPath: return "Log path could not be located (112)";
31 0 : case VRInitError_Init_PathRegistryNotWritable: return "Unable to write path registry (113)";
32 0 : case VRInitError_Init_AppInfoInitFailed: return "App info manager init failed (114)";
33 0 : case VRInitError_Init_Retry: return "Internal Retry (115)";
34 0 : case VRInitError_Init_InitCanceledByUser: return "User Canceled Init (116)";
35 0 : case VRInitError_Init_AnotherAppLaunching: return "Another app was already launching (117)";
36 0 : case VRInitError_Init_SettingsInitFailed: return "Settings manager init failed (118)";
37 0 : case VRInitError_Init_ShuttingDown: return "VR system shutting down (119)";
38 0 : case VRInitError_Init_TooManyObjects: return "Too many tracked objects (120)";
39 0 : case VRInitError_Init_NoServerForBackgroundApp: return "Not starting vrserver for background app (121)";
40 0 : case VRInitError_Init_NotSupportedWithCompositor: return "The requested interface is incompatible with the compositor and the compositor is running (122)";
41 0 : case VRInitError_Init_NotAvailableToUtilityApps: return "This interface is not available to utility applications (123)";
42 0 : case VRInitError_Init_Internal: return "vrserver internal error (124)";
43 0 : case VRInitError_Init_HmdDriverIdIsNone: return "Hmd DriverId is invalid (125)";
44 0 : case VRInitError_Init_HmdNotFoundPresenceFailed: return "Hmd Not Found Presence Failed (126)";
45 0 : case VRInitError_Init_VRMonitorNotFound: return "VR Monitor Not Found (127)";
46 0 : case VRInitError_Init_VRMonitorStartupFailed: return "VR Monitor startup failed (128)";
47 0 : case VRInitError_Init_LowPowerWatchdogNotSupported: return "Low Power Watchdog Not Supported (129)";
48 0 : case VRInitError_Init_InvalidApplicationType: return "Invalid Application Type (130)";
49 0 : case VRInitError_Init_NotAvailableToWatchdogApps: return "Not available to watchdog apps (131)";
50 0 : case VRInitError_Init_WatchdogDisabledInSettings: return "Watchdog disabled in settings (132)";
51 0 : case VRInitError_Init_VRDashboardNotFound: return "VR Dashboard Not Found (133)";
52 0 : case VRInitError_Init_VRDashboardStartupFailed: return "VR Dashboard startup failed (134)";
53 0 : case VRInitError_Init_VRHomeNotFound: return "VR Home Not Found (135)";
54 0 : case VRInitError_Init_VRHomeStartupFailed: return "VR home startup failed (136)";
55 :
56 0 : case VRInitError_Driver_Failed: return "Driver Failed (200)";
57 0 : case VRInitError_Driver_Unknown: return "Driver Not Known (201)";
58 0 : case VRInitError_Driver_HmdUnknown: return "HMD Not Known (202)";
59 0 : case VRInitError_Driver_NotLoaded: return "Driver Not Loaded (203)";
60 0 : case VRInitError_Driver_RuntimeOutOfDate: return "Driver runtime is out of date (204)";
61 0 : case VRInitError_Driver_HmdInUse: return "HMD already in use by another application (205)";
62 0 : case VRInitError_Driver_NotCalibrated: return "Device is not calibrated (206)";
63 0 : case VRInitError_Driver_CalibrationInvalid: return "Device Calibration is invalid (207)";
64 0 : case VRInitError_Driver_HmdDisplayNotFound: return "HMD detected over USB, but Monitor not found (208)";
65 0 : case VRInitError_Driver_TrackedDeviceInterfaceUnknown: return "Driver Tracked Device Interface unknown (209)";
66 : // case VRInitError_Driver_HmdDisplayNotFoundAfterFix: return "HMD detected over USB, but Monitor not found after attempt to fix (210)"; // taken out upon Ben's request: He thinks that there is no need to separate that error from 208
67 0 : case VRInitError_Driver_HmdDriverIdOutOfBounds: return "Hmd DriverId is our of bounds (211)";
68 0 : case VRInitError_Driver_HmdDisplayMirrored: return "HMD detected over USB, but Monitor may be mirrored instead of extended (212)";
69 :
70 0 : case VRInitError_IPC_ServerInitFailed: return "VR Server Init Failed (300)";
71 0 : case VRInitError_IPC_ConnectFailed: return "Connect to VR Server Failed (301)";
72 0 : case VRInitError_IPC_SharedStateInitFailed: return "Shared IPC State Init Failed (302)";
73 0 : case VRInitError_IPC_CompositorInitFailed: return "Shared IPC Compositor Init Failed (303)";
74 0 : case VRInitError_IPC_MutexInitFailed: return "Shared IPC Mutex Init Failed (304)";
75 0 : case VRInitError_IPC_Failed: return "Shared IPC Failed (305)";
76 0 : case VRInitError_IPC_CompositorConnectFailed: return "Shared IPC Compositor Connect Failed (306)";
77 0 : case VRInitError_IPC_CompositorInvalidConnectResponse: return "Shared IPC Compositor Invalid Connect Response (307)";
78 0 : case VRInitError_IPC_ConnectFailedAfterMultipleAttempts: return "Shared IPC Connect Failed After Multiple Attempts (308)";
79 :
80 0 : case VRInitError_Compositor_Failed: return "Compositor failed to initialize (400)";
81 0 : case VRInitError_Compositor_D3D11HardwareRequired: return "Compositor failed to find DX11 hardware (401)";
82 0 : case VRInitError_Compositor_FirmwareRequiresUpdate: return "Compositor requires mandatory firmware update (402)";
83 0 : case VRInitError_Compositor_OverlayInitFailed: return "Compositor initialization succeeded, but overlay init failed (403)";
84 0 : case VRInitError_Compositor_ScreenshotsInitFailed: return "Compositor initialization succeeded, but screenshot init failed (404)";
85 0 : case VRInitError_Compositor_UnableToCreateDevice: return "Compositor unable to create graphics device (405)";
86 :
87 : // Oculus
88 0 : case VRInitError_VendorSpecific_UnableToConnectToOculusRuntime: return "Unable to connect to Oculus Runtime (1000)";
89 :
90 : // Lighthouse
91 0 : case VRInitError_VendorSpecific_HmdFound_CantOpenDevice: return "HMD found, but can not open device (1101)";
92 0 : case VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart: return "HMD found, but unable to request config (1102)";
93 0 : case VRInitError_VendorSpecific_HmdFound_NoStoredConfig: return "HMD found, but no stored config (1103)";
94 0 : case VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck: return "HMD found, but failed configuration check (1113)";
95 0 : case VRInitError_VendorSpecific_HmdFound_ConfigTooBig: return "HMD found, but config too big (1104)";
96 0 : case VRInitError_VendorSpecific_HmdFound_ConfigTooSmall: return "HMD found, but config too small (1105)";
97 0 : case VRInitError_VendorSpecific_HmdFound_UnableToInitZLib: return "HMD found, but unable to init ZLib (1106)";
98 0 : case VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion: return "HMD found, but problems with the data (1107)";
99 0 : case VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart: return "HMD found, but problems with the data (1108)";
100 0 : case VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart: return "HMD found, but problems with the data (1109)";
101 0 : case VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext: return "HMD found, but problems with the data (1110)";
102 0 : case VRInitError_VendorSpecific_HmdFound_UserDataAddressRange: return "HMD found, but problems with the data (1111)";
103 0 : case VRInitError_VendorSpecific_HmdFound_UserDataError: return "HMD found, but problems with the data (1112)";
104 :
105 0 : case VRInitError_Steam_SteamInstallationNotFound: return "Unable to find Steam installation (2000)";
106 :
107 : default:
108 : {
109 : static char buf[128];
110 0 : sprintf( buf, "Unknown error (%d)", eError );
111 0 : return buf;
112 : }
113 : }
114 :
115 : }
116 :
117 :
118 0 : const char *GetIDForVRInitError( vr::EVRInitError eError )
119 : {
120 0 : switch( eError )
121 : {
122 0 : RETURN_ENUM_AS_STRING( VRInitError_None );
123 0 : RETURN_ENUM_AS_STRING( VRInitError_Unknown );
124 :
125 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_InstallationNotFound );
126 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_InstallationCorrupt );
127 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_VRClientDLLNotFound );
128 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_FileNotFound );
129 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_FactoryNotFound );
130 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_InterfaceNotFound );
131 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_InvalidInterface );
132 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_UserConfigDirectoryInvalid );
133 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_HmdNotFound );
134 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_NotInitialized );
135 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_PathRegistryNotFound );
136 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_NoConfigPath );
137 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_NoLogPath );
138 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_PathRegistryNotWritable );
139 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_AppInfoInitFailed );
140 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_Retry );
141 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_InitCanceledByUser );
142 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_AnotherAppLaunching );
143 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_SettingsInitFailed );
144 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_ShuttingDown );
145 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_TooManyObjects );
146 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_NoServerForBackgroundApp );
147 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_NotSupportedWithCompositor );
148 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_NotAvailableToUtilityApps );
149 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_Internal );
150 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_VRMonitorNotFound );
151 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_VRMonitorStartupFailed );
152 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_LowPowerWatchdogNotSupported );
153 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_InvalidApplicationType );
154 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_NotAvailableToWatchdogApps );
155 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_WatchdogDisabledInSettings );
156 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_VRDashboardNotFound );
157 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_VRDashboardStartupFailed );
158 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_VRHomeNotFound );
159 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_VRHomeStartupFailed );
160 :
161 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_HmdDriverIdIsNone );
162 0 : RETURN_ENUM_AS_STRING( VRInitError_Init_HmdNotFoundPresenceFailed );
163 :
164 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_Failed );
165 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_Unknown );
166 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdUnknown);
167 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_NotLoaded);
168 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_RuntimeOutOfDate);
169 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdInUse);
170 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_NotCalibrated);
171 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_CalibrationInvalid);
172 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdDisplayNotFound);
173 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_TrackedDeviceInterfaceUnknown );
174 : // RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdDisplayNotFoundAfterFix );
175 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdDriverIdOutOfBounds );
176 0 : RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdDisplayMirrored );
177 :
178 0 : RETURN_ENUM_AS_STRING( VRInitError_IPC_ServerInitFailed);
179 0 : RETURN_ENUM_AS_STRING( VRInitError_IPC_ConnectFailed);
180 0 : RETURN_ENUM_AS_STRING( VRInitError_IPC_SharedStateInitFailed);
181 0 : RETURN_ENUM_AS_STRING( VRInitError_IPC_CompositorInitFailed);
182 0 : RETURN_ENUM_AS_STRING( VRInitError_IPC_MutexInitFailed);
183 0 : RETURN_ENUM_AS_STRING( VRInitError_IPC_Failed);
184 0 : RETURN_ENUM_AS_STRING( VRInitError_IPC_CompositorConnectFailed);
185 0 : RETURN_ENUM_AS_STRING( VRInitError_IPC_CompositorInvalidConnectResponse);
186 0 : RETURN_ENUM_AS_STRING( VRInitError_IPC_ConnectFailedAfterMultipleAttempts);
187 :
188 0 : RETURN_ENUM_AS_STRING( VRInitError_Compositor_Failed );
189 0 : RETURN_ENUM_AS_STRING( VRInitError_Compositor_D3D11HardwareRequired );
190 0 : RETURN_ENUM_AS_STRING( VRInitError_Compositor_FirmwareRequiresUpdate );
191 0 : RETURN_ENUM_AS_STRING( VRInitError_Compositor_OverlayInitFailed );
192 0 : RETURN_ENUM_AS_STRING( VRInitError_Compositor_ScreenshotsInitFailed );
193 0 : RETURN_ENUM_AS_STRING( VRInitError_Compositor_UnableToCreateDevice );
194 :
195 : // Oculus
196 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_UnableToConnectToOculusRuntime);
197 :
198 : // Lighthouse
199 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_CantOpenDevice);
200 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart);
201 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_NoStoredConfig);
202 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck );
203 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_ConfigTooBig );
204 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_ConfigTooSmall );
205 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UnableToInitZLib );
206 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion );
207 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart );
208 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart );
209 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext );
210 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UserDataAddressRange );
211 0 : RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UserDataError );
212 :
213 0 : RETURN_ENUM_AS_STRING( VRInitError_Steam_SteamInstallationNotFound );
214 :
215 : default:
216 : {
217 : static char buf[128];
218 0 : sprintf( buf, "Unknown error (%d)", eError );
219 0 : return buf;
220 : }
221 : }
222 : }
223 :
|