Remove explicit OSystem parameter from StackLock constructor; added OSystem::displayMessageOnOSD (not yet used; default implementation provided)
svn-id: r13413
This commit is contained in:
parent
09e3fec623
commit
39765b0d19
8 changed files with 74 additions and 56 deletions
|
@ -50,7 +50,7 @@ int OSystem_SDL::getDefaultGraphicsMode() const {
|
|||
}
|
||||
|
||||
bool OSystem_SDL::setGraphicsMode(int mode) {
|
||||
Common::StackLock lock(_graphicsMutex, this);
|
||||
Common::StackLock lock(_graphicsMutex);
|
||||
|
||||
int newScaleFactor = 1;
|
||||
ScalerProc *newScalerProc;
|
||||
|
@ -327,7 +327,7 @@ void OSystem_SDL::hotswap_gfx_mode() {
|
|||
}
|
||||
|
||||
void OSystem_SDL::updateScreen() {
|
||||
Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends
|
||||
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
|
||||
|
||||
internUpdateScreen();
|
||||
}
|
||||
|
@ -490,13 +490,13 @@ void OSystem_SDL::internUpdateScreen() {
|
|||
bool OSystem_SDL::save_screenshot(const char *filename) {
|
||||
assert(_hwscreen != NULL);
|
||||
|
||||
Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends
|
||||
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
|
||||
SDL_SaveBMP(_hwscreen, filename);
|
||||
return true;
|
||||
}
|
||||
|
||||
void OSystem_SDL::setFullscreenMode(bool enable) {
|
||||
Common::StackLock lock(_graphicsMutex, this);
|
||||
Common::StackLock lock(_graphicsMutex);
|
||||
|
||||
if (_full_screen != enable) {
|
||||
assert(_hwscreen != 0);
|
||||
|
@ -536,7 +536,7 @@ void OSystem_SDL::copyRectToScreen(const byte *src, int pitch, int x, int y, int
|
|||
if (_screen == NULL)
|
||||
return;
|
||||
|
||||
Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends
|
||||
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
|
||||
|
||||
if (((long)src & 3) == 0 && pitch == _screenWidth && x==0 && y==0 &&
|
||||
w==_screenWidth && h==_screenHeight && _mode_flags&DF_WANT_RECT_OPTIM) {
|
||||
|
@ -755,7 +755,7 @@ void OSystem_SDL::move_screen(int dx, int dy, int height) {
|
|||
if ((dx == 0 && dy == 0) || height <= 0)
|
||||
return;
|
||||
|
||||
Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends
|
||||
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
|
||||
|
||||
byte *src, *dst;
|
||||
int x, y;
|
||||
|
@ -849,7 +849,7 @@ void OSystem_SDL::clearOverlay() {
|
|||
if (!_overlayVisible)
|
||||
return;
|
||||
|
||||
Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends
|
||||
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
|
||||
|
||||
// hide the mouse
|
||||
undraw_mouse();
|
||||
|
|
|
@ -137,6 +137,10 @@ public:
|
|||
virtual void setFeatureState(Feature f, bool enable);
|
||||
virtual bool getFeatureState(Feature f);
|
||||
|
||||
#ifdef USE_OSD
|
||||
void displayMessageOnOSD(const char *msg);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void init_intern();
|
||||
|
||||
|
@ -150,8 +154,6 @@ protected:
|
|||
kOSDColorKey = 1,
|
||||
kOSDInitialAlpha = 80 // Initial alpha level, in percent
|
||||
};
|
||||
|
||||
void displayMessageOnOSD(const char *msg);
|
||||
#endif
|
||||
|
||||
// hardware screen
|
||||
|
@ -252,7 +254,7 @@ protected:
|
|||
void toggleMouseGrab();
|
||||
|
||||
|
||||
void internUpdateScreen();
|
||||
virtual void internUpdateScreen();
|
||||
|
||||
void load_gfx_mode();
|
||||
void unload_gfx_mode();
|
||||
|
|
|
@ -144,7 +144,7 @@ void OSystem_SDL::setFeatureState(Feature f, bool enable) {
|
|||
break;
|
||||
case kFeatureAspectRatioCorrection:
|
||||
if (_screenHeight == 200 && _adjustAspectRatio != enable) {
|
||||
Common::StackLock lock(_graphicsMutex, this);
|
||||
Common::StackLock lock(_graphicsMutex);
|
||||
|
||||
//assert(_hwscreen != 0);
|
||||
_adjustAspectRatio ^= true;
|
||||
|
|
|
@ -333,7 +333,7 @@ void OSystem_WINCE3::initSize(uint w, uint h) {
|
|||
else
|
||||
_toolbarHandler.setOffset(400);
|
||||
|
||||
OSystem_SDL_Common::initSize(w, h);
|
||||
OSystem_SDL::initSize(w, h);
|
||||
|
||||
update_game_settings();
|
||||
|
||||
|
@ -623,11 +623,9 @@ void OSystem_WINCE3::update_keyboard() {
|
|||
}
|
||||
}
|
||||
|
||||
void OSystem_WINCE3::updateScreen() {
|
||||
void OSystem_WINCE3::internUpdateScreen() {
|
||||
assert(_hwscreen != NULL);
|
||||
|
||||
Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends
|
||||
|
||||
update_keyboard();
|
||||
|
||||
// If the shake position changed, fill the dirty area with blackness
|
||||
|
@ -820,7 +818,7 @@ void OSystem_WINCE3::updateScreen() {
|
|||
|
||||
uint32 OSystem_WINCE3::property(int param, Property *value) {
|
||||
|
||||
Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends
|
||||
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
|
||||
|
||||
if (param == PROP_TOGGLE_FULLSCREEN) {
|
||||
// FIXME
|
||||
|
@ -898,7 +896,7 @@ uint32 OSystem_WINCE3::property(int param, Property *value) {
|
|||
bool OSystem_WINCE3::save_screenshot(const char *filename) {
|
||||
assert(_hwscreen != NULL);
|
||||
|
||||
Common::StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends
|
||||
Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
|
||||
SDL_SaveBMP(_hwscreen, filename);
|
||||
return true;
|
||||
}
|
||||
|
@ -928,7 +926,7 @@ static int mapKeyCE(SDLKey key, SDLMod mod, Uint16 unicode)
|
|||
void OSystem_WINCE3::draw_mouse() {
|
||||
// FIXME
|
||||
if (!(_toolbarHandler.visible() && _mouseCurState.y >= _toolbarHandler.getOffset()) && !_forceHideMouse)
|
||||
OSystem_SDL_Common::draw_mouse();
|
||||
OSystem_SDL::draw_mouse();
|
||||
}
|
||||
|
||||
void OSystem_WINCE3::fillMouseEvent(Event &event, int x, int y) {
|
||||
|
@ -987,7 +985,7 @@ void OSystem_WINCE3::add_dirty_rect(int x, int y, int w, int h) {
|
|||
}
|
||||
}
|
||||
|
||||
OSystem_SDL_Common::add_dirty_rect(x, y, w, h);
|
||||
OSystem_SDL::add_dirty_rect(x, y, w, h);
|
||||
}
|
||||
|
||||
// FIXME
|
||||
|
@ -1305,5 +1303,5 @@ bool OSystem_WINCE3::poll_event(Event *event) {
|
|||
|
||||
void OSystem_WINCE3::quit() {
|
||||
CEDevice::disableHardwareKeyMapping();
|
||||
OSystem_SDL_Common::quit();
|
||||
OSystem_SDL::quit();
|
||||
}
|
||||
|
|
|
@ -36,15 +36,16 @@
|
|||
|
||||
#include <SDL.h>
|
||||
|
||||
class OSystem_WINCE3 : public OSystem_SDL_Common {
|
||||
class OSystem_WINCE3 : public OSystem_SDL {
|
||||
public:
|
||||
OSystem_WINCE3();
|
||||
|
||||
// Update the dirty areas of the screen
|
||||
void updateScreen();
|
||||
void internUpdateScreen();
|
||||
|
||||
// Set a parameter
|
||||
uint32 property(int param, Property *value);
|
||||
bool hasFeature(Feature f);
|
||||
void setFeatureState(Feature f, bool enable);
|
||||
bool getFeatureState(Feature f);
|
||||
|
||||
void initSize(uint w, uint h);
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include "base/gameDetector.h"
|
||||
|
||||
#include "gui/message.h"
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/system.h"
|
||||
|
||||
|
@ -84,15 +86,20 @@ bool OSystem::setGraphicsMode(const char *name) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void OSystem::displayMessageOnOSD(const char *msg) {
|
||||
// Display the message for 1.5 seconds
|
||||
GUI::TimedMessageDialog dialog(msg, 1500);
|
||||
dialog.runModal();
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
|
||||
namespace Common {
|
||||
|
||||
StackLock::StackLock(OSystem::MutexRef mutex, OSystem *syst, const char *mutexName)
|
||||
: _mutex(mutex), _syst(syst), _mutexName(mutexName) {
|
||||
if (syst == 0)
|
||||
_syst = g_system;
|
||||
StackLock::StackLock(OSystem::MutexRef mutex, const char *mutexName)
|
||||
: _mutex(mutex), _mutexName(mutexName) {
|
||||
lock();
|
||||
}
|
||||
|
||||
|
@ -101,19 +108,17 @@ StackLock::~StackLock() {
|
|||
}
|
||||
|
||||
void StackLock::lock() {
|
||||
assert(_syst);
|
||||
if (_mutexName != NULL)
|
||||
debug(6, "Locking mutex %s", _mutexName);
|
||||
|
||||
_syst->lockMutex(_mutex);
|
||||
g_system->lockMutex(_mutex);
|
||||
}
|
||||
|
||||
void StackLock::unlock() {
|
||||
assert(_syst);
|
||||
if (_mutexName != NULL)
|
||||
debug(6, "Unlocking mutex %s", _mutexName);
|
||||
|
||||
_syst->unlockMutex(_mutex);
|
||||
g_system->unlockMutex(_mutex);
|
||||
}
|
||||
|
||||
} // End of namespace Common
|
||||
|
|
|
@ -602,12 +602,25 @@ public:
|
|||
virtual void quit() = 0;
|
||||
|
||||
/**
|
||||
* Set a window caption or any other comparable status display to the
|
||||
* given value.
|
||||
* @param caption the window caption to use from now on
|
||||
* Set a window caption or any other comparable status display to the
|
||||
* given value.
|
||||
* @param caption the window caption to use from now on
|
||||
*/
|
||||
virtual void setWindowCaption(const char *caption) {}
|
||||
|
||||
/**
|
||||
* Display a message in an 'on screen display'. That is, display it in a
|
||||
* fashion where it is visible on or near the screen (e.g. in a transparent
|
||||
* rectangle over the regular screen content; or in a message box beneath
|
||||
* it; etc.).
|
||||
*
|
||||
* @note There is a default implementation which uses a TimedMessageDialog
|
||||
* to display the message. Hence implementing this is optional.
|
||||
*
|
||||
* @param msg the message to display on screen
|
||||
*/
|
||||
virtual void displayMessageOnOSD(const char *msg);
|
||||
|
||||
/** Savefile management. */
|
||||
virtual SaveFileManager *get_savefile_manager() {
|
||||
return new SaveFileManager();
|
||||
|
@ -626,13 +639,12 @@ namespace Common {
|
|||
*/
|
||||
class StackLock {
|
||||
OSystem::MutexRef _mutex;
|
||||
OSystem *_syst;
|
||||
const char *_mutexName;
|
||||
|
||||
void lock();
|
||||
void unlock();
|
||||
public:
|
||||
StackLock(OSystem::MutexRef mutex, OSystem *syst = 0, const char *mutexName = NULL);
|
||||
StackLock(OSystem::MutexRef mutex, const char *mutexName = NULL);
|
||||
~StackLock();
|
||||
};
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ IMuseDigital::IMuseDigital(ScummEngine *scumm)
|
|||
IMuseDigital::~IMuseDigital() {
|
||||
stopAllSounds(true);
|
||||
{
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::~IMuseDigital()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::~IMuseDigital()");
|
||||
_vm->_timer->removeTimerProc(timer_handler);
|
||||
}
|
||||
delete _sound;
|
||||
|
@ -61,7 +61,7 @@ IMuseDigital::~IMuseDigital() {
|
|||
}
|
||||
|
||||
void IMuseDigital::callback() {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::callback()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::callback()");
|
||||
int l = 0;
|
||||
|
||||
if (_pause || !_vm)
|
||||
|
@ -227,7 +227,7 @@ void IMuseDigital::switchToNextRegion(int track) {
|
|||
}
|
||||
|
||||
void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int soundGroup, AudioStream *input, int hookId, int volume, int priority) {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::startSound()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::startSound()");
|
||||
debug(5, "IMuseDigital::startSound(%d)", soundId);
|
||||
int l;
|
||||
int lower_priority = 127;
|
||||
|
@ -358,7 +358,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
|
|||
}
|
||||
|
||||
void IMuseDigital::stopSound(int soundId) {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::stopSound()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::stopSound()");
|
||||
debug(5, "IMuseDigital::stopSound(%d)", soundId);
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
if ((_track[l].soundId == soundId) && _track[l].used) {
|
||||
|
@ -372,7 +372,7 @@ void IMuseDigital::stopSound(int soundId) {
|
|||
}
|
||||
|
||||
void IMuseDigital::setPriority(int soundId, int priority) {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::setPriority()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::setPriority()");
|
||||
debug(5, "IMuseDigital::setPrioritySound(%d, %d)", soundId, priority);
|
||||
|
||||
assert ((priority >= 0) && (priority <= 127));
|
||||
|
@ -385,7 +385,7 @@ void IMuseDigital::setPriority(int soundId, int priority) {
|
|||
}
|
||||
|
||||
void IMuseDigital::setVolume(int soundId, int volume) {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::setVolume()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::setVolume()");
|
||||
debug(5, "IMuseDigital::setVolumeSound(%d, %d)", soundId, volume);
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
if ((_track[l].soundId == soundId) && _track[l].used) {
|
||||
|
@ -395,7 +395,7 @@ void IMuseDigital::setVolume(int soundId, int volume) {
|
|||
}
|
||||
|
||||
void IMuseDigital::setPan(int soundId, int pan) {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::setPan()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::setPan()");
|
||||
debug(5, "IMuseDigital::setVolumeSound(%d, %d)", soundId, pan);
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
if ((_track[l].soundId == soundId) && _track[l].used) {
|
||||
|
@ -405,7 +405,7 @@ void IMuseDigital::setPan(int soundId, int pan) {
|
|||
}
|
||||
|
||||
void IMuseDigital::setFade(int soundId, int destVolume, int delay60HzTicks) {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::setFade()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::setFade()");
|
||||
debug(5, "IMuseDigital::setFade(%d, %d, %d)", soundId, destVolume, delay60HzTicks);
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
if ((_track[l].soundId == soundId) && _track[l].used) {
|
||||
|
@ -420,7 +420,7 @@ void IMuseDigital::setFade(int soundId, int destVolume, int delay60HzTicks) {
|
|||
void IMuseDigital::refreshScripts() {
|
||||
bool found = false;
|
||||
{
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::refreshScripts()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::refreshScripts()");
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) {
|
||||
found = true;
|
||||
|
@ -436,7 +436,7 @@ void IMuseDigital::refreshScripts() {
|
|||
void IMuseDigital::stopAllSounds(bool waitForStop) {
|
||||
debug(5, "IMuseDigital::stopAllSounds");
|
||||
{
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::stopAllSounds()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::stopAllSounds()");
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
if (_track[l].used) {
|
||||
if (_track[l].stream) {
|
||||
|
@ -461,7 +461,7 @@ void IMuseDigital::stopAllSounds(bool waitForStop) {
|
|||
}
|
||||
|
||||
void IMuseDigital::fadeOutMusic(int fadeDelay) {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::fadeOutMusic()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::fadeOutMusic()");
|
||||
debug(5, "IMuseDigital::fadeOutMusic");
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
if ((_track[l].used) && (_track[l].soundGroup == IMUSE_MUSIC) && (!_track[l].volFadeUsed)) {
|
||||
|
@ -474,7 +474,7 @@ void IMuseDigital::fadeOutMusic(int fadeDelay) {
|
|||
}
|
||||
|
||||
void IMuseDigital::pause(bool p) {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::pause()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::pause()");
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
if (_track[l].used) {
|
||||
_vm->_mixer->pauseHandle(_track[l].handle, p);
|
||||
|
@ -611,7 +611,7 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int
|
|||
}
|
||||
|
||||
int IMuseDigital::getSoundStatus(int sound) const {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::getSoundStatus()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::getSoundStatus()");
|
||||
debug(5, "IMuseDigital::getSoundStatus(%d)", sound);
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
if ((_track[l].soundId == sound) && _track[l].used) {
|
||||
|
@ -665,7 +665,7 @@ int32 IMuseDigital::getPosInMs(int soundId) {
|
|||
}
|
||||
|
||||
int32 IMuseDigital::getCurMusicPosInMs() {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::getCurMusicPosInMs()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::getCurMusicPosInMs()");
|
||||
int soundId = -1;
|
||||
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
|
@ -680,7 +680,7 @@ int32 IMuseDigital::getCurMusicPosInMs() {
|
|||
}
|
||||
|
||||
int32 IMuseDigital::getCurVoiceLipSyncWidth() {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::getCutVoiceLipSyncWidth()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::getCutVoiceLipSyncWidth()");
|
||||
int32 msPos = getPosInMs(kTalkSoundID) + _vm->VAR(_vm->VAR_SYNC) + 50;
|
||||
int32 width = 0, height = 0;
|
||||
|
||||
|
@ -690,7 +690,7 @@ int32 IMuseDigital::getCurVoiceLipSyncWidth() {
|
|||
}
|
||||
|
||||
int32 IMuseDigital::getCurVoiceLipSyncHeight() {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::getCurVoiceLipSyncHeight()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::getCurVoiceLipSyncHeight()");
|
||||
int32 msPos = getPosInMs(kTalkSoundID) + _vm->VAR(_vm->VAR_SYNC) + 50;
|
||||
int32 width = 0, height = 0;
|
||||
|
||||
|
@ -700,7 +700,7 @@ int32 IMuseDigital::getCurVoiceLipSyncHeight() {
|
|||
}
|
||||
|
||||
int32 IMuseDigital::getCurMusicLipSyncWidth(int syncId) {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::getCurMusicLipSyncWidth()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::getCurMusicLipSyncWidth()");
|
||||
int soundId = -1;
|
||||
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
|
@ -718,7 +718,7 @@ int32 IMuseDigital::getCurMusicLipSyncWidth(int syncId) {
|
|||
}
|
||||
|
||||
int32 IMuseDigital::getCurMusicLipSyncHeight(int syncId) {
|
||||
Common::StackLock lock(_mutex, g_system, "IMuseDigital::getCurMusicLipSyncHeight()");
|
||||
Common::StackLock lock(_mutex, "IMuseDigital::getCurMusicLipSyncHeight()");
|
||||
int soundId = -1;
|
||||
|
||||
for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue