mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-05 17:20:30 +00:00
SWORD1: Ensure thread safeness when blitting cursor
This commit is contained in:
parent
60a1010b10
commit
2b38cbc660
@ -84,6 +84,10 @@ void Mouse::useLogicAndMenu(Logic *pLogic, Menu *pMenu) {
|
||||
_menu = pMenu;
|
||||
}
|
||||
|
||||
void Mouse::useScreenMutex(Common::Mutex *mutex) {
|
||||
_screenAccessMutex = mutex;
|
||||
}
|
||||
|
||||
void Mouse::addToList(int id, Object *compact) {
|
||||
_objList[_numObjs].id = id;
|
||||
_objList[_numObjs].compact = compact;
|
||||
@ -309,7 +313,9 @@ void Mouse::animate() {
|
||||
uint8 *ptrData = (uint8 *)_currentPtr + sizeof(MousePtr);
|
||||
ptrData += _frame * _currentPtr->sizeX * _currentPtr->sizeY;
|
||||
|
||||
_screenAccessMutex->lock();
|
||||
CursorMan.replaceCursor(ptrData, _currentPtr->sizeX, _currentPtr->sizeY, _currentPtr->hotSpotX, _currentPtr->hotSpotY, 255);
|
||||
_screenAccessMutex->unlock();
|
||||
|
||||
_activeFrame = _frame;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#ifndef SWORD1_MOUSE_H
|
||||
#define SWORD1_MOUSE_H
|
||||
|
||||
#include "common/mutex.h"
|
||||
#include "common/scummsys.h"
|
||||
#include "common/rect.h"
|
||||
#include "sword1/sworddefs.h"
|
||||
@ -73,6 +74,7 @@ public:
|
||||
void initialize();
|
||||
void addToList(int id, Object *compact);
|
||||
void useLogicAndMenu(Logic *pLogic, Menu *pMenu);
|
||||
void useScreenMutex(Common::Mutex *mutex);
|
||||
void setLuggage(uint32 resID, uint32 rate);
|
||||
void setPointer(uint32 resID, uint32 rate);
|
||||
void animate();
|
||||
@ -95,6 +97,7 @@ private:
|
||||
ResMan *_resMan;
|
||||
ObjectMan *_objMan;
|
||||
Common::Point _mouse;
|
||||
Common::Mutex *_screenAccessMutex;
|
||||
|
||||
uint32 _currentPtrId, _currentLuggageId;
|
||||
MousePtr *_currentPtr;
|
||||
|
@ -106,6 +106,7 @@ Common::Error SwordEngine::init() {
|
||||
_menu = new Menu(_screen, _mouse);
|
||||
_logic = new Logic(this, _objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, _system, _mixer);
|
||||
_mouse->useLogicAndMenu(_logic, _menu);
|
||||
_mouse->useScreenMutex(&_screen->_screenAccessMutex);
|
||||
|
||||
syncSoundSettings();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user