Commit Graph

21057 Commits

Author SHA1 Message Date
Christoph Oelckers 5a1b858c0e - added some safety checks for reading empty lumps into a std::vector.
These can trip the internal safety checks, even though nothing gets read in.
2023-08-22 22:59:29 +02:00
Christoph Oelckers 42283f56ab - added a quick header check for WebP before loading the entire file for real identification.
This allows quick rejection of virtually everything that's not a WebP without loading the entire file first.
2023-08-22 22:54:54 +02:00
Christoph Oelckers 1748477086 - use FileData for readinf WebP 2023-08-22 22:54:54 +02:00
Christoph Oelckers c77ece4922 moved private definitions out of public headers. 2023-08-22 22:54:54 +02:00
Christoph Oelckers ebb71cebf1 - put the entire filesystem code into a namespace and created some subdirectories. 2023-08-22 22:54:54 +02:00
Christoph Oelckers 94c9ee4593 - got rid of the remaining persistent std::strings in the file system.
This also uses the string pool now.
2023-08-22 22:54:54 +02:00
Christoph Oelckers 929cae2f41 - rename File_Name back. 2023-08-22 22:54:53 +02:00
Christoph Oelckers 8e250abe0a - fix lump name setup. 2023-08-22 22:54:53 +02:00
Christoph Oelckers 54dc687436 - use the string pool for storing resource file names. 2023-08-22 22:54:53 +02:00
Christoph Oelckers 6d2047eef6 - also use the stringpool for the lump names in the filesystem. 2023-08-22 22:54:53 +02:00
Christoph Oelckers 3d673e3f20 - use a string pool to store the filenames in FResourceLump. 2023-08-22 22:54:53 +02:00
Christoph Oelckers 4f8305de5f - use the lump cache directly for FileData.
This was the final puzzle piece to allow using memory mapped files. :)
2023-08-22 22:54:53 +02:00
Christoph Oelckers 2c2bf0265f - refactored all places which treated FileData as zero terminated. 2023-08-22 22:54:53 +02:00
Christoph Oelckers 79e6d068a9 - got rid of the last two TArrays in the filesystem class. 2023-08-22 22:54:53 +02:00
Christoph Oelckers 535eb9a853 - use std::vector in GetFilesInFolder 2023-08-22 22:54:52 +02:00
Christoph Oelckers 2a6fb6da84 - use better hash function.
This is djb2 which is supposedly one of the best string hashing functions around.
Avoids annoying dependencies and is a lot simpler and faster than the alternatives.
2023-08-22 22:54:52 +02:00
Christoph Oelckers 5433430767 - FString is always gone. 2023-08-22 22:54:52 +02:00
Christoph Oelckers 3e3526f1ec - use a local hash function in the file system. 2023-08-22 22:54:52 +02:00
Christoph Oelckers acd5911cd4 - StringPool class added
This is a specialized stripped doen FMemArena.
2023-08-22 22:54:52 +02:00
Christoph Oelckers 4906d287cb - use std::vector<std::string> to pass the file list to InitMultipleFiles 2023-08-22 22:54:52 +02:00
Christoph Oelckers a0d679b84b - FileData cleanup and uncoupling from FString.
Work is still needed to allow this to use the lump cache directly because some decisions in the past made this data padded by a zero byte.
2023-08-22 22:54:52 +02:00
Christoph Oelckers ca1d7fd539 - store longName in a std::string and use std::vector for FileInfo
TArray cannot handle std::string so this must both be changed together.
2023-08-22 22:48:06 +02:00
Christoph Oelckers 8a5d3c096b - return a std::string from GetFileFullPath 2023-08-22 22:18:54 +02:00
Christoph Oelckers 25b7b18c3d - got rid of the two copying variants of fileSystem.GetFileShortName. 2023-08-22 22:18:53 +02:00
Christoph Oelckers c5b5b2b873 - cleanup. 2023-08-22 22:18:53 +02:00
Christoph Oelckers eccbafc1bc - let FileData.GetString only return a const char pointer.
Not exposing the implementation will allow a lot more optimization in the backend and we also want to get rid of FString here.
2023-08-22 22:18:53 +02:00
Christoph Oelckers 5398045f7d - got rid of FileSystem::GetFileData.
Using FMemFile is better in all these places.
2023-08-22 22:18:53 +02:00
Christoph Oelckers 21d6eb99eb use std::vector as return value for the FileReader's buffer readers. 2023-08-22 22:18:21 +02:00
Christoph Oelckers 12c7413149 - handle ZLibError 2023-08-22 21:49:56 +02:00
Christoph Oelckers 7f024debfd - clean up includes in 3 files. 2023-08-22 21:49:56 +02:00
Christoph Oelckers 9f45cc0469 - use snprintf for FileWriter::Printf.
pulling in stb_sprintf here may be tricky if the consuming application uses different options, so better not use it here.
2023-08-22 21:49:55 +02:00
Christoph Oelckers def6bffdfc - use std::vector for the MemoryArrayReader 2023-08-22 21:49:55 +02:00
Christoph Oelckers 2671394961 - only use standard types in WriteZip's API. 2023-08-22 21:49:55 +02:00
Christoph Oelckers 825f92b274 - use std::string in FZipFile::Open 2023-08-22 21:49:55 +02:00
Christoph Oelckers 959d0e93f7 - fixed and cleaned up file_whres.cpp 2023-08-22 21:49:55 +02:00
Christoph Oelckers f0bbc32bae - add m_swap.h to several files. 2023-08-22 21:49:55 +02:00
Christoph Oelckers 454af06acf - use a local byteswap header in the file system. 2023-08-22 21:49:55 +02:00
Christoph Oelckers 771fa2b51c - rewrote dir CCMD using ScanDirectory and avoiding I_ChDir entirely. 2023-08-22 21:49:55 +02:00
Christoph Oelckers 5f3d25ef44 - use ScanDirectory in all places where the findfile API was used.
This allows to completely hide its implementation details from the rest of the code which only gets a list of file names now.
2023-08-22 21:49:54 +02:00
Christoph Oelckers 566a8f58a7 - disable dir CCMD.
The implementation of this one is garbage, it needs to be redone without I_ChDir.
2023-08-22 21:49:54 +02:00
Christoph Oelckers 219b3fb9f9 - uncoupled directory loader from the rest of the engine. 2023-08-22 21:49:54 +02:00
Christoph Oelckers 5a32f98bde - first stage of uncoupling the file system from the engine.
This replaces several FStrings and TArrays with std::string and std::vector.
2023-08-22 21:49:54 +02:00
Christoph Oelckers 2524ea6b0e - moved linked textures from file system to texture manager. 2023-08-22 21:49:54 +02:00
Christoph Oelckers 1dc47f91c2 - file system error management refactoring. 2023-08-22 21:49:54 +02:00
Cacodemon345 145450a044 WebP image support 2023-08-22 19:14:21 +02:00
alexey.lysiuk ae2fa11963 - added safeguards against very early access to console variables in Cocoa backend
for an unknown reason, application activation functions can be called way too early during app launch
`S_SetSoundPaused()` function tries to read values of `i_pauseinbackground` and `i_soundinbackground` console variables before their initialization leading to a null pointer dereference

https://forum.zdoom.org/viewtopic.php?t=78092
2023-08-22 14:58:06 +03:00
Cacodemon345 22271d146a Switch to `vcpkg` for library dependencies 2023-08-21 21:12:00 +02:00
Christoph Oelckers 7fee89d1f5 - uncouple the file system from the engine's Printf function.
This is needed to use it in non GZDoom based projects.
2023-08-17 21:36:22 +02:00
Christoph Oelckers 9b790d23a8 - optimization of WideString and FileReader::Printf.
Both now omit the intermediate FString as the target buffer can be directly written to.
WideString was also moved to utf8.cpp/h to uncouple from zstring.
2023-08-17 18:45:33 +02:00
Cacodemon345 a4573b4ad1 Fix QOI image loading 2023-08-17 08:56:50 -04:00