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

Make PluginAPI::ReadScreen thread safe.

This commit is contained in:
Sergey Lipskiy 2016-11-20 11:09:11 +07:00
parent 83ff7f9ae5
commit 5e639452ec
2 changed files with 28 additions and 5 deletions

View File

@ -100,6 +100,25 @@ private:
u32 m_addr;
};
class ReadScreenCommand : public APICommand {
public:
ReadScreenCommand(void **_dest, long *_width, long *_height)
: m_dest(_dest)
, m_width(_width)
, m_height(_height) {
}
bool run() {
video().readScreen(m_dest, m_width, m_height);
return true;
}
private:
void ** m_dest;
long * m_width;
long * m_height;
};
class RomClosedCommand : public APICommand {
public:
RomClosedCommand(std::mutex * _pRspThreadMtx,
@ -273,4 +292,13 @@ void PluginAPI::FBWList(FrameBufferModifyEntry * _plist, unsigned int _size)
{
FBInfo::fbInfo.WriteList(reinterpret_cast<FBInfo::FrameBufferModifyEntry*>(_plist), _size);
}
void PluginAPI::ReadScreen(void **_dest, long *_width, long *_height)
{
#ifdef RSPTHREAD
_callAPICommand(ReadScreenCommand(_dest, _width, _height));
#else
video().readScreen(_dest, _width, _height);
#endif
}
#endif

View File

@ -32,8 +32,3 @@ void PluginAPI::GetDllInfo(PLUGIN_INFO * PluginInfo)
PluginInfo->NormalMemory = FALSE;
PluginInfo->MemoryBswaped = TRUE;
}
void PluginAPI::ReadScreen(void **_dest, long *_width, long *_height)
{
video().readScreen(_dest, _width, _height);
}