MCPcopy Create free account
hub / github.com/Wemino/MarkerPatch / LoadGyroCalibration

Function LoadGyroCalibration

include/Controller.hpp:193–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191 }
192
193 static bool LoadGyroCalibration(const char* serial)
194 {
195 if (!serial || serial[0] == '\0')
196 return false;
197
198 std::string filePath = GetGyroCalibrationFilePath(serial);
199 if (filePath.empty())
200 return false;
201
202 std::ifstream file(filePath, std::ios::binary);
203 if (!file)
204 return false;
205
206 file.seekg(0, std::ios::end);
207 if (file.tellg() != 0xC)
208 return false;
209
210 file.seekg(0, std::ios::beg);
211
212 float offsetX = 0.0, offsetY = 0.0, offsetZ = 0.0;
213 file.read(reinterpret_cast<char*>(&offsetX), sizeof(float));
214 file.read(reinterpret_cast<char*>(&offsetY), sizeof(float));
215 file.read(reinterpret_cast<char*>(&offsetZ), sizeof(float));
216
217 if (!file)
218 return false;
219
220 s_gyroOffset.offsetX = offsetX;
221 s_gyroOffset.offsetY = offsetY;
222 s_gyroOffset.offsetZ = offsetZ;
223 s_gyroOffset.hasInitialCalibration = true;
224
225 return true;
226 }
227
228 // ==========================================================
229 // Frame Timing

Callers 1

LoadGamepadCapabilitiesFunction · 0.85

Calls 3

readMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected