Commit Graph

871 Commits

Author SHA1 Message Date
Azamat H. Hackimov
4b8328cdfa Use correct sample size for processing
Change mveaudio_process() to use sample size defined by stream.
2024-07-12 17:03:28 +03:00
Azamat H. Hackimov
976f00a1f3 Use SDL_QueueAudio() instead callbacks on filling sound buffer
Fixes some issues when sound buffer get exhausted before refilling.
2024-07-12 17:03:28 +03:00
Louis Gombert
87f6ef009f
Merge pull request #488 from pzychotic/fix-no-intro-crash
Fix crash with -nointro
2024-07-10 19:32:26 +00:00
Thomas Roß
bdfb20af21 [Movie] Fixed a crash when -no-intro is used on the command line. 2024-07-10 20:48:17 +02:00
Louis Gombert
3c66b13200
Merge pull request #289 from winterheart/mve
Implementing own MVE library
2024-07-09 20:56:56 +00:00
Azamat H. Hackimov
5a4e1533a6 Fix playback case-insensitive intros 2024-07-09 09:47:11 +03:00
Azamat H. Hackimov
ae279d1211 Documenting ISoundDevice classes 2024-07-09 03:42:52 +03:00
Azamat H. Hackimov
32df86203a Cleanup d3movie.cpp
Remove unused variables, minor fixes.
2024-07-09 03:42:52 +03:00
Azamat H. Hackimov
c6eb9a8908 MVE: rename lnx_sound to sdl_sound
Now this is cross-platform playback.
2024-07-09 03:42:52 +03:00
Azamat H. Hackimov
4f0e0f87a5 Cleanup MVE library
Remove old implementation, cleanup unused code.
2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
def4737f53 Cleanup cinematics.cpp
Don't stop main sound subsystem as it now not interfere MVE playback. Removed unused debug variable.
2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
9672475f70 Update MVE playback on Windows
There only one problem still persist on playback - slow filling sound buffer from std::deque on MSVC Debug mode due extremely slow performance of STL containers on that mode. On Release and RelWithDebInfo playback is fine.
2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
8fd119bd3d MVE: Make timer code crossplatform 2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
a39ccfc3ca MVE: Implementing class for sound playback
Implemented abstraction layer and SDL backend.
2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
2f288f6dc9 MVE: use deque for FIFO buffer
Replacing circular ring implementation with queue that keeps decoded data between SDL audio callbacks.
2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
8d56e1c1ff MVE: Migrate to SDL2 functions
Replaced SDL 1.2 legacy calls to SDL2 equivalents.
Changed spec.size to fixed value 4096 as values obtained from file can produce sound stuttering.
2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
96c240a4c0 MVE: Add support for big-endian systems 2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
afd7c1a636 MVE: Initial sound support
Sound supported by SDL backend.
2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
a8784ee524 MVE: Implementing frame playing (main menu)
Reorganized MVE to use own MVESTREAM pointer for each opened MVE file.
2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
99ec2e3a5e MVE: Refactoring code
Merge libmve.h into mvelib.h
2024-07-09 03:40:49 +03:00
Azamat H. Hackimov
b94458f561 MVE: Switch to D2X implementation (first run)
Adapting movie and mve interfaces each other.
Converted open() to fopen() et al. calls.
movie expected image as RGB565 from old mve, but now it's RGB555, so there no need additional conversion. Fixed hicolor related conversion of width in movie's callbacks. Headers cleanup in both subsystems.

Sound and frame callbacks are still unavailable.
2024-07-09 03:40:49 +03:00
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
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