Commit graph

192 commits

Author SHA1 Message Date
Alibek Omarov
0c8da36a0b filesystem: disallow path traversal in FS_Delete and FS_Rename 2025-02-23 03:13:46 +03:00
Alibek Omarov
1d99f65e86 filesystem: when shutting down, clean up gameinfo pointers and total games count 2025-02-05 21:14:08 +03:00
Alibek Omarov
674a4e5883 filesystem: add ability to mount HD, LV, addon and language folders by engine request 2025-02-05 18:24:36 +03:00
Alibek Omarov
2457ecf226 filesystem: fix recursive basedir possible cyclic dependency when default game directory uses a basedir that's base directory is undefined
That could happen when default game directory depends on base directory that don't have gameinfo.txt.
Because all game directories with liblist.gam automatically have dependency on default game directory, it causes cyclic dependency.
2025-01-29 09:49:29 +03:00
Alibek Omarov
8cd99885f1 filesystem: clean added status for game folders when purging search paths 2025-01-29 09:46:18 +03:00
Alibek Omarov
375998dffb Cleanup xash3d_types.h from engine-specific macros and types 2025-01-22 15:10:18 +03:00
Alibek Omarov
b7c025b167 filesystem: android: request buffer for Android asset LoadFile implementation
Might be better than asking for random access and then only reading forward.
2025-01-21 19:50:14 +03:00
Alibek Omarov
f29c588e0f filesystem: take code from DarkPlaces to properly read compressed files 2025-01-21 18:47:42 +03:00
Alibek Omarov
a5c02c85f0 filesystem: wad: get rid of sentinel value at the end of wad_types array 2025-01-21 15:26:06 +03:00
Alibek Omarov
154df00f94 filesystem: don't create full path to rwdir, as cwd is always equal to rwdir
Fixes updating gameinfo.txt.
2025-01-20 19:53:04 +03:00
Alibek Omarov
a1da10fe38 filesystem: set default values for quick/autosave aged count 2025-01-20 16:06:57 +03:00
Alibek Omarov
785632a437 filesystem: minor refactoring in MD5_HashFile, use initializer instead of memset, limit buffer variable scope 2025-01-14 11:36:13 +03:00
Alibek Omarov
69341e36a3 public: expose commit and branch as global variables instead of functions 2025-01-13 20:02:59 +03:00
Alibek Omarov
35dc072b26 filesystem: on Android, assume all paths are case-sensitive because doing Linux-specific ioctl check crashes FUSE driver and kills our app 2025-01-13 13:56:15 +03:00
Alibek Omarov
f92a3695b3 filesystem: fix fd leak in Platform_GetDirectoryCaseSensitivity 2025-01-13 13:54:42 +03:00
Alibek Omarov
d4fe3d6f8a filesystem: wscript: check d_type field in struct dirent, as this is an extension and some supported ports (like psvita) don't have it 2025-01-08 01:22:23 +03:00
Alibek Omarov
1907485895 filesystem: re-enable folder check for array returned by listdirectory with dirs_only set to true
According to glibc manual, not all filesystems support it and some might return DT_UNKNOWN.
2025-01-08 01:22:23 +03:00
Alibek Omarov
cfebb3e1d6 filesystem: massively rework how scanning game directories work
* No more conversion from liblist.gam to gameinfo.txt. We are using liblist.gam directly now.
  gameinfo.txt being native format to Xash3D not only remains, it takes priority over liblist.gam.
* Quake game directories now don't receive autogenerated gameinfo.txt.
* Empty directories don't get gameinfo.txt either, finally making it easier to support HD addon folders.
* If user still wishes to generate gameinfo.txt, there is now command fs_make_gameinfo that creates
  gameinfo.txt for currently running game.
