1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00
Commit Graph

117 Commits

Author SHA1 Message Date
1bf05d43a1 fix video implementation error; implement paging; video loading 2023-11-16 22:39:50 +01:00
eee1a4d061 CVideoHandler.cpp: Clear screen before rendering each frame of the intro
This way, the background is black instead of showing glitchy artifacts when one resizes the window
2023-11-10 03:37:42 +01:00
f01ec55d21 Use the "nullptr" literal.
"nullptr" should be used to denote the null pointer
2023-10-27 18:18:59 +00:00
a1a5bc28c2 convert line endings from CRLF (Windows) to LF (Linux/Unix)
Mixed line endings cause problems when exporting patches with
git-format-patch and then trying to "git am" a patch with mixed and
non-matching line endings. In such a situation git will fail to apply
the patch.

This commit runs the dos2unix tools on the remaining files with CRLF
(\r\n) line endings to convert them to line-feeds (\n) only.

Files that are Windows specific like *.vcxproj and *.props files were
not converted.

Closes: #3073
2023-10-19 16:23:21 +02:00
19788c6399 suggestion 2023-10-09 22:22:10 +02:00
89a39fcfc0 code review 2023-10-08 20:27:56 +02:00
a1f6e49f87 vcmi always uses only 2 channels 2023-10-08 14:09:07 +02:00
639b6c6577 version 2023-10-08 12:49:59 +02:00
66ff603456 remove crackle 2023-10-08 12:49:59 +02:00
39e06ea5e1 fix error message 2023-10-08 12:49:59 +02:00
be2b3afe48 implements sounds 2023-10-08 12:49:59 +02:00
2bbce0f38b decoding working 2023-10-08 12:49:59 +02:00
8de4b88a1b basically playing 2023-10-08 12:49:59 +02:00
628de69a63 audio 2023-10-08 12:49:59 +02:00
6f8b62d77d codereview 2023-09-23 20:41:30 +02:00
30c6cf3b98 video & audio correction; win/lose 2023-09-22 21:45:12 +02:00
348eddcc17 Fix looped playback of video files 2023-09-17 01:31:31 +03:00
9cfcf5ea19 Fix regressions 2023-09-04 18:22:34 +03:00
97b7d44c88 Use ResourcePath for video accessing 2023-09-04 18:22:34 +03:00
823ffa7a07 Always use ResourcePath for referencing images and animations 2023-09-04 18:22:34 +03:00
44d16b32fe Use API identical to std classes where possible 2023-08-23 16:32:29 +03:00
c77f8482e3 Replaced event handling break system with key capturing 2023-05-20 01:51:49 +03:00
0e70f2998f SDL event handling is now done exclusively in input handler 2023-05-20 01:51:49 +03:00
5e86b00dda Moved input handling from GuiHandler to set of classes in eventsSDL dir 2023-05-20 01:51:49 +03:00
f84c2c3bb5 Removed getFrameDeltaMilliseconds from gui handler 2023-05-14 22:30:59 +03:00
03df274450 Framerate manager is now in a separate file and private member of GH 2023-05-14 22:22:37 +03:00
a72af34d9f vcmi: fix build and run with ffmpeg 6.0 2023-03-11 00:12:05 +03:00
7c58a46279 Removed some instances of access to screen surface 2023-02-03 18:23:53 +02:00
108a42e4ba Reorganized includes for new layout. New class - IImageLoader 2023-02-01 20:42:06 +02:00
0ba74fea73 Merge pull request #1515 from IvanSavenko/time_based_animations
Time based animations
2023-02-01 12:25:54 +02:00
9c3030603d Removed most SDL includes from headers, removed SDL int's 2023-01-30 19:55:32 +02:00
42df5626d9 Added Color class to replace SDL_Color 2023-01-30 00:12:43 +02:00
a9fefffc65 Video playback is now time-based, using video file timings 2023-01-28 13:19:35 +02:00
fc0f5a9fb3 Reduced SDL includes 2023-01-20 16:11:43 +02:00
9be38780cd Removed remaining parts of Geomeotries.h/cpp 2023-01-20 16:11:43 +02:00
ee7a573cb8 Refactoring of SDL API usage:
- Rect no longer inherits from SDL_Rect
- renamed vcmi functions that used SDL naming format
- moved all functions in SDL_Extensions file into CSDL_Ext namespace
- SDL_Rect is now used only by SDL_Extensions, all other code uses Rect
2023-01-20 16:11:43 +02:00
7fdad4e0f6 Code refactor following C++ standard and condition fixes 2022-11-15 03:20:55 +03:00
8757a577e3 CVideoHandler: fix codecContext according to docs 2022-05-14 13:22:41 +03:00
e7b753c222 CVideoHandler: use new ffmpeg 2022-05-14 13:22:41 +03:00
23215e039c client/CVideoHandler.cpp: fix crash on video playback
Avoid buffer overflow caused by sws_scale():
    http://trac.ffmpeg.org/ticket/9254
Currently (ffmpeg-4.4 with SSE3 enabled) sws_scale()
has a few requirements for target data buffers on rescaling:
1. buffer has to be aligned to be usable for SIMD instructions
2. buffer has to be padded to allow small overflow by SIMD instructions
Unfortunately SDL_Surface does not provide these guarantees.
This means that atempt to rescale directly into SDL surface causes
memory corruption. Usually it happens on campaign selection screen
where short video moves start spinning on mouse hover.

