mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
SWORD25: Fix engine exit when running without theoradec
svn-id: r53622
This commit is contained in:
parent
d94435eebd
commit
bbd95da899
@ -39,8 +39,6 @@
|
||||
#include "sword25/package/packagemanager.h"
|
||||
#include "sword25/sfx/soundengine.h"
|
||||
|
||||
#ifdef USE_THEORADEC
|
||||
|
||||
#define INDIRECTRENDERING 1
|
||||
|
||||
namespace Sword25 {
|
||||
@ -53,6 +51,7 @@ Service *OggTheora_CreateObject(Kernel *pKernel) {
|
||||
return new MoviePlayer(pKernel);
|
||||
}
|
||||
|
||||
#ifdef USE_THEORADEC
|
||||
MoviePlayer::MoviePlayer(Kernel *pKernel) : Service(pKernel), _decoder(g_system->getMixer()) {
|
||||
if (!registerScriptBindings())
|
||||
BS_LOG_ERRORLN("Script bindings could not be registered.");
|
||||
@ -178,7 +177,56 @@ double MoviePlayer::getTime() {
|
||||
return _decoder.getElapsedTime() / 1000.0;
|
||||
}
|
||||
|
||||
#else // USE_THEORADEC
|
||||
|
||||
MoviePlayer::MoviePlayer(Kernel *pKernel) : Service(pKernel) {
|
||||
if (!registerScriptBindings())
|
||||
BS_LOG_ERRORLN("Script bindings could not be registered.");
|
||||
else
|
||||
BS_LOGLN("Script bindings registered.");
|
||||
}
|
||||
|
||||
MoviePlayer::~MoviePlayer() {
|
||||
}
|
||||
|
||||
bool MoviePlayer::loadMovie(const Common::String &Filename, unsigned int Z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MoviePlayer::unloadMovie() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MoviePlayer::play() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MoviePlayer::pause() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void MoviePlayer::update() {
|
||||
}
|
||||
|
||||
bool MoviePlayer::isMovieLoaded() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MoviePlayer::isPaused() {
|
||||
return true;
|
||||
}
|
||||
|
||||
float MoviePlayer::getScaleFactor() {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
void MoviePlayer::setScaleFactor(float ScaleFactor) {
|
||||
}
|
||||
|
||||
double MoviePlayer::getTime() {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
#endif // USE_THEORADEC
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -37,12 +37,14 @@
|
||||
|
||||
#include "common/scummsys.h" // for USE_THEORADEC
|
||||
|
||||
#ifdef USE_THEORADEC
|
||||
#include "sword25/kernel/common.h"
|
||||
#include "sword25/kernel/service.h"
|
||||
#include "sword25/fmv/theora_decoder.h"
|
||||
#include "sword25/gfx/bitmap.h"
|
||||
|
||||
#ifdef USE_THEORADEC
|
||||
#include "sword25/fmv/theora_decoder.h"
|
||||
#endif
|
||||
|
||||
namespace Sword25 {
|
||||
|
||||
class MoviePlayer : public Service {
|
||||
@ -138,16 +140,17 @@ public:
|
||||
private:
|
||||
bool registerScriptBindings();
|
||||
|
||||
|
||||
#ifdef USE_THEORADEC
|
||||
TheoraDecoder _decoder;
|
||||
|
||||
Graphics::Surface *_backSurface;
|
||||
int _outX, _outY;
|
||||
|
||||
RenderObjectPtr<Bitmap> _outputBitmap;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -44,127 +44,91 @@
|
||||
namespace Sword25 {
|
||||
|
||||
int loadMovie(lua_State *L) {
|
||||
#ifdef USE_THEORADEC
|
||||
MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
|
||||
BS_ASSERT(FMVPtr);
|
||||
|
||||
lua_pushbooleancpp(L, FMVPtr->loadMovie(luaL_checkstring(L, 1), lua_gettop(L) == 2 ? static_cast<uint>(luaL_checknumber(L, 2)) : 10));
|
||||
#else
|
||||
lua_pushbooleancpp(L, true);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int unloadMovie(lua_State *L) {
|
||||
#ifdef USE_THEORADEC
|
||||
MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
|
||||
BS_ASSERT(FMVPtr);
|
||||
|
||||
lua_pushbooleancpp(L, FMVPtr->unloadMovie());
|
||||
#else
|
||||
lua_pushbooleancpp(L, true);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int play(lua_State *L) {
|
||||
#ifdef USE_THEORADEC
|
||||
MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
|
||||
BS_ASSERT(FMVPtr);
|
||||
|
||||
lua_pushbooleancpp(L, FMVPtr->play());
|
||||
#else
|
||||
lua_pushbooleancpp(L, true);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int pause(lua_State *L) {
|
||||
#ifdef USE_THEORADEC
|
||||
MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
|
||||
BS_ASSERT(FMVPtr);
|
||||
|
||||
lua_pushbooleancpp(L, FMVPtr->pause());
|
||||
#else
|
||||
lua_pushbooleancpp(L, true);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int update(lua_State *L) {
|
||||
#ifdef USE_THEORADEC
|
||||
MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
|
||||
BS_ASSERT(FMVPtr);
|
||||
|
||||
FMVPtr->update();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int isMovieLoaded(lua_State *L) {
|
||||
#ifdef USE_THEORADEC
|
||||
MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
|
||||
BS_ASSERT(FMVPtr);
|
||||
|
||||
lua_pushbooleancpp(L, FMVPtr->isMovieLoaded());
|
||||
#else
|
||||
lua_pushbooleancpp(L, true);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int isPaused(lua_State *L) {
|
||||
#ifdef USE_THEORADEC
|
||||
MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
|
||||
BS_ASSERT(FMVPtr);
|
||||
|
||||
lua_pushbooleancpp(L, FMVPtr->isPaused());
|
||||
#else
|
||||
lua_pushbooleancpp(L, false);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int getScaleFactor(lua_State *L) {
|
||||
#ifdef USE_THEORADEC
|
||||
MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
|
||||
BS_ASSERT(FMVPtr);
|
||||
|
||||
lua_pushnumber(L, FMVPtr->getScaleFactor());
|
||||
#else
|
||||
lua_pushnumber(L, 1);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int setScaleFactor(lua_State *L) {
|
||||
#ifdef USE_THEORADEC
|
||||
MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
|
||||
BS_ASSERT(FMVPtr);
|
||||
|
||||
FMVPtr->setScaleFactor(static_cast<float>(luaL_checknumber(L, 1)));
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getTime(lua_State *L) {
|
||||
#ifdef USE_THEORADEC
|
||||
MoviePlayer *FMVPtr = Kernel::GetInstance()->GetFMV();
|
||||
BS_ASSERT(FMVPtr);
|
||||
|
||||
lua_pushnumber(L, FMVPtr->getTime());
|
||||
#else
|
||||
lua_pushnumber(L, 0);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -185,7 +149,6 @@ const luaL_reg LIBRARY_FUNCTIONS[] = {
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
#ifdef USE_THEORADEC
|
||||
bool MoviePlayer::registerScriptBindings() {
|
||||
ScriptEngine *pScript = Kernel::GetInstance()->GetScript();
|
||||
BS_ASSERT(pScript);
|
||||
@ -196,6 +159,5 @@ bool MoviePlayer::registerScriptBindings() {
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // End of namespace Sword25
|
||||
|
@ -223,9 +223,6 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
|
||||
rect = *fillRectPtr;
|
||||
}
|
||||
|
||||
if (rect.width() == 800 && rect.height() == 600)
|
||||
debug(0, "[%d, %d, %d, %d], 0x%08x", rect.left, rect.top, rect.right, rect.bottom, color);
|
||||
|
||||
if (rect.width() > 0 && rect.height() > 0) {
|
||||
if (ca == 0xff) {
|
||||
_backSurface.fillRect(rect, color);
|
||||
|
@ -34,9 +34,7 @@
|
||||
|
||||
#include "common/system.h"
|
||||
#include "sword25/gfx/graphicengine.h"
|
||||
#ifdef USE_THEORADEC
|
||||
#include "sword25/fmv/movieplayer.h"
|
||||
#endif
|
||||
#include "sword25/input/inputengine.h"
|
||||
#include "sword25/kernel/kernel.h"
|
||||
#include "sword25/kernel/persistenceservice.h"
|
||||
@ -439,14 +437,12 @@ ScriptEngine *Kernel::GetScript() {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#ifdef USE_THEORADEC
|
||||
/**
|
||||
* Returns a pointer to the movie player, or NULL if it is not active.
|
||||
*/
|
||||
MoviePlayer *Kernel::GetFMV() {
|
||||
return static_cast<MoviePlayer *>(GetService("fmv"));
|
||||
}
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
@ -201,12 +201,10 @@ public:
|
||||
*/
|
||||
ScriptEngine *GetScript();
|
||||
|
||||
#ifdef USE_THEORADEC
|
||||
/**
|
||||
* Returns a pointer to the movie player, or NULL if it is not active
|
||||
*/
|
||||
MoviePlayer *GetFMV();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Pauses for the specified amount of time
|
||||
|
@ -55,11 +55,7 @@ Service *InputEngine_CreateObject(Kernel *pKernel);
|
||||
Service *SoundEngine_CreateObject(Kernel *pKernel);
|
||||
Service *LuaScriptEngine_CreateObject(Kernel *pKernel);
|
||||
Service *Geometry_CreateObject(Kernel *pKernel);
|
||||
#ifdef USE_THEORADEC
|
||||
Service *OggTheora_CreateObject(Kernel *pKernel);
|
||||
#else
|
||||
Service *OggTheora_CreateObject(Kernel *pKernel) { return NULL; }
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
|
@ -3,6 +3,8 @@ MODULE := engines/sword25
|
||||
MODULE_OBJS := \
|
||||
detection.o \
|
||||
sword25.o \
|
||||
fmv/movieplayer.o \
|
||||
fmv/movieplayer_script.o \
|
||||
gfx/animation.o \
|
||||
gfx/animationdescription.o \
|
||||
gfx/animationresource.o \
|
||||
@ -96,8 +98,6 @@ MODULE_OBJS := \
|
||||
|
||||
ifdef USE_THEORADEC
|
||||
MODULE_OBJS += \
|
||||
fmv/movieplayer.o \
|
||||
fmv/movieplayer_script.o \
|
||||
fmv/theora_decoder.o \
|
||||
fmv/yuvtorgba.o
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user