Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement mge_get_video_size #2890

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it essential to use int32_t? Why not just int?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not essential, but since x64 support for legacy Mupen64 is planned, the Zilmar spec headers have had their types indiscriminately changed to the C++ constant-width ones to avoid miscellaneous annoyances during porting of plugins.

This specific change is free to be reverted.


#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
Loading