102 Dalmatians: Puppies to the Rescue
Decompilation Source Reference | GitLab repository
Loading...
Searching...
No Matches
avi.c
Go to the documentation of this file.
1/* Recovered game implementation; original addresses identify provenance. */
9
10// Original pcdogs.exe: 0x40f5b0
11// Opens the MCI AVI device, resets the movie alias counter, and parses the supplied window-handle text only when initialization succeeds.
12BOOL Video_InitializeAVIPlayer(char const *window_handle_text)
13{
15
16 g_aviPlayerInitialized = mciSendStringA("open avivideo", NULL, 0, NULL) == 0;
18 return FALSE;
19
20 g_aviWindowHandle = (HWND)(uintptr_t)String_ParseAtoi(window_handle_text);
21
23}
24
25// Original pcdogs.exe: 0x40f5f0
26// Closes the MCI AVI device, clears its initialized flag, and returns the MCI error code.
28{
29 MCIERROR result = mciSendStringA("close avivideo", NULL, 0, NULL);
31
32 return result;
33}
34
35// Original pcdogs.exe: 0x40f610
36// Creates a unique MCI alias and opens the requested AVI file when the player is initialized, returning whether the command succeeded.
37BOOL Video_OpenAVIFile(char const *movie_path)
38{
40 return 0;
41
42 int32_t movie_alias_index = g_aviMovieCounter++;
43 String_FormatCRTString(g_aviMciAlias, "movie%d", movie_alias_index);
44 wsprintfA(g_aviMciCommand, "open %s type avivideo alias %s", movie_path, g_aviMciAlias);
45 return mciSendStringA(g_aviMciCommand, NULL, 0, NULL) == 0;
46}
47
48// Original pcdogs.exe: 0x40f670
49// Closes the current AVI alias and returns the MCI error code.
50MCIERROR Video_CloseAVIFile(void)
51{
52 wsprintfA(g_aviMciCommand, "close %s", g_aviMciAlias);
53 return mciSendStringA(g_aviMciCommand, NULL, 0, NULL);
54}
55
56// Original pcdogs.exe: 0x40f6a0
57// Starts fullscreen playback of the current AVI alias and returns whether the MCI command succeeded.
59{
60 wsprintfA(g_aviMciCommand, "play %s fullscreen", g_aviMciAlias);
61 return mciSendStringA(g_aviMciCommand, NULL, 0, NULL) == 0;
62}
63
64// Original pcdogs.exe: 0x40f6d0
65// Queries the current AVI mode and compares it case-insensitively with playing. The MCI query result is not checked before the returned text is inspected.
67{
68 wsprintfA(g_aviMciCommand, "status %s mode", g_aviMciAlias);
69
70 char status_text[VIDEO_MCI_STATUS_CAPACITY];
71 mciSendStringA(g_aviMciCommand, status_text, sizeof(status_text), NULL);
72
73 return __strcmpi(status_text, "playing") == 0;
74}
BOOL Video_PlayAVIFullscreen(void)
Definition avi.c:58
BOOL Video_OpenAVIFile(char const *movie_path)
Definition avi.c:37
BOOL Video_InitializeAVIPlayer(char const *window_handle_text)
Definition avi.c:12
MCIERROR Video_CloseAVIFile(void)
Definition avi.c:50
MCIERROR Video_ShutdownAVIPlayer(void)
Definition avi.c:27
BOOL Video_IsAVIPlaying(void)
Definition avi.c:66
#define g_aviPlayerInitialized
Definition globals.h:29
#define g_aviWindowHandle
Definition globals.h:237
int32_t String_ParseAtoi(char const *string)
Definition strings.c:78
int32_t __strcmpi(char const *s1, char const *s2)
Definition strings.c:279
int32_t String_FormatCRTString(char *buffer, char const *format,...)
Definition formatting.c:18
#define g_aviMciCommand
Definition strings.h:409
#define g_aviMciAlias
Definition strings.h:406
#define VIDEO_MCI_STATUS_CAPACITY
Definition constants.h:13
#define g_aviMovieCounter
Definition globals.h:50