MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / writePadData

Method writePadData

pcsx2/Recording/InputRecordingFile.cpp:181–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181bool InputRecordingFile::writePadData(const uint frame, const PadData data) const
182{
183 if (m_recordingFile == nullptr)
184 {
185 return false;
186 }
187
188 // TODO - use the slot in the future
189 const size_t seek = getRecordingBlockSeekPoint(frame) + s_controllerInputBytes * data.m_port;
190
191 // seek to the correct position and write data to the file
192 if (fseek(m_recordingFile, seek, SEEK_SET) != 0 ||
193 fwrite(&data.m_compactPressFlagsGroupOne, 1, 1, m_recordingFile) != 1 ||
194 fwrite(&data.m_compactPressFlagsGroupTwo, 1, 1, m_recordingFile) != 1 ||
195 fwrite(&std::get<0>(data.m_rightAnalog), 1, 1, m_recordingFile) != 1 ||
196 fwrite(&std::get<1>(data.m_rightAnalog), 1, 1, m_recordingFile) != 1 ||
197 fwrite(&std::get<0>(data.m_leftAnalog), 1, 1, m_recordingFile) != 1 ||
198 fwrite(&std::get<1>(data.m_leftAnalog), 1, 1, m_recordingFile) != 1 ||
199 fwrite(&std::get<1>(data.m_right), 1, 1, m_recordingFile) != 1 ||
200 fwrite(&std::get<1>(data.m_left), 1, 1, m_recordingFile) != 1 ||
201 fwrite(&std::get<1>(data.m_up), 1, 1, m_recordingFile) != 1 ||
202 fwrite(&std::get<1>(data.m_down), 1, 1, m_recordingFile) != 1 ||
203 fwrite(&std::get<1>(data.m_triangle), 1, 1, m_recordingFile) != 1 ||
204 fwrite(&std::get<1>(data.m_circle), 1, 1, m_recordingFile) != 1 ||
205 fwrite(&std::get<1>(data.m_cross), 1, 1, m_recordingFile) != 1 ||
206 fwrite(&std::get<1>(data.m_square), 1, 1, m_recordingFile) != 1 ||
207 fwrite(&std::get<1>(data.m_l1), 1, 1, m_recordingFile) != 1 ||
208 fwrite(&std::get<1>(data.m_r1), 1, 1, m_recordingFile) != 1 ||
209 fwrite(&std::get<1>(data.m_l2), 1, 1, m_recordingFile) != 1 ||
210 fwrite(&std::get<1>(data.m_r2), 1, 1, m_recordingFile) != 1)
211 {
212 return false;
213 }
214
215 fflush(m_recordingFile);
216 return true;
217}
218
219void InputRecordingFile::logRecordingMetadata()
220{

Callers 1

saveControllerDataMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected