MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / OnFilesReceived

Method OnFilesReceived

Sources/Jazz2/UI/Menu/ImportSection.cpp:119–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117 }
118
119 void ImportSection::OnFilesReceived(ArrayView<EmscriptenFileStream> files)
120 {
121 _fileCount = (std::int32_t)files.size();
122 if (_fileCount <= 0) {
123 _state = State::NothingSelected;
124 }
125
126 for (auto& file : files) {
127 if (file.GetSize() >= 262 && fs::GetExtension(file.GetName()) == "j2l"_s) {
128 file.Seek(180, SeekOrigin::Current); // Skip header
129
130 std::uint32_t magic = file.ReadValue<std::uint32_t>();
131 if (magic == 0x4C56454C /*LEVL*/) {
132 file.Seek(4, SeekOrigin::Current);
133
134 char name[32 + 1];
135 name[32] = '\0';
136 file.Read(name, 32);
137
138 LOGD("Found level: {}", name);
139 _foundLevels.emplace(name, true);
140 }
141 }
142 }
143
144 CheckFoundLevels();
145 }
146
147 void ImportSection::ShowPicker()
148 {

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.45
GetSizeMethod · 0.45
GetNameMethod · 0.45
SeekMethod · 0.45
ReadMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected