| 1217 | } |
| 1218 | |
| 1219 | void loadConfig( StateRecorderConfigData &config ) |
| 1220 | { |
| 1221 | if (config.framesBetweenSnaps < 1) |
| 1222 | { |
| 1223 | config.framesBetweenSnaps = 1; |
| 1224 | } |
| 1225 | if (config.timeBetweenSnapsMinutes < 0.0) |
| 1226 | { |
| 1227 | config.timeBetweenSnapsMinutes = 3.0f / 60.0f; |
| 1228 | } |
| 1229 | if (config.timeBetweenSnapsMinutes > config.historyDurationMinutes) |
| 1230 | { |
| 1231 | config.historyDurationMinutes = config.timeBetweenSnapsMinutes; |
| 1232 | } |
| 1233 | |
| 1234 | if (config.timingMode) |
| 1235 | { |
| 1236 | const double fhistMin = config.historyDurationMinutes; |
| 1237 | const double fsnapMin = config.timeBetweenSnapsMinutes; |
| 1238 | const double fnumSnaps = fhistMin / fsnapMin; |
| 1239 | |
| 1240 | ringBufSize = static_cast<int>( fnumSnaps + 0.5f ); |
| 1241 | |
| 1242 | int32_t fps = FCEUI_GetDesiredFPS(); // Do >> 24 to get in Hz |
| 1243 | |
| 1244 | double hz = ( ((double)fps) / 16777216.0 ); |
| 1245 | |
| 1246 | double framesPerSnapf = hz * fsnapMin * 60.0; |
| 1247 | |
| 1248 | framesPerSnap = static_cast<unsigned int>( framesPerSnapf + 0.50 ); |
| 1249 | } |
| 1250 | else |
| 1251 | { |
| 1252 | const double fhistMin = config.historyDurationMinutes; |
| 1253 | int32_t fps = FCEUI_GetDesiredFPS(); // Do >> 24 to get in Hz |
| 1254 | double hz = ( ((double)fps) / 16777216.0 ); |
| 1255 | |
| 1256 | const double fsnapMin = static_cast<double>(config.framesBetweenSnaps) / (hz * 60.0); |
| 1257 | const double fnumSnaps = fhistMin / fsnapMin; |
| 1258 | |
| 1259 | ringBufSize = static_cast<int>( fnumSnaps + 0.5f ); |
| 1260 | framesPerSnap = config.framesBetweenSnaps; |
| 1261 | } |
| 1262 | |
| 1263 | printf("ringBufSize:%i framesPerSnap:%i\n", ringBufSize, framesPerSnap ); |
| 1264 | |
| 1265 | compressionLevel = config.compressionLevel; |
| 1266 | loadPauseTime = config.loadPauseTimeSeconds; |
| 1267 | pauseOnLoad = config.pauseOnLoad; |
| 1268 | } |
| 1269 | |
| 1270 | void update(void) |
| 1271 | { |
no test coverage detected