Commit Graph

952 Commits

Author SHA1 Message Date
Azamat H. Hackimov
a5b86bd0fb MVE: convert libmve files to C++ 2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
ce74c43b44 MVE: add copyright headers, clang-format 2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
ef60434f72 Add D2X implementation of MVE
Added D2X implementation licensed under GPLv3 terms.
Cut from c030c4531a
2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
1ae023a13b Enumerate all DLL functions manually
Enumerate DLL functions to ease tying functions in main and DLL sides in code.
2024-07-09 02:08:25 +03:00
Azamat H. Hackimov
4279373307 Additional fix for cfile regressions
On starting multiplayer missions OpenCFILE() loses filename value. Change OpenCFILE() signature to use std::fs::path too.
2024-07-09 01:19:58 +03:00
Louis Gombert
d85aa5c158
Merge pull request #484 from winterheart/network-cfile
Fix runtime error on creating multiplayer game
2024-07-08 08:31:41 +00:00
Azamat H. Hackimov
45aa389f68 Move content from dmfcdllinit.h
Simplify code.
2024-07-08 11:15:18 +03:00
Azamat H. Hackimov
0bae89dd05 Fix runtime error on creating multiplayer game
Update dll typedefs to reflect cfile API changes.
2024-07-08 11:15:18 +03:00
Louis Gombert
de75a80ae7
Merge pull request #475 from winterheart/cfile-std-filesystem
cfile / ddio: use most of functions to std::filesystem::path
2024-07-06 23:25:12 +00:00
Azamat H. Hackimov
2fce643ae8 Use case-insensitive search for cf_OpenLibrary() on all platforms 2024-07-05 01:50:57 +03:00
Azamat H. Hackimov
7a1f08e811 Fix unittests on macOS
Surprisingly on macOS FS is case-insensitive.
2024-07-05 01:50:57 +03:00
Azamat H. Hackimov
b3affdb105 Use new cf_FindRealFileNameCaseInsensitive() function in code
A little speed-up for our slowpoke.
2024-07-05 01:50:57 +03:00
Azamat H. Hackimov
1a3c012228 Refactor cf_FindRealFileNameCaseInsensitive() function
Implementing cf_FindRealFileNameCaseInsensitive_new() based on std::fs::directory_iterator, which runs faster and more reliable.

cf_FindRealFileNameCaseInsensitive_new() works exactly as cf_FindRealFileNameCaseInsensitive().

Benchmark on Release build:

