| 448 | |
| 449 | /// |
| 450 | void process_request(Request &rr) |
| 451 | { |
| 452 | CE_ENSURE(!rr.done.load()); |
| 453 | rr.progress.store(0.0f); |
| 454 | rr.error.store(SaveError::SUCCESS); |
| 455 | |
| 456 | #if CROWN_PLATFORM_EMSCRIPTEN |
| 457 | if (!html5_spin_until(html5_save_game_ready)) |
| 458 | return; |
| 459 | |
| 460 | if (!html5_save_game_ok()) { |
| 461 | rr.progress.store(1.0f); |
| 462 | rr.error.store(SaveError::IO_ERROR); |
| 463 | rr.done.store(true); |
| 464 | return; |
| 465 | } |
| 466 | #endif |
| 467 | |
| 468 | s32 result = rr.type == SaveGame::Request::LOAD |
| 469 | ? read_request(rr) |
| 470 | : write_request(rr) |
| 471 | ; |
| 472 | |
| 473 | #if CROWN_PLATFORM_EMSCRIPTEN |
| 474 | if (result == SaveError::SUCCESS && rr.type == SaveGame::Request::SAVE) { |
| 475 | html5_save_game_flush(); |
| 476 | if (!html5_spin_until([]{ return !html5_save_game_syncing(); })) |
| 477 | return; |
| 478 | |
| 479 | if (!html5_save_game_flush_ok()) |
| 480 | result = SaveError::IO_ERROR; |
| 481 | } |
| 482 | #endif |
| 483 | |
| 484 | rr.progress.store(1.0f); |
| 485 | rr.error.store(result); |
| 486 | rr.done.store(true); |
| 487 | } |
| 488 | |
| 489 | /// |
| 490 | s32 run() |
nothing calls this directly
no test coverage detected