MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / readSaveDetails

Function readSaveDetails

src/OpenLoco/src/S5/S5.cpp:780–812  ·  view source on GitHub ↗

0x00442403

Source from the content-addressed store, hash-verified

778
779 // 0x00442403
780 std::unique_ptr<SaveDetails> readSaveDetails(const fs::path& path)
781 {
782 FileStream stream(path, StreamMode::read);
783 SawyerStreamReader fs(stream);
784 if (!fs.validateChecksum())
785 {
786 return nullptr;
787 }
788
789 Header s5Header{};
790
791 // Read header
792 fs.readChunk(&s5Header, sizeof(s5Header));
793
794 if (s5Header.version != kCurrentVersion)
795 {
796 return nullptr;
797 }
798
799 if (s5Header.hasFlags(HeaderFlags::isTitleSequence | HeaderFlags::isDump | HeaderFlags::isRaw))
800 {
801 return nullptr;
802 }
803
804 if (s5Header.hasFlags(HeaderFlags::hasSaveDetails))
805 {
806 // 0x0050AEA8
807 auto ret = std::make_unique<SaveDetails>();
808 fs.readChunk(ret.get(), sizeof(*ret));
809 return ret;
810 }
811 return nullptr;
812 }
813
814 // 0x00442AFC
815 std::unique_ptr<Scenario::Options> readScenarioOptions(const fs::path& path)

Callers 1

loadFileDetailsFunction · 0.85

Calls 4

validateChecksumMethod · 0.80
readChunkMethod · 0.80
hasFlagsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected