MCPcopy Create free account
hub / github.com/aardappel/lobster / LoadFile

Function LoadFile

dev/src/platform.cpp:350–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350int64_t LoadFile(string_view relfilename, string *dest, int64_t start, int64_t len, bool binary) {
351 assert(cur_loader);
352 auto it = pakfile_registry.find(relfilename);
353 if (it != pakfile_registry.end()) {
354 auto &[fname, foff, flen, funcompressed] = it->second;
355 auto l = LoadFileFromAny(fname, dest, foff, flen);
356 if (l >= 0) {
357 if (funcompressed >= 0) {
358 string uncomp;
359 WEntropyCoder<false>((const uint8_t *)dest->c_str(), dest->length(),
360 (size_t)funcompressed, uncomp);
361 dest->swap(uncomp);
362 TextModeConvert(*dest, binary);
363 return funcompressed;
364 } else {
365 TextModeConvert(*dest, binary);
366 return l;
367 }
368 }
369 }
370 if (len > 0) LOG_DEBUG("load: ", relfilename);
371 auto size = LoadFileFromAny(SanitizePath(relfilename), dest, start, len);
372 TextModeConvert(*dest, binary);
373 return size;
374}
375
376FILE *OpenFor(string_view filename, const char *mode, bool allow_absolute) {
377 if (IsAbsolute(filename)) {

Callers 15

LoadFontFunction · 0.70
CreateTextureFromFileFunction · 0.70
LoadImageFileFunction · 0.70
BuildPakFileFunction · 0.70
LoadPakDirFunction · 0.70
LoadMetaDataAndCodeFunction · 0.70
AddFileFunction · 0.70
ParseMaterialFileFunction · 0.70
LoadMaterialFileFunction · 0.70
loadiqmFunction · 0.70
LoadFontFunction · 0.70
AddCubeGenFunction · 0.70

Calls 7

LoadFileFromAnyFunction · 0.85
TextModeConvertFunction · 0.85
SanitizePathFunction · 0.85
endMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected