ALL: sync with scummvm

This commit is contained in:
Pawel Kolodziejski 2014-01-25 22:16:57 +01:00
parent 841d08db2e
commit 9098dfe9a2
39 changed files with 946 additions and 742 deletions

View File

@ -33,8 +33,9 @@ ifeq "$(HAVE_GCC)" "1"
#CXXFLAGS+= -Wmissing-format-attribute
ifneq "$(BACKEND)" "tizen"
# Disable RTTI and exceptions. These settings cause tizen apps to crash
CXXFLAGS+= -fno-rtti -fno-exceptions
# Disable exceptions. This setting causes tizen apps to crash
# TODO: Does this still apply after enabling RTTI again?
CXXFLAGS+= -fno-exceptions
endif
ifneq "$(HAVE_CLANG)" "1"

View File

@ -184,8 +184,7 @@ int MidiDriver_FluidSynth::open() {
MidiDriver_Emulated::open();
// The MT-32 emulator uses kSFXSoundType here. I don't know why.
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
_mixer->playStream(Audio::Mixer::kPlainSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
return 0;
}

View File

@ -80,15 +80,6 @@ protected:
void showLCDMessage(const char *message) {
g_system->displayMessageOnOSD(message);
}
void onDeviceReset() {}
void onDeviceReconfig() {}
void onNewReverbMode(Bit8u /* mode */) {}
void onNewReverbTime(Bit8u /* time */) {}
void onNewReverbLevel(Bit8u /* level */) {}
void onPartStateChanged(int /* partNum */, bool /* isActive */) {}
void onPolyStateChanged(int /* partNum */) {}
void onPartialStateChanged(int /* partialNum */, int /* oldPartialPhase */, int /* newPartialPhase */) {}
void onProgramChanged(int /* partNum */, char * /* patchName */) {}
};
} // end of namespace MT32Emu
@ -230,7 +221,7 @@ int MidiDriver_MT32::open() {
g_system->updateScreen();
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
_mixer->playStream(Audio::Mixer::kPlainSoundType, &_mixerSoundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
return 0;
}

View File

@ -81,6 +81,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const Common::String &p) {
_sDisplayName = ::lastPathComponent(_sPath);
_pFileLock = 0;
_bIsDirectory = false;
_bIsValid = false;
// Check whether the node exists and if it is a directory
struct ExamineData * pExd = IDOS->ExamineObjectTags(EX_StringNameInput,_sPath.c_str(),TAG_END);
@ -305,12 +306,6 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
AbstractFSNode *AmigaOSFilesystemNode::getParent() const {
ENTER();
if (!_bIsDirectory) {
debug(6, "Not a directory");
LEAVE();
return 0;
}
if (_pFileLock == 0) {
debug(6, "Root node");
LEAVE();
@ -332,6 +327,9 @@ AbstractFSNode *AmigaOSFilesystemNode::getParent() const {
}
bool AmigaOSFilesystemNode::isReadable() const {
if (!_bIsValid)
return false;
// Regular RWED protection flags are low-active or inverted, thus the negation.
// moreover pseudo root filesystem (null _pFileLock) is readable whatever the
// protection says
@ -341,6 +339,9 @@ bool AmigaOSFilesystemNode::isReadable() const {
}
bool AmigaOSFilesystemNode::isWritable() const {
if (!_bIsValid)
return false;
// Regular RWED protection flags are low-active or inverted, thus the negation.
// moreover pseudo root filesystem (null _pFileLock) is never writable whatever
// the protection says (because of the pseudo nature)

View File

@ -43,7 +43,13 @@
*/
class AmigaOSFilesystemNode : public AbstractFSNode {
protected:
/**
* The main file lock.
* If this is NULL but _bIsValid is true, then this Node references
* the virtual filesystem root.
*/
BPTR _pFileLock;
Common::String _sDisplayName;
Common::String _sPath;
bool _bIsDirectory;

View File

@ -37,27 +37,6 @@ class GraphicsManager : public PaletteManager {
public:
virtual ~GraphicsManager() {}
/**
* Makes this graphics manager active. That means it should be ready to
* process inputs now. However, even without being active it should be
* able to query the supported modes and other bits.
*
* HACK: Actually this is specific to SdlGraphicsManager subclasses.
* But sadly we cannot cast from GraphicsManager to SdlGraphicsManager
* because there is no relation between these two.
*/
virtual void activateManager() {}
/**
* Makes this graphics manager inactive. This should allow another
* graphics manager to become active again.
*
* HACK: Actually this is specific to SdlGraphicsManager subclasses.
* But sadly we cannot cast from GraphicsManager to SdlGraphicsManager
* because there is no relation between these two.
*/
virtual void deactivateManager() {}
virtual bool hasFeature(OSystem::Feature f) = 0;
virtual void setFeatureState(OSystem::Feature f, bool enable) = 0;
virtual bool getFeatureState(OSystem::Feature f) = 0;

View File

@ -31,10 +31,10 @@ SdlGraphicsManager::SdlGraphicsManager(SdlEventSource *source)
SdlGraphicsManager::~SdlGraphicsManager() {
}
void SdlGraphicsManager::initEventSource() {
void SdlGraphicsManager::activateManager() {
_eventSource->setGraphicsManager(this);
}
void SdlGraphicsManager::deinitEventSource() {
void SdlGraphicsManager::deactivateManager() {
_eventSource->setGraphicsManager(0);
}

View File

@ -23,6 +23,8 @@
#ifndef BACKENDS_GRAPHICS_SDL_SDLGRAPHICS_H
#define BACKENDS_GRAPHICS_SDL_SDLGRAPHICS_H
#include "backends/graphics/graphics.h"
#include "common/rect.h"
class SdlEventSource;
@ -31,15 +33,25 @@ class SdlEventSource;
* Base class for a SDL based graphics manager.
*
* It features a few extra a few extra features required by SdlEventSource.
* FIXME/HACK:
* Note it does not inherit from GraphicsManager to avoid a diamond inheritance
* in the current OpenGLSdlGraphicsManager.
*/
class SdlGraphicsManager {
class SdlGraphicsManager : virtual public GraphicsManager {
public:
SdlGraphicsManager(SdlEventSource *source);
virtual ~SdlGraphicsManager();
/**
* Makes this graphics manager active. That means it should be ready to
* process inputs now. However, even without being active it should be
* able to query the supported modes and other bits.
*/
virtual void activateManager();
/**
* Makes this graphics manager inactive. This should allow another
* graphics manager to become active again.
*/
virtual void deactivateManager();
/**
* Notify the graphics manager that the graphics needs to be redrawn, since
* the application window was modified.
@ -80,9 +92,6 @@ public:
virtual void notifyMousePos(Common::Point mouse) = 0;
protected:
void initEventSource();
void deinitEventSource();
SdlEventSource *_eventSource;
};

View File

@ -66,8 +66,7 @@ SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() {
}
void SurfaceSdlGraphicsManager::activateManager() {
GraphicsManager::activateManager();
initEventSource();
SdlGraphicsManager::activateManager();
// Register the graphics manager as a event observer
g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false);
@ -79,8 +78,7 @@ void SurfaceSdlGraphicsManager::deactivateManager() {
g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this);
}
deinitEventSource();
GraphicsManager::deactivateManager();
SdlGraphicsManager::deactivateManager();
}
void SurfaceSdlGraphicsManager::resetGraphicsScale() {

View File

@ -47,7 +47,7 @@
/**
* SDL graphics manager
*/
class SurfaceSdlGraphicsManager : public GraphicsManager, public SdlGraphicsManager, public Common::EventObserver {
class SurfaceSdlGraphicsManager : public SdlGraphicsManager, public Common::EventObserver {
public:
SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource);
virtual ~SurfaceSdlGraphicsManager();

View File

@ -50,7 +50,7 @@ void OSystem_POSIX::init() {
// Initialze File System Factory
_fsFactory = new POSIXFilesystemFactory();
#if defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY)
#if defined(USE_TASKBAR) && defined(USE_UNITY)
// Initialize taskbar manager
_taskbarManager = new UnityTaskbarManager();
#endif
@ -67,7 +67,7 @@ void OSystem_POSIX::initBackend() {
// Invoke parent implementation of this method
OSystem_SDL::initBackend();
#if defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY)
#if defined(USE_TASKBAR) && defined(USE_UNITY)
// Register the taskbar manager as an event source (this is necessary for the glib event loop to be run)
_eventManager->getEventDispatcher()->registerSource((UnityTaskbarManager *)_taskbarManager, false);
#endif

View File

@ -78,7 +78,7 @@ OSystem_SDL::~OSystem_SDL() {
delete _savefileManager;
_savefileManager = 0;
if (_graphicsManager) {
_graphicsManager->deactivateManager();
dynamic_cast<SdlGraphicsManager *>(_graphicsManager)->deactivateManager();
}
delete _graphicsManager;
_graphicsManager = 0;
@ -195,7 +195,7 @@ void OSystem_SDL::initBackend() {
// so the virtual keyboard can be initialized, but we have to add the
// graphics manager as an event observer after initializing the event
// manager.
_graphicsManager->activateManager();
dynamic_cast<SdlGraphicsManager *>(_graphicsManager)->activateManager();
}
#if defined(USE_TASKBAR)

View File

@ -24,7 +24,7 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
#include "common/scummsys.h"
#if defined(POSIX) && defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY)
#if defined(POSIX) && defined(USE_TASKBAR) && defined(USE_UNITY)
#include "backends/taskbar/unity/unity-taskbar.h"

View File

@ -23,7 +23,7 @@
#ifndef BACKEND_UNITY_TASKBAR_H
#define BACKEND_UNITY_TASKBAR_H
#if defined(POSIX) && defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY)
#if defined(POSIX) && defined(USE_TASKBAR) && defined(USE_UNITY)
#include "common/events.h"
#include "common/str.h"

View File

@ -184,7 +184,7 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const
//
// Add the game path to the directory search list
SearchMan.addDirectory(dir.getPath(), dir, 0, 4);
engine->initializePath(dir);
// Add extrapath (if any) to the directory search list
if (ConfMan.hasKey("extrapath")) {

View File

@ -296,7 +296,7 @@ bool PluginManagerUncached::loadPluginFromGameId(const Common::String &gameId) {
if (domain->contains(gameId)) {
Common::String filename = (*domain)[gameId];
if (loadPluginByFileName(filename)) {
if (loadPluginByFileName(filename)) {
return true;
}
}

View File

@ -53,7 +53,7 @@ bool INIFile::loadFromFile(const String &filename) {
return false;
}
bool INIFile::loadFromSaveFile(const char *filename) {
bool INIFile::loadFromSaveFile(const String &filename) {
assert(g_system);
SaveFileManager *saveFileMan = g_system->getSavefileManager();
SeekableReadStream *loadFile;
@ -181,7 +181,7 @@ bool INIFile::saveToFile(const String &filename) {
return false;
}
bool INIFile::saveToSaveFile(const char *filename) {
bool INIFile::saveToSaveFile(const String &filename) {
assert(g_system);
SaveFileManager *saveFileMan = g_system->getSavefileManager();
WriteStream *saveFile;

View File

@ -94,10 +94,10 @@ public:
void clear();
bool loadFromFile(const String &filename);
bool loadFromSaveFile(const char *filename);
bool loadFromSaveFile(const String &filename);
bool loadFromStream(SeekableReadStream &stream);
bool saveToFile(const String &filename);
bool saveToSaveFile(const char *filename);
bool saveToSaveFile(const String &filename);
bool saveToStream(WriteStream &stream);
bool hasSection(const String &section) const;

48
configure vendored
View File

@ -132,7 +132,7 @@ _opengles2=no
_opengl_shaders=no
_readline=auto
_freetype2=auto
_taskbar=yes
_taskbar=auto
_updates=no
_libunity=auto
# Default option behavior yes/no
@ -1293,7 +1293,7 @@ ds)
gamecube)
_host_os=gamecube
_host_cpu=ppc
_host_alias=powerpc-gekko
_host_alias=powerpc-eabi
;;
gp2x)
_host_os=gph-linux
@ -1416,7 +1416,7 @@ webos)
wii)
_host_os=wii
_host_cpu=ppc
_host_alias=powerpc-gekko
_host_alias=powerpc-eabi
;;
wince)
_host_os=wince
@ -2044,18 +2044,21 @@ case $_host_os in
CXXFLAGS="$CXXFLAGS -march=armv5te"
CXXFLAGS="$CXXFLAGS -mtune=xscale"
CXXFLAGS="$CXXFLAGS -msoft-float"
ABI="armeabi"
;;
android-v7a)
CXXFLAGS="$CXXFLAGS -march=armv7-a"
CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp"
CXXFLAGS="$CXXFLAGS -mfpu=vfp"
LDFLAGS="$LDFLAGS -Wl,--fix-cortex-a8"
ABI="armeabi-v7a"
;;
ouya)
CXXFLAGS="$CXXFLAGS -march=armv7-a"
CXXFLAGS="$CXXFLAGS -mtune=cortex-a9"
CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp"
CXXFLAGS="$CXXFLAGS -mfpu=neon"
ABI="armeabi-v7a"
;;
esac
# ResidualVM use newer NDK
@ -2083,6 +2086,8 @@ case $_host_os in
# ResidualVM use newer NDK
LDFLAGS="$LDFLAGS --sysroot=$ANDROID_NDK/platforms/android-8/arch-arm"
LDFLAGS="$LDFLAGS -mthumb-interwork"
LDFLAGS="$LDFLAGS -L$ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/`$CXX -dumpversion`/libs/$ABI/"
LIBS="$LIBS -lsupc++"
add_line_to_config_mk "ANDROID_SDK = $ANDROID_SDK"
_seq_midi=no
;;
@ -2423,6 +2428,8 @@ if test -n "$_host"; then
CXXFLAGS="$CXXFLAGS -fschedule-insns2"
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
CXXFLAGS="$CXXFLAGS -fdelete-null-pointer-checks"
# no-delayed-branch is a workaround for GCC bug #42841 - "SH: Assembler complains pcrel too far."
CXXFLAGS="$CXXFLAGS -fno-delayed-branch"
_backend="dc"
_build_scalers=no
_mad=yes
@ -2683,7 +2690,6 @@ if test -n "$_host"; then
_backend="tizen"
_port_mk="backends/platform/tizen/tizen.mk"
_arm_asm=yes
_taskbar=no
_build_scalers=no
_seq_midi=no
_mt32emu=no
@ -3670,6 +3676,25 @@ fi
if test "$_readline" = yes ; then
LIBS="$LIBS $READLINE_LIBS $_READLINE_LIBS"
INCLUDES="$INCLUDES $READLINE_CFLAGS"
#
# Check the type of rl_completion_entry_function.
# It can be int(*)(const char *, int) or char *(*)(const char *, int).
#
cat > $TMPC << EOF
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
int readline_completionFunction(const char *, int);
int main(void) {
char *x = readline("");
rl_completion_entry_function = &readline_completionFunction;
}
EOF
cc_check -c && add_line_to_config_h '#define USE_READLINE_INT_COMPLETION'
fi
define_in_config_h_if_yes "$_readline" 'USE_READLINE'
@ -3708,7 +3733,7 @@ if test "$_libunity" = yes ; then
LIBS="$LIBS $LIBUNITY_LIBS"
INCLUDES="$INCLUDES $LIBUNITY_CFLAGS"
fi
define_in_config_h_if_yes "$_libunity" 'USE_TASKBAR_UNITY'
define_in_config_h_if_yes "$_libunity" 'USE_UNITY'
fi
echo "$_libunity"
@ -3996,24 +4021,27 @@ fi
# Check whether to build taskbar integration support
#
echo_n "Building taskbar integration support... "
define_in_config_if_yes $_taskbar 'USE_TASKBAR'
if test "$_taskbar" = yes; then
if test "$_taskbar" = "no"; then
echo "no"
else
case $_host_os in
mingw*)
LIBS="$LIBS -lole32 -luuid"
echo "win32"
_taskbar=yes
;;
*)
if test "$_libunity" = yes; then
echo "unity"
_taskbar=yes
else
echo "$_taskbar"
echo "no"
_taskbar=no
fi
;;
esac
else
echo "$_taskbar"
fi
define_in_config_if_yes $_taskbar 'USE_TASKBAR'
#
# Check whether to build Bink video support

View File

@ -33,6 +33,6 @@
#define DISABLE_EDIT_AND_CONTINUE "" // Comma separated list of projects that need Edit&Continue to be disabled for co-routine support (the main project is automatically added)
#define ADDITIONAL_LIBRARY "glu32" // Add a single library to the list of externally linked libraries
#define NEEDS_RTTI 0 // Enable RTTI globally
#define NEEDS_RTTI 1 // Enable RTTI globally
#endif // TOOLS_CREATE_PROJECT_CONFIG_H

View File

@ -360,7 +360,7 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea
"\t\t<ClCompile>\n"
"\t\t\t<DisableLanguageExtensions>true</DisableLanguageExtensions>\n"
"\t\t\t<DisableSpecificWarnings>" << warnings << ";%(DisableSpecificWarnings)</DisableSpecificWarnings>\n"
"\t\t\t<AdditionalIncludeDirectories>$(" << LIBS_DEFINE << ")\\include;.\\;" << prefix << ";" << prefix << "\\engines;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
"\t\t\t<AdditionalIncludeDirectories>$(" << LIBS_DEFINE << ")\\include;.;" << prefix << ";" << prefix << "\\engines;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "$(TargetDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
"\t\t\t<PreprocessorDefinitions>" << definesList << "%(PreprocessorDefinitions)</PreprocessorDefinitions>\n"
"\t\t\t<ExceptionHandling>" << ((setup.devTools || setup.tests) ? "Sync" : "") << "</ExceptionHandling>\n";
@ -434,8 +434,11 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b
"\t\t\t<DebugInformationFormat>" << (isWin32 ? "EditAndContinue" : "ProgramDatabase") << "</DebugInformationFormat>\n" // For x64 format Edit and continue is not supported, thus we default to Program Database
"\t\t\t<EnablePREfast>" << (configuration == "Analysis" ? "true" : "false") << "</EnablePREfast>\n";
if (configuration == "LLVM")
properties << "\t\t\t<AdditionalOptions>-Wno-microsoft -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder -Wpointer-arith -Wcast-qual -Wshadow -Wnon-virtual-dtor -Wwrite-strings -Wno-conversion -Wno-shorten-64-to-32 -Wno-sign-compare -Wno-four-char-constants -Wno-nested-anon-types %(AdditionalOptions)</AdditionalOptions>\n";
if (configuration == "LLVM") {
// FIXME The LLVM cl wrapper does not seem to work properly with the $(TargetDir) path so we hard-code the build folder until the issue is resolved
properties << "\t\t\t<AdditionalIncludeDirectories>" << configuration << outputBitness <<";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
"\t\t\t<AdditionalOptions>-Wno-microsoft -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder -Wpointer-arith -Wcast-qual -Wshadow -Wnon-virtual-dtor -Wwrite-strings -Wno-conversion -Wno-shorten-64-to-32 -Wno-sign-compare -Wno-four-char-constants -Wno-nested-anon-types -Qunused-arguments %(AdditionalOptions)</AdditionalOptions>\n";
}
properties << "\t\t</ClCompile>\n"
"\t\t<Link>\n"
@ -521,6 +524,7 @@ void MSBuildProvider::writeFileListToProject(const FileNode &dir, std::ofstream
outputNasmCommand(projectFile, "Debug", (isDuplicate ? (*entry).prefix : ""));
outputNasmCommand(projectFile, "Analysis", (isDuplicate ? (*entry).prefix : ""));
outputNasmCommand(projectFile, "Release", (isDuplicate ? (*entry).prefix : ""));
outputNasmCommand(projectFile, "LLVM", (isDuplicate ? (*entry).prefix : ""));
projectFile << "\t\t</CustomBuild>\n";
}

View File

@ -15,6 +15,29 @@
-->
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" MenuName="Add to Image Watch"/>
<Type Name="Graphics::Surface">
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" />
</Type>
<Type Name="Graphics::Surface">
<Expand>
<Synthetic Name="[type]">
<DisplayString>UINT8</DisplayString>
</Synthetic>
<Item Name="[channels]" Condition="format.bytesPerPixel==1">1</Item>
<Item Name="[channels]" Condition="format.bytesPerPixel==2">2</Item>
<Synthetic Name="[channels]" Condition="format.bytesPerPixel==4">
<DisplayString>RGBA</DisplayString>
</Synthetic>
<Item Name="[width]">w</Item>
<Item Name="[height]">h</Item>
<Item Name="[stride]">pitch</Item>
<Item Name="[data]">pixels</Item>
</Expand>
</Type>
<Type Name="Common::Array&lt;*&gt;">
<DisplayString>{{size = {_size}}}</DisplayString>
<Expand>

View File

@ -10,7 +10,7 @@ License v2 and BSD licenses.
See COPYING.BSD, COPYING.LGPL and COPYING.FREEFONT.
The Debian packaging is licensed under the GPL.
ResidualVM is Copyright © 2003-2014 The ResidualVM Project
ResidualVM is Copyright © 2003-2014 The ResidualVM Team
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the

View File

@ -4,7 +4,7 @@
dh $@
override_dh_auto_configure:
./configure --prefix=/usr --bindir=/usr/games --datadir=/usr/share/games/residualvm --enable-release
./configure --prefix=/usr --bindir=/usr/games --datadir=/usr/share/games/residualvm --enable-release --enable-opengl-shaders
override_dh_auto_build:
$(MAKE)

View File

@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>residualvm</string>
<key>CFBundleGetInfoString</key>
<string>0.2.0git, Copyright 2003-2014 The ResidualVM team</string>
<string>0.2.0git, Copyright 2003-2014 The ResidualVM Team</string>
<key>CFBundleIconFile</key>
<string>residualvm.icns</string>
<key>CFBundleIdentifier</key>
@ -27,6 +27,6 @@
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2003-2014 The ResidualVM team</string>
<string>Copyright 2003-2014 The ResidualVM Team</string>
</dict>
</plist>

View File

@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>residualvm</string>
<key>CFBundleGetInfoString</key>
<string>@VERSION@, Copyright 2003-2014 The ResidualVM team</string>
<string>@VERSION@, Copyright 2003-2014 The ResidualVM Team</string>
<key>CFBundleIconFile</key>
<string>residualvm.icns</string>
<key>CFBundleIdentifier</key>
@ -27,6 +27,6 @@
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2003-2014 The ResidualVM team</string>
<string>Copyright 2003-2014 The ResidualVM Team</string>
</dict>
</plist>

View File

@ -154,6 +154,10 @@ Engine::~Engine() {
CursorMan.popCursorPalette();
}
void Engine::initializePath(const Common::FSNode &gamePath) {
SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 4);
}
void initCommonGFX(bool defaultTo1XScaler) {
const Common::ConfigManager::Domain *transientDomain = ConfMan.getDomain(Common::ConfigManager::kTransientDomain);
const Common::ConfigManager::Domain *gameDomain = ConfMan.getActiveDomain();

View File

@ -37,6 +37,7 @@ class Error;
class EventManager;
class SaveFileManager;
class TimerManager;
class FSNode;
}
namespace GUI {
class Debugger;
@ -141,6 +142,16 @@ public:
Engine(OSystem *syst);
virtual ~Engine();
/**
* Init SearchMan according to the game path.
*
* By default it adds the directory in non-flat mode with a depth of 4 as
* priority 0 to SearchMan.
*
* @param gamePath The base directory of the game data.
*/
virtual void initializePath(const Common::FSNode &gamePath);
/**
* Init the engine and start its main loop.
* @return returns kNoError on success, else an error code.

View File

@ -620,7 +620,10 @@ applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle) {
template<typename PixelType>
inline void VectorRendererSpec<PixelType>::
blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) {
if (sizeof(PixelType) == 4) {
if (alpha == 0xff) {
// fully opaque pixel, don't blend
*ptr = color | _alphaMask;
} else if (sizeof(PixelType) == 4) {
const byte sR = (color & _redMask) >> _format.rShift;
const byte sG = (color & _greenMask) >> _format.gShift;
const byte sB = (color & _blueMask) >> _format.bShift;
@ -628,15 +631,17 @@ blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) {
byte dR = (*ptr & _redMask) >> _format.rShift;
byte dG = (*ptr & _greenMask) >> _format.gShift;
byte dB = (*ptr & _blueMask) >> _format.bShift;
byte dA = (*ptr & _alphaMask) >> _format.aShift;
dR += ((sR - dR) * alpha) >> 8;
dG += ((sG - dG) * alpha) >> 8;
dB += ((sB - dB) * alpha) >> 8;
dA += ((0xff - dA) * alpha) >> 8;
*ptr = ((dR << _format.rShift) & _redMask)
| ((dG << _format.gShift) & _greenMask)
| ((dB << _format.bShift) & _blueMask)
| (*ptr & _alphaMask);
| ((dA << _format.aShift) & _alphaMask);
} else if (sizeof(PixelType) == 2) {
int idst = *ptr;
int isrc = color;
@ -651,7 +656,9 @@ blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) {
(_blueMask & ((idst & _blueMask) +
((int)(((int)(isrc & _blueMask) -
(int)(idst & _blueMask)) * alpha) >> 8))) |
(idst & _alphaMask));
(_alphaMask & ((idst & _alphaMask) +
((int)(((int)(_alphaMask) -
(int)(idst & _alphaMask)) * alpha) >> 8))));
} else {
error("Unsupported BPP format: %u", (uint)sizeof(PixelType));
}
@ -691,8 +698,7 @@ darkenFill(PixelType *ptr, PixelType *end) {
// assuming at least 3 alpha bits
mask |= 3 << _format.aShift;
PixelType addA = (PixelType)(255 >> _format.aLoss) << _format.aShift;
addA -= (addA >> 2);
PixelType addA = (PixelType)(3 << (_format.aShift + 6 - _format.aLoss));
while (ptr != end) {
// Darken the colour, and increase the alpha
@ -1266,51 +1272,50 @@ template<typename PixelType>
void VectorRendererSpec<PixelType>::
drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, PixelType bottom_color, bool fill) {
int pitch = _activeSurface->pitch / _activeSurface->format.bytesPerPixel;
int i, j;
PixelType *ptr_left;
int height = h;
PixelType *ptr_fill = (PixelType *)_activeSurface->getBasePtr(x, y);
// Fill Background
ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y);
i = h;
if (fill) {
assert((_bgColor & ~_alphaMask) == 0); // only support black
while (height--) {
darkenFill(ptr_fill, ptr_fill + w);
ptr_fill += pitch;
while (i--) {
darkenFill(ptr_left, ptr_left + w);
ptr_left += pitch;
}
}
int i, j;
x = MAX(x - bevel, 0);
y = MAX(y - bevel, 0);
w = MIN(w + (bevel * 2), (int)_activeSurface->w);
h = MIN(h + (bevel * 2), (int)_activeSurface->h);
PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y);
ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y);
i = bevel;
while (i--) {
colorFill<PixelType>(ptr_left, ptr_left + w, top_color);
ptr_left += pitch;
}
i = h - bevel;
ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y + bevel);
i = h - bevel;
while (i--) {
colorFill<PixelType>(ptr_left, ptr_left + bevel, top_color);
ptr_left += pitch;
}
i = bevel;
ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y + h - bevel);
i = bevel;
while (i--) {
colorFill<PixelType>(ptr_left + i, ptr_left + w, bottom_color);
ptr_left += pitch;
}
ptr_left = (PixelType *)_activeSurface->getBasePtr(x + w - bevel, y);
i = h - bevel;
j = bevel - 1;
ptr_left = (PixelType *)_activeSurface->getBasePtr(x + w - bevel, y);
while (i--) {
colorFill<PixelType>(ptr_left + j, ptr_left + bevel, bottom_color);
if (j > 0) j--;

View File

@ -32,6 +32,24 @@
namespace Graphics {
class Font;
/**
* Loads a TTF font file from a given data stream object.
*
* @param stream Stream object to load font data from.
* @param size The point size to load.
* @param dpi The dpi to use for size calculations, by default 72dpi
* are used.
* @param monochrome Whether the font should be loaded in pure monochrome
* mode. In case this is true no aliasing is used.
* @param mapping A mapping from code points 0-255 into UTF-32 code points.
* This can be used to support various 8bit character sets.
* In case the msb of the UTF-32 code point is set the font
* loading fails in case no glyph for it is found. When this
* is non-null only characters given in the mapping are
* supported.
* @return 0 in case loading fails, otherwise a pointer to the Font object.
*/
Font *loadTTFFont(Common::SeekableReadStream &stream, int size, uint dpi = 0, bool monochrome = false, const uint32 *mapping = 0);
void shutdownTTF();

View File

@ -56,7 +56,7 @@ enum {
static const char *copyright_text[] = {
"",
"C0""Copyright (C) 2003-2014 The ResidualVM project",
"C0""Copyright (C) 2003-2014 The ResidualVM Team",
"C0""http://www.residualvm.org",
"",
"C0""ResidualVM is the legal property of its developers, whose names are too numerous to list here. Please refer to the AUTHORS file distributed with this binary.",

View File

@ -133,6 +133,14 @@ Debugger *g_readline_debugger;
char *readline_completionFunction(const char *text, int state) {
return g_readline_debugger->readlineComplete(text, state);
}
#ifdef USE_READLINE_INT_COMPLETION
typedef int RLCompFunc_t(const char *, int);
#else
typedef char *RLCompFunc_t(const char *, int);
#endif
} // end of anonymous namespace
#endif
@ -162,7 +170,7 @@ void Debugger::enter() {
// TODO: add support for saving/loading history?
g_readline_debugger = this;
rl_completion_entry_function = &readline_completionFunction;
rl_completion_entry_function = (RLCompFunc_t *)&readline_completionFunction;
char *line_read = 0;
do {

File diff suppressed because it is too large Load Diff

View File

@ -218,6 +218,16 @@ void BinkDecoder::readNextPacket() {
frame.bits = 0;
}
VideoDecoder::AudioTrack *BinkDecoder::getAudioTrack(int index) {
// Bink audio track indexes are relative to the first audio track
Track *track = getTrack(index + 1);
if (!track || track->getTrackType() != Track::kTrackTypeAudio)
return 0;
return (AudioTrack *)track;
}
BinkDecoder::VideoFrame::VideoFrame() : bits(0) {
}

View File

@ -76,6 +76,8 @@ public:
void setAudioTrack(uint32 track);
protected:
void readNextPacket();
bool supportsAudioTrackSwitching() const { return true; }
AudioTrack *getAudioTrack(int index);
// ResidualVM-specific:
bool seekIntern(const Audio::Timestamp &time);

View File

@ -369,8 +369,7 @@ bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) {
if (_header.audioInfo[i].compression == kCompressionRDFT || _header.audioInfo[i].compression == kCompressionDCT)
warning("Unhandled Smacker v2 audio compression");
if (i == 0)
addTrack(new SmackerAudioTrack(_header.audioInfo[i], _soundType));
addTrack(new SmackerAudioTrack(_header.audioInfo[i], _soundType));
}
}
@ -477,7 +476,10 @@ void SmackerDecoder::readNextPacket() {
}
void SmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize) {
if (_header.audioInfo[track].hasAudio && chunkSize > 0 && track == 0) {
if (chunkSize == 0)
return;
if (_header.audioInfo[track].hasAudio) {
// Get the audio track, which start at offset 1 (first track is video)
SmackerAudioTrack *audioTrack = (SmackerAudioTrack *)getTrack(track + 1);
@ -501,14 +503,21 @@ void SmackerDecoder::handleAudioTrack(byte track, uint32 chunkSize, uint32 unpac
audioTrack->queuePCM(soundBuffer, chunkSize);
}
} else {
// Ignore the rest of the audio tracks, if they exist
// TODO: Are there any Smacker videos with more than one audio stream?
// If yes, we should play the rest of the audio streams as well
if (chunkSize > 0)
_fileStream->skip(chunkSize);
// Ignore possibly unused data
_fileStream->skip(chunkSize);
}
}
VideoDecoder::AudioTrack *SmackerDecoder::getAudioTrack(int index) {
// Smacker audio track indexes are relative to the first audio track
Track *track = getTrack(index + 1);
if (!track || track->getTrackType() != Track::kTrackTypeAudio)
return 0;
return (AudioTrack *)track;
}
SmackerDecoder::SmackerVideoTrack::SmackerVideoTrack(uint32 width, uint32 height, uint32 frameCount, const Common::Rational &frameRate, uint32 flags, uint32 signature) {
_surface = new Graphics::Surface();
_surface->create(width, height * (flags ? 2 : 1), Graphics::PixelFormat::createFormatCLUT8());
@ -726,16 +735,15 @@ void SmackerDecoder::SmackerVideoTrack::unpackPalette(Common::SeekableReadStream
} else { // top 2 bits are 00
sz++;
// get the lower 6 bits for each component (0x3f = 00111111)
byte b = b0 & 0x3f;
byte r = b0 & 0x3f;
byte g = (*p++) & 0x3f;
byte r = (*p++) & 0x3f;
byte b = (*p++) & 0x3f;
assert(g < 0xc0 && b < 0xc0);
// upscale to full 8-bit color values by multiplying by 4
*pal++ = b * 4;
*pal++ = g * 4;
*pal++ = r * 4;
// upscale to full 8-bit color values. The Multimedia Wiki suggests
// a lookup table for this, but this should produce the same result.
*pal++ = (r * 4 + r / 16);
*pal++ = (g * 4 + g / 16);
*pal++ = (b * 4 + b / 16);
}
}

View File

@ -69,6 +69,8 @@ public:
protected:
void readNextPacket();
bool supportsAudioTrackSwitching() const { return true; }
AudioTrack *getAudioTrack(int index);
virtual void handleAudioTrack(byte track, uint32 chunkSize, uint32 unpackedSize);

View File

@ -46,6 +46,7 @@ VideoDecoder::VideoDecoder() {
_endTime = 0;
_endTimeSet = false;
_nextVideoTrack = 0;
_mainAudioTrack = 0;
// Find the best format for output
_defaultHighColorFormat = g_system->getScreenFormat();
@ -75,6 +76,7 @@ void VideoDecoder::close() {
_endTime = 0;
_endTimeSet = false;
_nextVideoTrack = 0;
_mainAudioTrack = 0;
}
bool VideoDecoder::loadFile(const Common::String &filename) {
@ -553,6 +555,9 @@ Audio::Timestamp VideoDecoder::FixedRateVideoTrack::getDuration() const {
return getFrameTime(getFrameCount());
}
VideoDecoder::AudioTrack::AudioTrack() : _volume(Audio::Mixer::kMaxChannelVolume), _balance(0), _muted(false) {
}
bool VideoDecoder::AudioTrack::endOfTrack() const {
Audio::AudioStream *stream = getAudioStream();
return !stream || !g_system->getMixer()->isSoundHandleActive(_handle) || stream->endOfData();
@ -562,7 +567,7 @@ void VideoDecoder::AudioTrack::setVolume(byte volume) {
_volume = volume;
if (g_system->getMixer()->isSoundHandleActive(_handle))
g_system->getMixer()->setChannelVolume(_handle, _volume);
g_system->getMixer()->setChannelVolume(_handle, _muted ? 0 : _volume);
}
void VideoDecoder::AudioTrack::setBalance(int8 balance) {
@ -578,7 +583,7 @@ void VideoDecoder::AudioTrack::start() {
Audio::AudioStream *stream = getAudioStream();
assert(stream);
g_system->getMixer()->playStream(getSoundType(), &_handle, stream, -1, getVolume(), getBalance(), DisposeAfterUse::NO);
g_system->getMixer()->playStream(getSoundType(), &_handle, stream, -1, _muted ? 0 : getVolume(), getBalance(), DisposeAfterUse::NO);
// Pause the audio again if we're still paused
if (isPaused())
@ -597,7 +602,7 @@ void VideoDecoder::AudioTrack::start(const Audio::Timestamp &limit) {
stream = Audio::makeLimitingAudioStream(stream, limit, DisposeAfterUse::NO);
g_system->getMixer()->playStream(getSoundType(), &_handle, stream, -1, getVolume(), getBalance(), DisposeAfterUse::YES);
g_system->getMixer()->playStream(getSoundType(), &_handle, stream, -1, _muted ? 0 : getVolume(), getBalance(), DisposeAfterUse::YES);
// Pause the audio again if we're still paused
if (isPaused())
@ -611,6 +616,16 @@ uint32 VideoDecoder::AudioTrack::getRunningTime() const {
return 0;
}
void VideoDecoder::AudioTrack::setMute(bool mute) {
// Update the mute settings, if required
if (_muted != mute) {
_muted = mute;
if (g_system->getMixer()->isSoundHandleActive(_handle))
g_system->getMixer()->setChannelVolume(_handle, mute ? 0 : _volume);
}
}
void VideoDecoder::AudioTrack::pauseIntern(bool shouldPause) {
if (g_system->getMixer()->isSoundHandleActive(_handle))
g_system->getMixer()->pauseHandle(_handle, shouldPause);
@ -669,6 +684,17 @@ void VideoDecoder::addTrack(Track *track, bool isExternal) {
// Update volume settings if it's an audio track
((AudioTrack *)track)->setVolume(_audioVolume);
((AudioTrack *)track)->setBalance(_audioBalance);
if (!isExternal && supportsAudioTrackSwitching()) {
if (_mainAudioTrack) {
// The main audio track has already been found
((AudioTrack *)track)->setMute(true);
} else {
// First audio track found -> now the main one
_mainAudioTrack = (AudioTrack *)track;
_mainAudioTrack->setMute(false);
}
}
} else if (track->getTrackType() == Track::kTrackTypeVideo) {
// If this track has a better time, update _nextVideoTrack
if (!_nextVideoTrack || ((VideoTrack *)track)->getNextFrameStartTime() < _nextVideoTrack->getNextFrameStartTime())
@ -701,6 +727,34 @@ bool VideoDecoder::addStreamFileTrack(const Common::String &baseName) {
return result;
}
bool VideoDecoder::setAudioTrack(int index) {
if (!supportsAudioTrackSwitching())
return false;
AudioTrack *audioTrack = getAudioTrack(index);
if (!audioTrack)
return false;
if (_mainAudioTrack == audioTrack)
return true;
_mainAudioTrack->setMute(true);
audioTrack->setMute(false);
_mainAudioTrack = audioTrack;
return true;
}
uint VideoDecoder::getAudioTrackCount() const {
uint count = 0;
for (TrackList::const_iterator it = _internalTracks.begin(); it != _internalTracks.end(); it++)
if ((*it)->getTrackType() == Track::kTrackTypeAudio)
count++;
return count;
}
void VideoDecoder::setEndTime(const Audio::Timestamp &endTime) {
Audio::Timestamp startTime = 0;

View File

@ -407,6 +407,21 @@ public:
*/
bool addStreamFileTrack(const Common::String &baseName);
/**
* Set the internal audio track.
*
* Has no effect if the container does not support this.
* @see supportsAudioTrackSwitching()
*
* @param index The index of the track, whose meaning is dependent on the container
*/
bool setAudioTrack(int index);
/**
* Get the number of internal audio tracks.
*/
uint getAudioTrackCount() const;
protected:
/**
* An abstract representation of a track in a movie. Since tracks here are designed
@ -612,7 +627,7 @@ protected:
*/
class AudioTrack : public Track {
public:
AudioTrack() {}
AudioTrack();
virtual ~AudioTrack() {}
TrackType getTrackType() const { return kTrackTypeAudio; }
@ -662,6 +677,11 @@ protected:
*/
virtual Audio::Mixer::SoundType getSoundType() const { return Audio::Mixer::kPlainSoundType; }
/**
* Mute the track
*/
void setMute(bool mute);
protected:
void pauseIntern(bool shouldPause);
@ -674,6 +694,7 @@ protected:
Audio::SoundHandle _handle;
byte _volume;
int8 _balance;
bool _muted;
};
/**
@ -833,6 +854,25 @@ protected:
*/
virtual bool seekIntern(const Audio::Timestamp &time);
/**
* Does this video format support switching between audio tracks?
*
* Returning true implies this format supports multiple audio tracks,
* can switch tracks, and defaults to playing the first found audio
* track.
*/
virtual bool supportsAudioTrackSwitching() const { return false; }
/**
* Get the audio track for the given index.
*
* This is used only if supportsAudioTrackSwitching() returns true.
*
* @param index The index of the track, whose meaning is dependent on the container
* @return The audio track for the index, or 0 if not found
*/
virtual AudioTrack *getAudioTrack(int index) { return 0; }
private:
// Tracks owned by this VideoDecoder
TrackList _tracks;
@ -865,6 +905,8 @@ private:
uint32 _pauseStartTime;
byte _audioVolume;
int8 _audioBalance;
AudioTrack *_mainAudioTrack;
};
} // End of namespace Video