33 static Text GetDllFromRegistry()
40 ZeroMemory(dllBuf,
sizeof(dllBuf));
42 RegOpenKeyEx(HKEY_CURRENT_USER,
43 "Software\\NaturalPoint\\NATURALPOINT\\NPClient Location",
59 if (result == ERROR_SUCCESS && dllLen > 0)
60 dllLoc = (
const char*) dllBuf;
68 static const char* NPErrString(
NPRESULT r)
71 case NP_OK:
return "OK";
80 return "Unknown error code";
86 running(false), frame_signature(0),
87 az(0), el(0), x(0), y(0), z(0)
89 Print(
"*** NaturalPoint Game Client Initialization ***\n");
93 Text dllPath = GetDllFromRegistry();
97 if (result ==
NP_OK) {
98 Print(
"NPClient - Initialize successful.\n");
101 Print(
"NPClient - Unable to initialize interface: %s\n", NPErrString(result));
108 if (result ==
NP_OK) {
109 Print(
"NPClient - Window handle registration successful.\n");
112 Print(
"NPClient - Error registering window handle: %s\n", NPErrString(result));
117 unsigned short wNPClientVer;
120 if (result ==
NP_OK) {
121 Print(
"NPClient - NaturalPoint software version: %d.%02d\n", (wNPClientVer >> 8), (wNPClientVer & 0x00FF));
124 Print(
"NPClient - Error querying NaturalPoint software version: %s\n", NPErrString(result));
132 #define NP_DEVELOPER_ID 6401
145 unsigned int DataFields = 0;
153 Print(
"NPClient - Cursor stopped.\n");
155 Print(
"NPClient - Error stopping cursor: %s\n", NPErrString(result));
159 if (result ==
NP_OK) {
160 Print(
"NPClient - Data transmission started.\n");
164 Print(
"NPClient - Error starting data transmission: %s\n", NPErrString(result));
172 Print(
"NaturalPoint Game Client Shutdown\n");
189 if (result ==
NP_OK) {
219 if (
z < -0.25)
z = -0.25;