| 1546 | PARAM_CHECK(w->Serialize(ar, message)) |
| 1547 | return ar.Save(name); |
| 1548 | } |
| 1549 | |
| 1550 | bool World::LoadBin(const char* name, int message) |
| 1551 | { |
| 1552 | LOG_DEBUG(World, "LoadBin: Start - Total allocated: {} MB", Foundation::MemoryUsed() / (1024 * 1024)); |
| 1553 | LSError err; |
| 1554 | { |
| 1555 | GDebugger.NextAliveExpected(15 * 60 * 1000); |
| 1556 | ParamArchiveLoad ar; |
| 1557 | bool result = ar.LoadBin(name); |
| 1558 | if (!result) |
| 1559 | { |
| 1560 | return false; |
| 1561 | } |
| 1562 | |
| 1563 | LOG_DEBUG(World, "Load: Total allocated after ar.LoadBin: {} MB", Foundation::MemoryUsed() / (1024 * 1024)); |
| 1564 | ar.FirstPass(); |
| 1565 | err = Serialize(ar, message); |
| 1566 | if (err == LSOK) |
| 1567 | { |
| 1568 | ar.SecondPass(); |
| 1569 | err = Serialize(ar, message); |
| 1570 | } |
| 1571 | if (err == LSOK) |
| 1572 | { |
| 1573 | } |
| 1574 | else |
| 1575 | { |
| 1576 | ErrorMessage("Cannot load '%s'. Error '%s' at '%s'.", name, ar.GetErrorName(err), |
| 1577 | (const char*)ar.GetErrorContext()); |
| 1578 | } |
| 1579 | LOG_DEBUG(World, "Load: Total allocated after World::Serialize: {} MB", |
| 1580 | Foundation::MemoryUsed() / (1024 * 1024)); |
| 1581 | } |
| 1582 | LOG_DEBUG(World, "Total allocated after ~ParamArchive: {} MB", Foundation::MemoryUsed() / (1024 * 1024)); |
| 1583 | MemoryCleanUp(); |
| 1584 | LOG_DEBUG(World, "Total allocated after MemoryCleanUp: {} MB", Foundation::MemoryUsed() / (1024 * 1024)); |
| 1585 | if (err == LSOK) |
| 1586 | AspectRatio::SetGameplayActive(true); |
| 1587 | return err == LSOK; |