Skip to content

Commit

Permalink
tr2/fmv: use ffmpeg backend
Browse files Browse the repository at this point in the history
Resolves #1729.
  • Loading branch information
rr- committed Oct 21, 2024
1 parent 6ce4fc4 commit fb21aed
Show file tree
Hide file tree
Showing 13 changed files with 443 additions and 223 deletions.
8 changes: 5 additions & 3 deletions docs/tr2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
## [Unreleased](https://github.com/LostArtefacts/TRX/compare/tr2-0.5...develop) - ××××-××-××
- fixed `/give` not working with weapons (regression from 0.5)
- fixed the camera being cut off after using the gong hammer in Ice Palace (#1580)
- fixed the audio not being in sync when Lara strikes the gong in Ice Palace (#1725)
- improved FMV mode appearance - removed black scanlines (#1729)
- improved FMV mode behavior - stopped switching screen resolutions (#1729)
- improved switch object names
- Switch Type 1 renamed to "Airlock Switch"
- Switch Type 2 renamed to "Small Switch"
- Switch Type 3 renamed to "Switch Button"
- Switch Type 4 renamed to "Lever/Switch"
- Switch Type 5 renamed to "Underwater Lever/Switch"
- fixed `/give` not working with weapons (regression from 0.5)
- fixed the camera being cut off after using the gong hammer in Ice Palace (#1580)
- fixed the audio not being in sync when Lara strikes the gong in Ice Palace (#1725)

## [0.5](https://github.com/LostArtefacts/TRX/compare/afaf12a...tr2-0.5) - 2024-10-08
- added `/sfx` command
Expand Down
116 changes: 58 additions & 58 deletions docs/tr2/progress.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 26 additions & 26 deletions docs/tr2/progress.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4165,32 +4165,32 @@ typedef enum {
0x00457C79 0x001A + int32_t __fastcall Math_SinImpl(int16_t angle);
0x00457C93 0x002C + uint32_t __fastcall Math_Sqrt(uint32_t n);

0x00458D00 0x0006 * int __cdecl Player_PlayFrame(LPVOID, LPVOID, LPVOID, DWORD, LPCRECT, DWORD, DWORD, DWORD);
0x00458D06 0x0006 * int __cdecl Movie_GetTotalFrames(LPVOID);
0x00458D0C 0x0006 * int __cdecl Movie_GetCurrentFrame(LPVOID);
0x00458D12 0x0006 * int __cdecl Player_StartTimer(LPVOID);
0x00458D18 0x0006 * int __cdecl Player_InitMoviePlayback(LPVOID, LPVOID, LPVOID);
0x00458D1E 0x0006 * int __cdecl Movie_SetSyncAdjust(LPVOID, LPVOID, DWORD);
0x00458D24 0x0006 * int __cdecl Player_InitSound(LPVOID, DWORD, DWORD, BOOL, DWORD, DWORD, DWORD, DWORD, DWORD);
0x00458D2A 0x0006 * int __cdecl Movie_GetSoundChannels(LPVOID);
0x00458D30 0x0006 * int __cdecl Movie_GetSoundRate(LPVOID);
0x00458D36 0x0006 * int __cdecl Movie_GetSoundPrecision(LPVOID);
0x00458D3C 0x0006 * int __cdecl Player_GetDSErrorCode(void);
0x00458D42 0x0006 * int __cdecl Player_InitSoundSystem(HWND);
0x00458D48 0x0006 * int __cdecl Player_BlankScreen(DWORD, DWORD, DWORD, DWORD);
0x00458D4E 0x0006 * int __cdecl Player_InitPlaybackMode(HWND, LPVOID, DWORD, DWORD);
0x00458D54 0x0006 * int __cdecl Player_InitVideo(LPVOID, LPVOID, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
0x00458D5A 0x0006 * int __cdecl Movie_GetXSize(LPVOID);
0x00458D60 0x0006 * int __cdecl Movie_GetYSize(LPVOID);
0x00458D66 0x0006 * int __cdecl Movie_GetFormat(LPVOID);
0x00458D6C 0x0006 * int __cdecl Player_InitMovie(LPVOID, DWORD, DWORD, LPCTSTR, DWORD);
0x00458D72 0x0006 * int __cdecl Player_PassInDirectDrawObject(LPDIRECTDRAW3);
0x00458D78 0x0006 * int __cdecl Player_ReturnPlaybackMode(BOOL);
0x00458D7E 0x0006 * int __cdecl Player_ShutDownSoundSystem(void);
0x00458D84 0x0006 * int __cdecl Player_ShutDownMovie(LPVOID);
0x00458D8A 0x0006 * int __cdecl Player_ShutDownVideo(LPVOID);
0x00458D90 0x0006 * int __cdecl Player_ShutDownSound(LPVOID);
0x00458D96 0x0006 * int __cdecl Player_StopTimer(LPVOID);
0x00458D00 0x0006 + int __cdecl Player_PlayFrame(LPVOID, LPVOID, LPVOID, DWORD, LPCRECT, DWORD, DWORD, DWORD);
0x00458D06 0x0006 + int __cdecl Movie_GetTotalFrames(LPVOID);
0x00458D0C 0x0006 + int __cdecl Movie_GetCurrentFrame(LPVOID);
0x00458D12 0x0006 + int __cdecl Player_StartTimer(LPVOID);
0x00458D18 0x0006 + int __cdecl Player_InitMoviePlayback(LPVOID, LPVOID, LPVOID);
0x00458D1E 0x0006 + int __cdecl Movie_SetSyncAdjust(LPVOID, LPVOID, DWORD);
0x00458D24 0x0006 + int __cdecl Player_InitSound(LPVOID, DWORD, DWORD, BOOL, DWORD, DWORD, DWORD, DWORD, DWORD);
0x00458D2A 0x0006 + int __cdecl Movie_GetSoundChannels(LPVOID);
0x00458D30 0x0006 + int __cdecl Movie_GetSoundRate(LPVOID);
0x00458D36 0x0006 + int __cdecl Movie_GetSoundPrecision(LPVOID);
0x00458D3C 0x0006 + int __cdecl Player_GetDSErrorCode(void);
0x00458D42 0x0006 + int __cdecl Player_InitSoundSystem(HWND);
0x00458D48 0x0006 + int __cdecl Player_BlankScreen(DWORD, DWORD, DWORD, DWORD);
0x00458D4E 0x0006 + int __cdecl Player_InitPlaybackMode(HWND, LPVOID, DWORD, DWORD);
0x00458D54 0x0006 + int __cdecl Player_InitVideo(LPVOID, LPVOID, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD);
0x00458D5A 0x0006 + int __cdecl Movie_GetXSize(LPVOID);
0x00458D60 0x0006 + int __cdecl Movie_GetYSize(LPVOID);
0x00458D66 0x0006 + int __cdecl Movie_GetFormat(LPVOID);
0x00458D6C 0x0006 + int __cdecl Player_InitMovie(LPVOID, DWORD, DWORD, LPCTSTR, DWORD);
0x00458D72 0x0006 + int __cdecl Player_PassInDirectDrawObject(LPDIRECTDRAW3);
0x00458D78 0x0006 + int __cdecl Player_ReturnPlaybackMode(BOOL);
0x00458D7E 0x0006 + int __cdecl Player_ShutDownSoundSystem(void);
0x00458D84 0x0006 + int __cdecl Player_ShutDownMovie(LPVOID);
0x00458D8A 0x0006 + int __cdecl Player_ShutDownVideo(LPVOID);
0x00458D90 0x0006 + int __cdecl Player_ShutDownSound(LPVOID);
0x00458D96 0x0006 + int __cdecl Player_StopTimer(LPVOID);


# VARIABLES
Expand Down
26 changes: 20 additions & 6 deletions src/libtrx/engine/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ typedef struct {

void *primary_surface;
enum AVPixelFormat primary_surface_pixel_format;
int32_t primary_surface_stride;

VIDEO_SURFACE_ALLOCATOR_FUNC surface_allocator_func;
void *surface_allocator_func_user_data;
Expand Down Expand Up @@ -723,12 +724,14 @@ static int M_UploadTexture(M_STATE *is, AVFrame *frame)
is->primary_surface, is->surface_lock_func_user_data);

if (pixels != NULL) {
uint8_t *surf_planes[4];
int surf_linesize[4];
av_image_fill_arrays(
surf_planes, surf_linesize, pixels,
is->primary_surface_pixel_format, is->surface_width,
is->surface_height, 1);
uint8_t *surf_planes[4] = { pixels, NULL, NULL, NULL };
int surf_linesize[4] = { 0, 0, 0, 0 };
if (is->primary_surface_stride > 0) {
surf_linesize[0] = is->primary_surface_stride;
} else {
surf_linesize[0] = av_image_get_linesize(
is->primary_surface_pixel_format, is->surface_width, 0);
}

surf_planes[0] += is->target_surface_y * surf_linesize[0];
surf_planes[0] += av_image_get_linesize(
Expand Down Expand Up @@ -1951,6 +1954,17 @@ void Video_SetSurfacePixelFormat(VIDEO *video, enum AVPixelFormat pixel_format)
M_ReallocPrimarySurface(is, is->surface_width, is->surface_height, false);
}

void Video_SetSurfaceStride(VIDEO *video, const int32_t stride)
{
M_STATE *const is = video->priv;
if (is->primary_surface_stride == stride) {
return;
}

is->primary_surface_stride = stride;
M_ReallocPrimarySurface(is, is->surface_width, is->surface_height, false);
}

void Video_SetSurfaceAllocatorFunc(
VIDEO *const video, const VIDEO_SURFACE_ALLOCATOR_FUNC func,
void *const user_data)
Expand Down
1 change: 1 addition & 0 deletions src/libtrx/include/libtrx/engine/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ VIDEO *Video_Open(const char *path);
void Video_SetVolume(VIDEO *video, double volume);
void Video_SetSurfaceSize(VIDEO *video, int32_t width, int32_t height);
void Video_SetSurfacePixelFormat(VIDEO *video, enum AVPixelFormat pixel_format);
void Video_SetSurfaceStride(VIDEO *video, int32_t stride);
void Video_SetSurfaceAllocatorFunc(
VIDEO *video, VIDEO_SURFACE_ALLOCATOR_FUNC func, void *user_data);
void Video_SetSurfaceDeallocatorFunc(
Expand Down
4 changes: 2 additions & 2 deletions src/tr2/decomp/decomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ int32_t __cdecl WinGameStart(void)
{
// try {
WinVidStart();
RenderStart(1);
RenderStart(true);
WinInStart();
// } catch (int32_t error) {
// return error;
Expand All @@ -558,7 +558,7 @@ void __cdecl Shell_Shutdown(void)
{
Console_Shutdown();
WinInFinish();
RenderFinish(1);
RenderFinish(true);
WinVidFinish();
WinVidHideGameWindow();
if (g_ErrorMessage[0]) {
Expand Down
Loading

0 comments on commit fb21aed

Please sign in to comment.