1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Implement screenshot capture for MupenPlus.

This commit is contained in:
Sergey Lipskiy 2014-10-02 16:18:28 +07:00
parent d74e39b948
commit aa694d4314
4 changed files with 28 additions and 1 deletions

View File

@ -234,6 +234,27 @@ void OGLVideo::readScreen(void **_pDest, long *_pWidth, long *_pHeight )
glReadPixels( 0, m_heightOffset, m_width, m_height, format, GL_UNSIGNED_BYTE, *_pDest );
}
void OGLVideo::readScreen2(void * _dest, int * _width, int * _height, int _front)
{
if (_width == NULL || _height == NULL)
return;
*_width = m_screenWidth;
*_height = m_screenHeight;
if (_dest == NULL)
return;
GLint oldMode;
glGetIntegerv(GL_READ_BUFFER, &oldMode);
if (_front != 0)
glReadBuffer(GL_FRONT);
else
glReadBuffer(GL_BACK);
glReadPixels(0, m_heightOffset, m_screenWidth, m_screenHeight, GL_RGB, GL_UNSIGNED_BYTE, _dest);
glReadBuffer(oldMode);
}
void OGLRender::addTriangle(int _v0, int _v1, int _v2)
{
triangles.elements[triangles.num++] = _v0;

View File

@ -125,6 +125,7 @@ public:
void setCaptureScreen(const char * const _strDirectory);
void setToggleFullscreen() {m_bToggleFullscreen = true;}
void readScreen(void **_pDest, long *_pWidth, long *_pHeight );
void readScreen2(void * _dest, int * _width, int * _height, int _front);
void updateScale();
f32 getScaleX() const {return m_scaleX;}

View File

@ -57,11 +57,11 @@ public:
void DllAbout(HWND _hParent);
#else
// MupenPlus
void ReadScreen2(void * _dest, int * _width, int * _height, int _front) {}
void FBRead(unsigned int _addr) {}
void FBWrite(unsigned int addr, unsigned int size) {}
void FBGetFrameBufferInfo(void * _p) {}
void ResizeVideoOutput(int _Width, int _Height);
void ReadScreen2(void * _dest, int * _width, int * _height, int _front);
m64p_error PluginStartup(m64p_dynlib_handle _CoreLibHandle);
m64p_error PluginShutdown();

View File

@ -108,3 +108,8 @@ void PluginAPI::ResizeVideoOutput(int _Width, int _Height)
{
video().setWindowSize(_Width, _Height);
}
void PluginAPI::ReadScreen2(void * _dest, int * _width, int * _height, int _front)
{
video().readScreen2(_dest, _width, _height, _front);
}