| 203 | } |
| 204 | |
| 205 | int SaveState::postLoad(Context* context, MovieFile& m, bool branch, bool inputEditor) |
| 206 | { |
| 207 | int message = receiveMessage(); |
| 208 | |
| 209 | /* Loading is not assured to succeed, the following must |
| 210 | * only be done if it's the case. |
| 211 | */ |
| 212 | bool didLoad = message == MSGB_LOADING_SUCCEEDED; |
| 213 | if (didLoad) { |
| 214 | /* The copy of SharedConfig that the game stores may not |
| 215 | * be the same as this one due to memory loading, so we |
| 216 | * send it. |
| 217 | */ |
| 218 | sendMessage(MSGN_CONFIG); |
| 219 | sendData(&context->config.sc, sizeof(SharedConfig)); |
| 220 | |
| 221 | if (!((!branch) && |
| 222 | (context->config.sc.recording == SharedConfig::RECORDING_READ || |
| 223 | (context->config.sc.recording == SharedConfig::RECORDING_WRITE && |
| 224 | inputEditor)))) { |
| 225 | m.copyFrom(*movie); |
| 226 | } |
| 227 | |
| 228 | /* If the movie was modified since last state load, increment |
| 229 | * the rerecord count. */ |
| 230 | if (m.inputs->modifiedSinceLastStateLoad) { |
| 231 | context->rerecord_count++; |
| 232 | m.inputs->modifiedSinceLastStateLoad = false; |
| 233 | } |
| 234 | |
| 235 | message = receiveMessage(); |
| 236 | } |
| 237 | |
| 238 | /* The frame count has changed, we must get the new one */ |
| 239 | if (message != MSGB_FRAMECOUNT_TIME) { |
| 240 | std::cerr << "Got wrong message after state loading" << std::endl; |
| 241 | return ENOLOAD; |
| 242 | } |
| 243 | |
| 244 | receiveData(&context->framecount, sizeof(uint64_t)); |
| 245 | receiveData(&context->current_time_sec, sizeof(uint64_t)); |
| 246 | receiveData(&context->current_time_nsec, sizeof(uint64_t)); |
| 247 | receiveData(&context->current_realtime_sec, sizeof(uint64_t)); |
| 248 | receiveData(&context->current_realtime_nsec, sizeof(uint64_t)); |
| 249 | context->new_realtime_sec = context->current_realtime_sec; |
| 250 | context->new_realtime_nsec = context->current_realtime_nsec; |
| 251 | |
| 252 | // if (context->config.sc.recording == SharedConfig::RECORDING_WRITE) { |
| 253 | // context->config.sc.movie_framecount = context->framecount; |
| 254 | // m.header->length_sec = context->current_time_sec; |
| 255 | // m.header->length_nsec = context->current_time_nsec; |
| 256 | // } |
| 257 | |
| 258 | if (didLoad) { |
| 259 | sendMessage(MSGN_OSD_MSG); |
| 260 | if (branch) |
| 261 | sendString(loaded_branch_msg); |
| 262 | else |
nothing calls this directly
no test coverage detected