To fix [1.] we use av_malloc() for memory allocation.
To fix [2.] we add an `ffmpeg_pad` that provides plenty of space.
We have to use intermdiate buffer and then use memcpy() to land it
to SDL_Surface.

Without the change crash has the following backtrace:

```
(gdb) bt
    (c=0x47508940, src=0x1ffeffef50, srcStride=0x1ffeffef30, srcSliceY=0, srcSliceH=116, dst=0x1ffeffef70, dstStride=0x1ffeffef40) at src/libswscale/x86/yuv2rgb_template.c:119
    (c=<optimized out>, srcSlice=<optimized out>, srcStride=0x432afa20, srcSliceY=<optimized out>, srcSliceH=116, dst=<optimized out>, dstStride=0x1ffefff0a0) at src/libswscale/swscale.c:969
    (this=0x1abaa330, x=90, y=72, dst=0x1a85a4c0, forceRedraw=<optimized out>, update=<optimized out>)
    at ../vcmi-9999/client/CVideoHandler.cpp:332
    at ../vcmi-9999/client/gui/CIntObject.cpp:83
    at ../vcmi-9999/client/gui/CGuiHandler.cpp:462
```

valgrind points to corruption right in sws_scale():

```
Invalid write of size 8
   at 0x6C50BD3: ??? (in /usr/lib64/libswscale.so.5.7.100)
   by 0x6C4FAE6: yuv420_rgb32_ssse3 (yuv2rgb_template.c:119)
   by 0x6C28DF2: sws_scale (swscale.c:969)
   by 0x4566F6: CVideoPlayer::nextFrame() (CVideoHandler.cpp:293)
   by 0x4573A6: CVideoPlayer::update(int, int, SDL_Surface*, bool, bool) (CVideoHandler.cpp:332)
   by 0x25EC94: CIntObject::show(SDL_Surface*) [clone .part.0] (CIntObject.cpp:83)
   by 0x34E855: CMainMenu::update() (CMainMenu.cpp:319)
   by 0x25D589: CGuiHandler::renderFrame() (CGuiHandler.cpp:462)
   by 0x1F7450: mainLoop (CMT.cpp:1387)
   by 0x1F7450: main (CMT.cpp:513)
 Address 0x475088a8 is 0 bytes after a block of size 92,840 alloc'd
   at 0x483F7E5: malloc (vg_replace_malloc.c:380)
   by 0x52B4E23: SDL_malloc_REAL (SDL_malloc.c:5387)
   by 0x5266237: SDL_SIMDAlloc_REAL (SDL_cpuinfo.c:963)
   by 0x52EF042: SDL_CreateRGBSurfaceWithFormat_REAL (SDL_surface.c:123)
   by 0x2649AC: CSDL_Ext::newSurface(int, int, SDL_Surface*) (SDL_Extensions.cpp:42)
   by 0x457B20: CVideoPlayer::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, bool, bool) (CVideoHandler.cpp:182)
   by 0x457C60: CVideoPlayer::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool) (CVideoHandler.cpp:84)
   by 0x35B14E: CCampaignScreen::CCampaignButton::show(SDL_Surface*) (CCampaignScreen.cpp:126)
   by 0x25EC94: CIntObject::show(SDL_Surface*) [clone .part.0] (CIntObject.cpp:83)
   by 0x34E855: CMainMenu::update() (CMainMenu.cpp:319)
   by 0x25D589: CGuiHandler::renderFrame() (CGuiHandler.cpp:462)
   by 0x1F7450: mainLoop (CMT.cpp:1387)
   by 0x1F7450: main (CMT.cpp:513)
```

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2021-07-31 14:35:31 +03:00
a05ae78e67 Fixed lots of warnings.
Disabled the following (for MSVC only) that couldn't (or shouldn't) be fixed.

4003: not enough actual parameters for macro 'identifier'
4250: 'class1' : inherits 'class2::member' via dominance
4251: 'type' : class 'type1' needs to have dll-interface to be used by clients of class 'type2'
4275: non dll-interface class 'type1' used as base for dll-interface class 'type2'
2020-10-04 02:20:18 -07:00
75f8c8b29a Gui cleanup4 (#446)
* use smart pointers for almost all widget fields
* use SDL2 texture for cursor
* a lot af small tweaks and formatting
* removed CompImage class, it is actually useless as long as regular SDLImage support margins
* CGuiHandler: use smart pointers for [push|pop]Int
2018-07-25 01:36:48 +03:00
64d9dadd64 Logging cleanup. 2017-08-11 15:47:50 +03:00
a4c0ad94b1 Code style: remove default value hints in definitions (#342)
Some are outdated and this is something IDE are useful for.
2017-07-15 14:08:20 +03:00
f1e5797834 Code style: move or add licensing information on top of every file 2017-07-14 01:26:03 +03:00
c4ab962cc0 Fixed a few CWE-457 2016-11-27 17:48:18 +03:00
e20f861727 try to fix travis build.
What an ancient version of ffmpeg does it have?
2015-11-11 15:44:17 +03:00
f9dfa8d0c2 try to fix libav 9.18 2015-11-11 15:18:05 +03:00
33c933c208 All "old" APIs are deprecated in ffmgeg 2.2.3 - remove them entirely 2015-11-11 13:07:56 +03:00
4b94efe6b5 Hopefully proper fix for ffmpeg on MSVS 2015-11-11 12:41:28 +03:00