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