Skip to content

Commit

Permalink
Implement mge_get_video_size
Browse files Browse the repository at this point in the history
Required for capture on legacy Mupen64, as it needs a way to request the video size in a thread and wgl context-agnostic way
  • Loading branch information
Aurumaker72 committed Dec 18, 2024
1 parent d5be3c6 commit 9430145
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/PluginAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class PluginAPI
void DllConfig(HWND _hParent);
void GetDllInfo (PLUGIN_INFO * PluginInfo);
void ReadScreen(void **_dest, long *_width, long *_height);
void GetVideoSize(int32_t* width, int32_t* height);

void DllAbout(/*HWND _hParent*/);

Expand Down
10 changes: 10 additions & 0 deletions src/ZilmarGFX_1_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ the plugin
#define _GFX_H_INCLUDED__

#if defined(__cplusplus)
#include <cstdint>
extern "C" {
#endif

Expand Down Expand Up @@ -285,6 +286,15 @@ EXPORT void CALL ReadScreen (void **dest, long *width, long *height);
******************************************************************/
EXPORT void CALL DllCrtFree(void* addr);

/******************************************************************
Function: mge_get_video_size
Purpose: Gets the current video size.
Input: width - Pointer receiving the video width. Can be null.
height - Pointer receiving the video height. Can be null.
Output: none
******************************************************************/
EXPORT void CALL mge_get_video_size(int32_t* width, int32_t* height);

#if defined(__cplusplus)
}
#endif
Expand Down
5 changes: 5 additions & 0 deletions src/ZilmarPluginAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ EXPORT void CALL DllCrtFree(void* addr)
free(addr);
}

void CALL mge_get_video_size(int32_t* width, int32_t* height)
{
api().GetVideoSize(width, height);
}

}
13 changes: 13 additions & 0 deletions src/common/CommonAPIImpl_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,17 @@ void PluginAPI::ReadScreen(void **_dest, long *_width, long *_height)
dwnd().readScreen(_dest, _width, _height);
#endif
}

void PluginAPI::GetVideoSize(int32_t* width, int32_t* height)
{
if (width)
{
*width = dwnd().getWidth();
}
if (height)
{
*height = dwnd().getHeight();
}
}

#endif

0 comments on commit 9430145

Please sign in to comment.