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

Function LoadFile

lobster/src/platform.cpp:299–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299int64_t LoadFile(string_view relfilename, string *dest, int64_t start, int64_t len, bool binary) {
300 assert(cur_loader);
301 auto it = pakfile_registry.find(relfilename);
302 if (it != pakfile_registry.end()) {
303 auto &[fname, foff, flen, funcompressed] = it->second;
304 auto l = LoadFileFromAny(fname, dest, foff, flen);
305 if (l >= 0) {
306 if (funcompressed >= 0) {
307 string uncomp;
308 WEntropyCoder<false>((const uchar *)dest->c_str(), dest->length(),
309 (size_t)funcompressed, uncomp);
310 dest->swap(uncomp);
311 TextModeConvert(*dest, binary);
312 return funcompressed;
313 } else {
314 TextModeConvert(*dest, binary);
315 return l;
316 }
317 }
318 }
319 if (len > 0) LOG_INFO("load: ", relfilename);
320 auto size = LoadFileFromAny(SanitizePath(relfilename), dest, start, len);
321 TextModeConvert(*dest, binary);
322 return size;
323}
324
325string WriteFileName(string_view relfilename) {
326 return write_dir + SanitizePath(relfilename);

Callers 15

LoadFontFunction · 0.70
CreateTextureFromFileFunction · 0.70
BuildPakFileFunction · 0.70
LoadPakDirFunction · 0.70
LoadByteCodeFunction · 0.70
AddFileFunction · 0.70
LoadMaterialFileFunction · 0.70
AddOcTreeFunction · 0.70
loadiqmFunction · 0.70
AddIMGUIFunction · 0.70
AddCubeGenFunction · 0.70
LoadSoundFunction · 0.70

Calls 7

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

Tested by

no test coverage detected