* No more creating empty folders for RoDir. They are now created on demand.
2025-01-08 01:22:23 +03:00
Alibek Omarov
ceb2b0c5e4 filesystem: add utility function FS_CheckForQuakePak that parses Quake PAK file and looks for specific files in it's root
Used to properly detect Quake game dirs.
2025-01-08 01:22:23 +03:00
Alibek Omarov
3d60770b84 filesystem: add flag to open files in a RAM
On Linux, it uses memfd_create syscall that can be found on Linux 3.17 and
higher. By default memfds are executable, so we set MFD_NOEXEC_SEAL flag to
prevent execution at creation time.
2024-12-19 04:22:25 +03:00
Alibek Omarov
b28c1186b2 filesystem: fix loading dlls by full path as required by metamod-r 2024-12-05 19:20:13 +03:00
Alibek Omarov
4798cd6d1e filesystem: add new export to get fs_rootdir path 2024-11-30 09:28:30 +03:00
Alibek Omarov
0154ffa060 wscript: try to automatically set console subsystem flag depending on target features
Remove subsystem flag from shlibs and stlibs, it's only required for executables.
2024-11-27 15:43:13 +03:00
Alibek Omarov
b94446161e filesystem: add functions to directly look up into archives 2024-11-23 13:56:53 +03:00
Alibek Omarov
567cf44111 filesystem: wad: remove unused variable in FS_FindFile_WAD 2024-11-23 13:56:25 +03:00
Alibek Omarov
10e8790311 filesystem: VFileSystem009: fix missing override keyword on a virtual method 2024-11-20 06:32:16 +03:00
Alibek Omarov
8fd5a5af96 filesystem: simplify ambient number bound check 2024-11-17 13:04:44 +03:00
Alibek Omarov
d15949d2e8 Rename _format to FORMAT_CHECK 2024-11-07 14:24:07 +03:00
Alibek Omarov
d8eb918cea filesystem: rename IVFileSystem009 to IFileSystem to avoid UBsan errors when debugging a mod that calls this interface using original headers 2024-11-06 19:46:22 +03:00
Alibek Omarov
96b95db7c8 filesystem: compile with rtti, but still disable exceptions 2024-11-06 19:46:22 +03:00
Alibek Omarov
0313e19674 filesystem: strip upper directory access from FS_FindFile when FS_AllowDirectPath is set to true
Detailed explanation is available in the code comments.
2024-10-29 16:13:31 +03:00
Alibek Omarov
48a9f17222 filesystem: only export GetFSAPI, CreateInterface is useless with static linking (and should be implemented differently) 2024-10-24 00:40:47 +03:00
Alibek Omarov
a15c1f99b2 wscript: remove useless features 2024-10-23 23:20:47 +03:00
Alibek Omarov
0a1269d52d filesystem: zip: fix non-heap object dealloc 2024-09-30 04:00:28 +03:00
Alibek Omarov
2e5bc31c9e filesystem: set malloc like attribute for imported zone memory allocator functions 2024-09-30 04:00:28 +03:00
Alibek Omarov
9ee1b32e2d engine: set malloc like and warn_unused_result attributes on common allocation functions, fs, image and soundlib 2024-09-30 04:00:28 +03:00
Alibek Omarov
a6c7b67d0d filesystem: include errno.h for Win32 2024-08-17 17:32:50 +03:00
Alibek Omarov
2df01316ce engine: client: add two new APIs for mainui to get extended new gameinfo structure 2024-08-13 18:28:07 +03:00
Alibek Omarov
3a67aefee2 filesystem: check rodir too when checking falldir existence too, just in case 2024-08-13 17:25:25 +03:00
Alibek Omarov
d114dffcb4 filesystem: add new gameinfo.txt key: demomap 2024-08-13 17:22:06 +03:00
Alibek Omarov
d2d6ed8bd4 filesystem: fix zip_t and pack_t definition so it have true standard flexible array member 2024-08-10 13:46:00 +03:00
Alibek Omarov
274f9d5846 filesystem: replace same struct type memcpys by assignments 2024-07-31 00:06:15 +03:00
Alibek Omarov
52f9aad4d0 filesystem: add new call to fs_stdio C API to check whether we support that archive format 2024-07-30 15:25:20 +03:00
Alibek Omarov
7bb5175084 Turn downloaded/ and custom/ into com_strings.h definitions, like sound path and saves path 2024-07-30 15:25:20 +03:00
Alibek Omarov
963cbf61e4 filesystem: fix loading libraries from archives on Windows 2024-07-21 01:49:34 +03:00
Alibek Omarov
17950fec3e filesystem: make engfuncs const 2024-07-16 15:23:03 +03:00
Alibek Omarov
2a394eee62 filesystem: make g_api const 2024-07-16 15:23:03 +03:00
Alibek Omarov
64716e6b42 filesystem: request win32 error string in wide chars and then transform it to UTF-8 using our utflib 2024-07-09 08:25:15 +03:00
Alibek Omarov
efee8149e2 filesystem: remove unneeded cast to fs_offset_t in write() call 2024-07-04 07:23:13 +03:00
Alibek Omarov
c73fa3d7a6 filesystem: fix mounting wads again
Because of the mounting order, VFS fails to automatically find unpacked WADs
2024-06-28 18:00:40 +03:00