```
-------------------------------------------------------------------
Benchmark                         Time             CPU   Iterations
-------------------------------------------------------------------
cfile_no_exist_old            11607 ns        11399 ns        63035
cfile_no_exist_new             9302 ns         9196 ns        70041
cfile_exist_relative_old       2701 ns         2480 ns       282695
cfile_exist_relative_new        867 ns          866 ns       798478
cfile_exist_absolute_old       3415 ns         3167 ns       228323
cfile_exist_absolute_new       1182 ns         1181 ns       574782
```
2024-07-05 01:50:57 +03:00
Azamat H. Hackimov
f44f6a4bbd CFILE: change signature of cf_FindRealFileNameCaseInsenstive()
Moved directory parameter to 3rd position and make it optional.
2024-07-05 01:50:57 +03:00
Azamat H. Hackimov
c287a2df48 Fix compilation of Descent3Editor
Convert some of the paths to use std::fs::path.
2024-07-05 01:50:57 +03:00
Azamat H. Hackimov
41ec941b50 Convert bm_SaveFileBitmap() and SaveVClip() to std::fs::path 2024-07-05 01:50:57 +03:00
Azamat H. Hackimov
5222bb28f3 Update cinematics API to use std::fs::path 2024-07-05 01:50:57 +03:00
Azamat H. Hackimov
65520373e6 CFILE: Remove duplicated code in open_file_in_directory()
Refactoring platform-dependent parts of code into common part, greatly reduce LOC.
2024-07-05 01:50:57 +03:00
Azamat H. Hackimov
c5712208f6 CFILE: Additional unit tests for cfile functions 2024-07-05 01:50:57 +03:00
Azamat H. Hackimov
15ec76dd64 CFILE: Change cf_FindRealFileNameCaseInsenstive() to use std::fs::path 2024-07-05 01:50:57 +03:00
Azamat H. Hackimov
dad20b0830 CFILE: Add unittest framework 2024-07-05 01:50:57 +03:00
Louis Gombert
9263055e73
Merge pull request #482 from pzychotic/cmake-folders
Better project structure for IDEs
2024-07-04 18:36:03 +00:00
Azamat H. Hackimov
ee9e642a86
Merge pull request #474 from Lgt2x/enable-warnings
Enable all compilation warning on unix platforms
2024-07-04 21:01:39 +03:00
Louis Gombert
9ec18a240b Enable all compilation warning on unix platforms 2024-07-04 21:30:38 +02:00
Thomas Roß
12ec7c50c7 [CMake] Enabled the CMake property USE_FOLDERS to provide a more structured project list in IDEs with the help of set(CMAKE_FOLDER "...") calls. 2024-07-03 19:55:04 +02:00
Azamat H. Hackimov
4c574bf198
Merge pull request #481 from MaddTheSane/iffSafe
Fix endian issues with iff importer.
2024-07-03 12:22:05 +03:00
C.W. Betts
21e1384a3c Create an overloaded cf_ReadInt and cf_ReadShort that takes a bool to indicate little endian reads.
As suggested by @winterheart
2024-07-02 18:34:45 -06:00
C.W. Betts
d817c1930e Fix endian issues with iff importer.
It should now work on big-endian machines.
2024-07-02 15:48:18 -06:00
Louis Gombert
7695296ca0
Merge pull request #478 from pzychotic/fix-warnings
Fix compiler warnings
2024-07-02 08:58:42 +00:00
Azamat H. Hackimov
de49da0e9a DDIO: Remove unused platform-dependent functions
Remove ddio_CreateDir(), ddio_RemoveDir(), ddio_SaveWorkingDir(), ddio_RestoreWorkingDir(), ddio_DirExists(). Replace them in code with std::fs alternatives.
2024-07-01 12:50:49 +03:00
Azamat H. Hackimov
3af18dadc3 MANAGE: convert some global path variables to std::fs::path
Simplifies code related to UpdatePrimitive().
2024-07-01 12:50:49 +03:00
Azamat H. Hackimov
a00be9f71a MANAGE: refactor UpdatePrimitive() related code
Use std::fs::path on path construction, simplify code.
2024-07-01 12:50:49 +03:00
Azamat H. Hackimov
c33d99a5db MANAGE: convert UpdatePrimitive() to use std::fs::path 2024-07-01 12:50:49 +03:00
Azamat H. Hackimov
81555afd15 CFILE: convert cf_Diff() to use std::fs::path
Convert cf_Diff() and underlying functions to use std::filesystem::path
2024-07-01 12:50:49 +03:00
Azamat H. Hackimov
c47210be75 CFILE: convert cf_CopyFile() cf_CopyFileTime() to use std::fs::path
Convert cf_CopyFile() cf_CopyFileTime() and underlying functions to use std::filesystem::path
2024-07-01 12:50:49 +03:00
Azamat H. Hackimov
d1f0ddf888 CFILE: refactor internal paths and extensions
Refactor paths and extensions to use std::map. Rewriting related code in manage.cpp.
2024-07-01 12:50:49 +03:00
Azamat H. Hackimov
8d14ae025c CFILE: migrate more functions to use std::fs::path
Convert cf_IsFileInHog(), cf_OpenFileInLibrary() and cf_GetfileCRC() functions to use std::fs::path.
2024-07-01 12:50:49 +03:00
Azamat H. Hackimov
0ea758084f CFILE: refactor internal paths and extensions
Refactor paths and extensions to use std::map. Rewriting related code in manage.cpp.
2024-07-01 12:50:48 +03:00
Azamat H. Hackimov
33e8802363 CFILE: make path_entry struct using std::fs::path
Simplify related code in `cf_SetSearchPath()`.
2024-07-01 12:50:48 +03:00
Azamat H. Hackimov
82084e9176 Convert some of cfile functions to use std::filesystem
Make cfopen(), open_file_in_directory() and cfexist() use std::filesystem::path arguments.
2024-07-01 12:50:48 +03:00
Thomas Roß
9b8d61d16a [Netgames] Use size_t when catching strlen() return type and other buffer calculations.
This fixes alot of warnings of type C4267 '=': conversion from 'size_t' to 'int', possible loss of data.
2024-06-29 21:58:34 +02:00
Thomas Roß
85dce8bef1 [DMFC] Fixed wrong type in forward declaration.
This fixes alot of warnings of type C4099 'PInfo': type name first seen using 'struct' now seen using 'class'.
2024-06-29 21:55:09 +02:00
Thomas Roß
0f3b449d0b [Multiplayer] Fixed warning C4288 nonstandard extension used: 'i': loop control variable declared in the for-loop is used outside the for-loop scope; it conflicts with the declaration in the outer scope. 2024-06-29 21:54:01 +02:00
Thomas Roß
285604b7db [Editor] Fixed parameter type for AppendMenu() call.
This fixes alot of warnings of type:
C4311 'type cast': pointer truncation from 'HMENU' to 'uint32_t'
C4302 'type cast': truncation from 'HMENU' to 'uint32_t'
2024-06-29 21:52:50 +02:00
Thomas Roß
d55dc5c321 [Scripts] Fixed 100 warnings of type C4101 'foo': unreferenced local variable, since this cpp file gets included in alot of scripts. 2024-06-29 21:50:50 +02:00
Thomas Roß
1ff9c2c3ba [Multiplayer] Fixed 200 warnings of type C4267 '+=': conversion from 'size_t' to 'int', possible loss of data. 2024-06-29 21:49:13 +02:00
Thomas Roß
e961d7c05d [Misc] Removed cast of assert condition to unsigned int to prevent pointer truncation.
This fixes over one thousand warnings of type:
C4311 'type cast': pointer truncation from 'foo *' to 'unsigned int'
C4302 'type cast': truncation from 'foo *' to 'unsigned int'
2024-06-29 21:47:28 +02:00
Azamat H. Hackimov
e68f270318
Merge pull request #457 from Lgt2x/win-sdl2
Use SDL2 on Windows
2024-06-29 22:24:34 +03:00
Azamat H. Hackimov
7b7ffde4d8 Fix loading OpenGL library on Windows
On loading GL symbols we are using SDL_GL_GetProcAddress(), which only valid if we previously loaded OpenGL library with SDL_GL_LoadLibrary(). We cannot use mod_LoadModule() here, otherwise finding symbols will fail.
2024-06-29 20:53:13 +02:00
Louis Gombert
b394df23cd Update VCPKG builtin-baseline and SDL version to 2.30.3 2024-06-29 18:28:23 +02:00