Skip to content

Commit 14cad5a

Browse files
Aurumaker72gonetz
authored andcommitted
Implement mge_get_video_size
Required for capture on legacy Mupen64, as it needs a way to request the video size in a thread and wgl context-agnostic way
1 parent a78f458 commit 14cad5a

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

Diff for: src/PluginAPI.h

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class PluginAPI
6363
void DllConfig(HWND _hParent);
6464
void GetDllInfo (PLUGIN_INFO * PluginInfo);
6565
void ReadScreen(void **_dest, long *_width, long *_height);
66+
void GetVideoSize(int32_t* width, int32_t* height);
6667

6768
void DllAbout(/*HWND _hParent*/);
6869

Diff for: src/ZilmarGFX_1_3.h

+10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ the plugin
2020
#define _GFX_H_INCLUDED__
2121

2222
#if defined(__cplusplus)
23+
#include <cstdint>
2324
extern "C" {
2425
#endif
2526

@@ -285,6 +286,15 @@ EXPORT void CALL ReadScreen (void **dest, long *width, long *height);
285286
******************************************************************/
286287
EXPORT void CALL DllCrtFree(void* addr);
287288

289+
/******************************************************************
290+
Function: mge_get_video_size
291+
Purpose: Gets the current video size.
292+
Input: width - Pointer receiving the video width. Can be null.
293+
height - Pointer receiving the video height. Can be null.
294+
Output: none
295+
******************************************************************/
296+
EXPORT void CALL mge_get_video_size(int32_t* width, int32_t* height);
297+
288298
#if defined(__cplusplus)
289299
}
290300
#endif

Diff for: src/ZilmarPluginAPI.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,9 @@ EXPORT void CALL DllCrtFree(void* addr)
6060
free(addr);
6161
}
6262

63+
void CALL mge_get_video_size(int32_t* width, int32_t* height)
64+
{
65+
api().GetVideoSize(width, height);
66+
}
67+
6368
}

Diff for: src/common/CommonAPIImpl_common.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -312,4 +312,17 @@ void PluginAPI::ReadScreen(void **_dest, long *_width, long *_height)
312312
dwnd().readScreen(_dest, _width, _height);
313313
#endif
314314
}
315+
316+
void PluginAPI::GetVideoSize(int32_t* width, int32_t* height)
317+
{
318+
if (width)
319+
{
320+
*width = dwnd().getWidth();
321+
}
322+
if (height)
323+
{
324+
*height = dwnd().getHeight();
325+
}
326+
}
327+
315328
#endif

0 commit comments

Comments
 (0)