ALL: Synced with ScummVM - rev 0b777c23a9

This commit is contained in:
Pawel Kolodziejski 2020-08-11 00:59:40 +02:00
parent b557bb7f60
commit aea3bae26d
81 changed files with 2024 additions and 1418 deletions

View file

@ -19,4 +19,5 @@
SpacesInAngles: false, SpacesInAngles: false,
SpacesInParentheses: false, SpacesInParentheses: false,
SpacesInSquareBrackets: false, SpacesInSquareBrackets: false,
Standard: c++03,
} }

View file

@ -32,11 +32,8 @@ ifeq "$(HAVE_GCC)" "1"
# being helpful. # being helpful.
#CXXFLAGS+= -Wmissing-format-attribute #CXXFLAGS+= -Wmissing-format-attribute
ifneq "$(BACKEND)" "tizen" # Disable exceptions.
# Disable exceptions. This setting causes tizen apps to crash
# TODO: Does this still apply after enabling RTTI again?
CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-exceptions
endif
ifneq "$(HAVE_CLANG)" "1" ifneq "$(HAVE_CLANG)" "1"
# enable checking of pointers returned by "new", but only when we do not # enable checking of pointers returned by "new", but only when we do not

View file

@ -355,8 +355,7 @@ int FLACStream::readBuffer(int16 *buffer, const int numSamples) {
break; break;
default: default:
decoderOk = false; decoderOk = false;
warning("FLACStream: An error occurred while decoding. DecoderState is: %s", warning("FLACStream: An error occurred while decoding. DecoderState is: %d", getStreamDecoderState());
FLAC__StreamDecoderStateString[getStreamDecoderState()]);
} }
// Compute how many samples we actually produced // Compute how many samples we actually produced
@ -668,8 +667,7 @@ inline void FLACStream::callbackMetadata(const ::FLAC__StreamMetadata *metadata)
} }
inline void FLACStream::callbackError(::FLAC__StreamDecoderErrorStatus status) { inline void FLACStream::callbackError(::FLAC__StreamDecoderErrorStatus status) {
// some of these are non-critical-Errors // some of these are non-critical-Errors
debug(1, "FLACStream: An error occurred while decoding. DecoderState is: %s", debug(1, "FLACStream: An error occurred while decoding. DecoderStateError is: %d", status);
FLAC__StreamDecoderErrorStatusString[status]);
} }
/* Static Callback Wrappers */ /* Static Callback Wrappers */

View file

@ -109,6 +109,7 @@ static const struct {
{ MT_APPLEIIGS, GUIO_MIDIAPPLEIIGS }, { MT_APPLEIIGS, GUIO_MIDIAPPLEIIGS },
{ MT_TOWNS, GUIO_MIDITOWNS }, { MT_TOWNS, GUIO_MIDITOWNS },
{ MT_PC98, GUIO_MIDIPC98 }, { MT_PC98, GUIO_MIDIPC98 },
{ MT_SEGACD, GUIO_MIDISEGACD },
{ MT_GM, GUIO_MIDIGM }, { MT_GM, GUIO_MIDIGM },
{ MT_MT32, GUIO_MIDIMT32 }, { MT_MT32, GUIO_MIDIMT32 },
{ 0, 0 }, { 0, 0 },
@ -229,6 +230,11 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
reslt = hdl; reslt = hdl;
break; break;
case MT_SEGACD:
if (flags & MDT_SEGACD)
reslt = hdl;
break;
case MT_GM: case MT_GM:
case MT_GS: case MT_GS:
case MT_MT32: case MT_MT32:
@ -363,6 +369,9 @@ MidiDriver::DeviceHandle MidiDriver::detectDevice(int flags) {
} else if (flags & MDT_PC98) { } else if (flags & MDT_PC98) {
tp = MT_PC98; tp = MT_PC98;
flags &= ~MDT_PC98; flags &= ~MDT_PC98;
} else if (flags & MDT_SEGACD) {
tp = MT_SEGACD;
flags &= ~MDT_SEGACD;
} else if (flags & MDT_ADLIB) { } else if (flags & MDT_ADLIB) {
tp = MT_ADLIB; tp = MT_ADLIB;
flags &= ~MDT_ADLIB; flags &= ~MDT_ADLIB;
@ -564,6 +573,10 @@ void MidiDriver_BASE::send(int8 source, byte status, byte firstOp, byte secondOp
send(source, status | ((uint32)firstOp << 8) | ((uint32)secondOp << 16)); send(source, status | ((uint32)firstOp << 8) | ((uint32)secondOp << 16));
} }
void MidiDriver_BASE::stopAllNotes(bool stopSustainedNotes) {
// ResidualVM - not used
}
void MidiDriver::midiDriverCommonSend(uint32 b) { void MidiDriver::midiDriverCommonSend(uint32 b) {
// ResidualVM - not used // ResidualVM - not used
} }

View file

@ -47,6 +47,7 @@ enum MusicType {
MT_APPLEIIGS, // Apple IIGS MT_APPLEIIGS, // Apple IIGS
MT_TOWNS, // FM-TOWNS MT_TOWNS, // FM-TOWNS
MT_PC98, // PC98 MT_PC98, // PC98
MT_SEGACD, // SegaCD
MT_GM, // General MIDI MT_GM, // General MIDI
MT_MT32, // MT-32 MT_MT32, // MT-32
MT_GS // Roland GS MT_GS // Roland GS
@ -77,11 +78,12 @@ enum MidiDriverFlags {
MDT_AMIGA = 1 << 5, MDT_AMIGA = 1 << 5,
MDT_APPLEIIGS = 1 << 6, MDT_APPLEIIGS = 1 << 6,
MDT_TOWNS = 1 << 7, // FM-TOWNS: Maps to MT_TOWNS MDT_TOWNS = 1 << 7, // FM-TOWNS: Maps to MT_TOWNS
MDT_PC98 = 1 << 8, // FM-TOWNS: Maps to MT_PC98 MDT_PC98 = 1 << 8, // PC-98: Maps to MT_PC98
MDT_MIDI = 1 << 9, // Real MIDI MDT_SEGACD = 1 << 9,
MDT_PREFER_MT32 = 1 << 10, // MT-32 output is preferred MDT_MIDI = 1 << 10, // Real MIDI
MDT_PREFER_GM = 1 << 11, // GM output is preferred MDT_PREFER_MT32 = 1 << 11, // MT-32 output is preferred
MDT_PREFER_FLUID= 1 << 12 // FluidSynth driver is preferred MDT_PREFER_GM = 1 << 12, // GM output is preferred
MDT_PREFER_FLUID= 1 << 13 // FluidSynth driver is preferred
}; };
/** /**
@ -159,6 +161,32 @@ public:
* ignored. * ignored.
*/ */
virtual void metaEvent(int8 source, byte type, byte *data, uint16 length) { metaEvent(type, data, length); } virtual void metaEvent(int8 source, byte type, byte *data, uint16 length) { metaEvent(type, data, length); }
/**
* Stops all currently active notes. Specify stopSustainedNotes if
* the MIDI data makes use of the sustain controller to also stop
* sustained notes.
*
* Usually, the MIDI parser tracks active notes and terminates them
* when playback is stopped. This method should be used as a backup
* to silence the MIDI output in case the MIDI parser makes a
* mistake when tracking acive notes. It can also be used when
* quitting or pausing a game.
*
* By default, this method sends an All Notes Off message and, if
* stopSustainedNotes is true, a Sustain off message on all MIDI
* channels. Driver implementations can override this if they want
* to implement this functionality in a different way.
*/
virtual void stopAllNotes(bool stopSustainedNotes = false);
/**
* A driver implementation might need time to prepare playback of
* a track. Use this function to check if the driver is ready to
* receive MIDI events.
*/
virtual bool isReady() { return true; }
protected: protected:
/** /**

View file

@ -59,8 +59,13 @@ Common::DialogManager::DialogResult GtkDialogManager::showFileBrowser(const char
if (isDirBrowser) { if (isDirBrowser) {
action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
} }
#if GTK_CHECK_VERSION(3,20,0)
GtkFileChooserNative *native = gtk_file_chooser_native_new(utf8Title, NULL, action, utf8Choose, utf8Cancel); GtkFileChooserNative *native = gtk_file_chooser_native_new(utf8Title, NULL, action, utf8Choose, utf8Cancel);
GtkFileChooser *chooser = GTK_FILE_CHOOSER(native); GtkFileChooser *chooser = GTK_FILE_CHOOSER(native);
#else
GtkWidget *dialog = gtk_file_chooser_dialog_new(utf8Title, NULL, action, utf8Choose, GTK_RESPONSE_ACCEPT, utf8Cancel, GTK_RESPONSE_CANCEL, NULL);
GtkFileChooser *chooser = GTK_FILE_CHOOSER(dialog);
#endif
free(utf8Cancel); free(utf8Cancel);
free(utf8Choose); free(utf8Choose);
free(utf8Title); free(utf8Title);
@ -73,7 +78,11 @@ Common::DialogManager::DialogResult GtkDialogManager::showFileBrowser(const char
// Show dialog // Show dialog
beginDialog(); beginDialog();
#if GTK_CHECK_VERSION(3,20,0)
int res = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native)); int res = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
#else
int res = gtk_dialog_run(GTK_DIALOG(dialog));
#endif
if (res == GTK_RESPONSE_ACCEPT) { if (res == GTK_RESPONSE_ACCEPT) {
// Get the selection from the user // Get the selection from the user
char *path = gtk_file_chooser_get_filename(chooser); char *path = gtk_file_chooser_get_filename(chooser);
@ -87,7 +96,11 @@ Common::DialogManager::DialogResult GtkDialogManager::showFileBrowser(const char
g_free(last); g_free(last);
} }
#if GTK_CHECK_VERSION(3,20,0)
g_object_unref(native); g_object_unref(native);
#else
gtk_widget_destroy(dialog);
#endif
while (gtk_events_pending()) while (gtk_events_pending())
gtk_main_iteration(); gtk_main_iteration();

View file

@ -63,59 +63,59 @@ public:
/** @name Graphics */ /** @name Graphics */
//@{ //@{
virtual GraphicsManager *getGraphicsManager(); GraphicsManager *getGraphicsManager();
virtual const GraphicsMode *getSupportedGraphicsModes() const override; virtual const GraphicsMode *getSupportedGraphicsModes() const override;
virtual int getDefaultGraphicsMode() const override; virtual int getDefaultGraphicsMode() const override;
virtual bool setGraphicsMode(int mode) override; virtual bool setGraphicsMode(int mode) override;
virtual int getGraphicsMode() const override; virtual int getGraphicsMode() const override;
virtual const GraphicsMode *getSupportedShaders() const override; virtual const GraphicsMode *getSupportedShaders() const override final;
virtual int getDefaultShader() const override; virtual int getDefaultShader() const override final;
virtual int getShader() const override; virtual int getShader() const override final;
virtual bool setShader(int id) override; virtual bool setShader(int id) override final;
virtual const GraphicsMode *getSupportedStretchModes() const override; virtual const GraphicsMode *getSupportedStretchModes() const override final;
virtual int getDefaultStretchMode() const override; virtual int getDefaultStretchMode() const override final;
virtual bool setStretchMode(int mode) override; virtual bool setStretchMode(int mode) override final;
virtual int getStretchMode() const override; virtual int getStretchMode() const override final;
virtual void resetGraphicsScale() override; virtual void resetGraphicsScale() override final;
#ifdef USE_RGB_COLOR #ifdef USE_RGB_COLOR
virtual Graphics::PixelFormat getScreenFormat() const override; virtual Graphics::PixelFormat getScreenFormat() const override final;
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const override; virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const override final;
#endif #endif
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) override; virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) override final;
virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d); // ResidualVM specific method virtual void setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d); // ResidualVM specific method
virtual Graphics::PixelBuffer getScreenPixelBuffer(); // ResidualVM specific method virtual Graphics::PixelBuffer getScreenPixelBuffer(); // ResidualVM specific method
virtual void suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right); // ResidualVM specific method virtual void suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right); // ResidualVM specific method
virtual void initSizeHint(const Graphics::ModeList &modes) override; virtual void initSizeHint(const Graphics::ModeList &modes) override final;
virtual int getScreenChangeID() const override; virtual int getScreenChangeID() const override final;
virtual void beginGFXTransaction() override; virtual void beginGFXTransaction() override final;
virtual OSystem::TransactionError endGFXTransaction() override; virtual OSystem::TransactionError endGFXTransaction() override final;
virtual int16 getHeight() override; virtual int16 getHeight() override final;
virtual int16 getWidth() override; virtual int16 getWidth() override final;
virtual PaletteManager *getPaletteManager() override; virtual PaletteManager *getPaletteManager() override final;
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override; virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override final;
virtual Graphics::Surface *lockScreen() override; virtual Graphics::Surface *lockScreen() override final;
virtual void unlockScreen() override; virtual void unlockScreen() override final;
virtual void fillScreen(uint32 col) override; virtual void fillScreen(uint32 col) override final;
virtual void updateScreen() override; virtual void updateScreen() override final;
virtual void setShakePos(int shakeXOffset, int shakeYOffset) override; virtual void setShakePos(int shakeXOffset, int shakeYOffset) override final;
virtual void setFocusRectangle(const Common::Rect& rect) override; virtual void setFocusRectangle(const Common::Rect& rect) override final;
virtual void clearFocusRectangle() override; virtual void clearFocusRectangle() override final;
virtual void showOverlay() override; virtual void showOverlay() override final;
virtual void hideOverlay() override; virtual void hideOverlay() override final;
virtual Graphics::PixelFormat getOverlayFormat() const override; virtual Graphics::PixelFormat getOverlayFormat() const override final;
virtual void clearOverlay() override; virtual void clearOverlay() override final;
virtual void grabOverlay(void *buf, int pitch) override; virtual void grabOverlay(void *buf, int pitch) override final;
virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override; virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override final;
virtual int16 getOverlayHeight() override; virtual int16 getOverlayHeight() override final;
virtual int16 getOverlayWidth() override; virtual int16 getOverlayWidth() override final;
virtual bool showMouse(bool visible) override; virtual bool showMouse(bool visible) override final;
virtual void warpMouse(int x, int y) override; virtual void warpMouse(int x, int y) override final;
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) override; virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) override final;
virtual void setCursorPalette(const byte *colors, uint start, uint num) override; virtual void setCursorPalette(const byte *colors, uint start, uint num) override final;
virtual bool lockMouse(bool lock); // ResidualVM specific method virtual bool lockMouse(bool lock); // ResidualVM specific method
//@} //@}
@ -123,10 +123,10 @@ public:
/** @name Mutex handling */ /** @name Mutex handling */
//@{ //@{
virtual MutexRef createMutex() override; virtual MutexRef createMutex() override final;
virtual void lockMutex(MutexRef mutex) override; virtual void lockMutex(MutexRef mutex) override final;
virtual void unlockMutex(MutexRef mutex) override; virtual void unlockMutex(MutexRef mutex) override final;
virtual void deleteMutex(MutexRef mutex) override; virtual void deleteMutex(MutexRef mutex) override final;
//@} //@}
@ -140,8 +140,8 @@ public:
/** @name Miscellaneous */ /** @name Miscellaneous */
//@{ //@{
virtual void displayMessageOnOSD(const char *msg) override; virtual void displayMessageOnOSD(const char *msg) override final;
virtual void displayActivityIconOnOSD(const Graphics::Surface *icon) override; virtual void displayActivityIconOnOSD(const Graphics::Surface *icon) override final;
//@} //@}

View file

@ -232,11 +232,6 @@ MODULE_OBJS += \
audiocd/linux/linux-audiocd.o audiocd/linux/linux-audiocd.o
endif endif
ifeq ($(BACKEND),tizen)
MODULE_OBJS += \
timer/tizen/timer.o
endif
ifeq ($(BACKEND),3ds) ifeq ($(BACKEND),3ds)
MODULE_OBJS += \ MODULE_OBJS += \
plugins/3ds/3ds-provider.o plugins/3ds/3ds-provider.o
@ -281,13 +276,6 @@ MODULE_OBJS += \
graphics/openpandora/op-graphics.o graphics/openpandora/op-graphics.o
endif endif
ifeq ($(BACKEND),ps2)
MODULE_OBJS += \
fs/ps2/ps2-fs.o \
fs/ps2/ps2-fs-factory.o \
plugins/ps2/ps2-provider.o
endif
ifeq ($(BACKEND),psp) ifeq ($(BACKEND),psp)
MODULE_OBJS += \ MODULE_OBJS += \
fs/psp/psp-fs.o \ fs/psp/psp-fs.o \
@ -312,11 +300,6 @@ MODULE_OBJS += \
events/samsungtvsdl/samsungtvsdl-events.o events/samsungtvsdl/samsungtvsdl-events.o
endif endif
ifeq ($(BACKEND),webos)
MODULE_OBJS += \
events/webossdl/webossdl-events.o
endif
ifeq ($(BACKEND),wii) ifeq ($(BACKEND),wii)
MODULE_OBJS += \ MODULE_OBJS += \
fs/wii/wii-fs.o \ fs/wii/wii-fs.o \

View file

@ -22,7 +22,7 @@
#include "common/scummsys.h" #include "common/scummsys.h"
#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(WEBOS) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3) && !defined(PSP2) && !defined(ANDROIDSDL) && !defined(NINTENDO_SWITCH) #if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3) && !defined(PSP2) && !defined(ANDROIDSDL) && !defined(NINTENDO_SWITCH)
#include "backends/platform/sdl/posix/posix.h" #include "backends/platform/sdl/posix/posix.h"
#include "backends/plugins/sdl/sdl-provider.h" #include "backends/plugins/sdl/sdl-provider.h"

View file

@ -39,13 +39,19 @@ SdlWindow::SdlWindow()
#endif #endif
{ {
#if !SDL_VERSION_ATLEAST(2, 0, 0) #if SDL_VERSION_ATLEAST(2, 0, 0)
#elif SDL_VERSION_ATLEAST(1, 2, 10)
// Query the desktop resolution. We simply hope nothing tried to change // Query the desktop resolution. We simply hope nothing tried to change
// the resolution so far. // the resolution so far.
const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo(); const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
if (videoInfo && videoInfo->current_w > 0 && videoInfo->current_h > 0) { if (videoInfo && videoInfo->current_w > 0 && videoInfo->current_h > 0) {
_desktopRes = Common::Rect(videoInfo->current_w, videoInfo->current_h); _desktopRes = Common::Rect(videoInfo->current_w, videoInfo->current_h);
} }
#elif defined(MAEMO)
// All supported Maemo devices have a display resolution of 800x480
_desktopRes = Common::Rect(800, 480);
#else
#error Unable to detect screen resolution
#endif #endif
} }

View file

@ -33,7 +33,6 @@
#include "common/ustr.h" #include "common/ustr.h"
#include "common/config-manager.h" #include "common/config-manager.h"
#include "common/encoding.h" #include "common/encoding.h"
#include <pthread.h>
SPDConnection *_connection; SPDConnection *_connection;

View file

@ -32,6 +32,8 @@
#include "common/list.h" #include "common/list.h"
#include "common/mutex.h" #include "common/mutex.h"
#include <pthread.h>
struct StartSpeechParams { struct StartSpeechParams {
pthread_mutex_t *mutex; pthread_mutex_t *mutex;
Common::List<Common::String> *speechQueue; Common::List<Common::String> *speechQueue;

View file

@ -462,7 +462,11 @@ void WindowsTextToSpeechManager::updateVoices() {
ISpObjectTokenCategory *cpCategory; ISpObjectTokenCategory *cpCategory;
HRESULT hr = CoCreateInstance(CLSID_SpObjectTokenCategory, NULL, CLSCTX_ALL, IID_ISpObjectTokenCategory, (void**)&cpCategory); HRESULT hr = CoCreateInstance(CLSID_SpObjectTokenCategory, NULL, CLSCTX_ALL, IID_ISpObjectTokenCategory, (void**)&cpCategory);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
hr = cpCategory->SetId(L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCore\\Voices", FALSE);
if (!SUCCEEDED(hr)) {
hr = cpCategory->SetId(SPCAT_VOICES, FALSE); hr = cpCategory->SetId(SPCAT_VOICES, FALSE);
}
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
hr = cpCategory->EnumTokens(NULL, NULL, &cpEnum); hr = cpCategory->EnumTokens(NULL, NULL, &cpEnum);
} }

View file

@ -29,7 +29,12 @@
#include "common/textconsole.h" #include "common/textconsole.h"
static volatile bool timerInstalled = false;
static Uint32 timer_handler(Uint32 interval, void *param) { static Uint32 timer_handler(Uint32 interval, void *param) {
if (!timerInstalled)
return interval;
((DefaultTimerManager *)param)->handler(); ((DefaultTimerManager *)param)->handler();
return interval; return interval;
} }
@ -40,11 +45,14 @@ SdlTimerManager::SdlTimerManager() {
error("Could not initialize SDL: %s", SDL_GetError()); error("Could not initialize SDL: %s", SDL_GetError());
} }
timerInstalled = true;
// Creates the timer callback // Creates the timer callback
_timerID = SDL_AddTimer(10, &timer_handler, this); _timerID = SDL_AddTimer(10, &timer_handler, this);
} }
SdlTimerManager::~SdlTimerManager() { SdlTimerManager::~SdlTimerManager() {
timerInstalled = false;
// Removes the timer callback // Removes the timer callback
SDL_RemoveTimer(_timerID); SDL_RemoveTimer(_timerID);
} }

View file

@ -59,15 +59,9 @@ const char *gScummVMVersion = SCUMMVM_VERSION SCUMMVM_REVISION;
#ifdef __amigaos4__ #ifdef __amigaos4__
static const char *version_cookie __attribute__((used)) = "$VER: ResidualVM " SCUMMVM_VERSION SCUMMVM_REVISION " (" AMIGA_DATE ")"; static const char *version_cookie __attribute__((used)) = "$VER: ResidualVM " SCUMMVM_VERSION SCUMMVM_REVISION " (" AMIGA_DATE ")";
#endif #endif
#ifdef __PLAYSTATION2__
const char *gScummVMBuildDate = "Git Master"; /* ScummVM Git Master */
const char *gScummVMVersionDate = SCUMMVM_VERSION SCUMMVM_REVISION " - PlayStation2";
const char *gScummVMFullVersion = "ResidualVM " SCUMMVM_VERSION SCUMMVM_REVISION " - PlayStation2";
#else
const char *gScummVMBuildDate = __DATE__ " " __TIME__; const char *gScummVMBuildDate = __DATE__ " " __TIME__;
const char *gScummVMVersionDate = SCUMMVM_VERSION SCUMMVM_REVISION " (" __DATE__ " " __TIME__ ")"; const char *gScummVMVersionDate = SCUMMVM_VERSION SCUMMVM_REVISION " (" __DATE__ " " __TIME__ ")";
const char *gScummVMFullVersion = "ResidualVM " SCUMMVM_VERSION SCUMMVM_REVISION " (" __DATE__ " " __TIME__ ")"; const char *gScummVMFullVersion = "ResidualVM " SCUMMVM_VERSION SCUMMVM_REVISION " (" __DATE__ " " __TIME__ ")";
#endif
const char *gScummVMFeatures = "" const char *gScummVMFeatures = ""
#ifdef TAINTED_BUILD #ifdef TAINTED_BUILD
// TAINTED means the build contains engines/subengines not enabled by default // TAINTED means the build contains engines/subengines not enabled by default

View file

@ -53,6 +53,7 @@ const struct GameOpt {
{ GUIO_MIDIAPPLEIIGS,"midiAppleIIgs" }, { GUIO_MIDIAPPLEIIGS,"midiAppleIIgs" },
{ GUIO_MIDITOWNS, "midiTowns" }, { GUIO_MIDITOWNS, "midiTowns" },
{ GUIO_MIDIPC98, "midiPC98" }, { GUIO_MIDIPC98, "midiPC98" },
{ GUIO_MIDISEGACD, "midiSegaCD" },
{ GUIO_MIDIMT32, "midiMt32" }, { GUIO_MIDIMT32, "midiMt32" },
{ GUIO_MIDIGM, "midiGM" }, { GUIO_MIDIGM, "midiGM" },

View file

@ -41,6 +41,7 @@
#define GUIO_MIDIAPPLEIIGS "\015" #define GUIO_MIDIAPPLEIIGS "\015"
#define GUIO_MIDITOWNS "\016" #define GUIO_MIDITOWNS "\016"
#define GUIO_MIDIPC98 "\017" #define GUIO_MIDIPC98 "\017"
#define GUIO_MIDISEGACD "\018"
#define GUIO_MIDIMT32 "\020" #define GUIO_MIDIMT32 "\020"
#define GUIO_MIDIGM "\021" #define GUIO_MIDIGM "\021"

View file

@ -304,15 +304,7 @@ public:
* Base constructor, creates an empty hashmap. * Base constructor, creates an empty hashmap.
*/ */
template<class Key, class Val, class HashFunc, class EqualFunc> template<class Key, class Val, class HashFunc, class EqualFunc>
HashMap<Key, Val, HashFunc, EqualFunc>::HashMap() HashMap<Key, Val, HashFunc, EqualFunc>::HashMap() : _defaultVal() {
//
// We have to skip _defaultVal() on PS2 to avoid gcc 3.2.2 ICE
//
#ifdef __PLAYSTATION2__
{
#else
: _defaultVal() {
#endif
_mask = HASHMAP_MIN_CAPACITY - 1; _mask = HASHMAP_MIN_CAPACITY - 1;
_storage = new Node *[HASHMAP_MIN_CAPACITY]; _storage = new Node *[HASHMAP_MIN_CAPACITY];
assert(_storage != nullptr); assert(_storage != nullptr);

View file

@ -23,11 +23,7 @@
#ifndef COMMON_INTTYPES_H #ifndef COMMON_INTTYPES_H
#define COMMON_INTTYPES_H #define COMMON_INTTYPES_H
#if defined(__PLAYSTATION2__) #if defined(_MSC_VER) || defined (__SYMBIAN32__)
typedef uint8 uint8_t;
typedef uint16 uint16_t;
typedef uint32 uint32_t;
#elif defined(_MSC_VER) || defined (__SYMBIAN32__)
typedef signed char int8_t; typedef signed char int8_t;
typedef signed short int16_t; typedef signed short int16_t;
typedef unsigned char uint8_t; typedef unsigned char uint8_t;

View file

@ -53,7 +53,7 @@
#include "common/str.h" #include "common/str.h"
// Win32 incompatibilities // Win32 incompatibilities
#if (defined(WIN32) && !defined(__GNUC__)) || defined(__PLAYSTATION2__) #if (defined(WIN32) && !defined(__GNUC__))
static inline bool isnan(double x) { static inline bool isnan(double x) {
return x != x; return x != x;
} }

View file

@ -37,7 +37,6 @@
namespace Common { namespace Common {
#define MBI_INFOHDR 128
#define MBI_ZERO1 0 #define MBI_ZERO1 0
#define MBI_NAMELEN 1 #define MBI_NAMELEN 1
#define MBI_ZERO2 74 #define MBI_ZERO2 74
@ -386,10 +385,11 @@ bool MacResManager::isMacBinary(SeekableReadStream &stream) {
uint32 rsrcSize = READ_BE_UINT32(infoHeader + MBI_RFLEN); uint32 rsrcSize = READ_BE_UINT32(infoHeader + MBI_RFLEN);
uint32 dataSizePad = (((dataSize + 127) >> 7) << 7); uint32 dataSizePad = (((dataSize + 127) >> 7) << 7);
uint32 rsrcSizePad = (((rsrcSize + 127) >> 7) << 7); // Files produced by ISOBuster are not padded, thus, compare with the actual size
//uint32 rsrcSizePad = (((rsrcSize + 127) >> 7) << 7);
// Length check // Length check
if (MBI_INFOHDR + dataSizePad + rsrcSizePad == (uint32)stream.size()) { if (MBI_INFOHDR + dataSizePad + rsrcSize <= (uint32)stream.size()) {
resForkOffset = MBI_INFOHDR + dataSizePad; resForkOffset = MBI_INFOHDR + dataSizePad;
} }
} }
@ -425,10 +425,11 @@ bool MacResManager::loadFromMacBinary(SeekableReadStream &stream) {
uint32 rsrcSize = READ_BE_UINT32(infoHeader + MBI_RFLEN); uint32 rsrcSize = READ_BE_UINT32(infoHeader + MBI_RFLEN);
uint32 dataSizePad = (((dataSize + 127) >> 7) << 7); uint32 dataSizePad = (((dataSize + 127) >> 7) << 7);
uint32 rsrcSizePad = (((rsrcSize + 127) >> 7) << 7); // Files produced by ISOBuster are not padded, thus, compare with the actual size
//uint32 rsrcSizePad = (((rsrcSize + 127) >> 7) << 7);
// Length check // Length check
if (MBI_INFOHDR + dataSizePad + rsrcSizePad == (uint32)stream.size()) { if (MBI_INFOHDR + dataSizePad + rsrcSize <= (uint32)stream.size()) {
_resForkOffset = MBI_INFOHDR + dataSizePad; _resForkOffset = MBI_INFOHDR + dataSizePad;
_resForkSize = rsrcSize; _resForkSize = rsrcSize;
} }
@ -751,4 +752,28 @@ void MacResManager::dumpRaw() {
} }
} }
MacResManager::MacVers *MacResManager::parseVers(SeekableReadStream *vvers) {
MacVers *v = new MacVers;
v->majorVer = vvers->readByte();
v->minorVer = vvers->readByte();
byte devStage = vvers->readByte();
const char *s;
switch (devStage) {
case 0x20: s = "Prealpha"; break;
case 0x40: s = "Alpha"; break;
case 0x60: s = "Beta"; break;
case 0x80: s = "Final"; break;
default: s = "";
}
v->devStr = s;
v->preReleaseVer = vvers->readByte();
v->region = vvers->readUint16BE();
v->str = vvers->readPascalString();
v->msg = vvers->readPascalString();
return v;
}
} // End of namespace Common } // End of namespace Common

View file

@ -49,6 +49,8 @@ typedef Array<uint32> MacResTagArray;
*/ */
class MacResManager { class MacResManager {
#define MBI_INFOHDR 128
public: public:
MacResManager(); MacResManager();
~MacResManager(); ~MacResManager();
@ -139,6 +141,8 @@ public:
*/ */
SeekableReadStream *getDataFork(); SeekableReadStream *getDataFork();
static int getDataForkOffset() { return MBI_INFOHDR; }
/** /**
* Get the name of a given resource * Get the name of a given resource
* @param typeID FourCC of the type * @param typeID FourCC of the type
@ -188,6 +192,24 @@ public:
*/ */
void dumpRaw(); void dumpRaw();
/**
* Check if the given stream is in the MacBinary format.
* @param stream The stream we're checking
*/
static bool isMacBinary(SeekableReadStream &stream);
struct MacVers {
byte majorVer;
byte minorVer;
byte devStage;
String devStr;
byte preReleaseVer;
uint16 region;
String str;
String msg;
};
static MacVers *parseVers(SeekableReadStream *vvers);
private: private:
SeekableReadStream *_stream; SeekableReadStream *_stream;
String _baseFileName; String _baseFileName;
@ -200,12 +222,6 @@ private:
static String constructAppleDoubleName(String name); static String constructAppleDoubleName(String name);
static String disassembleAppleDoubleName(String name, bool *isAppleDouble); static String disassembleAppleDoubleName(String name, bool *isAppleDouble);
/**
* Check if the given stream is in the MacBinary format.
* @param stream The stream we're checking
*/
static bool isMacBinary(SeekableReadStream &stream);
/** /**
* Do a sanity check whether the given stream is a raw resource fork. * Do a sanity check whether the given stream is a raw resource fork.
* *

View file

@ -78,10 +78,17 @@ public:
* This is a MemoryReadStream subclass which adds non-endian * This is a MemoryReadStream subclass which adds non-endian
* read methods whose endianness is set on the stream creation. * read methods whose endianness is set on the stream creation.
*/ */
class MemoryReadStreamEndian : public MemoryReadStream, public ReadStreamEndian { class MemoryReadStreamEndian : public MemoryReadStream, public SeekableReadStreamEndian {
public: public:
MemoryReadStreamEndian(const byte *buf, uint32 len, bool bigEndian) MemoryReadStreamEndian(const byte *buf, uint32 len, bool bigEndian)
: MemoryReadStream(buf, len), ReadStreamEndian(bigEndian) {} : MemoryReadStream(buf, len), SeekableReadStreamEndian(bigEndian), ReadStreamEndian(bigEndian) {}
int32 pos() const { return MemoryReadStream::pos(); }
int32 size() const { return MemoryReadStream::size(); }
bool seek(int32 offs, int whence = SEEK_SET) { return MemoryReadStream::seek(offs, whence); }
bool skip(uint32 offset) { return MemoryReadStream::seek(offset, SEEK_CUR); }
}; };
/** /**

View file

@ -272,7 +272,6 @@
defined(__DS__) || \ defined(__DS__) || \
defined(__3DS__) || \ defined(__3DS__) || \
defined(IPHONE) || \ defined(IPHONE) || \
defined(__PLAYSTATION2__) || \
defined(__PSP__) || \ defined(__PSP__) || \
defined(__SYMBIAN32__) defined(__SYMBIAN32__)
@ -443,13 +442,8 @@
typedef unsigned int uint32; typedef unsigned int uint32;
typedef signed int int32; typedef signed int int32;
typedef unsigned int uint; typedef unsigned int uint;
#ifdef __PLAYSTATION2__
typedef signed long int64;
typedef unsigned long uint64;
#else
typedef signed long long int64; typedef signed long long int64;
typedef unsigned long long uint64; typedef unsigned long long uint64;
#endif
#endif #endif
// //
@ -462,7 +456,8 @@
defined(_M_X64) || \ defined(_M_X64) || \
defined(__ppc64__) || \ defined(__ppc64__) || \
defined(__powerpc64__) || \ defined(__powerpc64__) || \
defined(__LP64__) defined(__LP64__) || \
defined(_M_ARM64)
typedef uint64 uintptr; typedef uint64 uintptr;

View file

@ -284,7 +284,7 @@ String &String::operator=(char c) {
} }
String &String::operator+=(const char *str) { String &String::operator+=(const char *str) {
if (_str <= str && str <= _str + _size) if (pointerInOwnBuffer(str))
return operator+=(String(str)); return operator+=(String(str));
int len = strlen(str); int len = strlen(str);
@ -297,6 +297,16 @@ String &String::operator+=(const char *str) {
return *this; return *this;
} }
bool String::pointerInOwnBuffer(const char *str) const {
//compared pointers must be in the same array or UB
//cast to intptr however is IB
//which includes comparision of the values
uintptr ownBuffStart = (uintptr)_str;
uintptr ownBuffEnd = (uintptr)(_str + _size);
uintptr candidateAddr = (uintptr)str;
return ownBuffStart <= candidateAddr && candidateAddr <= ownBuffEnd;
}
String &String::operator+=(const String &str) { String &String::operator+=(const String &str) {
if (&str == this) if (&str == this)
return operator+=(String(str)); return operator+=(String(str));

View file

@ -398,6 +398,8 @@ protected:
void decRefCount(int *oldRefCount); void decRefCount(int *oldRefCount);
void initWithCStr(const char *str, uint32 len); void initWithCStr(const char *str, uint32 len);
bool pointerInOwnBuffer(const char *str) const;
void decodeUTF8(U32String &dst) const; void decodeUTF8(U32String &dst) const;
void decodeOneByte(U32String &dst, CodePage page) const; void decodeOneByte(U32String &dst, CodePage page) const;
}; };

View file

@ -279,6 +279,8 @@ public:
*/ */
class ReadStream : virtual public Stream { class ReadStream : virtual public Stream {
public: public:
ReadStream() {}
/** /**
* Returns true if a read failed because the stream end has been reached. * Returns true if a read failed because the stream end has been reached.
* This flag is cleared by clearErr(). * This flag is cleared by clearErr().
@ -707,7 +709,7 @@ public:
* This is a SeekableReadStream subclass which adds non-endian read * This is a SeekableReadStream subclass which adds non-endian read
* methods whose endianness is set during the stream creation. * methods whose endianness is set during the stream creation.
*/ */
class SeekableReadStreamEndian : public SeekableReadStream, public ReadStreamEndian { class SeekableReadStreamEndian : virtual public SeekableReadStream, virtual public ReadStreamEndian {
public: public:
SeekableReadStreamEndian(bool bigEndian) : ReadStreamEndian(bigEndian) {} SeekableReadStreamEndian(bool bigEndian) : ReadStreamEndian(bigEndian) {}
}; };

View file

@ -66,7 +66,7 @@ public:
* Manipulating the parent stream directly /will/ mess up a substream. * Manipulating the parent stream directly /will/ mess up a substream.
* @see SubReadStream * @see SubReadStream
*/ */
class SeekableSubReadStream : public SubReadStream, public SeekableReadStream { class SeekableSubReadStream : public SubReadStream, virtual public SeekableReadStream {
protected: protected:
SeekableReadStream *_parentStream; SeekableReadStream *_parentStream;
uint32 _begin; uint32 _begin;
@ -86,12 +86,20 @@ public:
* Manipulating the parent stream directly /will/ mess up a substream. * Manipulating the parent stream directly /will/ mess up a substream.
* @see SubReadStream * @see SubReadStream
*/ */
class SeekableSubReadStreamEndian : public SeekableSubReadStream, public ReadStreamEndian { class SeekableSubReadStreamEndian : virtual public SeekableSubReadStream, virtual public SeekableReadStreamEndian {
public: public:
SeekableSubReadStreamEndian(SeekableReadStream *parentStream, uint32 begin, uint32 end, bool bigEndian, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO) SeekableSubReadStreamEndian(SeekableReadStream *parentStream, uint32 begin, uint32 end, bool bigEndian, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO)
: SeekableSubReadStream(parentStream, begin, end, disposeParentStream), : SeekableSubReadStream(parentStream, begin, end, disposeParentStream),
SeekableReadStreamEndian(bigEndian),
ReadStreamEndian(bigEndian) { ReadStreamEndian(bigEndian) {
} }
virtual int32 pos() const { return SeekableSubReadStream::pos(); }
virtual int32 size() const { return SeekableSubReadStream::size(); }
virtual bool seek(int32 offset, int whence = SEEK_SET) { return SeekableSubReadStream::seek(offset, whence); }
void hexdump(int len, int bytesPerLine = 16, int startOffset = 0) { SeekableSubReadStream::hexdump(len, bytesPerLine, startOffset); }
bool skip(uint32 offset) { return SeekableSubReadStream::seek(offset, SEEK_CUR); }
}; };
/** /**

View file

@ -64,7 +64,7 @@ void UnicodeBiDiText::initWithU32String(const U32String &input) {
FriBidiChar *visual_str = new FriBidiChar[buff_length * sizeof(FriBidiChar)]; FriBidiChar *visual_str = new FriBidiChar[buff_length * sizeof(FriBidiChar)];
_log_to_vis_index = new uint32[input_size]; _log_to_vis_index = new uint32[input_size];
_vis_to_log_index = new uint32[input_size]; _vis_to_log_index = new uint32[input_size];
FriBidiCharType pbase_dir = FRIBIDI_TYPE_ON; FriBidiParType pbase_dir = FRIBIDI_PAR_ON;
if (!fribidi_log2vis( if (!fribidi_log2vis(
/* input */ /* input */
@ -89,7 +89,11 @@ void UnicodeBiDiText::initWithU32String(const U32String &input) {
delete[] visual_str; delete[] visual_str;
} }
#else #else
warning("initWithU32String: Fribidi not available, using input string as fallback"); static bool fribidiWarning = true;
if (fribidiWarning) {
warning("initWithU32String: Fribidi not available, will use input strings as fallback.");
fribidiWarning = false;
}
visual = input; visual = input;
#endif #endif

View file

@ -23,6 +23,7 @@
#include "common/file.h" #include "common/file.h"
#include "common/memstream.h" #include "common/memstream.h"
#include "common/str.h" #include "common/str.h"
#include "common/ustr.h"
#include "common/winexe.h" #include "common/winexe.h"
#include "common/winexe_ne.h" #include "common/winexe_ne.h"
#include "common/winexe_pe.h" #include "common/winexe_pe.h"
@ -183,4 +184,59 @@ WinResources *WinResources::createFromEXE(const String &fileName) {
return nullptr; return nullptr;
} }
WinResources::VersionHash *WinResources::parseVersionInfo(SeekableReadStream *res) {
VersionHash *versionMap = new VersionHash;
while (res->pos() < res->size() && !res->eos()) {
while (res->pos() % 4 && !res->eos()) // Pad to 4
res->readByte();
/* uint16 len = */ res->readUint16LE();
uint16 valLen = res->readUint16LE();
uint16 type = res->readUint16LE();
uint16 c;
Common::U32String info;
while ((c = res->readUint16LE()) != 0 && !res->eos())
info += c;
while (res->pos() % 4 && !res->eos()) // Pad to 4
res->readByte();
if (res->eos())
break;
if (type != 0) { // text
Common::U32String value;
for (int j = 0; j < valLen; j++)
value += res->readUint16LE();
versionMap->setVal(info.encode(), value);
} else {
if (info == "VS_VERSION_INFO") {
uint16 pos2 = res->pos() + valLen;
res->readUint32LE();
res->readUint32LE();
uint16 fileB = res->readUint16LE();
uint16 fileA = res->readUint16LE();
uint16 fileD = res->readUint16LE();
uint16 fileC = res->readUint16LE();
uint16 prodB = res->readUint16LE();
uint16 prodA = res->readUint16LE();
uint16 prodD = res->readUint16LE();
uint16 prodC = res->readUint16LE();
versionMap->setVal("File:", Common::String::format("%d.%d.%d.%d", fileA, fileB, fileC, fileD));
versionMap->setVal("Prod:", Common::String::format("%d.%d.%d.%d", prodA, prodB, prodC, prodD));
while (res->pos() != pos2 && !res->eos())
res->readByte();
}
}
}
return versionMap;
}
} // End of namespace Common } // End of namespace Common

View file

@ -130,6 +130,10 @@ public:
} }
static WinResources *createFromEXE(const String &fileName); static WinResources *createFromEXE(const String &fileName);
typedef Common::HashMap<Common::String, Common::U32String, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> VersionHash;
static VersionHash *parseVersionInfo(SeekableReadStream *stream);
}; };
} // End of namespace Common } // End of namespace Common

251
configure vendored
View file

@ -178,6 +178,7 @@ _iconv=auto
_tts=no _tts=no
_gtk=auto _gtk=auto
_fribidi=auto _fribidi=auto
_test_cxx11=no
# Default option behavior yes/no # Default option behavior yes/no
_debug_build=auto _debug_build=auto
_release_build=auto _release_build=auto
@ -542,7 +543,7 @@ get_system_exe_extension() {
riscos) riscos)
_exeext=",e1f" _exeext=",e1f"
;; ;;
3ds | dreamcast | ds | gamecube | n64 | ps2 | psp | switch | wii) 3ds | dreamcast | ds | gamecube | n64 | psp | switch | wii)
_exeext=".elf" _exeext=".elf"
;; ;;
gph-linux) gph-linux)
@ -1716,14 +1717,6 @@ ppc-amigaos)
_host_cpu=powerpc _host_cpu=powerpc
_host_alias=$_host _host_alias=$_host
;; ;;
ps2)
_host_os=ps2
_host_cpu=mips64r5900el
_host_alias=ee
# PS2 bogus dirs: they actually depend on launch medium
datadir='host:data'
docdir='host:docs'
;;
ps3) ps3)
_host_os=ps3 _host_os=ps3
_host_cpu=powerpc _host_cpu=powerpc
@ -1777,26 +1770,6 @@ switch)
# Switch SDK has C++11 constructs so we must enable it # Switch SDK has C++11 constructs so we must enable it
_use_cxx11=yes _use_cxx11=yes
;; ;;
tizen)
_host_os=tizen
_host_cpu=arm
_host_alias=arm-linux-gnueabi
;;
webos)
_host_os=webos
_host_cpu=arm
_host_alias=arm-none-linux-gnueabi
# The prefix is always the same on WebOS so we hardcode the default
# here. It is still possible to define a custom prefix which is
# needed when packaging the app with a user-specific app ID.
test "x$prefix" = xNONE && prefix=/media/cryptofs/apps/usr/palm/applications/org.residualvm.residualvm
# WebOS apps are installed into app-specific directories. The
# default directory structure of ScummVM makes no sense here so we
# hardcode WebOS specific directories here.
datarootdir='${prefix}/data'
datadir='${datarootdir}'
docdir='${prefix}/doc'
;;
wii) wii)
_host_os=wii _host_os=wii
_host_cpu=powerpc _host_cpu=powerpc
@ -1825,7 +1798,7 @@ else
fi fi
case $_host in case $_host in
arm-*riscos | caanoo | gp2x | gp2xwiz | openpandora | ps2 | psp | psp2 | switch) arm-*riscos | caanoo | gp2x | gp2xwiz | openpandora | psp | psp2 | switch)
if test "$_debug_build" = auto; then if test "$_debug_build" = auto; then
# If you want to debug one of these platforms, use '--disable-optimizations --enable-debug' # If you want to debug one of these platforms, use '--disable-optimizations --enable-debug'
_debug_build=no _debug_build=no
@ -1894,12 +1867,6 @@ n64)
exit 1 exit 1
fi fi
;; ;;
ps2)
if test -z "$PS2SDK"; then
echo "Please set PS2SDK in your environment. export PS2SDK=<path to ps2 sdk>"
exit 1
fi
;;
ps3) ps3)
if test -z "$PS3DEV"; then if test -z "$PS3DEV"; then
echo "Please set PS3DEV in your environment. export PS3DEV=<path to ps3 toolchain>" echo "Please set PS3DEV in your environment. export PS3DEV=<path to ps3 toolchain>"
@ -1955,22 +1922,6 @@ riscos)
add_line_to_config_mk "BINDHELP := bindhelp" add_line_to_config_mk "BINDHELP := bindhelp"
fi fi
;; ;;
tizen)
if test -z "$TIZEN_ROOTSTRAP"; then
echo "Please set TIZEN_ROOTSTRAP in your environment. export TIZEN_ROOTSTRAP=<path to Tizen SDK device profile>"
exit 1
fi
;;
webos)
if test -z "$WEBOS_SDK"; then
echo "Please set WEBOS_SDK in your environment. export WEBOS_SDK=<path to WebOS SDK>"
exit 1
fi
if test -z "$WEBOS_PDK"; then
echo "Please set WEBOS_PDK in your environment. export WEBOS_PDK=<path to WebOS PDK>"
exit 1
fi
;;
*) *)
;; ;;
esac esac
@ -2269,7 +2220,7 @@ fi
# However, some platforms use GNU extensions in system header files, so # However, some platforms use GNU extensions in system header files, so
# for these we must not use -pedantic. # for these we must not use -pedantic.
case $_host_os in case $_host_os in
3ds | android | androidsdl | gamecube | ps2 | psp | switch | tizen | wii | webos) 3ds | android | androidsdl | gamecube | psp | switch | wii)
;; ;;
*) *)
# ICC does not support pedantic, while GCC and clang do. # ICC does not support pedantic, while GCC and clang do.
@ -2509,7 +2460,7 @@ case $_host_cpu in
openpandora) openpandora)
define_in_config_if_yes yes 'USE_ARM_NEON_ASPECT_CORRECTOR' define_in_config_if_yes yes 'USE_ARM_NEON_ASPECT_CORRECTOR'
;; ;;
androidsdl-armeabi | arm-*riscos | caanoo | ds | gp2x | gp2xwiz | maemo | tizen) androidsdl-armeabi | arm-*riscos | caanoo | ds | gp2x | gp2xwiz | maemo )
define_in_config_if_yes yes 'USE_ARM_SCALER_ASM' define_in_config_if_yes yes 'USE_ARM_SCALER_ASM'
# FIXME: The following feature exhibits a bug. It produces distorted # FIXME: The following feature exhibits a bug. It produces distorted
# sound since 9003ce517ff9906b0288f9f7c02197fd091d4554. The ARM # sound since 9003ce517ff9906b0288f9f7c02197fd091d4554. The ARM
@ -2944,14 +2895,6 @@ EOF
add_line_to_config_mk 'N64 = 1' add_line_to_config_mk 'N64 = 1'
_nuked_opl=no _nuked_opl=no
;; ;;
ps2)
append_var CXXFLAGS "-G2"
append_var DEFINES "-D_EE"
append_var DEFINES "-D__PLAYSTATION2__"
if test -z "$PS2SDK_OLD"; then
append_var DEFINES "-D__NEW_PS2SDK__"
fi
;;
ps3) ps3)
# Force use of SDL and freetype from the ps3 toolchain # Force use of SDL and freetype from the ps3 toolchain
_sdlpath="$PS3DEV/portlibs/ppu:$PS3DEV/portlibs/ppu/bin" _sdlpath="$PS3DEV/portlibs/ppu:$PS3DEV/portlibs/ppu/bin"
@ -3056,28 +2999,6 @@ EOF
_optimization_level=-O3 _optimization_level=-O3
fi fi
;; ;;
tizen)
add_line_to_config_mk "TIZEN_ROOTSTRAP = $TIZEN_ROOTSTRAP"
append_var LDFLAGS "--sysroot=${TIZEN_ROOTSTRAP}"
append_var LDFLAGS "-L${TIZEN_LIBS}/lib"
append_var CXXFLAGS "-I${TIZEN_LIBS}/include"
;;
webos)
append_var CXXFLAGS "--sysroot=$WEBOS_PDK/arm-gcc/sysroot"
append_var CXXFLAGS "-I$WEBOS_PDK/include"
append_var CXXFLAGS "-I$WEBOS_PDK/include/SDL"
append_var CXXFLAGS "-I$WEBOS_PDK/device/usr/include"
# These compiler options are needed to support the Palm Pixi
append_var CXXFLAGS "-mcpu=arm1136jf-s"
append_var CXXFLAGS "-mfpu=vfp "
append_var CXXFLAGS "-mfloat-abi=softfp"
append_var LDFLAGS "-L$WEBOS_PDK/device/lib"
append_var LDFLAGS "-L$WEBOS_PDK/device/usr/lib"
append_var LDFLAGS "-Wl,--allow-shlib-undefined"
append_var LDFLAGS "--sysroot=$WEBOS_PDK/arm-gcc/sysroot"
add_line_to_config_mk "WEBOS_SDK = $WEBOS_SDK"
_seq_midi=no
;;
wii) wii)
_optimization_level=-Os _optimization_level=-Os
append_var CXXFLAGS "-mrvl" append_var CXXFLAGS "-mrvl"
@ -3432,47 +3353,6 @@ if test -n "$_host"; then
_port_mk="backends/platform/sdl/amigaos/amigaos.mk" _port_mk="backends/platform/sdl/amigaos/amigaos.mk"
;; ;;
ps2)
append_var DEFINES "-DDISABLE_TEXT_CONSOLE"
append_var DEFINES "-DDISABLE_COMMAND_LINE"
append_var DEFINES "-DDISABLE_DOSBOX_OPL"
append_var DEFINES "-DDISABLE_SID"
append_var DEFINES "-DDISABLE_NES_APU"
append_var CXXFLAGS "-fno-exceptions"
append_var CXXFLAGS "-fno-rtti"
_backend="ps2"
_build_scalers=no
_mt32emu=no
_nuked_opl=no
# HACK to enable mad & zlib (they are not properly detected due to linker issues).
# This trick doesn't work for tremor right now, as the PS2 port the resulting library
# libtremor, while our code later on expects it to be called libvorbisidec.
# TODO: Enable tremor, e.g. by adding -ltremor or by renaming the lib.
# Disable this for older SDK as this breaks the build otherwise...
if test -z "$PS2SDK_OLD" && test "$_tremor" = auto; then
_tremor=yes
fi
_mad=yes
_zlib=yes
# HACK to fix compilation of C source files for now.
add_line_to_config_mk 'CC := ee-gcc'
add_line_to_config_mk 'CFLAGS := -std=c99 -W -Wno-unused-parameter -Wconversion -pedantic -G2 -s -O2 -Wuninitialized'
# HACK to fix linking for now. It seems ee-g++ does not handle linking correctly.
LD=ee-gcc
if test "$_debug_build" = yes; then
# TODO: Setup debug build properly
append_var DEFINES "-D__PS2_DEBUG__"
#append_var INCLUDES "-I$(PS2GDB)/ee"
#append_var LDFLAGS "-L$(PS2GDB)/lib"
append_var LDFLAGS "-lps2gdbStub"
append_var LDFLAGS "-lps2ip"
append_var LDFLAGS "-ldebug"
else
# If not building for debug mode, strip binaries.
append_var CXXFLAGS "-s"
fi
;;
ps3) ps3)
_timidity=no _timidity=no
_vkeybd=yes _vkeybd=yes
@ -3515,29 +3395,6 @@ if test -n "$_host"; then
_vkeybd=yes _vkeybd=yes
_port_mk="backends/platform/sdl/switch/switch.mk" _port_mk="backends/platform/sdl/switch/switch.mk"
;; ;;
tizen)
_unix=yes
_backend="tizen"
_port_mk="backends/platform/tizen/tizen.mk"
_build_scalers=no
_seq_midi=no
_mt32emu=no
_timidity=no
_vkeybd=yes
# Tizen relies on the OpenGL ES output thus we always enable it.
_opengl_mode=gles
;;
webos)
_backend="webos"
_port_mk="backends/platform/webos/webos.mk"
_build_scalers=yes
_build_hq_scalers=no
_timidity=no
_mt32emu=no
_seq_midi=no
_vkeybd=no
add_line_to_config_mk "HOST_COMPILER = `uname`"
;;
wii) wii)
_backend="wii" _backend="wii"
_build_scalers=no _build_scalers=no
@ -3651,6 +3508,7 @@ case $_backend in
;; ;;
null) null)
append_var DEFINES "-DUSE_NULL_DRIVER" append_var DEFINES "-DUSE_NULL_DRIVER"
_text_console=yes
;; ;;
openpandora) openpandora)
append_var DEFINES "-DOPENPANDORA" append_var DEFINES "-DOPENPANDORA"
@ -3660,26 +3518,6 @@ case $_backend in
fi fi
_sdl=auto _sdl=auto
;; ;;
ps2)
append_var DEFINES "-D_EE"
append_var DEFINES "-DFORCE_RETURN_TO_LAUNCHER"
append_var INCLUDES "-I$PS2SDK/ee/include"
append_var INCLUDES "-I$PS2SDK/common/include"
append_var INCLUDES "-I$PS2SDK/ports/include"
if test "$_dynamic_modules" = no ; then
append_var LDFLAGS "-mno-crt0"
append_var LDFLAGS "$PS2SDK/ee/startup/crt0.o"
append_var LDFLAGS "-T $PS2SDK/ee/startup/linkfile"
fi
append_var LDFLAGS "-L$PS2SDK/ee/lib"
append_var LDFLAGS "-L$PS2SDK/ports/lib"
if test -d "$PS2DEV/isjpcm"; then
append_var INCLUDES "-I$PS2DEV/isjpcm/include"
append_var LDFLAGS "-L$PS2DEV/isjpcm/lib"
fi
append_var LIBS "-lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm"
append_var LIBS "-lm -lc -lfileXio -lkernel -lstdc++"
;;
psp) psp)
append_var DEFINES "-D__PSP__" append_var DEFINES "-D__PSP__"
append_var DEFINES "-DDISABLE_COMMAND_LINE" append_var DEFINES "-DDISABLE_COMMAND_LINE"
@ -3712,34 +3550,6 @@ case $_backend in
_sdl=auto _sdl=auto
append_var MODULES "backends/platform/sdl" append_var MODULES "backends/platform/sdl"
;; ;;
tizen)
# dirent.h not available. NONSTANDARD_PORT==ensure portdefs.h is included
append_var DEFINES "-DTIZEN -DDISABLE_STDIO_FILESTREAM -DNONSTANDARD_PORT"
append_var DEFINES "-DNO_STDERR_STDOUT"
append_var DEFINES "-DDISABLE_COMMAND_LINE"
append_var INCLUDES '-I$(srcdir)/backends/platform/tizen'
append_var INCLUDES '-I$(TIZEN_ROOTSTRAP)/usr/include'
append_var INCLUDES '-I$(TIZEN_ROOTSTRAP)/usr/include/osp'
if test "$_debug_build" = yes; then
append_var CXXFLAGS "-D_DEBUG -DBUILD_DLL -O0 -g3"
fi
# created a shared library for inclusion via the eclipse build
append_var CXXFLAGS "-Wno-psabi"
append_var CXXFLAGS "--sysroot=${TIZEN_ROOTSTRAP}"
append_var CXXFLAGS "-fmessage-length=0"
append_var CXXFLAGS "-fPIC"
HOSTEXEPRE=lib
HOSTEXEEXT=.a
;;
webos)
# There is no sdl-config in the WebOS PDK so we don't use find_sdlconfig here.
# The PDL library acts as the WebOS device toolchain, and is required to control the virtual keyboard among other OS-level events.
append_var LIBS "-lSDL -lpdl"
append_var DEFINES "-DWEBOS"
append_var MODULES "backends/platform/sdl"
_sdl=yes
_sdlversion=1.2.0
;;
wii) wii)
append_var DEFINES "-D__WII__" append_var DEFINES "-D__WII__"
append_var DEFINES "-DGEKKO" append_var DEFINES "-DGEKKO"
@ -3883,7 +3693,7 @@ fi
# Enable 16bit support only for backends which support it # Enable 16bit support only for backends which support it
# #
case $_backend in case $_backend in
3ds | android | androidsdl | dingux | dc | gph | iphone | ios7 | maemo | openpandora | psp | psp2 | samsungtv | sdl | switch | tizen | webos | wii) 3ds | android | androidsdl | dingux | dc | gph | iphone | ios7 | maemo | null | openpandora | psp | psp2 | samsungtv | sdl | switch | wii)
if test "$_16bit" = auto ; then if test "$_16bit" = auto ; then
_16bit=yes _16bit=yes
else else
@ -3956,10 +3766,10 @@ esac
# #
echo_n "Checking if host is POSIX compliant... " echo_n "Checking if host is POSIX compliant... "
case $_host_os in case $_host_os in
amigaos* | cygwin* | dreamcast | ds | gamecube | mingw* | n64 | ps2 | ps3 | psp2 | psp | riscos | wii) amigaos* | cygwin* | dreamcast | ds | gamecube | mingw* | n64 | ps3 | psp2 | psp | riscos | wii)
_posix=no _posix=no
;; ;;
3ds | android | androidsdl | beos* | bsd* | darwin* | freebsd* | gnu* | gph-linux | haiku* | hpux* | iphone | ios7 | irix*| k*bsd*-gnu* | linux* | maemo | mint* | netbsd* | openbsd* | solaris* | sunos* | switch | uclinux* | webos) 3ds | android | androidsdl | beos* | bsd* | darwin* | freebsd* | gnu* | gph-linux | haiku* | hpux* | iphone | ios7 | irix*| k*bsd*-gnu* | linux* | maemo | mint* | netbsd* | openbsd* | solaris* | sunos* | switch | uclinux*)
_posix=yes _posix=yes
;; ;;
os2-emx*) os2-emx*)
@ -4165,14 +3975,6 @@ PLUGIN_EXTRA_DEPS = $(EXECUTABLE)
PLUGIN_LDFLAGS := -Wl,--enable-auto-import -shared ./libresidualvm.a PLUGIN_LDFLAGS := -Wl,--enable-auto-import -shared ./libresidualvm.a
PRE_OBJS_FLAGS := -Wl,--whole-archive PRE_OBJS_FLAGS := -Wl,--whole-archive
POST_OBJS_FLAGS := -Wl,--export-all-symbols -Wl,--no-whole-archive -Wl,--out-implib,./libresidualvm.a POST_OBJS_FLAGS := -Wl,--export-all-symbols -Wl,--no-whole-archive -Wl,--out-implib,./libresidualvm.a
'
;;
ps2)
_elf_loader=yes
append_var DEFINES "-DUNCACHED_PLUGINS"
_mak_plugins='
LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/main_prog.ld
PLUGIN_LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/plugin.ld -lstdc++ -lc
' '
;; ;;
psp) psp)
@ -4181,18 +3983,6 @@ PLUGIN_LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backend
_mak_plugins=' _mak_plugins='
LDFLAGS += -Wl,-T$(srcdir)/backends/plugins/psp/main_prog.ld LDFLAGS += -Wl,-T$(srcdir)/backends/plugins/psp/main_prog.ld
PLUGIN_LDFLAGS += -Wl,-T$(srcdir)/backends/plugins/psp/plugin.ld -lstdc++ -lc PLUGIN_LDFLAGS += -Wl,-T$(srcdir)/backends/plugins/psp/plugin.ld -lstdc++ -lc
'
;;
webos)
_plugin_prefix="lib"
_plugin_suffix=".so"
append_var CXXFLAGS "-fpic"
append_var LIBS "-ldl"
_mak_plugins='
PLUGIN_EXTRA_DEPS =
PLUGIN_LDFLAGS += -shared $(LDFLAGS)
PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive
POST_OBJS_FLAGS := -Wl,-no-whole-archive
' '
;; ;;
*) *)
@ -4310,7 +4100,7 @@ int main(void) { return 0; }
EOF EOF
cc_check -lsapi -lole32 && _tts=yes cc_check -lsapi -lole32 && _tts=yes
;; ;;
linux*) linux* | freebsd*)
cat > $TMPC << EOF cat > $TMPC << EOF
#include <speech-dispatcher/libspeechd.h> #include <speech-dispatcher/libspeechd.h>
int main(void) { return 0; } int main(void) { return 0; }
@ -4385,8 +4175,6 @@ if test "$_tremor" = yes && test "$_vorbis" = no; then
if test "$_tremolo" = yes ; then if test "$_tremolo" = yes ; then
add_line_to_config_h '#define USE_TREMOLO' add_line_to_config_h '#define USE_TREMOLO'
append_var LIBS "$TREMOR_LIBS -ltremolo" append_var LIBS "$TREMOR_LIBS -ltremolo"
elif test "$_host" = ps2 ; then
LIBS="-ltremor $LIBS"
else else
append_var LIBS "$TREMOR_LIBS -lvorbisidec" append_var LIBS "$TREMOR_LIBS -lvorbisidec"
fi fi
@ -4977,6 +4765,10 @@ if test "$_fluidsynth" = auto; then
int main(void) { delete_fluid_settings(new_fluid_settings()); return 0; } int main(void) { delete_fluid_settings(new_fluid_settings()); return 0; }
EOF EOF
cc_check_no_clean $FLUIDSYNTH_CFLAGS $FLUIDSYNTH_LIBS && _fluidsynth=yes cc_check_no_clean $FLUIDSYNTH_CFLAGS $FLUIDSYNTH_LIBS && _fluidsynth=yes
if test "$_fluidsynth" != yes && test "$_pkg_config" = "yes" && $_pkgconfig --exists fluidsynth; then
FLUIDSYNTH_LIBS="`$_pkgconfig --static --libs fluidsynth`"
cc_check_no_clean $FLUIDSYNTH_CFLAGS $FLUIDSYNTH_LIBS && _fluidsynth=yes
fi
if test "$_fluidsynth" != yes; then if test "$_fluidsynth" != yes; then
FLUIDSYNTH_LIBS="$FLUIDSYNTH_STATIC_LIBS" FLUIDSYNTH_LIBS="$FLUIDSYNTH_STATIC_LIBS"
cc_check_no_clean $FLUIDSYNTH_CFLAGS $FLUIDSYNTH_LIBS && _fluidsynth=yes cc_check_no_clean $FLUIDSYNTH_CFLAGS $FLUIDSYNTH_LIBS && _fluidsynth=yes
@ -5495,6 +5287,7 @@ case $_host_os in
linuxcd=no linuxcd=no
cat > $TMPC << EOF cat > $TMPC << EOF
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <sys/sysmacros.h>
#include <sys/types.h> #include <sys/types.h>
int main(void) { int main(void) {
int x = CDROMREADAUDIO; int x = CDROMREADAUDIO;
@ -5732,8 +5525,8 @@ if test "$_tts" = "no"; then
echo "no" echo "no"
else else
case $_host_os in case $_host_os in
linux*) linux* | freebsd*)
echo "linux" echo "speech dispatcher"
_tts=yes _tts=yes
define_in_config_if_yes $_tts 'USE_SPEECH_DISPATCHER' define_in_config_if_yes $_tts 'USE_SPEECH_DISPATCHER'
append_var LIBS '-lspeechd -lpthread' append_var LIBS '-lspeechd -lpthread'
@ -5814,15 +5607,11 @@ case $_backend in
# Add ../plugins as a path so plugins can be found when running from a .PND. # Add ../plugins as a path so plugins can be found when running from a .PND.
append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"../plugins\\\"" append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"../plugins\\\""
;; ;;
maemo | webos) maemo)
# The WebOS and Maemo apps want the plugins in the "lib" directory # The Maemo apps want the plugins in the "lib" directory
# without a scummvm sub directory. # without a scummvm sub directory.
append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"$libdir\\\"" append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"$libdir\\\""
;; ;;
ps2)
# PS2 bogus dir: it actually depends on launch medium
append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"host:plugins\\\""
;;
*) *)
append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"$libdir/residualvm\\\"" append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"$libdir/residualvm\\\""
;; ;;
@ -5849,7 +5638,7 @@ echo "$_enable_asan"
echo_n "Backend... " echo_n "Backend... "
echo_n "$_backend" echo_n "$_backend"
if test "$_backend" = "sdl" -a -n "$_sdlversion"; then if test "$_sdl" = yes -a -n "$_sdlversion"; then
echo_n " ($_sdlversion)" echo_n " ($_sdlversion)"
fi fi

View file

@ -28,26 +28,27 @@
#undef main #undef main
#endif // main #endif // main
#include "config.h"
#include "create_project.h" #include "create_project.h"
#include "config.h"
#include "cmake.h" #include "cmake.h"
#include "codeblocks.h" #include "codeblocks.h"
#include "msbuild.h"
#include "msvc.h" #include "msvc.h"
#include "visualstudio.h" #include "visualstudio.h"
#include "msbuild.h"
#include "xcode.h" #include "xcode.h"
#include <algorithm>
#include <fstream> #include <fstream>
#include <iomanip>
#include <iostream> #include <iostream>
#include <iterator>
#include <sstream> #include <sstream>
#include <stack> #include <stack>
#include <algorithm> #include <utility>
#include <iomanip>
#include <iterator>
#include <cstring>
#include <cstdlib> #include <cstdlib>
#include <cstring>
#include <ctime> #include <ctime>
#if (defined(_WIN32) || defined(WIN32)) && !defined(__GNUC__) #if (defined(_WIN32) || defined(WIN32)) && !defined(__GNUC__)
@ -57,11 +58,11 @@
#if (defined(_WIN32) || defined(WIN32)) #if (defined(_WIN32) || defined(WIN32))
#include <windows.h> #include <windows.h>
#else #else
#include <dirent.h>
#include <errno.h>
#include <sstream> #include <sstream>
#include <sys/param.h> #include <sys/param.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#endif #endif
namespace { namespace {
@ -133,7 +134,7 @@ int main(int argc, char *argv[]) {
setup.features = getAllFeatures(); setup.features = getAllFeatures();
ProjectType projectType = kProjectNone; ProjectType projectType = kProjectNone;
const MSVCVersion* msvc = NULL; const MSVCVersion *msvc = NULL;
int msvcVersion = 0; int msvcVersion = 0;
// Parse command line arguments // Parse command line arguments
@ -141,7 +142,7 @@ int main(int argc, char *argv[]) {
for (int i = 2; i < argc; ++i) { for (int i = 2; i < argc; ++i) {
if (!std::strcmp(argv[i], "--list-engines")) { if (!std::strcmp(argv[i], "--list-engines")) {
cout << " The following enables are available in the " PROJECT_DESCRIPTION " source distribution\n" cout << " The following enables are available in the " PROJECT_DESCRIPTION " source distribution\n"
" located at \"" << srcDir << "\":\n"; << " located at \"" << srcDir << "\":\n";
cout << " state | name | description\n\n"; cout << " state | name | description\n\n";
cout.setf(std::ios_base::left, std::ios_base::adjustfield); cout.setf(std::ios_base::left, std::ios_base::adjustfield);
@ -283,6 +284,8 @@ int main(int argc, char *argv[]) {
setup.tests = true; setup.tests = true;
} else if (!std::strcmp(argv[i], "--sdl1")) { } else if (!std::strcmp(argv[i], "--sdl1")) {
setup.useSDL2 = false; setup.useSDL2 = false;
} else if (!std::strcmp(argv[i], "--use-canonical-lib-names")) {
setup.useCanonicalLibNames = true;
} else { } else {
std::cerr << "ERROR: Unknown parameter \"" << argv[i] << "\"\n"; std::cerr << "ERROR: Unknown parameter \"" << argv[i] << "\"\n";
return -1; return -1;
@ -431,6 +434,12 @@ int main(int argc, char *argv[]) {
setup.libraries.push_back("sdl2"); setup.libraries.push_back("sdl2");
} }
if (setup.useCanonicalLibNames) {
for (StringList::iterator lib = setup.libraries.begin(); lib != setup.libraries.end(); ++lib) {
*lib = getCanonicalLibName(*lib);
}
}
// Add additional project-specific library // Add additional project-specific library
#ifdef ADDITIONAL_LIBRARY #ifdef ADDITIONAL_LIBRARY
setup.libraries.push_back(ADDITIONAL_LIBRARY); setup.libraries.push_back(ADDITIONAL_LIBRARY);
@ -475,7 +484,6 @@ int main(int argc, char *argv[]) {
provider = new CreateProjectTool::CodeBlocksProvider(globalWarnings, projectWarnings); provider = new CreateProjectTool::CodeBlocksProvider(globalWarnings, projectWarnings);
// Those libraries are automatically added by MSVC, but we need to add them manually with mingw // Those libraries are automatically added by MSVC, but we need to add them manually with mingw
setup.libraries.push_back("ole32"); setup.libraries.push_back("ole32");
setup.libraries.push_back("uuid"); setup.libraries.push_back("uuid");
@ -733,6 +741,9 @@ void displayHelp(const char *exe) {
" --tests Create project files for the tests\n" " --tests Create project files for the tests\n"
" (ignores --build-events and --installer, as well as engine settings)\n" " (ignores --build-events and --installer, as well as engine settings)\n"
" (default: false)\n" " (default: false)\n"
" --use-canonical-lib-names Use canonical library names for linking. This makes it easy to use\n"
" e.g. vcpkg-provided libraries\n"
" (default: false)\n"
"\n" "\n"
"Engines settings:\n" "Engines settings:\n"
" --list-engines list all available engines and their default state\n" " --list-engines list all available engines and their default state\n"
@ -952,9 +963,12 @@ bool parseEngine(const std::string &line, EngineDesc &engine) {
return false; return false;
++token; ++token;
engine.name = *token; ++token; engine.name = *token;
engine.desc = *token; ++token; ++token;
engine.enable = (*token == "yes"); ++token; engine.desc = *token;
++token;
engine.enable = (*token == "yes");
++token;
if (token != tokens.end()) { if (token != tokens.end()) {
engine.subEngines = tokenize(*token); engine.subEngines = tokenize(*token);
++token; ++token;
@ -1043,6 +1057,7 @@ TokenList tokenize(const std::string &input, char separator) {
} }
namespace { namespace {
// clang-format off
const Feature s_features[] = { const Feature s_features[] = {
// Libraries // Libraries
{ "libz", "USE_ZLIB", "zlib", true, "zlib (compression) support" }, { "libz", "USE_ZLIB", "zlib", true, "zlib (compression) support" },
@ -1085,6 +1100,7 @@ const Feature s_features[] = {
{ "langdetect", "USE_DETECTLANG", "", true, "System language detection support" }, // This feature actually depends on "translation", there { "langdetect", "USE_DETECTLANG", "", true, "System language detection support" }, // This feature actually depends on "translation", there
// is just no current way of properly detecting this... // is just no current way of properly detecting this...
{ "text-console", "USE_TEXT_CONSOLE_FOR_DEBUGGER", "", false, "Text console debugger" }, // This feature is always applied in xcode projects { "text-console", "USE_TEXT_CONSOLE_FOR_DEBUGGER", "", false, "Text console debugger" }, // This feature is always applied in xcode projects
// { "tts", "USE_TTS", "", true, "Text to speech support"} // ResidualVM change
}; };
const Tool s_tools[] = { const Tool s_tools[] = {
@ -1101,8 +1117,46 @@ const MSVCVersion s_msvc[] = {
{ 15, "Visual Studio 2017", "12.00", "15", "15.0", "v141", "llvm" }, { 15, "Visual Studio 2017", "12.00", "15", "15.0", "v141", "llvm" },
{ 16, "Visual Studio 2019", "12.00", "Version 16", "16.0", "v142", "llvm" } { 16, "Visual Studio 2019", "12.00", "Version 16", "16.0", "v142", "llvm" }
}; };
const std::pair<std::string, std::string> s_canonical_lib_name_map[] = {
std::make_pair("jpeg-static", "jpeg"),
std::make_pair("libfaad", "faad"),
std::make_pair("libFLAC_static", "FLAC"),
std::make_pair("libfluidsynth", "fluidsynth"),
std::make_pair("libmad", "mad"),
std::make_pair("libmpeg2", "mpeg2"),
std::make_pair("libogg_static", "ogg"),
std::make_pair("libtheora_static", "theora"),
std::make_pair("libvorbis_static", "vorbis"),
std::make_pair("libvorbisfile_static", "vorbisfile"),
std::make_pair("SDL_net", "SDL2_net"), // Only support SDL2
std::make_pair("win_utf8_io_static", "FLAC") // This is some FLAC-specific library not needed with vcpkg, but as there's '.lib' appended to each library, we can't set it to empty, so set it to FLAC again instead
};
const char *s_msvc_arch_names[] = {"arm64", "x86", "x64"};
const char *s_msvc_config_names[] = {"arm64", "Win32", "x64"};
// clang-format on
} // End of anonymous namespace } // End of anonymous namespace
std::string getMSVCArchName(MSVC_Architecture arch) {
return s_msvc_arch_names[arch];
}
std::string getMSVCConfigName(MSVC_Architecture arch) {
return s_msvc_config_names[arch];
}
std::string getCanonicalLibName(const std::string &lib) {
const size_t libCount = sizeof(s_canonical_lib_name_map) / sizeof(s_canonical_lib_name_map[0]);
for (size_t i = 0; i < libCount; ++i) {
if (s_canonical_lib_name_map[i].first == lib) {
return s_canonical_lib_name_map[i].second;
}
}
return lib;
}
FeatureList getAllFeatures() { FeatureList getAllFeatures() {
const size_t featureCount = sizeof(s_features) / sizeof(s_features[0]); const size_t featureCount = sizeof(s_features) / sizeof(s_features[0]);
@ -1124,15 +1178,30 @@ StringList getFeatureDefines(const FeatureList &features) {
return defines; return defines;
} }
StringList getFeatureLibraries(const Feature &feature) {
StringList libraries;
if (feature.enable && feature.libraries && feature.libraries[0]) {
StringList fLibraries = tokenize(feature.libraries);
libraries.splice(libraries.end(), fLibraries);
}
// The libraries get sorted as they can get used in algorithms where ordering is a
// precondition, e.g. merge()
libraries.sort();
return libraries;
}
StringList getFeatureLibraries(const FeatureList &features) { StringList getFeatureLibraries(const FeatureList &features) {
StringList libraries; StringList libraries;
for (FeatureList::const_iterator i = features.begin(); i != features.end(); ++i) { for (FeatureList::const_iterator i = features.begin(); i != features.end(); ++i) {
if (i->enable && i->libraries && i->libraries[0]) { StringList fl = getFeatureLibraries(*i);
StringList fLibraries = tokenize(i->libraries); for (StringList::const_iterator flit = fl.begin(); flit != fl.end(); ++flit) {
libraries.splice(libraries.end(), fLibraries); libraries.push_back(*flit);
} }
} }
libraries.sort();
return libraries; return libraries;
} }
@ -1156,6 +1225,27 @@ bool getFeatureBuildState(const std::string &name, FeatureList &features) {
} }
} }
BuildSetup removeFeatureFromSetup(BuildSetup setup, const std::string &feature) {
// TODO: use const_iterator in C++11
for (FeatureList::iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
if (i->enable && feature == i->name) {
StringList feature_libs = getFeatureLibraries(*i);
for (StringList::iterator lib = feature_libs.begin(); lib != feature_libs.end(); ++lib) {
if (setup.useCanonicalLibNames) {
*lib = getCanonicalLibName(*lib);
}
setup.libraries.remove(*lib);
}
if (i->define && i->define[0]) {
setup.defines.remove(i->define);
}
setup.features.erase(i);
break;
}
}
return setup;
}
ToolList getAllTools() { ToolList getAllTools() {
const size_t toolCount = sizeof(s_tools) / sizeof(s_tools[0]); const size_t toolCount = sizeof(s_tools) / sizeof(s_tools[0]);
@ -1250,7 +1340,8 @@ void splitFilename(const std::string &fileName, std::string &name, std::string &
std::string basename(const std::string &fileName) { std::string basename(const std::string &fileName) {
const std::string::size_type slash = fileName.find_last_of('/'); const std::string::size_type slash = fileName.find_last_of('/');
if (slash == std::string::npos) return fileName; if (slash == std::string::npos)
return fileName;
return fileName.substr(slash + 1); return fileName.substr(slash + 1);
} }
@ -1410,7 +1501,6 @@ void createDirectory(const std::string &dir) {
} }
} }
#endif #endif
} }
/** /**
@ -1501,7 +1591,8 @@ void ProjectProvider::createProject(BuildSetup &setup) {
if (i->first == setup.projectName) if (i->first == setup.projectName)
continue; continue;
// Retain the files between engines if we're creating a single project // Retain the files between engines if we're creating a single project
in.clear(); ex.clear(); in.clear();
ex.clear();
const std::string moduleDir = setup.srcDir + targetFolder + i->first; const std::string moduleDir = setup.srcDir + targetFolder + i->first;
@ -1511,7 +1602,8 @@ void ProjectProvider::createProject(BuildSetup &setup) {
if (setup.tests) { if (setup.tests) {
// Create the main project file. // Create the main project file.
in.clear(); ex.clear(); in.clear();
ex.clear();
createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex);
createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex);
createModuleList(setup.srcDir + "/base", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/base", setup.defines, setup.testDirs, in, ex);
@ -1525,7 +1617,8 @@ void ProjectProvider::createProject(BuildSetup &setup) {
createProjectFile(setup.projectName, svmUUID, setup, setup.srcDir, in, ex); createProjectFile(setup.projectName, svmUUID, setup, setup.srcDir, in, ex);
} else if (!setup.devTools) { } else if (!setup.devTools) {
// Last but not least create the main project file. // Last but not least create the main project file.
in.clear(); ex.clear(); in.clear();
ex.clear();
// File list for the Project file // File list for the Project file
createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex);
createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex);
@ -1620,8 +1713,10 @@ std::string ProjectProvider::createUUID() const {
for (int i = 0; i < kUUIDLen; ++i) for (int i = 0; i < kUUIDLen; ++i)
uuid[i] = (unsigned char)((std::rand() / (double)(RAND_MAX)) * 0xFF); uuid[i] = (unsigned char)((std::rand() / (double)(RAND_MAX)) * 0xFF);
uuid[8] &= 0xBF; uuid[8] |= 0x80; uuid[8] &= 0xBF;
uuid[6] &= 0x4F; uuid[6] |= 0x40; uuid[8] |= 0x80;
uuid[6] &= 0x4F;
uuid[6] |= 0x40;
return UUIDToString(uuid); return UUIDToString(uuid);
#endif #endif
@ -1643,7 +1738,7 @@ std::string ProjectProvider::createUUID(const std::string &name) const {
// Hash unique ScummVM namespace {5f5b43e8-35ff-4f1e-ad7e-a2a87e9b5254} // Hash unique ScummVM namespace {5f5b43e8-35ff-4f1e-ad7e-a2a87e9b5254}
const BYTE uuidNs[kUUIDLen] = const BYTE uuidNs[kUUIDLen] =
{ 0x5f, 0x5b, 0x43, 0xe8, 0x35, 0xff, 0x4f, 0x1e, 0xad, 0x7e, 0xa2, 0xa8, 0x7e, 0x9b, 0x52, 0x54 }; {0x5f, 0x5b, 0x43, 0xe8, 0x35, 0xff, 0x4f, 0x1e, 0xad, 0x7e, 0xa2, 0xa8, 0x7e, 0x9b, 0x52, 0x54};
if (!CryptHashData(hHash, uuidNs, kUUIDLen, 0)) { if (!CryptHashData(hHash, uuidNs, kUUIDLen, 0)) {
CryptDestroyHash(hHash); CryptDestroyHash(hHash);
CryptReleaseContext(hProv, 0); CryptReleaseContext(hProv, 0);
@ -1667,8 +1762,10 @@ std::string ProjectProvider::createUUID(const std::string &name) const {
} }
// Add version and variant // Add version and variant
uuid[6] &= 0x0F; uuid[6] |= 0x30; uuid[6] &= 0x0F;
uuid[8] &= 0x3F; uuid[8] |= 0x80; uuid[6] |= 0x30;
uuid[8] &= 0x3F;
uuid[8] |= 0x80;
CryptDestroyHash(hHash); CryptDestroyHash(hHash);
CryptReleaseContext(hProv, 0); CryptReleaseContext(hProv, 0);
@ -1719,7 +1816,8 @@ void ProjectProvider::addFilesToProject(const std::string &dir, std::ofstream &p
continue; continue;
// Search for duplicates // Search for duplicates
StringList::const_iterator j = i; ++j; StringList::const_iterator j = i;
++j;
for (; j != includeList.end(); ++j) { for (; j != includeList.end(); ++j) {
std::string candidateFileName = getLastPathComponent(*j); std::string candidateFileName = getLastPathComponent(*j);
std::transform(candidateFileName.begin(), candidateFileName.end(), candidateFileName.begin(), tolower); std::transform(candidateFileName.begin(), candidateFileName.end(), candidateFileName.begin(), tolower);
@ -1990,7 +2088,7 @@ void ProjectProvider::createEnginePluginsTable(const BuildSetup &setup) {
<< "#endif\n"; << "#endif\n";
} }
} }
} // End of anonymous namespace } // namespace CreateProjectTool
void error(const std::string &message) { void error(const std::string &message) {
std::cerr << "ERROR: " << message << "!" << std::endl; std::cerr << "ERROR: " << message << "!" << std::endl;

View file

@ -27,8 +27,8 @@
#define __has_feature(x) 0 // Compatibility with non-clang compilers. #define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif #endif
#include <map>
#include <list> #include <list>
#include <map>
#include <string> #include <string>
#include <cassert> #include <cassert>
@ -200,6 +200,14 @@ StringList getFeatureDefines(const FeatureList &features);
*/ */
StringList getFeatureLibraries(const FeatureList &features); StringList getFeatureLibraries(const FeatureList &features);
/**
* Returns a list of all external library files, according to the
* feature passed.
*
* @param features Feature for the build (this may contain features, which are *not* enabled!)
*/
StringList getFeatureLibraries(const Feature &feature);
/** /**
* Sets the state of a given feature. This can be used to * Sets the state of a given feature. This can be used to
* either include or exclude an feature. * either include or exclude an feature.
@ -247,6 +255,7 @@ struct BuildSetup {
bool runBuildEvents; ///< Run build events as part of the build (generate revision number and copy engine/theme data & needed files to the build folder bool runBuildEvents; ///< Run build events as part of the build (generate revision number and copy engine/theme data & needed files to the build folder
bool createInstaller; ///< Create installer after the build bool createInstaller; ///< Create installer after the build
bool useSDL2; ///< Whether to use SDL2 or not. bool useSDL2; ///< Whether to use SDL2 or not.
bool useCanonicalLibNames; ///< Whether to use canonical libraries names or default ones
BuildSetup() { BuildSetup() {
devTools = false; devTools = false;
@ -254,6 +263,7 @@ struct BuildSetup {
runBuildEvents = false; runBuildEvents = false;
createInstaller = false; createInstaller = false;
useSDL2 = true; useSDL2 = true;
useCanonicalLibNames = false;
} }
}; };
@ -263,9 +273,9 @@ struct BuildSetup {
* @param message The error message to print to stderr. * @param message The error message to print to stderr.
*/ */
#if defined(__GNUC__) #if defined(__GNUC__)
#define NORETURN_POST __attribute__((__noreturn__)) #define NORETURN_POST __attribute__((__noreturn__))
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#define NORETURN_PRE __declspec(noreturn) #define NORETURN_PRE __declspec(noreturn)
#endif #endif
#ifndef NORETURN_PRE #ifndef NORETURN_PRE
@ -294,6 +304,15 @@ struct MSVCVersion {
}; };
typedef std::list<MSVCVersion> MSVCList; typedef std::list<MSVCVersion> MSVCList;
enum MSVC_Architecture {
ARCH_ARM64,
ARCH_X86,
ARCH_AMD64
};
std::string getMSVCArchName(MSVC_Architecture arch);
std::string getMSVCConfigName(MSVC_Architecture arch);
/** /**
* Creates a list of all supported versions of Visual Studio. * Creates a list of all supported versions of Visual Studio.
* *
@ -316,6 +335,23 @@ const MSVCVersion *getMSVCVersion(int version);
*/ */
int getInstalledMSVC(); int getInstalledMSVC();
/**
* Return a "canonical" library name, so it is easier to integrate other providers of dependencies.
*
* @param lib The link library as provided by ScummVM libs.
* @return Canonical link library.
*/
std::string getCanonicalLibName(const std::string &lib);
/**
* Removes given feature from setup.
*
* @param setup The setup to be processed.
* @param feature The feature to be removed
* @return A copy of setup less feature.
*/
BuildSetup removeFeatureFromSetup(BuildSetup setup, const std::string &feature);
namespace CreateProjectTool { namespace CreateProjectTool {
/** /**
@ -590,7 +626,6 @@ protected:
std::string createUUID(const std::string &name) const; std::string createUUID(const std::string &name) const;
private: private:
/** /**
* Returns the string representation of an existing UUID. * Returns the string representation of an existing UUID.
* *
@ -608,6 +643,6 @@ private:
void createEnginePluginsTable(const BuildSetup &setup); void createEnginePluginsTable(const BuildSetup &setup);
}; };
} // End of CreateProjectTool namespace } // namespace CreateProjectTool
#endif // TOOLS_CREATE_PROJECT_H #endif // TOOLS_CREATE_PROJECT_H

View file

@ -20,11 +20,11 @@
* *
*/ */
#include "config.h"
#include "msbuild.h" #include "msbuild.h"
#include "config.h"
#include <fstream>
#include <algorithm> #include <algorithm>
#include <fstream>
namespace CreateProjectTool { namespace CreateProjectTool {
@ -32,8 +32,12 @@ namespace CreateProjectTool {
// MSBuild Provider (Visual Studio 2010 and later) // MSBuild Provider (Visual Studio 2010 and later)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
MSBuildProvider::MSBuildProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version, const MSVCVersion& msvc) MSBuildProvider::MSBuildProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version, const MSVCVersion &msvc)
: MSVCProvider(global_warnings, project_warnings, version, msvc) { : MSVCProvider(global_warnings, project_warnings, version, msvc) {
_archs.push_back(ARCH_X86);
_archs.push_back(ARCH_AMD64);
_archs.push_back(ARCH_ARM64);
} }
const char *MSBuildProvider::getProjectExtension() { const char *MSBuildProvider::getProjectExtension() {
@ -48,23 +52,23 @@ namespace {
inline void outputConfiguration(std::ostream &project, const std::string &config, const std::string &platform) { inline void outputConfiguration(std::ostream &project, const std::string &config, const std::string &platform) {
project << "\t\t<ProjectConfiguration Include=\"" << config << "|" << platform << "\">\n" project << "\t\t<ProjectConfiguration Include=\"" << config << "|" << platform << "\">\n"
"\t\t\t<Configuration>" << config << "</Configuration>\n" << "\t\t\t<Configuration>" << config << "</Configuration>\n"
"\t\t\t<Platform>" << platform << "</Platform>\n" << "\t\t\t<Platform>" << platform << "</Platform>\n"
"\t\t</ProjectConfiguration>\n"; << "\t\t</ProjectConfiguration>\n";
} }
inline void outputConfigurationType(const BuildSetup &setup, std::ostream &project, const std::string &name, const std::string &config, const std::string &toolset) { inline void outputConfigurationType(const BuildSetup &setup, std::ostream &project, const std::string &name, const std::string &config, const std::string &toolset) {
project << "\t<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='" << config << "'\" Label=\"Configuration\">\n" project << "\t<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='" << config << "'\" Label=\"Configuration\">\n"
"\t\t<ConfigurationType>" << ((name == setup.projectName || setup.devTools || setup.tests) ? "Application" : "StaticLibrary") << "</ConfigurationType>\n" << "\t\t<ConfigurationType>" << ((name == setup.projectName || setup.devTools || setup.tests) ? "Application" : "StaticLibrary") << "</ConfigurationType>\n"
"\t\t<PlatformToolset>" << toolset << "</PlatformToolset>\n" << "\t\t<PlatformToolset>" << toolset << "</PlatformToolset>\n"
"\t</PropertyGroup>\n"; << "\t</PropertyGroup>\n";
} }
inline void outputProperties(std::ostream &project, const std::string &config, const std::string &properties) { inline void outputProperties(std::ostream &project, const std::string &config, const std::string &properties) {
project << "\t<ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='" << config << "'\" Label=\"PropertySheets\">\n" project << "\t<ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='" << config << "'\" Label=\"PropertySheets\">\n"
"\t\t<Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n" << "\t\t<Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n"
"\t\t<Import Project=\"" << properties << "\" />\n" << "\t\t<Import Project=\"" << properties << "\" />\n"
"\t</ImportGroup>\n"; << "\t</ImportGroup>\n";
} }
} // End of anonymous namespace } // End of anonymous namespace
@ -73,68 +77,73 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
const StringList &includeList, const StringList &excludeList) { const StringList &includeList, const StringList &excludeList) {
const std::string projectFile = setup.outputDir + '/' + name + getProjectExtension(); const std::string projectFile = setup.outputDir + '/' + name + getProjectExtension();
std::ofstream project(projectFile.c_str()); std::ofstream project(projectFile.c_str());
if (!project) if (!project || !project.is_open()) {
error("Could not open \"" + projectFile + "\" for writing"); error("Could not open \"" + projectFile + "\" for writing");
return;
}
project << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" project << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" << "<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
"\t<ItemGroup Label=\"ProjectConfigurations\">\n"; << "\t<ItemGroup Label=\"ProjectConfigurations\">\n";
outputConfiguration(project, "Debug", "Win32");
outputConfiguration(project, "Debug", "x64");
outputConfiguration(project, "Analysis", "Win32");
outputConfiguration(project, "Analysis", "x64");
outputConfiguration(project, "LLVM", "Win32");
outputConfiguration(project, "LLVM", "x64");
outputConfiguration(project, "Release", "Win32");
outputConfiguration(project, "Release", "x64");
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
outputConfiguration(project, "Debug", getMSVCConfigName(*arch));
outputConfiguration(project, "Analysis", getMSVCConfigName(*arch));
outputConfiguration(project, "LLVM", getMSVCConfigName(*arch));
outputConfiguration(project, "Release", getMSVCConfigName(*arch));
}
project << "\t</ItemGroup>\n"; project << "\t</ItemGroup>\n";
// Project name & Guid // Project name & Guid
project << "\t<PropertyGroup Label=\"Globals\">\n" project << "\t<PropertyGroup Label=\"Globals\">\n"
"\t\t<ProjectGuid>{" << uuid << "}</ProjectGuid>\n" << "\t\t<ProjectGuid>{" << uuid << "}</ProjectGuid>\n"
"\t\t<RootNamespace>" << name << "</RootNamespace>\n" << "\t\t<RootNamespace>" << name << "</RootNamespace>\n"
"\t\t<Keyword>Win32Proj</Keyword>\n" << "\t\t<Keyword>Win32Proj</Keyword>\n"
"\t\t<VCTargetsPath Condition=\"'$(VCTargetsPath" << _version << ")' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''\">$(VCTargetsPath" << _version << ")</VCTargetsPath>\n" << "\t\t<VCTargetsPath Condition=\"'$(VCTargetsPath" << _version << ")' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''\">$(VCTargetsPath" << _version << ")</VCTargetsPath>\n";
"\t</PropertyGroup>\n";
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
project << "\t\t<VcpkgTriplet Condition=\"'$(Platform)' == '" << getMSVCConfigName(*arch) << "'\">" << getMSVCArchName(*arch) << "-windows</VcpkgTriplet>\n";
}
project << "\t</PropertyGroup>\n";
// Shared configuration // Shared configuration
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n"; project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n";
outputConfigurationType(setup, project, name, "Release|Win32", _msvcVersion.toolsetMSVC); for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
outputConfigurationType(setup, project, name, "Analysis|Win32", _msvcVersion.toolsetMSVC); outputConfigurationType(setup, project, name, "Release|" + getMSVCConfigName(*arch), _msvcVersion.toolsetMSVC);
outputConfigurationType(setup, project, name, "LLVM|Win32", _msvcVersion.toolsetLLVM); outputConfigurationType(setup, project, name, "Analysis" + getMSVCConfigName(*arch), _msvcVersion.toolsetMSVC);
outputConfigurationType(setup, project, name, "Debug|Win32", _msvcVersion.toolsetMSVC); outputConfigurationType(setup, project, name, "LLVM|" + getMSVCConfigName(*arch), _msvcVersion.toolsetLLVM);
outputConfigurationType(setup, project, name, "Release|x64", _msvcVersion.toolsetMSVC); outputConfigurationType(setup, project, name, "Debug|" + getMSVCConfigName(*arch), _msvcVersion.toolsetMSVC);
outputConfigurationType(setup, project, name, "LLVM|x64", _msvcVersion.toolsetLLVM); }
outputConfigurationType(setup, project, name, "Analysis|x64", _msvcVersion.toolsetMSVC);
outputConfigurationType(setup, project, name, "Debug|x64", _msvcVersion.toolsetMSVC);
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n" project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n"
"\t<ImportGroup Label=\"ExtensionSettings\">\n" << "\t<ImportGroup Label=\"ExtensionSettings\">\n"
"\t</ImportGroup>\n"; << "\t</ImportGroup>\n";
outputProperties(project, "Release|Win32", setup.projectDescription + "_Release.props"); for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
outputProperties(project, "Analysis|Win32", setup.projectDescription + "_Analysis.props"); outputProperties(project, "Release|" + getMSVCConfigName(*arch), setup.projectDescription + "_Release" + getMSVCArchName(*arch) + ".props");
outputProperties(project, "LLVM|Win32", setup.projectDescription + "_LLVM.props"); outputProperties(project, "Analysis|" + getMSVCConfigName(*arch), setup.projectDescription + "_Analysis" + getMSVCArchName(*arch) + ".props");
outputProperties(project, "Debug|Win32", setup.projectDescription + "_Debug.props"); outputProperties(project, "LLVM|" + getMSVCConfigName(*arch), setup.projectDescription + "_LLVM" + getMSVCArchName(*arch) + ".props");
outputProperties(project, "Release|x64", setup.projectDescription + "_Release64.props"); outputProperties(project, "Debug|" + getMSVCConfigName(*arch), setup.projectDescription + "_Debug" + getMSVCArchName(*arch) + ".props");
outputProperties(project, "Analysis|x64", setup.projectDescription + "_Analysis64.props"); }
outputProperties(project, "LLVM|x64", setup.projectDescription + "_LLVM64.props");
outputProperties(project, "Debug|x64", setup.projectDescription + "_Debug64.props");
project << "\t<PropertyGroup Label=\"UserMacros\" />\n"; project << "\t<PropertyGroup Label=\"UserMacros\" />\n";
// Project-specific settings (analysis uses debug properties) // Project-specific settings (analysis uses debug properties)
outputProjectSettings(project, name, setup, false, true, "Debug"); for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
outputProjectSettings(project, name, setup, false, true, "Analysis"); BuildSetup archsetup = setup;
outputProjectSettings(project, name, setup, false, true, "LLVM"); std::map<MSVC_Architecture, StringList>::const_iterator disabled_features_it = _arch_disabled_features.find(*arch);
outputProjectSettings(project, name, setup, true, true, "Release"); if (disabled_features_it != _arch_disabled_features.end()) {
outputProjectSettings(project, name, setup, false, false, "Debug"); for (StringList::const_iterator j = disabled_features_it->second.begin(); j != disabled_features_it->second.end(); ++j) {
outputProjectSettings(project, name, setup, false, false, "Analysis"); archsetup = removeFeatureFromSetup(archsetup, *j);
outputProjectSettings(project, name, setup, false, false, "LLVM"); }
outputProjectSettings(project, name, setup, true, false, "Release"); }
outputProjectSettings(project, name, archsetup, false, *arch, "Debug");
outputProjectSettings(project, name, archsetup, false, *arch, "Analysis");
outputProjectSettings(project, name, archsetup, false, *arch, "LLVM");
outputProjectSettings(project, name, archsetup, true, *arch, "Release");
}
// Files // Files
std::string modulePath; std::string modulePath;
@ -200,18 +209,20 @@ void MSBuildProvider::createFiltersFile(const BuildSetup &setup, const std::stri
const std::string filtersFile = setup.outputDir + '/' + name + getProjectExtension() + ".filters"; const std::string filtersFile = setup.outputDir + '/' + name + getProjectExtension() + ".filters";
std::ofstream filters(filtersFile.c_str()); std::ofstream filters(filtersFile.c_str());
if (!filters) if (!filters || !filters.is_open()) {
error("Could not open \"" + filtersFile + "\" for writing"); error("Could not open \"" + filtersFile + "\" for writing");
return;
}
filters << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" filters << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Project ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"; << "<Project ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n";
// Output the list of filters // Output the list of filters
filters << "\t<ItemGroup>\n"; filters << "\t<ItemGroup>\n";
for (std::list<std::string>::iterator filter = _filters.begin(); filter != _filters.end(); ++filter) { for (std::list<std::string>::iterator filter = _filters.begin(); filter != _filters.end(); ++filter) {
filters << "\t\t<Filter Include=\"" << *filter << "\">\n" filters << "\t\t<Filter Include=\"" << *filter << "\">\n"
"\t\t\t<UniqueIdentifier>" << createUUID() << "</UniqueIdentifier>\n" << "\t\t\t<UniqueIdentifier>" << createUUID() << "</UniqueIdentifier>\n"
"\t\t</Filter>\n"; << "\t\t</Filter>\n";
} }
filters << "\t</ItemGroup>\n"; filters << "\t</ItemGroup>\n";
@ -231,8 +242,8 @@ void MSBuildProvider::outputFilter(std::ostream &filters, const FileEntries &fil
for (FileEntries::const_iterator entry = files.begin(), end = files.end(); entry != end; ++entry) { for (FileEntries::const_iterator entry = files.begin(), end = files.end(); entry != end; ++entry) {
if ((*entry).filter != "") { if ((*entry).filter != "") {
filters << "\t\t<" << action << " Include=\"" << (*entry).path << "\">\n" filters << "\t\t<" << action << " Include=\"" << (*entry).path << "\">\n"
"\t\t\t<Filter>" << (*entry).filter << "</Filter>\n" << "\t\t\t<Filter>" << (*entry).filter << "</Filter>\n"
"\t\t</" << action << ">\n"; << "\t\t</" << action << ">\n";
} else { } else {
filters << "\t\t<" << action << " Include=\"" << (*entry).path << "\" />\n"; filters << "\t\t<" << action << " Include=\"" << (*entry).path << "\" />\n";
} }
@ -249,14 +260,14 @@ void MSBuildProvider::writeReferences(const BuildSetup &setup, std::ofstream &ou
continue; continue;
output << "\t<ProjectReference Include=\"" << i->first << ".vcxproj\">\n" output << "\t<ProjectReference Include=\"" << i->first << ".vcxproj\">\n"
"\t\t<Project>{" << i->second << "}</Project>\n" << "\t\t<Project>{" << i->second << "}</Project>\n"
"\t</ProjectReference>\n"; << "\t</ProjectReference>\n";
} }
output << "\t</ItemGroup>\n"; output << "\t</ItemGroup>\n";
} }
void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) { void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration) {
// Check for project-specific warnings: // Check for project-specific warnings:
std::map<std::string, StringList>::iterator warningsIterator = _projectWarnings.find(name); std::map<std::string, StringList>::iterator warningsIterator = _projectWarnings.find(name);
bool enableLanguageExtensions = true; // ResidualVM bool enableLanguageExtensions = true; // ResidualVM
@ -271,8 +282,8 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
for (StringList::const_iterator i = warningsIterator->second.begin(); i != warningsIterator->second.end(); ++i) for (StringList::const_iterator i = warningsIterator->second.begin(); i != warningsIterator->second.end(); ++i)
warnings += *i + ';'; warnings += *i + ';';
project << "\t<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='" << configuration << "|" << (isWin32 ? "Win32" : "x64") << "'\">\n" project << "\t<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='" << configuration << "|" << getMSVCConfigName(arch) << "'\">\n"
"\t\t<ClCompile>\n"; << "\t\t<ClCompile>\n";
// Language Extensions // Language Extensions
if (setup.devTools || setup.tests || name == setup.projectName || enableLanguageExtensions) { if (setup.devTools || setup.tests || name == setup.projectName || enableLanguageExtensions) {
@ -298,33 +309,33 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
libraries += *i + ".lib;"; libraries += *i + ".lib;";
project << "\t\t<Link>\n" project << "\t\t<Link>\n"
"\t\t\t<OutputFile>$(OutDir)" << ((setup.devTools || setup.tests) ? name : setup.projectName) << ".exe</OutputFile>\n" << "\t\t\t<OutputFile>$(OutDir)" << ((setup.devTools || setup.tests) ? name : setup.projectName) << ".exe</OutputFile>\n"
"\t\t\t<AdditionalDependencies>" << libraries << "%(AdditionalDependencies)</AdditionalDependencies>\n" << "\t\t\t<AdditionalDependencies>" << libraries << "%(AdditionalDependencies)</AdditionalDependencies>\n"
"\t\t</Link>\n"; << "\t\t</Link>\n";
if (!setup.devTools && !setup.tests && setup.runBuildEvents) { if (!setup.devTools && !setup.tests && setup.runBuildEvents) {
project << "\t\t<PreBuildEvent>\n" project << "\t\t<PreBuildEvent>\n"
"\t\t\t<Message>Generate revision</Message>\n" << "\t\t\t<Message>Generate revision</Message>\n"
"\t\t\t<Command>" << getPreBuildEvent() << "</Command>\n" << "\t\t\t<Command>" << getPreBuildEvent() << "</Command>\n"
"\t\t</PreBuildEvent>\n"; << "\t\t</PreBuildEvent>\n";
// Copy data files to the build folder // Copy data files to the build folder
project << "\t\t<PostBuildEvent>\n" project << "\t\t<PostBuildEvent>\n"
"\t\t\t<Message>Copy data files to the build folder</Message>\n" << "\t\t\t<Message>Copy data files to the build folder</Message>\n"
"\t\t\t<Command>" << getPostBuildEvent(isWin32, setup) << "</Command>\n" << "\t\t\t<Command>" << getPostBuildEvent(arch, setup) << "</Command>\n"
"\t\t</PostBuildEvent>\n"; << "\t\t</PostBuildEvent>\n";
} else if (setup.tests) { } else if (setup.tests) {
project << "\t\t<PreBuildEvent>\n" project << "\t\t<PreBuildEvent>\n"
"\t\t\t<Message>Generate runner.cpp</Message>\n" << "\t\t\t<Message>Generate runner.cpp</Message>\n"
"\t\t\t<Command>" << getTestPreBuildEvent(setup) << "</Command>\n" << "\t\t\t<Command>" << getTestPreBuildEvent(setup) << "</Command>\n"
"\t\t</PreBuildEvent>\n"; << "\t\t</PreBuildEvent>\n";
} }
} }
project << "\t</ItemDefinitionGroup>\n"; project << "\t</ItemDefinitionGroup>\n";
} }
void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) { void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix, bool runBuildEvents) {
std::string warnings; std::string warnings;
for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i) for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
@ -339,22 +350,22 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea
definesList += REVISION_DEFINE ";"; definesList += REVISION_DEFINE ";";
properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" << "<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
"\t<PropertyGroup>\n" << "\t<PropertyGroup>\n"
"\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_Global</_PropertySheetDisplayName>\n" << "\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_Global</_PropertySheetDisplayName>\n"
"\t\t<ExecutablePath>$(" << LIBS_DEFINE << ")\\bin;$(" << LIBS_DEFINE << ")\\bin\\" << (bits == 32 ? "x86" : "x64") << ";$(ExecutablePath)</ExecutablePath>\n" << "\t\t<ExecutablePath>$(" << LIBS_DEFINE << ")\\bin;$(" << LIBS_DEFINE << ")\\bin\\" << getMSVCArchName(arch) << ";$(" << LIBS_DEFINE << ")\\$(Configuration)\\bin;$(ExecutablePath)</ExecutablePath>\n"
"\t\t<LibraryPath>$(" << LIBS_DEFINE << ")\\lib\\" << (bits == 32 ? "x86" : "x64") << ";$(" << LIBS_DEFINE << ")\\lib\\" << (bits == 32 ? "x86" : "x64") << "\\$(Configuration);$(LibraryPath)</LibraryPath>\n" << "\t\t<LibraryPath>$(" << LIBS_DEFINE << ")\\lib\\" << getMSVCArchName(arch) << ";$(" << LIBS_DEFINE << ")\\lib\\" << getMSVCArchName(arch) << "\\$(Configuration);$(" << LIBS_DEFINE << ")\\lib;$(" << LIBS_DEFINE << ")\\$(Configuration)\\lib;$(LibraryPath)</LibraryPath>\n"
"\t\t<IncludePath>$(" << LIBS_DEFINE << ")\\include;$(" << LIBS_DEFINE << ")\\include\\" << (setup.useSDL2 ? "SDL2" : "SDL") << ";$(IncludePath)</IncludePath>\n" << "\t\t<IncludePath>$(" << LIBS_DEFINE << ")\\include;$(" << LIBS_DEFINE << ")\\include\\" << (setup.useSDL2 ? "SDL2" : "SDL") << ";$(IncludePath)</IncludePath>\n"
"\t\t<OutDir>$(Configuration)" << bits << "\\</OutDir>\n" << "\t\t<OutDir>$(Configuration)" << getMSVCArchName(arch) << "\\</OutDir>\n"
"\t\t<IntDir>$(Configuration)" << bits << "\\$(ProjectName)\\</IntDir>\n" << "\t\t<IntDir>$(Configuration)" << getMSVCArchName(arch) << "\\$(ProjectName)\\</IntDir>\n"
"\t</PropertyGroup>\n" << "\t</PropertyGroup>\n"
"\t<ItemDefinitionGroup>\n" << "\t<ItemDefinitionGroup>\n"
"\t\t<ClCompile>\n" << "\t\t<ClCompile>\n"
"\t\t\t<DisableLanguageExtensions>true</DisableLanguageExtensions>\n" << "\t\t\t<DisableLanguageExtensions>true</DisableLanguageExtensions>\n"
"\t\t\t<DisableSpecificWarnings>" << warnings << ";%(DisableSpecificWarnings)</DisableSpecificWarnings>\n" << "\t\t\t<DisableSpecificWarnings>" << warnings << ";%(DisableSpecificWarnings)</DisableSpecificWarnings>\n"
"\t\t\t<AdditionalIncludeDirectories>.;" << prefix << ";" << prefix << "\\engines;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n" << "\t\t\t<AdditionalIncludeDirectories>.;" << prefix << ";" << prefix << "\\engines;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
"\t\t\t<PreprocessorDefinitions>" << definesList << "%(PreprocessorDefinitions)</PreprocessorDefinitions>\n" << "\t\t\t<PreprocessorDefinitions>" << definesList << "%(PreprocessorDefinitions)</PreprocessorDefinitions>\n"
"\t\t\t<ExceptionHandling>" << ((setup.devTools || setup.tests) ? "Sync" : "") << "</ExceptionHandling>\n"; << "\t\t\t<ExceptionHandling>" << ((setup.devTools || setup.tests) ? "Sync" : "") << "</ExceptionHandling>\n";
#if NEEDS_RTTI #if NEEDS_RTTI
properties << "\t\t\t<RuntimeTypeInfo>true</RuntimeTypeInfo>\n"; properties << "\t\t\t<RuntimeTypeInfo>true</RuntimeTypeInfo>\n";
@ -363,98 +374,99 @@ void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstrea
#endif #endif
properties << "\t\t\t<WarningLevel>Level4</WarningLevel>\n" properties << "\t\t\t<WarningLevel>Level4</WarningLevel>\n"
"\t\t\t<TreatWarningAsError>false</TreatWarningAsError>\n" << "\t\t\t<TreatWarningAsError>false</TreatWarningAsError>\n"
"\t\t\t<CompileAs>Default</CompileAs>\n" << "\t\t\t<CompileAs>Default</CompileAs>\n"
"\t\t\t<MultiProcessorCompilation>true</MultiProcessorCompilation>\n" << "\t\t\t<MultiProcessorCompilation>true</MultiProcessorCompilation>\n"
"\t\t\t<ConformanceMode>true</ConformanceMode>\n" << "\t\t\t<ConformanceMode>true</ConformanceMode>\n"
"\t\t\t<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>\n" << "\t\t\t<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>\n"
"\t\t</ClCompile>\n" << "\t\t</ClCompile>\n"
"\t\t<Link>\n" << "\t\t<Link>\n"
"\t\t\t<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\n" << "\t\t\t<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\n"
"\t\t\t<SubSystem>Console</SubSystem>\n"; << "\t\t\t<SubSystem>Console</SubSystem>\n";
if (!setup.devTools && !setup.tests) if (!setup.devTools && !setup.tests)
properties << "\t\t\t<EntryPointSymbol>WinMainCRTStartup</EntryPointSymbol>\n"; properties << "\t\t\t<EntryPointSymbol>WinMainCRTStartup</EntryPointSymbol>\n";
properties << "\t\t</Link>\n" properties << "\t\t</Link>\n"
"\t\t<ResourceCompile>\n" << "\t\t<ResourceCompile>\n"
"\t\t\t<AdditionalIncludeDirectories>.;" << prefix << ";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n" << "\t\t\t<AdditionalIncludeDirectories>.;" << prefix << ";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
"\t\t\t<PreprocessorDefinitions>" << definesList << "%(PreprocessorDefinitions)</PreprocessorDefinitions>\n" << "\t\t\t<PreprocessorDefinitions>" << definesList << "%(PreprocessorDefinitions)</PreprocessorDefinitions>\n"
"\t\t</ResourceCompile>\n" << "\t\t</ResourceCompile>\n"
"\t</ItemDefinitionGroup>\n" << "\t</ItemDefinitionGroup>\n"
"</Project>\n"; << "</Project>\n";
properties.flush(); properties.flush();
} }
void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) { void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration) {
const std::string outputBitness = (isWin32 ? "32" : "64"); std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + configuration + getMSVCArchName(arch) + getPropertiesExtension()).c_str());
if (!properties || !properties.is_open()) {
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str()); error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + configuration + getMSVCArchName(arch) + getPropertiesExtension() + "\" for writing");
if (!properties) return;
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing"); }
properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" << "<Project DefaultTargets=\"Build\" ToolsVersion=\"" << _msvcVersion.project << "\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
"\t<ImportGroup Label=\"PropertySheets\">\n" << "\t<ImportGroup Label=\"PropertySheets\">\n"
"\t\t<Import Project=\"" << setup.projectDescription << "_Global" << (isWin32 ? "" : "64") << ".props\" />\n" << "\t\t<Import Project=\"" << setup.projectDescription << "_Global" << getMSVCArchName(arch) << ".props\" />\n"
"\t</ImportGroup>\n" << "\t</ImportGroup>\n"
"\t<PropertyGroup>\n" << "\t<PropertyGroup>\n"
"\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_" << configuration << outputBitness << "</_PropertySheetDisplayName>\n" << "\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_" << configuration << getMSVCArchName(arch) << "</_PropertySheetDisplayName>\n"
"\t\t<LinkIncremental>" << (isRelease ? "false" : "true") << "</LinkIncremental>\n" << "\t\t<LinkIncremental>" << (isRelease ? "false" : "true") << "</LinkIncremental>\n"
"\t\t<GenerateManifest>false</GenerateManifest>\n" << "\t\t<GenerateManifest>false</GenerateManifest>\n"
"\t</PropertyGroup>\n" << "\t</PropertyGroup>\n"
"\t<ItemDefinitionGroup>\n" << "\t<ItemDefinitionGroup>\n"
"\t\t<ClCompile>\n"; << "\t\t<ClCompile>\n";
if (isRelease) { if (isRelease) {
properties << "\t\t\t<IntrinsicFunctions>true</IntrinsicFunctions>\n" properties << "\t\t\t<IntrinsicFunctions>true</IntrinsicFunctions>\n"
"\t\t\t<WholeProgramOptimization>true</WholeProgramOptimization>\n" << "\t\t\t<WholeProgramOptimization>true</WholeProgramOptimization>\n"
"\t\t\t<PreprocessorDefinitions>WIN32;RELEASE_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n" << "\t\t\t<PreprocessorDefinitions>WIN32;RELEASE_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n"
"\t\t\t<StringPooling>true</StringPooling>\n" << "\t\t\t<StringPooling>true</StringPooling>\n"
"\t\t\t<BufferSecurityCheck>false</BufferSecurityCheck>\n" << "\t\t\t<BufferSecurityCheck>false</BufferSecurityCheck>\n"
"\t\t\t<DebugInformationFormat></DebugInformationFormat>\n" << "\t\t\t<DebugInformationFormat></DebugInformationFormat>\n"
"\t\t\t<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n" << "\t\t\t<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n"
"\t\t\t<EnablePREfast>" << (configuration == "Analysis" ? "true" : "false") << "</EnablePREfast>\n" << "\t\t\t<EnablePREfast>" << (configuration == "Analysis" ? "true" : "false") << "</EnablePREfast>\n"
"\t\t</ClCompile>\n" << "\t\t</ClCompile>\n"
"\t\t<Lib>\n" << "\t\t<Lib>\n"
"\t\t\t<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>\n" << "\t\t\t<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>\n"
"\t\t</Lib>\n" << "\t\t</Lib>\n"
"\t\t<Link>\n" << "\t\t<Link>\n"
"\t\t\t<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>\n" << "\t\t\t<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>\n"
"\t\t\t<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\n" << "\t\t\t<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\n"
"\t\t\t<SetChecksum>true</SetChecksum>\n"; << "\t\t\t<SetChecksum>true</SetChecksum>\n";
} else { } else {
properties << "\t\t\t<Optimization>Disabled</Optimization>\n" properties << "\t\t\t<Optimization>Disabled</Optimization>\n"
"\t\t\t<PreprocessorDefinitions>WIN32;" << (configuration == "LLVM" ? "_CRT_SECURE_NO_WARNINGS;" : "") << "%(PreprocessorDefinitions)</PreprocessorDefinitions>\n" << "\t\t\t<PreprocessorDefinitions>WIN32;" << (configuration == "LLVM" ? "_CRT_SECURE_NO_WARNINGS;" : "") << "%(PreprocessorDefinitions)</PreprocessorDefinitions>\n"
"\t\t\t<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n" << "\t\t\t<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\n"
"\t\t\t<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n" << "\t\t\t<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n"
"\t\t\t<FunctionLevelLinking>true</FunctionLevelLinking>\n" << "\t\t\t<FunctionLevelLinking>true</FunctionLevelLinking>\n"
"\t\t\t<TreatWarningAsError>false</TreatWarningAsError>\n"; << "\t\t\t<TreatWarningAsError>false</TreatWarningAsError>\n";
if (_version >= 14) { if (_version >= 14) {
// Since MSVC 2015 Edit and Continue is support for x64 too. // Since<<SVC 2015 Edit and Continue is supported for x86 and x86-64, but not for ARM.
properties << "\t\t\t<DebugInformationFormat>" << "EditAndContinue" << "</DebugInformationFormat>\n"; properties << "\t\t\t<DebugInformationFormat>" << (arch != ARCH_ARM64 ? "EditAndContinue" : "ProgramDatabase") << "</DebugInformationFormat>\n";
} else { } else {
// Older MSVC versions did not support Edit and Continue for x64, thus we do not use it. // Older MSVC versions did not support Edit and Continue for x64, thus we do not use it.
properties << "\t\t\t<DebugInformationFormat>" << (isWin32 ? "EditAndContinue" : "ProgramDatabase") << "</DebugInformationFormat>\n"; properties << "\t\t\t<DebugInformationFormat>" << (arch == ARCH_X86 ? "EditAndContinue" : "ProgramDatabase") << "</DebugInformationFormat>\n";
} }
properties << "\t\t\t<EnablePREfast>" << (configuration == "Analysis" ? "true" : "false") << "</EnablePREfast>\n"; properties << "\t\t\t<EnablePREfast>" << (configuration == "Analysis" ? "true" : "false") << "</EnablePREfast>\n";
if (configuration == "LLVM") { 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 // 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" const std::string outputBitness = (arch == ARCH_X86 ? "32" : "64");
"\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\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" properties << "\t\t</ClCompile>\n"
"\t\t<Link>\n" << "\t\t<Link>\n"
"\t\t\t<GenerateDebugInformation>true</GenerateDebugInformation>\n" << "\t\t\t<GenerateDebugInformation>true</GenerateDebugInformation>\n"
"\t\t\t<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>\n"; << "\t\t\t<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>\n";
} }
properties << "\t\t</Link>\n" properties << "\t\t</Link>\n"
"\t</ItemDefinitionGroup>\n" << "\t</ItemDefinitionGroup>\n"
"</Project>\n"; << "</Project>\n";
properties.flush(); properties.flush();
properties.close(); properties.close();
@ -462,7 +474,7 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b
bool hasEnding(std::string const &fullString, std::string const &ending) { bool hasEnding(std::string const &fullString, std::string const &ending) {
if (fullString.length() > ending.length()) { if (fullString.length() > ending.length()) {
return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending)); return (0 == fullString.compare(fullString.length() - ending.length(), ending.length(), ending));
} else { } else {
return false; return false;
} }
@ -472,7 +484,7 @@ namespace {
inline void outputNasmCommand(std::ostream &projectFile, const std::string &config, const std::string &prefix) { inline void outputNasmCommand(std::ostream &projectFile, const std::string &config, const std::string &prefix) {
projectFile << "\t\t\t<Command Condition=\"'$(Configuration)|$(Platform)'=='" << config << "|Win32'\">nasm.exe -f win32 -g -o \"$(IntDir)" << prefix << "%(Filename).obj\" \"%(FullPath)\"</Command>\n" projectFile << "\t\t\t<Command Condition=\"'$(Configuration)|$(Platform)'=='" << config << "|Win32'\">nasm.exe -f win32 -g -o \"$(IntDir)" << prefix << "%(Filename).obj\" \"%(FullPath)\"</Command>\n"
"\t\t\t<Outputs Condition=\"'$(Configuration)|$(Platform)'=='" << config << "|Win32'\">$(IntDir)" << prefix << "%(Filename).obj;%(Outputs)</Outputs>\n"; << "\t\t\t<Outputs Condition=\"'$(Configuration)|$(Platform)'=='" << config << "|Win32'\">$(IntDir)" << prefix << "%(Filename).obj;%(Outputs)</Outputs>\n";
} }
} // End of anonymous namespace } // End of anonymous namespace
@ -503,7 +515,7 @@ void MSBuildProvider::writeFileListToProject(const FileNode &dir, std::ofstream
// Deal with duplicated file names // Deal with duplicated file names
if (isDuplicate) { if (isDuplicate) {
projectFile << "\t\t<ClCompile Include=\"" << (*entry).path << "\">\n" projectFile << "\t\t<ClCompile Include=\"" << (*entry).path << "\">\n"
"\t\t\t<ObjectFileName>$(IntDir)" << (*entry).prefix << "%(Filename).obj</ObjectFileName>\n"; << "\t\t\t<ObjectFileName>$(IntDir)" << (*entry).prefix << "%(Filename).obj</ObjectFileName>\n";
projectFile << "\t\t</ClCompile>\n"; projectFile << "\t\t</ClCompile>\n";
} else { } else {
@ -526,7 +538,7 @@ void MSBuildProvider::writeFileListToProject(const FileNode &dir, std::ofstream
const bool isDuplicate = (std::find(duplicate.begin(), duplicate.end(), (*entry).name + ".o") != duplicate.end()); const bool isDuplicate = (std::find(duplicate.begin(), duplicate.end(), (*entry).name + ".o") != duplicate.end());
projectFile << "\t\t<CustomBuild Include=\"" << (*entry).path << "\">\n" projectFile << "\t\t<CustomBuild Include=\"" << (*entry).path << "\">\n"
"\t\t\t<FileType>Document</FileType>\n"; << "\t\t\t<FileType>Document</FileType>\n";
outputNasmCommand(projectFile, "Debug", (isDuplicate ? (*entry).prefix : "")); outputNasmCommand(projectFile, "Debug", (isDuplicate ? (*entry).prefix : ""));
outputNasmCommand(projectFile, "Analysis", (isDuplicate ? (*entry).prefix : "")); outputNasmCommand(projectFile, "Analysis", (isDuplicate ? (*entry).prefix : ""));
@ -587,4 +599,4 @@ void MSBuildProvider::computeFileList(const FileNode &dir, const StringList &dup
} }
} }
} // End of CreateProjectTool namespace } // namespace CreateProjectTool

View file

@ -35,16 +35,16 @@ protected:
void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir, void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir,
const StringList &includeList, const StringList &excludeList); const StringList &includeList, const StringList &excludeList);
void outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration); void outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration);
void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation, void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix); const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);
void writeReferences(const BuildSetup &setup, std::ofstream &output); void writeReferences(const BuildSetup &setup, std::ofstream &output);
void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents); void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix, bool runBuildEvents) override;
void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration); void createBuildProp(const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration) override;
const char *getProjectExtension(); const char *getProjectExtension();
const char *getPropertiesExtension(); const char *getPropertiesExtension();
@ -56,7 +56,7 @@ private:
std::string filter; std::string filter;
std::string prefix; std::string prefix;
bool operator<(const FileEntry& rhs) const { bool operator<(const FileEntry &rhs) const {
return path.compare(rhs.path) == -1; // Not exactly right for alphabetical order, but good enough return path.compare(rhs.path) == -1; // Not exactly right for alphabetical order, but good enough
} }
}; };
@ -76,6 +76,6 @@ private:
void outputFiles(std::ostream &projectFile, const FileEntries &files, const std::string &action); void outputFiles(std::ostream &projectFile, const FileEntries &files, const std::string &action);
}; };
} // End of CreateProjectTool namespace } // namespace CreateProjectTool
#endif // TOOLS_CREATE_PROJECT_MSBUILD_H #endif // TOOLS_CREATE_PROJECT_MSBUILD_H

View file

@ -20,12 +20,12 @@
* *
*/ */
#include "config.h"
#include "msvc.h" #include "msvc.h"
#include "config.h"
#include <fstream>
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
#include <fstream>
namespace CreateProjectTool { namespace CreateProjectTool {
@ -37,6 +37,20 @@ MSVCProvider::MSVCProvider(StringList &global_warnings, std::map<std::string, St
_enableLanguageExtensions = tokenize(ENABLE_LANGUAGE_EXTENSIONS, ','); _enableLanguageExtensions = tokenize(ENABLE_LANGUAGE_EXTENSIONS, ',');
_disableEditAndContinue = tokenize(DISABLE_EDIT_AND_CONTINUE, ','); _disableEditAndContinue = tokenize(DISABLE_EDIT_AND_CONTINUE, ',');
// NASM not supported for Windows on AMD64 target
StringList amd64_disabled_features;
amd64_disabled_features.push_back("nasm");
_arch_disabled_features[ARCH_AMD64] = amd64_disabled_features;
// NASM not supported for WoA target
// No OpenGL, OpenGL ES on Windows on ARM
// https://github.com/microsoft/vcpkg/issues/11248 [fribidi] Fribidi doesn't cross-compile on x86-64 to target arm/arm64
StringList arm64_disabled_features;
arm64_disabled_features.push_back("nasm");
arm64_disabled_features.push_back("opengl");
arm64_disabled_features.push_back("opengles");
arm64_disabled_features.push_back("fribidi");
_arch_disabled_features[ARCH_ARM64] = arm64_disabled_features;
} }
void MSVCProvider::createWorkspace(const BuildSetup &setup) { void MSVCProvider::createWorkspace(const BuildSetup &setup) {
@ -50,8 +64,10 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) {
std::string solutionUUID = createUUID(setup.projectName + ".sln"); std::string solutionUUID = createUUID(setup.projectName + ".sln");
std::ofstream solution((setup.outputDir + '/' + setup.projectName + ".sln").c_str()); std::ofstream solution((setup.outputDir + '/' + setup.projectName + ".sln").c_str());
if (!solution) if (!solution || !solution.is_open()) {
error("Could not open \"" + setup.outputDir + '/' + setup.projectName + ".sln\" for writing"); error("Could not open \"" + setup.outputDir + '/' + setup.projectName + ".sln\" for writing");
return;
}
solution << "Microsoft Visual Studio Solution File, Format Version " << _msvcVersion.solutionFormat << "\n"; solution << "Microsoft Visual Studio Solution File, Format Version " << _msvcVersion.solutionFormat << "\n";
solution << "# Visual Studio " << _msvcVersion.solutionVersion << "\n"; solution << "# Visual Studio " << _msvcVersion.solutionVersion << "\n";
@ -77,42 +93,36 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) {
} }
solution << "Global\n" solution << "Global\n"
"\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n" "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
"\t\tDebug|Win32 = Debug|Win32\n"
"\t\tAnalysis|Win32 = Analysis|Win32\n"
"\t\tLLVM|Win32 = LLVM|Win32\n"
"\t\tRelease|Win32 = Release|Win32\n"
"\t\tDebug|x64 = Debug|x64\n"
"\t\tAnalysis|x64 = Analysis|x64\n"
"\t\tLLVM|x64 = LLVM|x64\n"
"\t\tRelease|x64 = Release|x64\n"
"\tEndGlobalSection\n"
"\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) { for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
solution << "\t\t{" << i->second << "}.Debug|Win32.ActiveCfg = Debug|Win32\n" solution << "\t\tDebug|" << getMSVCConfigName(*arch) << " = Debug|" << getMSVCConfigName(*arch) << "\n"
"\t\t{" << i->second << "}.Debug|Win32.Build.0 = Debug|Win32\n" << "\t\tAnalysis|" << getMSVCConfigName(*arch) << " = Analysis|" << getMSVCConfigName(*arch) << "\n"
"\t\t{" << i->second << "}.Analysis|Win32.ActiveCfg = Analysis|Win32\n" << "\t\tLLVM|" << getMSVCConfigName(*arch) << " = LLVM|" << getMSVCConfigName(*arch) << "\n"
"\t\t{" << i->second << "}.Analysis|Win32.Build.0 = Analysis|Win32\n" << "\t\tRelease|" << getMSVCConfigName(*arch) << " = Release|" << getMSVCConfigName(*arch) << "\n";
"\t\t{" << i->second << "}.LLVM|Win32.ActiveCfg = LLVM|Win32\n"
"\t\t{" << i->second << "}.LLVM|Win32.Build.0 = LLVM|Win32\n"
"\t\t{" << i->second << "}.Release|Win32.ActiveCfg = Release|Win32\n"
"\t\t{" << i->second << "}.Release|Win32.Build.0 = Release|Win32\n"
"\t\t{" << i->second << "}.Debug|x64.ActiveCfg = Debug|x64\n"
"\t\t{" << i->second << "}.Debug|x64.Build.0 = Debug|x64\n"
"\t\t{" << i->second << "}.Analysis|x64.ActiveCfg = Analysis|x64\n"
"\t\t{" << i->second << "}.Analysis|x64.Build.0 = Analysis|x64\n"
"\t\t{" << i->second << "}.LLVM|x64.ActiveCfg = LLVM|x64\n"
"\t\t{" << i->second << "}.LLVM|x64.Build.0 = LLVM|x64\n"
"\t\t{" << i->second << "}.Release|x64.ActiveCfg = Release|x64\n"
"\t\t{" << i->second << "}.Release|x64.Build.0 = Release|x64\n";
} }
solution << "\tEndGlobalSection\n" solution << "\tEndGlobalSection\n"
"\tGlobalSection(SolutionProperties) = preSolution\n" "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
"\t\tHideSolutionNode = FALSE\n"
"\tEndGlobalSection\n" for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
"EndGlobal\n"; for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
solution << "\t\t{" << i->second << "}.Debug|" << getMSVCConfigName(*arch) << ".ActiveCfg = Debug|" << getMSVCConfigName(*arch) << "\n"
<< "\t\t{" << i->second << "}.Debug|" << getMSVCConfigName(*arch) << ".Build.0 = Debug|" << getMSVCConfigName(*arch) << "\n"
<< "\t\t{" << i->second << "}.Analysis|" << getMSVCConfigName(*arch) << ".ActiveCfg = Analysis|" << getMSVCConfigName(*arch) << "\n"
<< "\t\t{" << i->second << "}.Analysis|" << getMSVCConfigName(*arch) << ".Build.0 = Analysis|" << getMSVCConfigName(*arch) << "\n"
<< "\t\t{" << i->second << "}.LLVM|" << getMSVCConfigName(*arch) << ".ActiveCfg = LLVM|" << getMSVCConfigName(*arch) << "\n"
<< "\t\t{" << i->second << "}.LLVM|" << getMSVCConfigName(*arch) << ".Build.0 = LLVM|" << getMSVCConfigName(*arch) << "\n"
<< "\t\t{" << i->second << "}.Release|" << getMSVCConfigName(*arch) << ".ActiveCfg = Release|" << getMSVCConfigName(*arch) << "\n"
<< "\t\t{" << i->second << "}.Release|" << getMSVCConfigName(*arch) << ".Build.0 = Release|" << getMSVCConfigName(*arch) << "\n";
}
}
solution << "\tEndGlobalSection\n"
<< "\tGlobalSection(SolutionProperties) = preSolution\n"
<< "\t\tHideSolutionNode = FALSE\n"
<< "\tEndGlobalSection\n"
<< "EndGlobal\n";
} }
void MSVCProvider::createOtherBuildFiles(const BuildSetup &setup) { void MSVCProvider::createOtherBuildFiles(const BuildSetup &setup) {
@ -121,14 +131,12 @@ void MSVCProvider::createOtherBuildFiles(const BuildSetup &setup) {
// Create the configuration property files (for Debug and Release with 32 and 64bits versions) // Create the configuration property files (for Debug and Release with 32 and 64bits versions)
// Note: we use the debug properties for the analysis configuration // Note: we use the debug properties for the analysis configuration
createBuildProp(setup, true, false, "Release"); for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
createBuildProp(setup, true, true, "Release"); createBuildProp(setup, true, *arch, "Release");
createBuildProp(setup, false, false, "Debug"); createBuildProp(setup, false, *arch, "Debug");
createBuildProp(setup, false, true, "Debug"); createBuildProp(setup, false, *arch, "Analysis");
createBuildProp(setup, false, false, "Analysis"); createBuildProp(setup, false, *arch, "LLVM");
createBuildProp(setup, false, true, "Analysis"); }
createBuildProp(setup, false, false, "LLVM");
createBuildProp(setup, false, true, "LLVM");
} }
void MSVCProvider::addResourceFiles(const BuildSetup &setup, StringList &includeList, StringList &excludeList) { void MSVCProvider::addResourceFiles(const BuildSetup &setup, StringList &includeList, StringList &excludeList) {
@ -137,27 +145,22 @@ void MSVCProvider::addResourceFiles(const BuildSetup &setup, StringList &include
} }
void MSVCProvider::createGlobalProp(const BuildSetup &setup) { void MSVCProvider::createGlobalProp(const BuildSetup &setup) {
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_Global" + getPropertiesExtension()).c_str()); for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(*arch) + getPropertiesExtension()).c_str());
if (!properties) if (!properties)
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getPropertiesExtension() + "\" for writing"); error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getMSVCArchName(*arch) + getPropertiesExtension() + "\" for writing");
outputGlobalPropFile(setup, properties, 32, setup.defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents); BuildSetup archSetup = setup;
std::map<MSVC_Architecture, StringList>::const_iterator arch_disabled_features_it = _arch_disabled_features.find(*arch);
if (arch_disabled_features_it != _arch_disabled_features.end()) {
for (StringList::const_iterator feature = arch_disabled_features_it->second.begin(); feature != arch_disabled_features_it->second.end(); ++feature) {
archSetup = removeFeatureFromSetup(archSetup, *feature);
}
}
outputGlobalPropFile(archSetup, properties, *arch, archSetup.defines, convertPathToWin(archSetup.filePrefix), archSetup.runBuildEvents);
properties.close(); properties.close();
properties.open((setup.outputDir + '/' + setup.projectDescription + "_Global64" + getPropertiesExtension()).c_str());
if (!properties)
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global64" + getPropertiesExtension() + "\" for writing");
// HACK: We must disable the "nasm" feature for x64. To achieve that we must recreate the define list.
StringList x64Defines = setup.defines;
for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
if (i->enable && i->define && i->define[0] && !strcmp(i->name, "nasm")) {
x64Defines.remove(i->define);
break;
} }
}
outputGlobalPropFile(setup, properties, 64, x64Defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
} }
std::string MSVCProvider::getPreBuildEvent() const { std::string MSVCProvider::getPreBuildEvent() const {
@ -182,7 +185,7 @@ std::string MSVCProvider::getTestPreBuildEvent(const BuildSetup &setup) const {
return "&quot;$(SolutionDir)../../test/cxxtest/cxxtestgen.py&quot; --runner=ParenPrinter --no-std --no-eh -o &quot;$(SolutionDir)test_runner.cpp&quot;" + target; return "&quot;$(SolutionDir)../../test/cxxtest/cxxtestgen.py&quot; --runner=ParenPrinter --no-std --no-eh -o &quot;$(SolutionDir)test_runner.cpp&quot;" + target;
} }
std::string MSVCProvider::getPostBuildEvent(bool isWin32, const BuildSetup &setup) const { std::string MSVCProvider::getPostBuildEvent(MSVC_Architecture arch, const BuildSetup &setup) const {
std::string cmdLine = ""; std::string cmdLine = "";
cmdLine = "@echo off\n" cmdLine = "@echo off\n"
@ -193,7 +196,7 @@ std::string MSVCProvider::getPostBuildEvent(bool isWin32, const BuildSetup &setu
cmdLine += (setup.useSDL2) ? "SDL2" : "SDL"; cmdLine += (setup.useSDL2) ? "SDL2" : "SDL";
cmdLine += " &quot;%" LIBS_DEFINE "%/lib/"; cmdLine += " &quot;%" LIBS_DEFINE "%/lib/";
cmdLine += (isWin32) ? "x86" : "x64"; cmdLine += getMSVCArchName(arch);
cmdLine += "/$(Configuration)&quot; "; cmdLine += "/$(Configuration)&quot; ";
// Specify if installer needs to be built or not // Specify if installer needs to be built or not
@ -205,4 +208,4 @@ std::string MSVCProvider::getPostBuildEvent(bool isWin32, const BuildSetup &setu
return cmdLine; return cmdLine;
} }
} // End of CreateProjectTool namespace } // namespace CreateProjectTool

View file

@ -37,6 +37,9 @@ protected:
StringList _enableLanguageExtensions; StringList _enableLanguageExtensions;
StringList _disableEditAndContinue; StringList _disableEditAndContinue;
std::list<MSVC_Architecture> _archs;
std::map<MSVC_Architecture, StringList> _arch_disabled_features;
void createWorkspace(const BuildSetup &setup); void createWorkspace(const BuildSetup &setup);
void createOtherBuildFiles(const BuildSetup &setup); void createOtherBuildFiles(const BuildSetup &setup);
@ -64,17 +67,17 @@ protected:
* @param prefix File prefix, used to add additional include paths. * @param prefix File prefix, used to add additional include paths.
* @param runBuildEvents true if generating a revision number, false otherwise * @param runBuildEvents true if generating a revision number, false otherwise
*/ */
virtual void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) = 0; virtual void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix, bool runBuildEvents) = 0;
/** /**
* Generates the project properties for debug and release settings. * Generates the project properties for debug and release settings.
* *
* @param setup Description of the desired build setup. * @param setup Description of the desired build setup.
* @param isRelease Type of property file * @param isRelease Type of property file
* @param isWin32 Bitness of property file * @param arch Target architecture
* @param configuration Name of property file * @param configuration Name of property file
*/ */
virtual void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) = 0; virtual void createBuildProp(const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration) = 0;
/** /**
* Get the file extension for property files * Get the file extension for property files
@ -96,14 +99,14 @@ protected:
/** /**
* Get the command line for copying data files to the build directory. * Get the command line for copying data files to the build directory.
* *
* @param isWin32 Bitness of property file. * @param arch Target architecture
* @param setup Description of the desired build setup. * @param setup Description of the desired build setup.
* *
* @return The post build event. * @return The post build event.
*/ */
std::string getPostBuildEvent(bool isWin32, const BuildSetup &setup) const; std::string getPostBuildEvent(MSVC_Architecture arch, const BuildSetup &setup) const;
}; };
} // End of CreateProjectTool namespace } // namespace CreateProjectTool
#endif // TOOLS_CREATE_PROJECT_MSVC_H #endif // TOOLS_CREATE_PROJECT_MSVC_H

View file

@ -20,11 +20,11 @@
* *
*/ */
#include "config.h"
#include "visualstudio.h" #include "visualstudio.h"
#include "config.h"
#include <fstream>
#include <algorithm> #include <algorithm>
#include <fstream>
namespace CreateProjectTool { namespace CreateProjectTool {
@ -32,8 +32,11 @@ namespace CreateProjectTool {
// Visual Studio Provider (Visual Studio 2008) // Visual Studio Provider (Visual Studio 2008)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
VisualStudioProvider::VisualStudioProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version, const MSVCVersion& msvc) VisualStudioProvider::VisualStudioProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version, const MSVCVersion &msvc)
: MSVCProvider(global_warnings, project_warnings, version, msvc) { : MSVCProvider(global_warnings, project_warnings, version, msvc) {
_archs.push_back(ARCH_X86);
_archs.push_back(ARCH_AMD64);
} }
const char *VisualStudioProvider::getProjectExtension() { const char *VisualStudioProvider::getProjectExtension() {
@ -48,29 +51,32 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
const StringList &includeList, const StringList &excludeList) { const StringList &includeList, const StringList &excludeList) {
const std::string projectFile = setup.outputDir + '/' + name + getProjectExtension(); const std::string projectFile = setup.outputDir + '/' + name + getProjectExtension();
std::ofstream project(projectFile.c_str()); std::ofstream project(projectFile.c_str());
if (!project) if (!project || !project.is_open()) {
error("Could not open \"" + projectFile + "\" for writing"); error("Could not open \"" + projectFile + "\" for writing");
return;
}
project << "<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n" project << "<?xml version=\"1.0\" encoding=\"windows-1252\"?>\n"
"<VisualStudioProject\n" << "<VisualStudioProject\n"
"\tProjectType=\"Visual C++\"\n" << "\tProjectType=\"Visual C++\"\n"
"\tVersion=\"" << _version << ".00\"\n" << "\tVersion=\"" << _version << ".00\"\n"
"\tName=\"" << name << "\"\n" << "\tName=\"" << name << "\"\n"
"\tProjectGUID=\"{" << uuid << "}\"\n" << "\tProjectGUID=\"{" << uuid << "}\"\n"
"\tRootNamespace=\"" << name << "\"\n" << "\tRootNamespace=\"" << name << "\"\n"
"\tKeyword=\"Win32Proj\"\n"; << "\tKeyword=\"Win32Proj\"\n";
project << "\tTargetFrameworkVersion=\"131072\"\n"; project << "\tTargetFrameworkVersion=\"131072\"\n";
project << "\t>\n" project << "\t>\n"
"\t<Platforms>\n" "\t<Platforms>\n";
"\t\t<Platform Name=\"Win32\" />\n" for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
"\t\t<Platform Name=\"x64\" />\n" project << "\t\t<Platform Name=\"" << getMSVCConfigName(*arch) << "\" />\n";
"\t</Platforms>\n" }
"\t<Configurations>\n"; project << "\t</Platforms>\n"
<< "\t<Configurations>\n";
// Check for project-specific warnings: // Check for project-specific warnings:
std::map< std::string, std::list<std::string> >::iterator warningsIterator = _projectWarnings.find(name); std::map<std::string, std::list<std::string> >::iterator warningsIterator = _projectWarnings.find(name);
if (setup.devTools || setup.tests || name == setup.projectName) { if (setup.devTools || setup.tests || name == setup.projectName) {
std::string libraries; std::string libraries;
@ -78,20 +84,15 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i) for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
libraries += ' ' + *i + ".lib"; libraries += ' ' + *i + ".lib";
// Win32
outputConfiguration(project, setup, libraries, "Debug", "Win32", "", true);
outputConfiguration(project, setup, libraries, "Analysis", "Win32", "", true);
outputConfiguration(project, setup, libraries, "LLVM", "Win32", "", true);
outputConfiguration(project, setup, libraries, "Release", "Win32", "", true);
// x64
// For 'x64' we must disable NASM support. Usually we would need to disable the "nasm" feature for that and // For 'x64' we must disable NASM support. Usually we would need to disable the "nasm" feature for that and
// re-create the library list, BUT since NASM doesn't link any additional libraries, we can just use the // re-create the library list, BUT since NASM doesn't link any additional libraries, we can just use the
// libraries list created for IA-32. If that changes in the future, we need to adjust this part! // libraries list created for IA-32. If that changes in the future, we need to adjust this part!
outputConfiguration(project, setup, libraries, "Debug", "x64", "64", false); for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
outputConfiguration(project, setup, libraries, "Analysis", "x64", "64", false); outputConfiguration(project, setup, libraries, "Debug", *arch);
outputConfiguration(project, setup, libraries, "LLVM", "Win32", "64", false); outputConfiguration(project, setup, libraries, "Analysis", *arch);
outputConfiguration(project, setup, libraries, "Release", "x64", "64", false); outputConfiguration(project, setup, libraries, "LLVM", *arch);
outputConfiguration(project, setup, libraries, "Release", *arch);
}
} else { } else {
bool enableLanguageExtensions = true; // ResidualVM bool enableLanguageExtensions = true; // ResidualVM
@ -107,19 +108,16 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
toolConfig += (disableEditAndContinue ? "DebugInformationFormat=\"3\" " : ""); toolConfig += (disableEditAndContinue ? "DebugInformationFormat=\"3\" " : "");
toolConfig += (enableLanguageExtensions ? "DisableLanguageExtensions=\"false\" " : ""); toolConfig += (enableLanguageExtensions ? "DisableLanguageExtensions=\"false\" " : "");
// Win32 for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
outputConfiguration(setup, project, toolConfig, "Debug", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Debug", *arch);
outputConfiguration(setup, project, toolConfig, "Analysis", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Analysis", *arch);
outputConfiguration(setup, project, toolConfig, "LLVM", "Win32", ""); outputConfiguration(setup, project, toolConfig, "LLVM", *arch);
outputConfiguration(setup, project, toolConfig, "Release", "Win32", ""); outputConfiguration(setup, project, toolConfig, "Release", *arch);
outputConfiguration(setup, project, toolConfig, "Debug", "x64", "64"); }
outputConfiguration(setup, project, toolConfig, "Analysis", "x64", "64");
outputConfiguration(setup, project, toolConfig, "LLVM", "x64", "64");
outputConfiguration(setup, project, toolConfig, "Release", "x64", "64");
} }
project << "\t</Configurations>\n" project << "\t</Configurations>\n"
"\t<Files>\n"; << "\t<Files>\n";
std::string modulePath; std::string modulePath;
if (!moduleDir.compare(0, setup.srcDir.size(), setup.srcDir)) { if (!moduleDir.compare(0, setup.srcDir.size(), setup.srcDir)) {
@ -139,44 +137,44 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
} }
project << "\t</Files>\n" project << "\t</Files>\n"
"</VisualStudioProject>\n"; << "</VisualStudioProject>\n";
} }
void VisualStudioProvider::outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const std::string &platform, const std::string &props, const bool isWin32) { void VisualStudioProvider::outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const MSVC_Architecture arch) {
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\" << setup.projectDescription << "_" << config << props << ".vsprops\">\n" project << "\t\t<Configuration Name=\"" << config << "|" << getMSVCConfigName(arch) << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\" << setup.projectDescription << "_" << config << getMSVCArchName(arch) << ".vsprops\">\n"
"\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" DebugInformationFormat=\"3\" />\n" << "\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" DebugInformationFormat=\"3\" />\n"
"\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/" << setup.projectName << ".exe\"\n" << "\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/" << setup.projectName << ".exe\"\n"
"\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n" << "\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
"\t\t\t/>\n"; << "\t\t\t/>\n";
outputBuildEvents(project, setup, isWin32); outputBuildEvents(project, setup, arch);
project << "\t\t</Configuration>\n"; project << "\t\t</Configuration>\n";
} }
void VisualStudioProvider::outputConfiguration(const BuildSetup &setup, std::ostream &project, const std::string &toolConfig, const std::string &config, const std::string &platform, const std::string &props) { void VisualStudioProvider::outputConfiguration(const BuildSetup &setup, std::ostream &project, const std::string &toolConfig, const std::string &config, const MSVC_Architecture arch) {
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\" << setup.projectDescription << "_" << config << props << ".vsprops\">\n" project << "\t\t<Configuration Name=\"" << config << "|" << getMSVCConfigName(arch) << "\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\" << setup.projectDescription << "_" << config << getMSVCArchName(arch) << ".vsprops\">\n"
"\t\t\t<Tool Name=\"VCCLCompilerTool\" "<< toolConfig << "/>\n" << "\t\t\t<Tool Name=\"VCCLCompilerTool\" " << toolConfig << "/>\n"
"\t\t</Configuration>\n"; << "\t\t</Configuration>\n";
} }
void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildSetup &setup, const bool isWin32) { void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildSetup &setup, const MSVC_Architecture arch) {
if (!setup.devTools && !setup.tests && setup.runBuildEvents) { if (!setup.devTools && !setup.tests && setup.runBuildEvents) {
project << "\t\t\t<Tool\tName=\"VCPreBuildEventTool\"\n" project << "\t\t\t<Tool\tName=\"VCPreBuildEventTool\"\n"
"\t\t\t\tCommandLine=\"" << getPreBuildEvent() << "\"\n" << "\t\t\t\tCommandLine=\"" << getPreBuildEvent() << "\"\n"
"\t\t\t/>\n" << "\t\t\t/>\n"
"\t\t\t<Tool\tName=\"VCPostBuildEventTool\"\n" << "\t\t\t<Tool\tName=\"VCPostBuildEventTool\"\n"
"\t\t\t\tCommandLine=\"" << getPostBuildEvent(isWin32, setup) << "\"\n" << "\t\t\t\tCommandLine=\"" << getPostBuildEvent(arch, setup) << "\"\n"
"\t\t\t/>\n"; << "\t\t\t/>\n";
} }
// Generate runner file before build for tests // Generate runner file before build for tests
if (setup.tests) { if (setup.tests) {
project << "\t\t\t<Tool\tName=\"VCPreBuildEventTool\"\n" project << "\t\t\t<Tool\tName=\"VCPreBuildEventTool\"\n"
"\t\t\t\tCommandLine=\"" << getTestPreBuildEvent(setup) << "\"\n" << "\t\t\t\tCommandLine=\"" << getTestPreBuildEvent(setup) << "\"\n"
"\t\t\t/>\n"; << "\t\t\t/>\n";
project << "\t\t\t<Tool\tName=\"VCPostBuildEventTool\"\n" project << "\t\t\t<Tool\tName=\"VCPostBuildEventTool\"\n"
"\t\t\t\tCommandLine=\"$(TargetPath)\" IgnoreExitCode=\"true\"\n" << "\t\t\t\tCommandLine=\"$(TargetPath)\" IgnoreExitCode=\"true\"\n"
"\t\t\t/>\n"; << "\t\t\t/>\n";
} }
} }
@ -193,7 +191,7 @@ void VisualStudioProvider::writeReferences(const BuildSetup &setup, std::ofstrea
output << "\tEndProjectSection\n"; output << "\tEndProjectSection\n";
} }
void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) { void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix, bool runBuildEvents) {
std::string warnings; std::string warnings;
for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i) for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
warnings += *i + ';'; warnings += *i + ';';
@ -210,20 +208,20 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of
definesList += REVISION_DEFINE ";"; definesList += REVISION_DEFINE ";";
properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n" properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
"<VisualStudioPropertySheet\n" << "<VisualStudioPropertySheet\n"
"\tProjectType=\"Visual C++\"\n" << "\tProjectType=\"Visual C++\"\n"
"\tVersion=\"8.00\"\n" << "\tVersion=\"8.00\"\n"
"\tName=\"" << setup.projectDescription << "_Global\"\n" << "\tName=\"" << setup.projectDescription << "_Global\"\n"
"\tOutputDirectory=\"$(ConfigurationName)" << bits << "\"\n" << "\tOutputDirectory=\"$(ConfigurationName)" << getMSVCArchName(arch) << "\"\n"
"\tIntermediateDirectory=\"$(ConfigurationName)" << bits << "/$(ProjectName)\"\n" << "\tIntermediateDirectory=\"$(ConfigurationName)" << getMSVCArchName(arch) << "/$(ProjectName)\"\n"
"\t>\n" << "\t>\n"
"\t<Tool\n" << "\t<Tool\n"
"\t\tName=\"VCCLCompilerTool\"\n" << "\t\tName=\"VCCLCompilerTool\"\n"
"\t\tDisableLanguageExtensions=\"" << (setup.devTools ? "false" : "true") << "\"\n" << "\t\tDisableLanguageExtensions=\"" << (setup.devTools ? "false" : "true") << "\"\n"
"\t\tDisableSpecificWarnings=\"" << warnings << "\"\n" << "\t\tDisableSpecificWarnings=\"" << warnings << "\"\n"
"\t\tAdditionalIncludeDirectories=\".\\;" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;$(" << LIBS_DEFINE << ")\\include\\SDL;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "\"\n" << "\t\tAdditionalIncludeDirectories=\".\\;" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;$(" << LIBS_DEFINE << ")\\include\\SDL;" << (setup.tests ? prefix + "\\test\\cxxtest;" : "") << "\"\n"
"\t\tPreprocessorDefinitions=\"" << definesList << "\"\n" << "\t\tPreprocessorDefinitions=\"" << definesList << "\"\n"
"\t\tExceptionHandling=\"" << ((setup.devTools || setup.tests || _version == 14) ? "1" : "0") << "\"\n"; << "\t\tExceptionHandling=\"" << ((setup.devTools || setup.tests || _version == 14) ? "1" : "0") << "\"\n";
#if NEEDS_RTTI #if NEEDS_RTTI
properties << "\t\tRuntimeTypeInfo=\"true\"\n"; properties << "\t\tRuntimeTypeInfo=\"true\"\n";
@ -232,87 +230,88 @@ void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::of
#endif #endif
properties << "\t\tWarningLevel=\"4\"\n" properties << "\t\tWarningLevel=\"4\"\n"
"\t\tWarnAsError=\"false\"\n" << "\t\tWarnAsError=\"false\"\n"
"\t\tCompileAs=\"0\"\n" << "\t\tCompileAs=\"0\"\n"
"\t\t/>\n" << "\t\t/>\n"
"\t<Tool\n" << "\t<Tool\n"
"\t\tName=\"VCLibrarianTool\"\n" << "\t\tName=\"VCLibrarianTool\"\n"
"\t\tIgnoreDefaultLibraryNames=\"\"\n" << "\t\tIgnoreDefaultLibraryNames=\"\"\n"
"\t/>\n" << "\t/>\n"
"\t<Tool\n" << "\t<Tool\n"
"\t\tName=\"VCLinkerTool\"\n" << "\t\tName=\"VCLinkerTool\"\n"
"\t\tIgnoreDefaultLibraryNames=\"\"\n" << "\t\tIgnoreDefaultLibraryNames=\"\"\n"
"\t\tSubSystem=\"1\"\n"; << "\t\tSubSystem=\"1\"\n";
if (!setup.devTools && !setup.tests) if (!setup.devTools && !setup.tests)
properties << "\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n"; properties << "\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n";
properties << "\t\tAdditionalLibraryDirectories=\"$(" << LIBS_DEFINE << ")\\lib\\" << ((bits == 32) ? "x86" : "x64") << "\"\n" properties << "\t\tAdditionalLibraryDirectories=\"$(" << LIBS_DEFINE << ")\\lib\\" << getMSVCArchName(arch) << "\"\n"
"\t/>\n" << "\t/>\n"
"\t<Tool\n" << "\t<Tool\n"
"\t\tName=\"VCResourceCompilerTool\"\n" << "\t\tName=\"VCResourceCompilerTool\"\n"
"\t\tAdditionalIncludeDirectories=\".\\;" << prefix << "\"\n" << "\t\tAdditionalIncludeDirectories=\".\\;" << prefix << "\"\n"
"\t\tPreprocessorDefinitions=\"" << definesList << "\"\n" << "\t\tPreprocessorDefinitions=\"" << definesList << "\"\n"
"\t/>\n" << "\t/>\n"
"</VisualStudioPropertySheet>\n"; << "</VisualStudioPropertySheet>\n";
properties.flush(); properties.flush();
} }
void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration) { void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration) {
const std::string outputBitness = (isWin32 ? "32" : "64");
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str()); std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + configuration + getMSVCArchName(arch) + getPropertiesExtension()).c_str());
if (!properties) if (!properties || !properties.is_open()) {
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + configuration + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing"); error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + configuration + getMSVCArchName(arch) + getPropertiesExtension() + "\" for writing");
return;
}
properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n" properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
"<VisualStudioPropertySheet\n" << "<VisualStudioPropertySheet\n"
"\tProjectType=\"Visual C++\"\n" << "\tProjectType=\"Visual C++\"\n"
"\tVersion=\"8.00\"\n" << "\tVersion=\"8.00\"\n"
"\tName=\"" << setup.projectDescription << "_" << configuration << outputBitness << "\"\n" << "\tName=\"" << setup.projectDescription << "_" << configuration << getMSVCArchName(arch) << "\"\n"
"\tInheritedPropertySheets=\".\\" << setup.projectDescription << "_Global" << (isWin32 ? "" : "64") << ".vsprops\"\n" << "\tInheritedPropertySheets=\".\\" << setup.projectDescription << "_Global" << getMSVCArchName(arch) << ".vsprops\"\n"
"\t>\n" << "\t>\n"
"\t<Tool\n" << "\t<Tool\n"
"\t\tName=\"VCCLCompilerTool\"\n"; << "\t\tName=\"VCCLCompilerTool\"\n";
if (isRelease) { if (isRelease) {
properties << "\t\tEnableIntrinsicFunctions=\"true\"\n" properties << "\t\tEnableIntrinsicFunctions=\"true\"\n"
"\t\tWholeProgramOptimization=\"true\"\n" << "\t\tWholeProgramOptimization=\"true\"\n"
"\t\tPreprocessorDefinitions=\"WIN32;RELEASE_BUILD\"\n" << "\t\tPreprocessorDefinitions=\"WIN32;RELEASE_BUILD\"\n"
"\t\tStringPooling=\"true\"\n" << "\t\tStringPooling=\"true\"\n"
"\t\tBufferSecurityCheck=\"false\"\n" << "\t\tBufferSecurityCheck=\"false\"\n"
"\t\tDebugInformationFormat=\"0\"\n" << "\t\tDebugInformationFormat=\"0\"\n"
"\t\tRuntimeLibrary=\"0\"\n" << "\t\tRuntimeLibrary=\"0\"\n"
"\t\tAdditionalOption=\"" << (configuration == "Analysis" ? "/analyze" : "") << "\"\n" << "\t\tAdditionalOption=\"" << (configuration == "Analysis" ? "/analyze" : "") << "\"\n"
"\t/>\n" << "\t/>\n"
"\t<Tool\n" << "\t<Tool\n"
"\t\tName=\"VCLinkerTool\"\n" << "\t\tName=\"VCLinkerTool\"\n"
"\t\tLinkIncremental=\"1\"\n" << "\t\tLinkIncremental=\"1\"\n"
"\t\tGenerateManifest=\"false\"\n" << "\t\tGenerateManifest=\"false\"\n"
"\t\tIgnoreDefaultLibraryNames=\"\"\n" << "\t\tIgnoreDefaultLibraryNames=\"\"\n"
"\t\tSetChecksum=\"true\"\n"; << "\t\tSetChecksum=\"true\"\n";
} else { } else {
properties << "\t\tOptimization=\"0\"\n" properties << "\t\tOptimization=\"0\"\n"
"\t\tPreprocessorDefinitions=\"WIN32\"\n" << "\t\tPreprocessorDefinitions=\"WIN32\"\n"
"\t\tMinimalRebuild=\"true\"\n" << "\t\tMinimalRebuild=\"true\"\n"
"\t\tBasicRuntimeChecks=\"3\"\n" << "\t\tBasicRuntimeChecks=\"3\"\n"
"\t\tRuntimeLibrary=\"1\"\n" << "\t\tRuntimeLibrary=\"1\"\n"
"\t\tEnableFunctionLevelLinking=\"true\"\n" << "\t\tEnableFunctionLevelLinking=\"true\"\n"
"\t\tWarnAsError=\"false\"\n" << "\t\tWarnAsError=\"false\"\n"
"\t\tDebugInformationFormat=\"" << (isWin32 ? "4" : "3") << "\"\n" // For x64 format "4" (Edit and continue) is not supported, thus we default to "3" << "\t\tDebugInformationFormat=\"" << (arch == ARCH_X86 ? "3" : "4") << "\"\n" // For x64 format "4" (Edit and continue) is not supported, thus we default to "3"
"\t\tAdditionalOption=\"" << (configuration == "Analysis" ? "/analyze" : "") << "\"\n" << "\t\tAdditionalOption=\"" << (configuration == "Analysis" ? "/analyze" : "") << "\"\n"
"\t/>\n" << "\t/>\n"
"\t<Tool\n" << "\t<Tool\n"
"\t\tName=\"VCLinkerTool\"\n" << "\t\tName=\"VCLinkerTool\"\n"
"\t\tLinkIncremental=\"2\"\n" << "\t\tLinkIncremental=\"2\"\n"
"\t\tGenerateManifest=\"false\"\n" << "\t\tGenerateManifest=\"false\"\n"
"\t\tGenerateDebugInformation=\"true\"\n" << "\t\tGenerateDebugInformation=\"true\"\n"
"\t\tIgnoreDefaultLibraryNames=\"libcmt.lib\"\n"; << "\t\tIgnoreDefaultLibraryNames=\"libcmt.lib\"\n";
} }
properties << "\t/>\n" properties << "\t/>\n"
"</VisualStudioPropertySheet>\n"; << "</VisualStudioPropertySheet>\n";
properties.flush(); properties.flush();
properties.close(); properties.close();
@ -337,6 +336,7 @@ void VisualStudioProvider::writeFileListToProject(const FileNode &dir, std::ofst
name += ".o"; name += ".o";
std::transform(name.begin(), name.end(), name.begin(), tolower); std::transform(name.begin(), name.end(), name.begin(), tolower);
const bool isDuplicate = (std::find(duplicate.begin(), duplicate.end(), name) != duplicate.end()); const bool isDuplicate = (std::find(duplicate.begin(), duplicate.end(), name) != duplicate.end());
std::string filePath = convertPathToWin(filePrefix + node->name);
if (ext == "asm") { if (ext == "asm") {
std::string objFileName = "$(IntDir)\\"; std::string objFileName = "$(IntDir)\\";
@ -347,41 +347,14 @@ void VisualStudioProvider::writeFileListToProject(const FileNode &dir, std::ofst
const std::string toolLine = indentString + "\t\t<Tool Name=\"VCCustomBuildTool\" CommandLine=\"nasm.exe -f win32 -g -o &quot;" + objFileName + "&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;\" Outputs=\"" + objFileName + "\" />\n"; const std::string toolLine = indentString + "\t\t<Tool Name=\"VCCustomBuildTool\" CommandLine=\"nasm.exe -f win32 -g -o &quot;" + objFileName + "&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;\" Outputs=\"" + objFileName + "\" />\n";
// NASM is not supported for x64, thus we do not need to add additional entries here :-). // NASM is not supported for x64, thus we do not need to add additional entries here :-).
projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\">\n" writeFileToProject(projectFile, filePath, ARCH_X86, indentString, toolLine);
<< indentString << "\t<FileConfiguration Name=\"Debug|Win32\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Analysis|Win32\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Release|Win32\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "</File>\n";
} else { } else {
if (isDuplicate) { if (isDuplicate) {
const std::string toolLine = indentString + "\t\t<Tool Name=\"VCCLCompilerTool\" ObjectFile=\"$(IntDir)\\" + objPrefix + "$(InputName).obj\" XMLDocumentationFileName=\"$(IntDir)\\" + objPrefix + "$(InputName).xdc\" />\n"; const std::string toolLine = indentString + "\t\t<Tool Name=\"VCCLCompilerTool\" ObjectFile=\"$(IntDir)\\" + objPrefix + "$(InputName).obj\" XMLDocumentationFileName=\"$(IntDir)\\" + objPrefix + "$(InputName).xdc\" />\n";
projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\">\n" for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
<< indentString << "\t<FileConfiguration Name=\"Debug|Win32\">\n" writeFileToProject(projectFile, filePath, *arch, indentString, toolLine);
<< toolLine }
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Analysis|Win32\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Release|Win32\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Debug|x64\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Analysis|x64\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Release|x64\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "</File>\n";
} else { } else {
projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\" />\n"; projectFile << indentString << "<File RelativePath=\"" << convertPathToWin(filePrefix + node->name) << "\" />\n";
} }
@ -396,4 +369,22 @@ void VisualStudioProvider::writeFileListToProject(const FileNode &dir, std::ofst
projectFile << getIndent(indentation + 1) << "</Filter>\n"; projectFile << getIndent(indentation + 1) << "</Filter>\n";
} }
} // End of CreateProjectTool namespace void VisualStudioProvider::writeFileToProject(std::ofstream &projectFile, const std::string &filePath, MSVC_Architecture arch,
const std::string &indentString, const std::string &toolLine) {
projectFile << indentString << "<File RelativePath=\"" << filePath << "\">\n"
<< indentString << "\t<FileConfiguration Name=\"Debug|" << getMSVCConfigName(arch) << "\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Analysis|" << getMSVCConfigName(arch) << "\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"LLVM|" << getMSVCConfigName(arch) << "\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "\t<FileConfiguration Name=\"Release|" << getMSVCConfigName(arch) << "\">\n"
<< toolLine
<< indentString << "\t</FileConfiguration>\n"
<< indentString << "</File>\n";
}
} // namespace CreateProjectTool

View file

@ -29,7 +29,7 @@ namespace CreateProjectTool {
class VisualStudioProvider : public MSVCProvider { class VisualStudioProvider : public MSVCProvider {
public: public:
VisualStudioProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version, const MSVCVersion& msvc); VisualStudioProvider(StringList &global_warnings, std::map<std::string, StringList> &project_warnings, const int version, const MSVCVersion &msvc);
protected: protected:
void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir, void createProjectFile(const std::string &name, const std::string &uuid, const BuildSetup &setup, const std::string &moduleDir,
@ -38,20 +38,23 @@ protected:
void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation, void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix); const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);
void writeFileToProject(std::ofstream &projectFile, const std::string &filePath, MSVC_Architecture arch,
const std::string &indentString, const std::string &toolLine);
void writeReferences(const BuildSetup &setup, std::ofstream &output); void writeReferences(const BuildSetup &setup, std::ofstream &output);
void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents); void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, MSVC_Architecture arch, const StringList &defines, const std::string &prefix, bool runBuildEvents);
void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, std::string configuration); void createBuildProp(const BuildSetup &setup, bool isRelease, MSVC_Architecture arch, const std::string &configuration);
const char *getProjectExtension(); const char *getProjectExtension();
const char *getPropertiesExtension(); const char *getPropertiesExtension();
void outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const std::string &platform, const std::string &props, const bool isWin32); void outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const MSVC_Architecture arch);
void outputConfiguration(const BuildSetup &setup, std::ostream &project, const std::string &toolConfig, const std::string &config, const std::string &platform, const std::string &props); void outputConfiguration(const BuildSetup &setup, std::ostream &project, const std::string &toolConfig, const std::string &config, const MSVC_Architecture arch);
void outputBuildEvents(std::ostream &project, const BuildSetup &setup, const bool isWin32); void outputBuildEvents(std::ostream &project, const BuildSetup &setup, const MSVC_Architecture arch);
}; };
} // End of CreateProjectTool namespace } // namespace CreateProjectTool
#endif // TOOLS_CREATE_PROJECT_VISUALSTUDIO_H #endif // TOOLS_CREATE_PROJECT_VISUALSTUDIO_H

View file

@ -745,7 +745,7 @@ void XcodeProvider::setupProject() {
Object *project = new Object(this, "PBXProject", "PBXProject", "PBXProject", "", "Project object"); Object *project = new Object(this, "PBXProject", "PBXProject", "PBXProject", "", "Project object");
project->addProperty("buildConfigurationList", getHash("XCConfigurationList_scummvm"), "Build configuration list for PBXProject \"" PROJECT_NAME "\"", kSettingsNoValue); project->addProperty("buildConfigurationList", getHash("XCConfigurationList_" PROJECT_NAME), "Build configuration list for PBXProject \"" PROJECT_NAME "\"", kSettingsNoValue);
project->addProperty("compatibilityVersion", "Xcode 3.2", "", kSettingsNoValue | kSettingsQuoteVariable); project->addProperty("compatibilityVersion", "Xcode 3.2", "", kSettingsNoValue | kSettingsQuoteVariable);
project->addProperty("developmentRegion", "English", "", kSettingsNoValue); project->addProperty("developmentRegion", "English", "", kSettingsNoValue);
project->addProperty("hasScannedForEncodings", "1", "", kSettingsNoValue); project->addProperty("hasScannedForEncodings", "1", "", kSettingsNoValue);

View file

@ -58,7 +58,7 @@ if ($mode eq "") {
$Text::Wrap::unexpand = 0; $Text::Wrap::unexpand = 0;
if ($mode eq "TEXT") { if ($mode eq "TEXT") {
$Text::Wrap::columns = 78; $Text::Wrap::columns = 78;
$max_name_width = 28; # The maximal width of a name. $max_name_width = 29; # The maximal width of a name.
} elsif ($mode eq "CPP") { } elsif ($mode eq "CPP") {
$Text::Wrap::columns = 48; # Approx. $Text::Wrap::columns = 48; # Approx.
} }

View file

@ -1,25 +1,141 @@
#!/bin/bash #!/bin/bash
#
# Iterates over current directory, encodes all files with
# MacBinary but ensures that the dates are preserved
for i in * usage() {
do cat << EOF
Usage: $0 [OPTIONS]...
Dumping Mac files into MacBinary format
There are 2 operation modes. Direct MacBinary encoding (Mac-only) and dumping ISO
contents with hfsutils.
Mode 1:
$0 macbinary
Operate in MacBinary encoding mode
Mode 2:
$0 <file.iso>
Operate in disk dumping mode
Miscellaneous:
-h, --help display this help and exit
EOF
}
path=
macbinarydump() {
mypath=`realpath $0`
for i in *
do
if test -d "$i" ; then if test -d "$i" ; then
cd "$i" cd "$i"
if [ "$(ls -A .)" ] ; then # directory is not empty if [ "$(ls -A .)" ] ; then # directory is not empty
bash $0 "$1/$i" bash $mypath macbinary-phase2 "$path/$i"
fi fi
cd .. cd ..
else else
echo -ne "$1/$i... \r" echo -ne "$path/$i... \r"
macbinary encode "$i" macbinary encode "$i"
touch -r "$i" "$i.bin" touch -r "$i" "$i.bin"
mv "$i.bin" "$i" mv "$i.bin" "$i"
fi fi
done done
}
# on the top level we want to print a new line hfsdump() {
if test -z "$1" ; then IFS=$'\n'
mypath=`realpath $0`
for i in `hls -F1a`
do
if [[ "$i" =~ ":" ]] ; then
dir="${i%?}"
hcd "$dir"
mkdir "$dir"
cd "$dir"
bash $mypath hfsutils-phase2 "$path:$i"
hcd ::
cd ..
else
echo -ne "$path$i... \r"
# Executable files have star at their end. Strip it
if [[ "$i" =~ \*$ ]] ; then
file="${i%?}"
else
file="$i"
fi
fileunix="$file"
# Files count contain stars
file="${file//\*/\\*}"
hcopy -m "$file" "./$fileunix"
fi
done
}
for parm in "$@" ; do
if test "$parm" = "--help" || test "$parm" = "-help" || test "$parm" = "-h" ; then
usage
exit 0
fi
done # for parm in ...
if [[ $1 == "macbinary" ]] ; then
if test ! `type macbinary >/dev/null 2>/dev/null` ; then
echo "macbinary not found. Exiting"
exit 1
fi
macbinarydump
echo echo
exit 0
fi fi
if [[ $1 == "macbinary-phase2" ]] ; then
path=$2
macbinarydump
exit 0
fi
###########
# hfsutils mode
if [ "$#" -lt 1 ] ; then
usage
exit 1
fi
if [[ $1 == "hfsutils-phase2" ]] ; then
path=$2
hfsdump
exit 0
fi
if ! `type hmount >/dev/null 2>/dev/null` ; then
echo "hfsutils not found. Exiting"
exit 1
fi
isofile="$1"
echo -n "Mounting ISO..."
hmount "$isofile" >/dev/null 2>/dev/null
if test -z $? ; then
echo error
exit 1
fi
echo done
echo "Dumping..."
hfsdump
echo
echo -n "Unmounting ISO..."
humount >/dev/null 2>/dev/null
if test -z $? ; then
echo error
exit 1
fi
echo done

View file

@ -205,11 +205,6 @@ void MainMenuDialog::reflowLayout() {
void MainMenuDialog::save() { void MainMenuDialog::save() {
int slot = _saveDialog->runModalWithCurrentTarget(); int slot = _saveDialog->runModalWithCurrentTarget();
#if defined(__PLAYSTATION2__) && defined(DYNAMIC_MODULES)
char pokeme[32];
snprintf(pokeme,32,"hack");
#endif
if (slot >= 0) { if (slot >= 0) {
Common::String result(_saveDialog->getResultString()); Common::String result(_saveDialog->getResultString());
if (result.empty()) { if (result.empty()) {

View file

@ -590,12 +590,13 @@ void Engine::openMainMenuDialog() {
} }
} }
applyGameSettings();
syncSoundSettings();
#ifdef USE_TTS #ifdef USE_TTS
if (ttsMan != nullptr) if (ttsMan != nullptr)
ttsMan->popState(); ttsMan->popState();
#endif #endif
applyGameSettings();
syncSoundSettings();
} }
bool Engine::warnUserAboutUnsupportedGame() { bool Engine::warnUserAboutUnsupportedGame() {

View file

@ -46,6 +46,7 @@
#include "engines/wintermute/base/font/base_font.h" #include "engines/wintermute/base/font/base_font.h"
#include "engines/wintermute/base/base_object.h" #include "engines/wintermute/base/base_object.h"
#include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_parser.h"
#include "engines/wintermute/base/base_region.h"
#include "engines/wintermute/base/sound/base_sound.h" #include "engines/wintermute/base/sound/base_sound.h"
#include "engines/wintermute/base/base_surface_storage.h" #include "engines/wintermute/base/base_surface_storage.h"
#include "engines/wintermute/base/base_transition_manager.h" #include "engines/wintermute/base/base_transition_manager.h"
@ -64,6 +65,7 @@
#include "engines/wintermute/video/video_player.h" #include "engines/wintermute/video/video_player.h"
#include "engines/wintermute/video/video_theora_player.h" #include "engines/wintermute/video/video_theora_player.h"
#include "engines/wintermute/platform_osystem.h" #include "engines/wintermute/platform_osystem.h"
#include "common/config-manager.h"
#include "common/str.h" #include "common/str.h"
namespace Wintermute { namespace Wintermute {
@ -1597,6 +1599,119 @@ bool AdGame::scheduleChangeScene(const char *filename, bool fadeIn) {
} }
//////////////////////////////////////////////////////////////////////////
bool AdGame::handleCustomActionStart(BaseGameCustomAction action) {
bool isCorrosion = BaseEngine::instance().getGameId() == "corrosion";
if (isCorrosion) {
// Corrosion Enhanced Edition contain city map screen, which is
// mouse controlled and conflicts with those custom actions
const char *m = "items\\street_map\\windows\\street_map_window.script";
if (_scEngine->isRunningScript(m)) {
return false;
}
}
int xLeft = 30;
int xCenter = _renderer->getWidth() / 2;
int xRight = _renderer->getWidth() - 30;
int yTop = 35;
int yCenter = _renderer->getHeight() / 2;
int yBottom = _renderer->getHeight() - 35;
if (isCorrosion && !(ConfMan.get("extra").contains("Enhanced"))) {
// original version of Corrosion has a toolbar under the game screen
yBottom -= 60;
}
BaseArray<AdObject *> objects;
Point32 p;
int distance = xCenter * xCenter + yCenter * yCenter;
switch (action) {
case kClickAtCenter:
p.x = xCenter;
p.y = yCenter;
break;
case kClickAtLeft:
p.x = xLeft;
p.y = yCenter;
break;
case kClickAtRight:
p.x = xRight;
p.y = yCenter;
break;
case kClickAtTop:
p.x = xCenter;
p.y = yTop;
break;
case kClickAtBottom:
p.x = xCenter;
p.y = yBottom;
break;
case kClickAtEntityNearestToCenter:
p.x = xCenter;
p.y = yCenter;
// Looking through all objects for entities near to the center
if (_scene && _scene->getSceneObjects(objects, true)) {
for (uint32 i = 0; i < objects.size(); i++) {
BaseRegion *region;
if (objects[i]->getType() != OBJECT_ENTITY ||
!objects[i]->_active ||
!objects[i]->_registrable ||
(!(region = ((AdEntity *)objects[i])->_region))
) {
continue;
}
// Something exactly at center? Great!
if (region->pointInRegion(xCenter, yCenter)) {
distance = 0;
p.x = xCenter;
p.y = yCenter;
break;
}
// Something at the edge? Available with other actions.
if (region->pointInRegion(xLeft, yCenter) ||
region->pointInRegion(xRight, yCenter) ||
region->pointInRegion(xCenter, yBottom) ||
region->pointInRegion(xCenter, yTop)
) {
continue;
}
// Keep entities that has less distance to center
int x = ((AdEntity *)objects[i])->_posX;
int y = ((AdEntity *)objects[i])->_posY - ((AdEntity *)objects[i])->getHeight() / 2;
int d = (x - xCenter) * (x - xCenter) + (y - yCenter) * (y - yCenter);
if (distance > d) {
distance = d;
p.x = x;
p.y = y;
}
}
}
break;
default:
return false;
}
BasePlatform::setCursorPos(p.x, p.y);
setActiveObject(_gameRef->_renderer->getObjectAt(p.x, p.y));
onMouseLeftDown();
onMouseLeftUp();
return true;
}
//////////////////////////////////////////////////////////////////////////
bool AdGame::handleCustomActionEnd(BaseGameCustomAction action) {
return false;
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
bool AdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) const { bool AdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) const {
BaseGame::getVersion(verMajor, verMinor, nullptr, nullptr); BaseGame::getVersion(verMajor, verMinor, nullptr, nullptr);

View file

@ -52,6 +52,9 @@ public:
bool onMouseRightDown() override; bool onMouseRightDown() override;
bool onMouseRightUp() override; bool onMouseRightUp() override;
bool handleCustomActionStart(BaseGameCustomAction action) override;
bool handleCustomActionEnd(BaseGameCustomAction action) override;
bool displayDebugInfo() override; bool displayDebugInfo() override;
bool addSpeechDir(const char *dir); bool addSpeechDir(const char *dir);

View file

@ -66,6 +66,7 @@ enum WMETargetExecutable {
WME_1_7_1, // DEAD:CODE 2007 WME_1_7_1, // DEAD:CODE 2007
WME_1_7_2, // DEAD:CODE 2007 WME_1_7_2, // DEAD:CODE 2007
WME_1_7_3, // DEAD:CODE 2007 WME_1_7_3, // DEAD:CODE 2007
WME_1_7_93, // DEAD:CODE 2007
WME_1_7_94, // DEAD:CODE 2007 WME_1_7_94, // DEAD:CODE 2007
WME_1_8_0, // DEAD:CODE 2007 WME_1_8_0, // DEAD:CODE 2007
WME_1_8_1, // DEAD:CODE 2007 WME_1_8_1, // DEAD:CODE 2007

View file

@ -79,6 +79,9 @@
#if EXTENDED_DEBUGGER_ENABLED #if EXTENDED_DEBUGGER_ENABLED
#include "engines/wintermute/base/scriptables/debuggable/debuggable_script_engine.h" #include "engines/wintermute/base/scriptables/debuggable/debuggable_script_engine.h"
#endif
#ifdef ENABLE_WME3D
#include "graphics/renderer.h" #include "graphics/renderer.h"
#endif #endif
@ -4011,50 +4014,6 @@ bool BaseGame::handleMouseWheel(int32 delta) {
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
bool BaseGame::handleCustomActionStart(BaseGameCustomAction action) { bool BaseGame::handleCustomActionStart(BaseGameCustomAction action) {
if (BaseEngine::instance().getGameId() == "corrosion") {
// Keyboard walking is added, for both original game & Enhanced Edition
// However, Enhanced Edition contain city map screen, which is
// mouse controlled and conflicts with those custom actions
const char *m = "items\\street_map\\windows\\street_map_window.script";
if (_scEngine->isRunningScript(m)) {
return false;
}
Point32 p;
switch (action) {
case kClickAtCenter:
p.x = _renderer->getWidth() / 2;
p.y = _renderer->getHeight() / 2;
break;
case kClickAtLeft:
p.x = 30;
p.y = _renderer->getHeight() / 2;
break;
case kClickAtRight:
p.x = _renderer->getWidth() - 30;
p.y = _renderer->getHeight() / 2;
break;
case kClickAtTop:
p.x = _renderer->getWidth() / 2;
p.y = 10;
break;
case kClickAtBottom:
p.x = _renderer->getWidth() / 2;
p.y = _renderer->getHeight();
p.y -= ConfMan.get("extra").contains("Enhanced") ? 35 : 90;
break;
default:
return false;
}
BasePlatform::setCursorPos(p.x, p.y);
setActiveObject(_gameRef->_renderer->getObjectAt(p.x, p.y));
onMouseLeftDown();
onMouseLeftUp();
return true;
}
return false; return false;
} }

View file

@ -222,8 +222,8 @@ public:
bool handleKeypress(Common::Event *event, bool printable = false) override; bool handleKeypress(Common::Event *event, bool printable = false) override;
virtual void handleKeyRelease(Common::Event *event); virtual void handleKeyRelease(Common::Event *event);
bool handleCustomActionStart(BaseGameCustomAction action); virtual bool handleCustomActionStart(BaseGameCustomAction action);
bool handleCustomActionEnd(BaseGameCustomAction action); virtual bool handleCustomActionEnd(BaseGameCustomAction action);
bool unfreeze(); bool unfreeze();
bool freeze(bool includingMusic = true); bool freeze(bool includingMusic = true);

View file

@ -36,7 +36,8 @@ enum BaseGameCustomAction {
kClickAtLeft = 1, kClickAtLeft = 1,
kClickAtRight = 2, kClickAtRight = 2,
kClickAtTop = 3, kClickAtTop = 3,
kClickAtBottom = 4 kClickAtBottom = 4,
kClickAtEntityNearestToCenter = 5
}; };
} // End of namespace Wintermute } // End of namespace Wintermute

View file

@ -36,7 +36,6 @@
#include "engines/wintermute/base/gfx/base_image.h" #include "engines/wintermute/base/gfx/base_image.h"
#include "engines/wintermute/base/save_thumb_helper.h" #include "engines/wintermute/base/save_thumb_helper.h"
#include "engines/wintermute/base/sound/base_sound.h" #include "engines/wintermute/base/sound/base_sound.h"
#include "graphics/transparent_surface.h"
#include "engines/wintermute/wintermute.h" #include "engines/wintermute/wintermute.h"
#include "graphics/scaler.h" #include "graphics/scaler.h"
#include "image/bmp.h" #include "image/bmp.h"
@ -179,11 +178,9 @@ void BasePersistenceManager::getSaveStateDesc(int slot, SaveStateDescriptor &des
Image::BitmapDecoder bmpDecoder; Image::BitmapDecoder bmpDecoder;
if (bmpDecoder.loadStream(thumbStream)) { if (bmpDecoder.loadStream(thumbStream)) {
const Graphics::Surface *bmpSurface = bmpDecoder.getSurface(); const Graphics::Surface *bmpSurface = bmpDecoder.getSurface();
Graphics::TransparentSurface *scaleableSurface = new Graphics::TransparentSurface(*bmpSurface, false); Graphics::Surface *scaled = bmpSurface->scale(kThumbnailWidth, kThumbnailHeight2);
Graphics::Surface *scaled = scaleableSurface->scale(kThumbnailWidth, kThumbnailHeight2);
Graphics::Surface *thumb = scaled->convertTo(g_system->getOverlayFormat()); Graphics::Surface *thumb = scaled->convertTo(g_system->getOverlayFormat());
desc.setThumbnail(thumb); desc.setThumbnail(thumb);
delete scaleableSurface;
scaled->free(); scaled->free();
delete scaled; delete scaled;
} }

View file

@ -28,7 +28,6 @@
#include "engines/wintermute/base/gfx/base_image.h" #include "engines/wintermute/base/gfx/base_image.h"
#include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/base/base_file_manager.h"
#include "graphics/transparent_surface.h"
#include "graphics/surface.h" #include "graphics/surface.h"
#include "image/png.h" #include "image/png.h"
#include "image/jpeg.h" #include "image/jpeg.h"
@ -112,14 +111,13 @@ bool BaseImage::saveBMPFile(const Common::String &filename) const {
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
bool BaseImage::resize(int newWidth, int newHeight) { bool BaseImage::resize(int newWidth, int newHeight) {
// WME Lite used FILTER_BILINEAR with FreeImage_Rescale here. // WME Lite used FILTER_BILINEAR with FreeImage_Rescale here.
Graphics::TransparentSurface temp(*_surface, true); Graphics::Surface *temp = _surface->scale((uint16)newWidth, (uint16)newHeight);
if (_deletableSurface) { if (_deletableSurface) {
_deletableSurface->free(); _deletableSurface->free();
delete _deletableSurface; delete _deletableSurface;
_deletableSurface = nullptr; _deletableSurface = nullptr;
} }
_surface = _deletableSurface = temp.scale((uint16)newWidth, (uint16)newHeight); _surface = _deletableSurface = temp;
temp.free();
return true; return true;
} }
@ -216,13 +214,13 @@ bool BaseImage::writeBMPToStream(Common::WriteStream *stream) const {
bool BaseImage::copyFrom(BaseImage *origImage, int newWidth, int newHeight) { bool BaseImage::copyFrom(BaseImage *origImage, int newWidth, int newHeight) {
// WME Lite used FILTER_BILINEAR with FreeImage_Rescale here. // WME Lite used FILTER_BILINEAR with FreeImage_Rescale here.
Graphics::TransparentSurface temp(*origImage->_surface, false); Graphics::Surface *temp = origImage->_surface->scale((uint16)newWidth, (uint16)newHeight);
if (_deletableSurface) { if (_deletableSurface) {
_deletableSurface->free(); _deletableSurface->free();
delete _deletableSurface; delete _deletableSurface;
_deletableSurface = nullptr; _deletableSurface = nullptr;
} }
_surface = _deletableSurface = temp.scale((uint16)newWidth, (uint16)newHeight); _surface = _deletableSurface = temp;
return true; return true;
} }

View file

@ -72,13 +72,7 @@ RenderTicketOpenGL::RenderTicketOpenGL(BaseSurfaceOpenGLTexture *owner, const Gr
} else if ((dstRect->width() != srcRect->width() || } else if ((dstRect->width() != srcRect->width() ||
dstRect->height() != srcRect->height()) && dstRect->height() != srcRect->height()) &&
_transform._numTimesX * _transform._numTimesY == 1) { _transform._numTimesX * _transform._numTimesY == 1) {
Graphics::TransparentSurface src(*_surface, false); Graphics::Surface *temp = _surface->scale(dstRect->width(), dstRect->height(), owner->_gameRef->getBilinearFiltering());
Graphics::Surface *temp;
if (owner->_gameRef->getBilinearFiltering()) {
temp = src.scaleT<Graphics::FILTER_BILINEAR>(dstRect->width(), dstRect->height());
} else {
temp = src.scaleT<Graphics::FILTER_NEAREST>(dstRect->width(), dstRect->height());
}
_surface->free(); _surface->free();
delete _surface; delete _surface;
_surface = temp; _surface = temp;

View file

@ -72,13 +72,7 @@ RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *s
} else if ((dstRect->width() != srcRect->width() || } else if ((dstRect->width() != srcRect->width() ||
dstRect->height() != srcRect->height()) && dstRect->height() != srcRect->height()) &&
_transform._numTimesX * _transform._numTimesY == 1) { _transform._numTimesX * _transform._numTimesY == 1) {
Graphics::TransparentSurface src(*_surface, false); Graphics::Surface *temp = _surface->scale(dstRect->width(), dstRect->height(), owner->_gameRef->getBilinearFiltering());
Graphics::Surface *temp;
if (owner->_gameRef->getBilinearFiltering()) {
temp = src.scaleT<Graphics::FILTER_BILINEAR>(dstRect->width(), dstRect->height());
} else {
temp = src.scaleT<Graphics::FILTER_NEAREST>(dstRect->width(), dstRect->height());
}
_surface->free(); _surface->free();
delete _surface; delete _surface;
_surface = temp; _surface = temp;

View file

@ -113,8 +113,9 @@ typedef enum {
// operation code types // operation code types
typedef enum { typedef enum {
OPCODES_UNCHANGED = 0, OPCODES_UNCHANGED = 0
#ifdef ENABLE_FOXTAIL #ifdef ENABLE_FOXTAIL
,
OPCODES_FOXTAIL_1_2_896, OPCODES_FOXTAIL_1_2_896,
OPCODES_FOXTAIL_1_2_902 OPCODES_FOXTAIL_1_2_902
#endif #endif

View file

@ -130,6 +130,8 @@ static const PlainGameDescriptor wintermuteGames[] = {
{"sofiasdebt", "Sofia's Debt"}, {"sofiasdebt", "Sofia's Debt"},
{"sotv1", "Shadows on the Vatican - Act I: Greed"}, {"sotv1", "Shadows on the Vatican - Act I: Greed"},
{"sotv2", "Shadows on the Vatican - Act II: Wrath"}, {"sotv2", "Shadows on the Vatican - Act II: Wrath"},
{"strangechange", "Strange Change"},
{"sunrise", "Sunrise: The game"},
{"tanya1", "Tanya Grotter and the Magical Double Bass"}, {"tanya1", "Tanya Grotter and the Magical Double Bass"},
{"tanya2", "Tanya Grotter and the Disappearing Floor"}, {"tanya2", "Tanya Grotter and the Disappearing Floor"},
{"tehran1933", "Murder In Tehran's Alleys 1933"}, {"tehran1933", "Murder In Tehran's Alleys 1933"},
@ -591,7 +593,7 @@ static const WMEGameDescription gameDescriptions[] = {
// Conspiracao Dumont (Demo) // Conspiracao Dumont (Demo)
WME_WINENTRY("conspiracao", "Demo", WME_WINENTRY("conspiracao", "Demo",
WME_ENTRY1s("ConspiracaoDumont.exe", "106f3f2c8f18bb5ffffeed634ace256c", 32908032), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION), WME_ENTRY1s("ConspiracaoDumont.exe", "106f3f2c8f18bb5ffffeed634ace256c", 32908032), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, WME_1_7_0),
// Corrosion: Cold Winter Waiting // Corrosion: Cold Winter Waiting
WME_WINENTRY("corrosion", "", WME_WINENTRY("corrosion", "",
@ -1404,7 +1406,7 @@ static const WMEGameDescription gameDescriptions[] = {
// Life In 3 Minutes // Life In 3 Minutes
WME_WINENTRY("lifein3minutes", "", WME_WINENTRY("lifein3minutes", "",
WME_ENTRY1s("data.dcp", "c6368950e37a95bf098b02b4eaa5b929", 141787214), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION), WME_ENTRY1s("data.dcp", "c6368950e37a95bf098b02b4eaa5b929", 141787214), Common::EN_ANY, ADGF_UNSTABLE, WME_1_9_1),
// Looky Demo (English) // Looky Demo (English)
WME_WINENTRY("looky", "Demo", WME_WINENTRY("looky", "Demo",
@ -4865,6 +4867,16 @@ static const WMEGameDescription gameDescriptions[] = {
WME_ENTRY2s("data.dcp", "5c88a51d010ad24225dee432ed38b238", 25987377, WME_ENTRY2s("data.dcp", "5c88a51d010ad24225dee432ed38b238", 25987377,
"lang-german.dcp", "78d06de2b4a8c68517eb6df3ded86d82", 1524330), Common::DE_DEU, ADGF_UNSTABLE, WME_1_9_1), "lang-german.dcp", "78d06de2b4a8c68517eb6df3ded86d82", 1524330), Common::DE_DEU, ADGF_UNSTABLE, WME_1_9_1),
// Strange Change
// NOTE: This is a 2.5D game that is out of ScummVM scope
WME_WINENTRY("strangechange", "",
WME_ENTRY1s("data.dcp", "818e53c1584dac28f336195d7dcfb97d", 3762512), Common::EN_ANY, ADGF_UNSTABLE | GF_3D, WME_1_8_6),
// Sunrise: The game (Demo) (German)
// NOTE: This is a 2.5D game that is out of ScummVM scope
WME_WINENTRY("sunrise", "",
WME_ENTRY1s("data.dcp", "3bac4da87472d2e7676e9548970d521a", 52095549), Common::DE_DEU, ADGF_UNSTABLE | GF_3D, WME_1_7_93),
// Tanya Grotter and the Magical Double Bass // Tanya Grotter and the Magical Double Bass
WME_WINENTRY("tanya1", "", WME_WINENTRY("tanya1", "",
WME_ENTRY1s("data.dcp", "035bbdaff078cc4053ecf4b518c0d0fd", 1007507786), Common::RU_RUS, ADGF_UNSTABLE, WME_1_8_0), WME_ENTRY1s("data.dcp", "035bbdaff078cc4053ecf4b518c0d0fd", 1007507786), Common::RU_RUS, ADGF_UNSTABLE, WME_1_8_0),
@ -5000,7 +5012,7 @@ static const WMEGameDescription gameDescriptions[] = {
// War // War
WME_WINENTRY("war", "", WME_WINENTRY("war", "",
WME_ENTRY1s("data.dcp", "003e317cda6d0137bbd5e5d7f089ee4d", 32591890), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION), WME_ENTRY1s("data.dcp", "003e317cda6d0137bbd5e5d7f089ee4d", 32591890), Common::EN_ANY, ADGF_UNSTABLE, WME_1_9_1),
// Wintermute Engine Technology Demo (1.2) // Wintermute Engine Technology Demo (1.2)
WME_WINENTRY("wmedemo", "1.2", WME_WINENTRY("wmedemo", "1.2",
@ -5025,11 +5037,11 @@ static const WMEGameDescription gameDescriptions[] = {
// Zilm: A Game of Reflex // Zilm: A Game of Reflex
WME_WINENTRY("zilm", "", WME_WINENTRY("zilm", "",
WME_ENTRY1s("data.dcp", "81cece0c8105b4725fc35064a32b4b52", 351726), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION), WME_ENTRY1s("data.dcp", "81cece0c8105b4725fc35064a32b4b52", 351726), Common::EN_ANY, ADGF_UNSTABLE, WME_1_9_3),
// Zilm: A Game of Reflex 1.0 // Zilm: A Game of Reflex 1.0
WME_WINENTRY("zilm", "1.0", WME_WINENTRY("zilm", "1.0",
WME_ENTRY1s("data.dcp", "098dffaf03d8adbb4cb5633e4733e63c", 351726), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION), WME_ENTRY1s("data.dcp", "098dffaf03d8adbb4cb5633e4733e63c", 351726), Common::EN_ANY, ADGF_UNSTABLE, WME_1_9_3),
// Zbang! The Game (Demo) // Zbang! The Game (Demo)
// NOTE: This is a 2.5D game that is out of ScummVM scope // NOTE: This is a 2.5D game that is out of ScummVM scope

View file

@ -35,6 +35,8 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
using namespace Common; using namespace Common;
Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "wintermute", "Wintermute engine"); Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "wintermute", "Wintermute engine");
Keymap *gameKeyMap = new Keymap(Keymap::kKeymapTypeGame, gameId, gameDescr);
Keymap *extraKeyMap = new Keymap(Keymap::kKeymapTypeGame, "extras", "ScummVM extra actions");
Action *act; Action *act;
@ -70,7 +72,12 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
gameId == "agustin" || gameId == "agustin" ||
gameId == "bickadoodle" || gameId == "bickadoodle" ||
gameId == "bthreshold" || gameId == "bthreshold" ||
gameId == "carolreed6" ||
gameId == "carolreed7" ||
gameId == "carolreed8" ||
gameId == "colorsoncanvas" || gameId == "colorsoncanvas" ||
gameId == "conspiracao" ||
gameId == "corrosion" ||
gameId == "deadcity" || gameId == "deadcity" ||
gameId == "darkfallls" || gameId == "darkfallls" ||
gameId == "drbohus" || gameId == "drbohus" ||
@ -84,6 +91,7 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
gameId == "hamlet" || gameId == "hamlet" ||
gameId == "hor" || gameId == "hor" ||
gameId == "juliauntold" || gameId == "juliauntold" ||
gameId == "lifein3minutes" ||
gameId == "lonelyrobot" || gameId == "lonelyrobot" ||
gameId == "machumayu" || gameId == "machumayu" ||
gameId == "mirage" || gameId == "mirage" ||
@ -94,20 +102,18 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
gameId == "sofiasdebt" || gameId == "sofiasdebt" ||
gameId == "spaceinvaders" || gameId == "spaceinvaders" ||
gameId == "spacemadness" || gameId == "spacemadness" ||
gameId == "strangechange" ||
gameId == "tanya1" || gameId == "tanya1" ||
gameId == "tanya2" || gameId == "tanya2" ||
gameId == "theancientmark1" || gameId == "theancientmark1" ||
gameId == "thebox" || gameId == "thebox" ||
gameId == "thekite" || gameId == "thekite" ||
gameId == "tradestory" || gameId == "tradestory" ||
gameId == "war" ||
gameId == "wmedemo" gameId == "wmedemo"
) { ) {
return Keymap::arrayOf(engineKeyMap); /* no game-specific keymap */
} } else if (gameId == "dfafadventure" ||
Keymap *gameKeyMap = new Keymap(Keymap::kKeymapTypeGame, gameId, gameDescr);
if (gameId == "dfafadventure" ||
gameId == "dreamcat" || gameId == "dreamcat" ||
gameId == "openquest" gameId == "openquest"
) { ) {
@ -215,7 +221,12 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
act->addDefaultInputMapping("JOY_Y"); // extra joy act->addDefaultInputMapping("JOY_Y"); // extra joy
gameKeyMap->addAction(act); gameKeyMap->addAction(act);
} else if (gameId == "drdoylemotch" || } else if (gameId == "drdoylemotch" ||
gameId == "carolreed9" ||
gameId == "carolreed10" ||
gameId == "carolreed11" ||
gameId == "carolreed12" ||
gameId == "kulivocko" || gameId == "kulivocko" ||
gameId == "sunrise" ||
gameId == "rebeccacarlson1" gameId == "rebeccacarlson1"
) { ) {
act = new Action("HINT", _("Show hints")); act = new Action("HINT", _("Show hints"));
@ -239,7 +250,56 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
act->setMiddleClickEvent(); act->setMiddleClickEvent();
act->addDefaultInputMapping("MOUSE_MIDDLE"); // original mouse act->addDefaultInputMapping("MOUSE_MIDDLE"); // original mouse
act->addDefaultInputMapping("JOY_Y"); // extra joy act->addDefaultInputMapping("JOY_Y"); // extra joy
engineKeyMap->addAction(act); gameKeyMap->addAction(act);
} else if (gameId == "qajarycat") {
act = new Action("HINT", _("Show hints"));
act->setKeyEvent(KeyState(KEYCODE_SPACE, ASCII_SPACE));
act->addDefaultInputMapping("SPACE"); // original keyboard
act->addDefaultInputMapping("MOUSE_MIDDLE"); // extra mouse
act->addDefaultInputMapping("JOY_Y"); // extra joy
gameKeyMap->addAction(act);
act = new Action("GUIA", _("GUI variant A"));
act->setKeyEvent(KEYCODE_F10);
act->addDefaultInputMapping("F10"); // original keyboard
act->addDefaultInputMapping("MOUSE_WHEEL_UP"); // extra mouse
act->addDefaultInputMapping("JOY_LEFT"); // extra joy
gameKeyMap->addAction(act);
act = new Action("GUIB", _("GUI variant B"));
act->setKeyEvent(KEYCODE_F11);
act->addDefaultInputMapping("F11"); // original keyboard
act->addDefaultInputMapping("MOUSE_WHEEL_DOWN"); // extra mouse
act->addDefaultInputMapping("JOY_RIGHT"); // extra joy
gameKeyMap->addAction(act);
act = new Action("PHONEX", _("Phone cancel button"));
act->setKeyEvent(KeyState(KEYCODE_BACKSPACE, ASCII_BACKSPACE));
act->addDefaultInputMapping("BACKSPACE"); // original keyboard
gameKeyMap->addAction(act);
act = new Action("PHONEU", _("Phone up button"));
act->setKeyEvent(KEYCODE_UP);
act->addDefaultInputMapping("UP"); // original keyboard
act->addDefaultInputMapping("JOY_UP"); // extra joy
gameKeyMap->addAction(act);
act = new Action("PHONED", _("Phone down button"));
act->setKeyEvent(KEYCODE_DOWN);
act->addDefaultInputMapping("DOWN"); // original keyboard
act->addDefaultInputMapping("JOY_DOWN"); // extra joy
gameKeyMap->addAction(act);
act = new Action("MCLK", _("Middle Click"));
act->setMiddleClickEvent();
act->addDefaultInputMapping("MOUSE_MIDDLE"); // original mouse
gameKeyMap->addAction(act);
act = new Action("WTF", _("???"));
act->setKeyEvent(KEYCODE_HOME);
act->addDefaultInputMapping("HOME"); // original keyboard
//TODO: extra joy control, e.g. "JOY_R+JOY_B"
gameKeyMap->addAction(act);
} else if (gameId == "alimardan1") { } else if (gameId == "alimardan1") {
act = new Action("HINT", _("Show hints")); act = new Action("HINT", _("Show hints"));
act->setKeyEvent(KeyState(KEYCODE_SPACE, ASCII_SPACE)); act->setKeyEvent(KeyState(KEYCODE_SPACE, ASCII_SPACE));
@ -510,43 +570,22 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
act = new Action("VOLMAX", _("Volume max")); act = new Action("VOLMAX", _("Volume max"));
act->setMouseWheelUpEvent(); act->setMouseWheelUpEvent();
act->addDefaultInputMapping("MOUSE_WHEEL_UP"); // original mouse act->addDefaultInputMapping("MOUSE_WHEEL_UP"); // original mouse
act->addDefaultInputMapping("UP"); // extra keyboard act->addDefaultInputMapping("PAGEUP"); // extra keyboard
act->addDefaultInputMapping("JOY_UP"); // extra joy //TODO: extra joy control, e.g. "JOY_R+JOY_UP"
gameKeyMap->addAction(act); gameKeyMap->addAction(act);
act = new Action("VOLOFF", _("Volume off")); act = new Action("VOLOFF", _("Volume off"));
act->setMouseWheelDownEvent(); act->setMouseWheelDownEvent();
act->addDefaultInputMapping("MOUSE_WHEEL_DOWN"); // original mouse act->addDefaultInputMapping("MOUSE_WHEEL_DOWN"); // original mouse
act->addDefaultInputMapping("DOWN"); // extra keyboard act->addDefaultInputMapping("PAGEDOWN"); // extra keyboard
act->addDefaultInputMapping("JOY_DOWN"); // extra joy //TODO: extra joy control, e.g. "JOY_R+JOY_DOWN"
gameKeyMap->addAction(act); gameKeyMap->addAction(act);
} else if (gameId == "corrosion") { } else if (gameId == "carolreed5") {
act = new Action(kStandardActionMoveUp, _("Walk forward")); act = new Action("HINT", _("Show hints"));
act->setCustomEngineActionEvent(kClickAtCenter); act->setKeyEvent(KeyState(KEYCODE_TAB, ASCII_TAB));
act->addDefaultInputMapping("UP"); // extra keyboard act->addDefaultInputMapping("TAB"); // original keyboard
act->addDefaultInputMapping("KP8"); // extra keyboard act->addDefaultInputMapping("MOUSE_MIDDLE"); // extra mouse
act->addDefaultInputMapping("JOY_UP"); // extra joy act->addDefaultInputMapping("JOY_Y"); // extra joy
gameKeyMap->addAction(act);
act = new Action(kStandardActionMoveDown, _("Walk backward"));
act->setCustomEngineActionEvent(kClickAtBottom);
act->addDefaultInputMapping("DOWN"); // extra keyboard
act->addDefaultInputMapping("KP2"); // extra keyboard
act->addDefaultInputMapping("JOY_DOWN"); // extra joy
gameKeyMap->addAction(act);
act = new Action(kStandardActionMoveLeft, _("Turn left"));
act->setCustomEngineActionEvent(kClickAtLeft);
act->addDefaultInputMapping("LEFT"); // extra keyboard
act->addDefaultInputMapping("KP4"); // extra keyboard
act->addDefaultInputMapping("JOY_LEFT"); // extra joy
gameKeyMap->addAction(act);
act = new Action(kStandardActionMoveRight, _("Turn right"));
act->setCustomEngineActionEvent(kClickAtRight);
act->addDefaultInputMapping("RIGHT"); // extra keyboard
act->addDefaultInputMapping("KP6"); // extra keyboard
act->addDefaultInputMapping("JOY_RIGHT"); // extra joy
gameKeyMap->addAction(act); gameKeyMap->addAction(act);
} else if (gameId == "erinmyers") { } else if (gameId == "erinmyers") {
act = new Action("GUIB", _("Change font size")); act = new Action("GUIB", _("Change font size"));
@ -1434,6 +1473,51 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
act->addDefaultInputMapping("MOUSE_MIDDLE"); // extra mouse act->addDefaultInputMapping("MOUSE_MIDDLE"); // extra mouse
act->addDefaultInputMapping("JOY_DOWN"); // extra joy act->addDefaultInputMapping("JOY_DOWN"); // extra joy
gameKeyMap->addAction(act); gameKeyMap->addAction(act);
} else if (gameId == "zilm") {
act = new Action("P1UP", _("Player 1: Up"));
act->setKeyEvent(KeyState(KEYCODE_w, 'w'));
act->addDefaultInputMapping("w"); // original keyboard
gameKeyMap->addAction(act);
act = new Action("P1LT", _("Player 1: Left"));
act->setKeyEvent(KeyState(KEYCODE_a, 'a'));
act->addDefaultInputMapping("a"); // original keyboard
gameKeyMap->addAction(act);
act = new Action("P1DN", _("Player 1: Down"));
act->setKeyEvent(KeyState(KEYCODE_s, 's'));
act->addDefaultInputMapping("s"); // original keyboard
gameKeyMap->addAction(act);
act = new Action("P1RT", _("Player 1: Right"));
act->setKeyEvent(KeyState(KEYCODE_d, 'd'));
act->addDefaultInputMapping("d"); // original keyboard
gameKeyMap->addAction(act);
act = new Action("P2UP", _("Player 2: Up"));
act->setKeyEvent(KEYCODE_UP);
act->addDefaultInputMapping("UP"); // original keyboard
gameKeyMap->addAction(act);
act = new Action("P2LT", _("Player 2: Left"));
act->setKeyEvent(KEYCODE_LEFT);
act->addDefaultInputMapping("LEFT"); // original keyboard
gameKeyMap->addAction(act);
act = new Action("P2DN", _("Player 2: Down"));
act->setKeyEvent(KEYCODE_DOWN);
act->addDefaultInputMapping("DOWN"); // original keyboard
gameKeyMap->addAction(act);
act = new Action("P2RT", _("Player 2: Right"));
act->setKeyEvent(KEYCODE_RIGHT);
act->addDefaultInputMapping("RIGHT"); // original keyboard
gameKeyMap->addAction(act);
act = new Action("DBGFPS", _("Debug FPS"));
act->setKeyEvent(KEYCODE_F2);
act->addDefaultInputMapping("F2"); // original keyboard
gameKeyMap->addAction(act);
} else if (gameId == "zbang") { } else if (gameId == "zbang") {
act = new Action("ACTNXT", _("Next action")); act = new Action("ACTNXT", _("Next action"));
act->setMouseWheelUpEvent(); act->setMouseWheelUpEvent();
@ -1515,7 +1599,7 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
act = new Action("MCLK", _("Middle Click")); act = new Action("MCLK", _("Middle Click"));
act->setMiddleClickEvent(); act->setMiddleClickEvent();
act->addDefaultInputMapping("MOUSE_MIDDLE"); // original mouse act->addDefaultInputMapping("MOUSE_MIDDLE"); // original mouse
engineKeyMap->addAction(act); gameKeyMap->addAction(act);
act = new Action("SCRLUP", _("Scroll up")); act = new Action("SCRLUP", _("Scroll up"));
act->setMouseWheelUpEvent(); act->setMouseWheelUpEvent();
@ -1542,8 +1626,51 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common
act->addDefaultInputMapping("TAB"); // original keyboard act->addDefaultInputMapping("TAB"); // original keyboard
gameKeyMap->addAction(act); gameKeyMap->addAction(act);
} }
result.push_back(gameKeyMap); result.push_back(gameKeyMap);
if (gameId == "carolreed4" ||
gameId == "carolreed5" ||
gameId == "carolreed6" ||
gameId == "carolreed7" ||
gameId == "carolreed8" ||
gameId == "carolreed9" ||
gameId == "carolreed10" ||
gameId == "carolreed11" ||
gameId == "carolreed12" ||
gameId == "corrosion" ||
gameId == "rebeccacarlson1"
) {
act = new Action(kStandardActionMoveUp, _("Walk forward"));
act->setCustomEngineActionEvent(kClickAtEntityNearestToCenter);
act->addDefaultInputMapping("UP"); // extra keyboard
act->addDefaultInputMapping("KP5"); // extra keyboard
act->addDefaultInputMapping("JOY_UP"); // extra joy
extraKeyMap->addAction(act);
act = new Action(kStandardActionMoveDown, _("Walk backward"));
act->setCustomEngineActionEvent(kClickAtBottom);
act->addDefaultInputMapping("DOWN"); // extra keyboard
act->addDefaultInputMapping("KP2"); // extra keyboard
act->addDefaultInputMapping("JOY_DOWN"); // extra joy
extraKeyMap->addAction(act);
act = new Action(kStandardActionMoveLeft, _("Turn left"));
act->setCustomEngineActionEvent(kClickAtLeft);
act->addDefaultInputMapping("LEFT"); // extra keyboard
act->addDefaultInputMapping("KP4"); // extra keyboard
act->addDefaultInputMapping("JOY_LEFT"); // extra joy
extraKeyMap->addAction(act);
act = new Action(kStandardActionMoveRight, _("Turn right"));
act->setCustomEngineActionEvent(kClickAtRight);
act->addDefaultInputMapping("RIGHT"); // extra keyboard
act->addDefaultInputMapping("KP6"); // extra keyboard
act->addDefaultInputMapping("JOY_RIGHT"); // extra joy
extraKeyMap->addAction(act);
}
result.push_back(extraKeyMap);
return result; return result;
} }

View file

@ -29,7 +29,9 @@
#ifndef WINTERMUTE_MATHUTIL_H #ifndef WINTERMUTE_MATHUTIL_H
#define WINTERMUTE_MATHUTIL_H #define WINTERMUTE_MATHUTIL_H
#ifdef ENABLE_WME3D
#include "math/vector3d.h" #include "math/vector3d.h"
#endif
namespace Wintermute { namespace Wintermute {

View file

@ -116,18 +116,10 @@ struct ColorMasks<555> {
kGreenBits = 5, kGreenBits = 5,
kBlueBits = 5, kBlueBits = 5,
#ifdef __N64__
/* Nintendo 64 uses a BGR555 color format for 16bit display */
kAlphaShift = 0,
kRedShift = kBlueBits+kGreenBits+1,
kGreenShift = kBlueBits + 1,
kBlueShift = 1,
#else /* RGB555 */
kAlphaShift = 0, kAlphaShift = 0,
kRedShift = kGreenBits+kBlueBits, kRedShift = kGreenBits+kBlueBits,
kGreenShift = kBlueBits, kGreenShift = kBlueBits,
kBlueShift = 0, kBlueShift = 0,
#endif
kAlphaMask = ((1 << kAlphaBits) - 1) << kAlphaShift, kAlphaMask = ((1 << kAlphaBits) - 1) << kAlphaShift,
kRedMask = ((1 << kRedBits) - 1) << kRedShift, kRedMask = ((1 << kRedBits) - 1) << kRedShift,
@ -206,17 +198,10 @@ struct ColorMasks<4444> {
kGreenBits = 4, kGreenBits = 4,
kBlueBits = 4, kBlueBits = 4,
#ifdef __PSP__ //PSP uses ABGR
kAlphaShift = kRedBits+kGreenBits+kBlueBits,
kRedShift = 0,
kGreenShift = kRedBits,
kBlueShift = kRedBits+kGreenBits,
#else //ARGB
kAlphaShift = kRedBits+kGreenBits+kBlueBits, kAlphaShift = kRedBits+kGreenBits+kBlueBits,
kRedShift = kGreenBits+kBlueBits, kRedShift = kGreenBits+kBlueBits,
kGreenShift = kBlueBits, kGreenShift = kBlueBits,
kBlueShift = 0, kBlueShift = 0,
#endif
kAlphaMask = ((1 << kAlphaBits) - 1) << kAlphaShift, kAlphaMask = ((1 << kAlphaBits) - 1) << kAlphaShift,
kRedMask = ((1 << kRedBits) - 1) << kRedShift, kRedMask = ((1 << kRedBits) - 1) << kRedShift,
@ -302,35 +287,6 @@ struct ColorMasks<8888> {
typedef uint32 PixelType; typedef uint32 PixelType;
}; };
#ifdef __WII__
/* Gamecube/Wii specific ColorMask ARGB3444 */
template<>
struct ColorMasks<3444> {
enum {
kBytesPerPixel = 2,
kAlphaBits = 3,
kRedBits = 4,
kGreenBits = 4,
kBlueBits = 4,
kBlueShift = 0,
kGreenShift = kBlueBits,
kRedShift = kGreenBits+kBlueBits,
kAlphaShift = kGreenBits+kBlueBits+kRedBits,
kAlphaMask = ((1 << kAlphaBits) - 1) << kAlphaShift,
kRedMask = ((1 << kRedBits) - 1) << kRedShift,
kGreenMask = ((1 << kGreenBits) - 1) << kGreenShift,
kBlueMask = ((1 << kBlueBits) - 1) << kBlueShift,
kRedBlueMask = kRedMask | kBlueMask
};
typedef uint16 PixelType;
};
#endif
template<class T> template<class T>
uint32 RGBToColor(uint8 r, uint8 g, uint8 b) { uint32 RGBToColor(uint8 r, uint8 g, uint8 b) {
return T::kAlphaMask | return T::kAlphaMask |

View file

@ -167,4 +167,290 @@ bool crossBlit(byte *dst, const byte *src,
return true; return true;
} }
namespace {
template <typename Size>
void scaleNN(byte *dst, const byte *src,
const uint dstPitch, const uint srcPitch,
const uint dstW, const uint dstH,
const uint srcW, const uint srcH,
int *scaleCacheX) {
const uint dstDelta = (dstPitch - dstW * sizeof(Size));
for (uint y = 0; y < dstH; y++) {
const Size *srcP = (const Size *)(src + ((y * srcH) / dstH) * srcPitch);
for (uint x = 0; x < dstW; x++) {
int val = srcP[scaleCacheX[x]];
*(Size *)dst = val;
dst += sizeof(Size);
}
dst += dstDelta;
}
}
} // End of anonymous namespace
bool scaleBlit(byte *dst, const byte *src,
const uint dstPitch, const uint srcPitch,
const uint dstW, const uint dstH,
const uint srcW, const uint srcH,
const Graphics::PixelFormat &fmt) {
int *scaleCacheX = new int[dstW];
for (uint x = 0; x < dstW; x++) {
scaleCacheX[x] = (x * srcW) / dstW;
}
switch (fmt.bytesPerPixel) {
case 1:
scaleNN<uint8>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, scaleCacheX);
break;
case 2:
scaleNN<uint16>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, scaleCacheX);
break;
case 4:
scaleNN<uint32>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, scaleCacheX);
break;
default:
delete[] scaleCacheX;
return false;
}
delete[] scaleCacheX;
return true;
}
/*
The functions below are adapted from SDL_rotozoom.c,
taken from SDL_gfx-2.0.18.
Its copyright notice:
=============================================================================
SDL_rotozoom.c: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces
Copyright (C) 2001-2012 Andreas Schiffler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
=============================================================================
The functions have been adapted for different structures, coordinate
systems and pixel formats.
*/
namespace {
inline byte scaleBlitBilinearInterpolate(byte c01, byte c00, byte c11, byte c10, int ex, int ey) {
int t1 = ((((c01 - c00) * ex) >> 16) + c00) & 0xff;
int t2 = ((((c11 - c10) * ex) >> 16) + c10) & 0xff;
return (((t2 - t1) * ey) >> 16) + t1;
}
template <typename Size>
Size scaleBlitBilinearInterpolate(Size c01, Size c00, Size c11, Size c10, int ex, int ey,
const Graphics::PixelFormat &fmt) {
byte c01_a, c01_r, c01_g, c01_b;
fmt.colorToARGB(c01, c01_a, c01_r, c01_g, c01_b);
byte c00_a, c00_r, c00_g, c00_b;
fmt.colorToARGB(c00, c00_a, c00_r, c00_g, c00_b);
byte c11_a, c11_r, c11_g, c11_b;
fmt.colorToARGB(c11, c11_a, c11_r, c11_g, c11_b);
byte c10_a, c10_r, c10_g, c10_b;
fmt.colorToARGB(c10, c10_a, c10_r, c10_g, c10_b);
byte dp_a = scaleBlitBilinearInterpolate(c01_a, c00_a, c11_a, c10_a, ex, ey);
byte dp_r = scaleBlitBilinearInterpolate(c01_r, c00_r, c11_r, c10_r, ex, ey);
byte dp_g = scaleBlitBilinearInterpolate(c01_g, c00_g, c11_g, c10_g, ex, ey);
byte dp_b = scaleBlitBilinearInterpolate(c01_b, c00_b, c11_b, c10_b, ex, ey);
return fmt.ARGBToColor(dp_a, dp_r, dp_g, dp_b);
}
template <typename Size, bool flipx, bool flipy> // TODO: See mirroring comment in RenderTicket ctor
void scaleBlitBilinearLogic(byte *dst, const byte *src,
const uint dstPitch, const uint srcPitch,
const uint dstW, const uint dstH,
const uint srcW, const uint srcH,
const Graphics::PixelFormat &fmt,
int *sax, int *say) {
int spixelw = (srcW - 1);
int spixelh = (srcH - 1);
const byte *sp = src;
if (flipx) {
sp += spixelw;
}
if (flipy) {
sp += srcPitch * spixelh;
}
int *csay = say;
for (uint y = 0; y < dstH; y++) {
Size *dp = (Size *)(dst + (dstPitch * y));
const byte *csp = sp;
int *csax = sax;
for (uint x = 0; x < dstW; x++) {
/*
* Setup color source pointers
*/
int ex = (*csax & 0xffff);
int ey = (*csay & 0xffff);
int cx = (*csax >> 16);
int cy = (*csay >> 16);
const byte *c00, *c01, *c10, *c11;
c00 = c01 = c10 = sp;
if (cy < spixelh) {
if (flipy) {
c10 -= srcPitch;
} else {
c10 += srcPitch;
}
}
c11 = c10;
if (cx < spixelw) {
if (flipx) {
c01 -= sizeof(Size);
c11 -= sizeof(Size);
} else {
c01 += sizeof(Size);
c11 += sizeof(Size);
}
}
/*
* Draw and interpolate colors
*/
*dp = scaleBlitBilinearInterpolate(*(const Size *)c01, *(const Size *)c00, *(const Size *)c11, *(const Size *)c10, ex, ey, fmt);
/*
* Advance source pointer x
*/
int *salastx = csax;
csax++;
int sstepx = (*csax >> 16) - (*salastx >> 16);
if (flipx) {
sp -= sstepx * sizeof(Size);
} else {
sp += sstepx * sizeof(Size);
}
/*
* Advance destination pointer x
*/
dp++;
}
/*
* Advance source pointer y
*/
int *salasty = csay;
csay++;
int sstepy = (*csay >> 16) - (*salasty >> 16);
sstepy *= srcPitch;
if (flipy) {
sp = csp - sstepy;
} else {
sp = csp + sstepy;
}
}
}
} // End of anonymous namespace
bool scaleBlitBilinear(byte *dst, const byte *src,
const uint dstPitch, const uint srcPitch,
const uint dstW, const uint dstH,
const uint srcW, const uint srcH,
const Graphics::PixelFormat &fmt) {
if (fmt.bytesPerPixel != 2 && fmt.bytesPerPixel != 4)
return false;
int *sax = new int[dstW + 1];
int *say = new int[dstH + 1];
assert(sax && say);
/*
* Precalculate row increments
*/
int spixelw = (srcW - 1);
int spixelh = (srcH - 1);
int sx = (int)(65536.0f * (float) spixelw / (float) (dstW - 1));
int sy = (int)(65536.0f * (float) spixelh / (float) (dstH - 1));
/* Maximum scaled source size */
int ssx = (srcW << 16) - 1;
int ssy = (srcH << 16) - 1;
/* Precalculate horizontal row increments */
int csx = 0;
int *csax = sax;
for (uint x = 0; x <= dstW; x++) {
*csax = csx;
csax++;
csx += sx;
/* Guard from overflows */
if (csx > ssx) {
csx = ssx;
}
}
/* Precalculate vertical row increments */
int csy = 0;
int *csay = say;
for (uint y = 0; y <= dstH; y++) {
*csay = csy;
csay++;
csy += sy;
/* Guard from overflows */
if (csy > ssy) {
csy = ssy;
}
}
if (fmt.bytesPerPixel == 4) {
scaleBlitBilinearLogic<uint32, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, sax, say);
} else if (fmt.bytesPerPixel == 2) {
scaleBlitBilinearLogic<uint16, false, false>(dst, src, dstPitch, srcPitch, dstW, dstH, srcW, srcH, fmt, sax, say);
} else {
delete[] sax;
delete[] say;
return false;
}
delete[] sax;
delete[] say;
return true;
}
} // End of namespace Graphics } // End of namespace Graphics

View file

@ -72,6 +72,18 @@ bool crossBlit(byte *dst, const byte *src,
const uint w, const uint h, const uint w, const uint h,
const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt); const Graphics::PixelFormat &dstFmt, const Graphics::PixelFormat &srcFmt);
bool scaleBlit(byte *dst, const byte *src,
const uint dstPitch, const uint srcPitch,
const uint dstW, const uint dstH,
const uint srcW, const uint srcH,
const Graphics::PixelFormat &fmt);
bool scaleBlitBilinear(byte *dst, const byte *src,
const uint dstPitch, const uint srcPitch,
const uint dstW, const uint dstH,
const uint srcW, const uint srcH,
const Graphics::PixelFormat &fmt);
} // End of namespace Graphics } // End of namespace Graphics
#endif // GRAPHICS_CONVERSION_H #endif // GRAPHICS_CONVERSION_H

View file

@ -54,18 +54,18 @@ public:
/** Return the cursor's hotspot's y coordinate. */ /** Return the cursor's hotspot's y coordinate. */
uint16 getHotspotY() const { return _hotspotY; } uint16 getHotspotY() const { return _hotspotY; }
/** Return the cursor's transparent key. */ /** Return the cursor's transparent key. */
byte getKeyColor() const { return 0xFF; } virtual byte getKeyColor() const { return 0xFF; }
const byte *getSurface() const { return _surface; } const byte *getSurface() const { return _surface; }
const byte *getPalette() const { return _palette; } virtual const byte *getPalette() const { return _palette; }
byte getPaletteStartIndex() const { return 0; } byte getPaletteStartIndex() const { return 0; }
uint16 getPaletteCount() const { return 256; } uint16 getPaletteCount() const { return 256; }
/** Read the cursor's data out of a stream. */ /** Read the cursor's data out of a stream. */
bool readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome = false, byte monochromeInvertedPixelColor = 0xff); bool readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome = false, byte monochromeInvertedPixelColor = 0xff);
private: protected:
bool readFromCURS(Common::SeekableReadStream &stream, byte monochromeInvertedPixelColor); bool readFromCURS(Common::SeekableReadStream &stream, byte monochromeInvertedPixelColor);
bool readFromCRSR(Common::SeekableReadStream &stream, bool forceMonochrome, byte monochromeInvertedPixelColor); bool readFromCRSR(Common::SeekableReadStream &stream, bool forceMonochrome, byte monochromeInvertedPixelColor);

View file

@ -90,6 +90,12 @@ ManagedSurface &ManagedSurface::operator=(const ManagedSurface &surf) {
_innerSurface.h = surf.h; _innerSurface.h = surf.h;
_innerSurface.pitch = surf.pitch; _innerSurface.pitch = surf.pitch;
this->format = surf.format; this->format = surf.format;
// Copy miscellaneous properties
_transparentColorSet = surf._transparentColorSet;
_transparentColor = surf._transparentColor;
_paletteSet = surf._paletteSet;
Common::copy(&surf._palette[0], &surf._palette[256], _palette);
} }
return *this; return *this;
@ -123,6 +129,12 @@ void ManagedSurface::create(ManagedSurface &surf, const Common::Rect &bounds) {
_innerSurface.h = bounds.height(); _innerSurface.h = bounds.height();
_owner = &surf; _owner = &surf;
_disposeAfterUse = DisposeAfterUse::NO; _disposeAfterUse = DisposeAfterUse::NO;
// Copy miscellaneous properties
_transparentColorSet = surf._transparentColorSet;
_transparentColor = surf._transparentColor;
_paletteSet = surf._paletteSet;
Common::copy(&surf._palette[0], &surf._palette[256], _palette);
} }
void ManagedSurface::free() { void ManagedSurface::free() {
@ -321,7 +333,7 @@ void ManagedSurface::transBlitFrom(const Surface &src, const Common::Rect &srcRe
const Common::Rect &destRect, uint transColor, bool flipped, uint overrideColor, uint srcAlpha, const Common::Rect &destRect, uint transColor, bool flipped, uint overrideColor, uint srcAlpha,
const Surface *mask, bool maskOnly) { const Surface *mask, bool maskOnly) {
transBlitFromInner(src, srcRect, destRect, transColor, flipped, overrideColor, srcAlpha, transBlitFromInner(src, srcRect, destRect, transColor, flipped, overrideColor, srcAlpha,
nullptr, mask, maskOnly); nullptr, nullptr, mask, maskOnly);
} }
void ManagedSurface::transBlitFrom(const ManagedSurface &src, uint transColor, bool flipped, void ManagedSurface::transBlitFrom(const ManagedSurface &src, uint transColor, bool flipped,
@ -355,23 +367,124 @@ void ManagedSurface::transBlitFrom(const ManagedSurface &src, const Common::Rect
const Surface *mask, bool maskOnly) { const Surface *mask, bool maskOnly) {
if (transColor == (uint)-1 && src._transparentColorSet) if (transColor == (uint)-1 && src._transparentColorSet)
transColor = src._transparentColor; transColor = src._transparentColor;
const uint32 *palette = src._paletteSet ? src._palette : nullptr; const uint32 *srcPalette = src._paletteSet ? src._palette : nullptr;
const uint32 *dstPalette = _paletteSet ? _palette : nullptr;
transBlitFromInner(src._innerSurface, srcRect, destRect, transColor, flipped, overrideColor, transBlitFromInner(src._innerSurface, srcRect, destRect, transColor, flipped, overrideColor,
srcAlpha, palette, mask, maskOnly); srcAlpha, srcPalette, dstPalette, mask, maskOnly);
}
static uint findBestColor(const uint32 *palette, byte cr, byte cg, byte cb) {
uint bestColor = 0;
double min = 0xFFFFFFFF;
for (uint i = 0; i < 256; ++i) {
uint col = palette[i];
int rmean = ((col & 0xff) + cr) / 2;
int r = (col & 0xff) - cr;
int g = ((col >> 8) & 0xff) - cg;
int b = ((col >> 16) & 0xff) - cb;
double dist = sqrt((((512 + rmean) * r * r) >> 8) + 4 * g * g + (((767 - rmean) * b * b) >> 8));
if (min > dist) {
bestColor = i;
min = dist;
}
}
return bestColor;
}
static byte *createPaletteLookup(const uint32 *srcPalette, const uint32 *dstPalette) {
byte *lookup = new byte[256];
for (int i = 0; i < 256; i++) {
uint col = srcPalette[i];
if (col == dstPalette[i]) {
lookup[i] = i;
} else {
lookup[i] = findBestColor(dstPalette, col & 0xff, (col >> 8) & 0xff, (col >> 16) & 0xff);
}
}
return lookup;
}
template<typename TSRC, typename TDEST>
void transBlitPixel(TSRC srcVal, TDEST &destVal, const Graphics::PixelFormat &srcFormat, const Graphics::PixelFormat &destFormat,
uint overrideColor, uint srcAlpha, const uint32 *srcPalette, const byte *lookup) {
if (srcFormat == destFormat && srcAlpha == 0xff) {
// Matching formats, so we can do a straight copy
destVal = overrideColor ? overrideColor : srcVal;
return;
}
// Otherwise we have to manually decode and re-encode each pixel
byte aSrc, rSrc, gSrc, bSrc;
if (srcFormat.bytesPerPixel == 1) {
assert(srcPalette != nullptr); // Catch the cases when palette is missing
// Get the palette color
const uint32 col = srcPalette[srcVal];
rSrc = col & 0xff;
gSrc = (col >> 8) & 0xff;
bSrc = (col >> 16) & 0xff;
aSrc = (col >> 24) & 0xff;
} else {
srcFormat.colorToARGB(srcVal, aSrc, rSrc, gSrc, bSrc);
}
byte rDest, gDest, bDest;
destFormat.colorToRGB(destVal, rDest, gDest, bDest);
if (srcAlpha != 0xff) {
aSrc = aSrc * srcAlpha / 255;
}
if (aSrc == 0) {
// Completely transparent, so skip
return;
} else if (aSrc == 0xff) {
// Completely opaque, so copy RGB values over
rDest = rSrc;
gDest = gSrc;
bDest = bSrc;
} else {
// Partially transparent, so calculate new pixel colors
double alpha = (double)aSrc / 255.0;
rDest = static_cast<byte>((rSrc * alpha) + (rDest * (1.0 - alpha)));
gDest = static_cast<byte>((gSrc * alpha) + (gDest * (1.0 - alpha)));
bDest = static_cast<byte>((bSrc * alpha) + (bDest * (1.0 - alpha)));
}
destVal = destFormat.ARGBToColor(0xff, rDest, gDest, bDest);
}
template<>
void transBlitPixel<byte, byte>(byte srcVal, byte &destVal, const Graphics::PixelFormat &srcFormat, const Graphics::PixelFormat &destFormat,
uint overrideColor, uint srcAlpha, const uint32 *srcPalette, const byte *lookup) {
if (srcAlpha == 0) {
// Completely transparent, so skip
return;
}
destVal = overrideColor ? overrideColor : srcVal;
if (lookup)
destVal = lookup[destVal];
} }
template<typename TSRC, typename TDEST> template<typename TSRC, typename TDEST>
void transBlit(const Surface &src, const Common::Rect &srcRect, Surface &dest, const Common::Rect &destRect, void transBlit(const Surface &src, const Common::Rect &srcRect, Surface &dest, const Common::Rect &destRect,
TSRC transColor, bool flipped, uint overrideColor, uint srcAlpha, const uint32 *palette, TSRC transColor, bool flipped, uint overrideColor, uint srcAlpha, const uint32 *srcPalette,
const Surface *mask, bool maskOnly) { const uint32 *dstPalette, const Surface *mask, bool maskOnly) {
int scaleX = SCALE_THRESHOLD * srcRect.width() / destRect.width(); int scaleX = SCALE_THRESHOLD * srcRect.width() / destRect.width();
int scaleY = SCALE_THRESHOLD * srcRect.height() / destRect.height(); int scaleY = SCALE_THRESHOLD * srcRect.height() / destRect.height();
const Graphics::PixelFormat &srcFormat = src.format;
const Graphics::PixelFormat &destFormat = dest.format; byte *lookup = nullptr;
byte aSrc, rSrc, gSrc, bSrc; if (srcPalette && dstPalette)
byte rDest, gDest, bDest; lookup = createPaletteLookup(srcPalette, dstPalette);
double alpha;
// Loop through drawing output lines // Loop through drawing output lines
for (int destY = destRect.top, scaleYCtr = 0; destY < destRect.bottom; ++destY, scaleYCtr += scaleY) { for (int destY = destRect.top, scaleYCtr = 0; destY < destRect.bottom; ++destY, scaleYCtr += scaleY) {
@ -398,63 +511,25 @@ void transBlit(const Surface &src, const Common::Rect &srcRect, Surface &dest, c
TSRC mskVal = mskLine[flipped ? src.w - scaleXCtr / SCALE_THRESHOLD - 1 : scaleXCtr / SCALE_THRESHOLD]; TSRC mskVal = mskLine[flipped ? src.w - scaleXCtr / SCALE_THRESHOLD - 1 : scaleXCtr / SCALE_THRESHOLD];
if (!mskVal) if (!mskVal)
continue; continue;
}
if (srcFormat == destFormat && srcAlpha == 0xff) { transBlitPixel<TSRC, TDEST>(srcVal, destLine[xCtr], src.format, dest.format, overrideColor, mskVal, srcPalette, lookup);
// Matching formats, so we can do a straight copy
destLine[xCtr] = overrideColor ? overrideColor : srcVal;
} else { } else {
// Otherwise we have to manually decode and re-encode each pixel transBlitPixel<TSRC, TDEST>(srcVal, destLine[xCtr], src.format, dest.format, overrideColor, srcAlpha, srcPalette, lookup);
if (srcFormat.bytesPerPixel == 1) { }
assert(palette != nullptr); // Catch the cases when palette is missing
// Get the palette color
const uint32 col = palette[srcVal];
rSrc = col & 0xff;
gSrc = (col >> 8) & 0xff;
bSrc = (col >> 16) & 0xff;
aSrc = (col >> 24) & 0xff;
} else {
srcFormat.colorToARGB(srcVal, aSrc, rSrc, gSrc, bSrc);
} }
destFormat.colorToRGB(destLine[xCtr], rDest, gDest, bDest);
if (srcAlpha != 0xff) {
aSrc = aSrc * srcAlpha / 255;
} }
if (aSrc == 0) { delete[] lookup;
// Completely transparent, so skip
continue;
}
else if (aSrc == 0xff) {
// Completely opaque, so copy RGB values over
rDest = rSrc;
gDest = gSrc;
bDest = bSrc;
}
else {
// Partially transparent, so calculate new pixel colors
alpha = (double)aSrc / 255.0;
rDest = static_cast<byte>((rSrc * alpha) + (rDest * (1.0 - alpha)));
gDest = static_cast<byte>((gSrc * alpha) + (gDest * (1.0 - alpha)));
bDest = static_cast<byte>((bSrc * alpha) + (bDest * (1.0 - alpha)));
}
destLine[xCtr] = destFormat.ARGBToColor(0xff, rDest, gDest, bDest);
}
}
}
} }
#define HANDLE_BLIT(SRC_BYTES, DEST_BYTES, SRC_TYPE, DEST_TYPE) \ #define HANDLE_BLIT(SRC_BYTES, DEST_BYTES, SRC_TYPE, DEST_TYPE) \
if (src.format.bytesPerPixel == SRC_BYTES && format.bytesPerPixel == DEST_BYTES) \ if (src.format.bytesPerPixel == SRC_BYTES && format.bytesPerPixel == DEST_BYTES) \
transBlit<SRC_TYPE, DEST_TYPE>(src, srcRect, _innerSurface, destRect, transColor, flipped, overrideColor, srcAlpha, palette, mask, maskOnly); \ transBlit<SRC_TYPE, DEST_TYPE>(src, srcRect, _innerSurface, destRect, transColor, flipped, overrideColor, srcAlpha, srcPalette, dstPalette, mask, maskOnly); \
else else
void ManagedSurface::transBlitFromInner(const Surface &src, const Common::Rect &srcRect, void ManagedSurface::transBlitFromInner(const Surface &src, const Common::Rect &srcRect,
const Common::Rect &destRect, uint transColor, bool flipped, uint overrideColor, const Common::Rect &destRect, uint transColor, bool flipped, uint overrideColor,
uint srcAlpha, const uint32 *palette, const Surface *mask, bool maskOnly) { uint srcAlpha, const uint32 *srcPalette, const uint32 *dstPalette, const Surface *mask, bool maskOnly) {
if (src.w == 0 || src.h == 0 || destRect.width() == 0 || destRect.height() == 0) if (src.w == 0 || src.h == 0 || destRect.width() == 0 || destRect.height() == 0)
return; return;
@ -505,12 +580,18 @@ void ManagedSurface::setPalette(const byte *colors, uint start, uint num) {
} }
_paletteSet = true; _paletteSet = true;
if (_owner)
_owner->setPalette(colors, start, num);
} }
void ManagedSurface::setPalette(const uint32 *colors, uint start, uint num) { void ManagedSurface::setPalette(const uint32 *colors, uint start, uint num) {
assert(start < 256 && (start + num) <= 256); assert(start < 256 && (start + num) <= 256);
Common::copy(colors, colors + num, &_palette[start]); Common::copy(colors, colors + num, &_palette[start]);
_paletteSet = true; _paletteSet = true;
if (_owner)
_owner->setPalette(colors, start, num);
} }
} // End of namespace Graphics } // End of namespace Graphics

View file

@ -92,7 +92,7 @@ protected:
*/ */
void transBlitFromInner(const Surface &src, const Common::Rect &srcRect, void transBlitFromInner(const Surface &src, const Common::Rect &srcRect,
const Common::Rect &destRect, uint transColor, bool flipped, uint overrideColor, const Common::Rect &destRect, uint transColor, bool flipped, uint overrideColor,
uint srcAlpha, const uint32 *palette, const Surface *mask, bool maskOnly); uint srcAlpha, const uint32 *srcPalette, const uint32 *dstPalette, const Surface *mask, bool maskOnly);
public: public:
/** /**
* Clips the given source bounds so the passed destBounds will be entirely on-screen * Clips the given source bounds so the passed destBounds will be entirely on-screen
@ -299,7 +299,7 @@ public:
* Copies another surface into this one ignoring pixels of a designated transparent color * Copies another surface into this one ignoring pixels of a designated transparent color
* @param src Source surface * @param src Source surface
* @param destPos Destination position to draw the surface * @param destPos Destination position to draw the surface
* @param mask Mask definition (0-skip, other-copy) * @param mask Mask definition
*/ */
void transBlitFrom(const Surface &src, const Common::Point &destPos, void transBlitFrom(const Surface &src, const Common::Point &destPos,
const ManagedSurface &mask); const ManagedSurface &mask);
@ -308,7 +308,7 @@ public:
* Copies another surface into this one ignoring pixels of a designated transparent color * Copies another surface into this one ignoring pixels of a designated transparent color
* @param src Source surface * @param src Source surface
* @param destPos Destination position to draw the surface * @param destPos Destination position to draw the surface
* @param mask Mask definition (0-skip, other-copy) * @param mask Mask definition
*/ */
void transBlitFrom(const Surface &src, const Common::Point &destPos, void transBlitFrom(const Surface &src, const Common::Point &destPos,
const Surface &mask); const Surface &mask);
@ -323,8 +323,6 @@ public:
* @param overrideColor Optional color to use instead of non-transparent pixels from * @param overrideColor Optional color to use instead of non-transparent pixels from
* the source surface * the source surface
* @param srcAlpha Optional additional transparency applied to src * @param srcAlpha Optional additional transparency applied to src
* @param mask Optional parameter with mask definition (0-skip, other-copy)
* @param maskOnly Optional parameter for using mask over transColor
*/ */
void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos, void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Point &destPos,
uint transColor = 0, bool flipped = false, uint overrideColor = 0, uint srcAlpha = 0xff); uint transColor = 0, bool flipped = false, uint overrideColor = 0, uint srcAlpha = 0xff);
@ -340,7 +338,7 @@ public:
* @param overrideColor Optional color to use instead of non-transparent pixels from * @param overrideColor Optional color to use instead of non-transparent pixels from
* the source surface * the source surface
* @param srcAlpha Optional additional transparency applied to src * @param srcAlpha Optional additional transparency applied to src
* @param mask Optional parameter with mask definition (0-skip, other-copy) * @param mask Optional parameter with mask definition
* @param maskOnly Optional parameter for using mask over transColor * @param maskOnly Optional parameter for using mask over transColor
*/ */
void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect, void transBlitFrom(const Surface &src, const Common::Rect &srcRect, const Common::Rect &destRect,
@ -376,7 +374,7 @@ public:
* Copies another surface into this one ignoring pixels of a designated transparent color * Copies another surface into this one ignoring pixels of a designated transparent color
* @param src Source surface * @param src Source surface
* @param destPos Destination position to draw the surface * @param destPos Destination position to draw the surface
* @param mask Mask definition (0-skip, other-copy) * @param mask Mask definition
*/ */
void transBlitFrom(const ManagedSurface &src, const Common::Point &destPos, void transBlitFrom(const ManagedSurface &src, const Common::Point &destPos,
const ManagedSurface &mask); const ManagedSurface &mask);
@ -406,6 +404,8 @@ public:
* @param overrideColor Optional color to use instead of non-transparent pixels from * @param overrideColor Optional color to use instead of non-transparent pixels from
* the source surface * the source surface
* @param srcAlpha Optional additional transparency applied to src * @param srcAlpha Optional additional transparency applied to src
* @param mask Optional parameter with mask definition
* @param maskOnly Optional parameter for using mask over transColor
*/ */
void transBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Rect &destRect, void transBlitFrom(const ManagedSurface &src, const Common::Rect &srcRect, const Common::Rect &destRect,
uint transColor = 0, bool flipped = false, uint overrideColor = 0, uint srcAlpha = 0xff, uint transColor = 0, bool flipped = false, uint overrideColor = 0, uint srcAlpha = 0xff,

View file

@ -47,6 +47,7 @@
#include "common/array.h" #include "common/array.h"
#include "graphics/transparent_surface.h" #include "graphics/transparent_surface.h"
#include "graphics/nine_patch.h" #include "graphics/nine_patch.h"
//#include "graphics/macgui/macwindowmanager.h" // ResidualVM specific
#include "graphics/managed_surface.h" #include "graphics/managed_surface.h"
@ -207,7 +208,7 @@ bad_bitmap:
} }
} }
void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette, int numColors) { void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette, int numColors, MacWindowManager *wm) {
/* don't draw bitmaps that are smaller than the fixed area */ /* don't draw bitmaps that are smaller than the fixed area */
if (dw < _h._fix || dh < _v._fix) if (dw < _h._fix || dh < _v._fix)
return; return;
@ -231,7 +232,7 @@ void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, in
/* Handle CLUT8 */ /* Handle CLUT8 */
if (target.format.bytesPerPixel == 1) { if (target.format.bytesPerPixel == 1) {
if (!palette) if (!palette && !wm)
error("NinePatchBitmap::blit(): Trying to blit into a surface with 8bpp, you need a palette."); error("NinePatchBitmap::blit(): Trying to blit into a surface with 8bpp, you need a palette.");
Surface *srf = new Surface(); Surface *srf = new Surface();
@ -244,6 +245,7 @@ void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, in
// recalculated when the palette changes. // recalculated when the palette changes.
_cached_colors.clear(); _cached_colors.clear();
if (palette) {
for (uint i = 0; i < srf->w; ++i) { for (uint i = 0; i < srf->w; ++i) {
for (uint j = 0; j < srf->h; ++j) { for (uint j = 0; j < srf->h; ++j) {
uint32 color = *(uint32*)srf->getBasePtr(i, j); uint32 color = *(uint32*)srf->getBasePtr(i, j);
@ -252,6 +254,18 @@ void NinePatchBitmap::blit(Graphics::Surface &target, int dx, int dy, int dw, in
} }
} }
} }
} else {
for (uint i = 0; i < srf->w; ++i) {
for (uint j = 0; j < srf->h; ++j) {
uint32 color = *(uint32*)srf->getBasePtr(i, j);
byte r, g, b;
_bmp->format.colorToRGB(color, r, g, b);
if (color > 0) {
// *((byte *)target.getBasePtr(i, j)) = wm->findBestColor(r, g, b); // ResidualVM specific
}
}
}
}
srf->free(); srf->free();
delete srf; delete srf;

View file

@ -54,6 +54,7 @@ namespace Graphics {
struct TransparentSurface; struct TransparentSurface;
struct Surface; struct Surface;
class MacWindowManager;
struct NinePatchMark { struct NinePatchMark {
int offset; int offset;
@ -88,7 +89,7 @@ public:
NinePatchBitmap(Graphics::TransparentSurface *bmp, bool owns_bitmap); NinePatchBitmap(Graphics::TransparentSurface *bmp, bool owns_bitmap);
~NinePatchBitmap(); ~NinePatchBitmap();
void blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette = NULL, int numColors = 0); void blit(Graphics::Surface &target, int dx, int dy, int dw, int dh, byte *palette = NULL, int numColors = 0, MacWindowManager *wm = NULL);
void blitClip(Graphics::Surface &target, Common::Rect clip, int dx, int dy, int dw, int dh); void blitClip(Graphics::Surface &target, Common::Rect clip, int dx, int dy, int dw, int dh);
int getWidth() { return _width; } int getWidth() { return _width; }

View file

@ -122,6 +122,7 @@ void Screen::setPalette(const byte palette[PALETTE_SIZE]) {
void Screen::setPalette(const byte *palette, uint start, uint num) { void Screen::setPalette(const byte *palette, uint start, uint num) {
assert(format.bytesPerPixel == 1); assert(format.bytesPerPixel == 1);
g_system->getPaletteManager()->setPalette(palette, start, num); g_system->getPaletteManager()->setPalette(palette, start, num);
ManagedSurface::setPalette(palette, start, num);
} }
void Screen::clearPalette() { void Screen::clearPalette() {

View file

@ -368,6 +368,21 @@ void Surface::flipVertical(const Common::Rect &r) {
delete[] temp; delete[] temp;
} }
Graphics::Surface *Surface::scale(uint16 newWidth, uint16 newHeight, bool filtering) const {
Graphics::Surface *target = new Graphics::Surface();
target->create(newWidth, newHeight, format);
if (filtering) {
scaleBlitBilinear((byte *)target->getPixels(), (const byte *)getPixels(), target->pitch, pitch, target->w, target->h, w, h, format);
} else {
scaleBlit((byte *)target->getPixels(), (const byte *)getPixels(), target->pitch, pitch, target->w, target->h, w, h, format);
}
return target;
}
void Surface::convertToInPlace(const PixelFormat &dstFormat, const byte *palette) { void Surface::convertToInPlace(const PixelFormat &dstFormat, const byte *palette) {
// Do not convert to the same format and ignore empty surfaces. // Do not convert to the same format and ignore empty surfaces.
if (format == dstFormat || pixels == 0) { if (format == dstFormat || pixels == 0) {

View file

@ -334,6 +334,19 @@ public:
* @param r Rect to flip * @param r Rect to flip
*/ */
void flipVertical(const Common::Rect &r); void flipVertical(const Common::Rect &r);
/**
* Scale the data to the given size.
*
* The calling code must call free on the returned surface and then delete
* it.
*
* @param newWidth the resulting width.
* @param newHeight the resulting height.
* @param filtering Whether or not to use bilinear filtering.
*/
Graphics::Surface *scale(uint16 newWidth, uint16 newHeight, bool filtering = false) const;
}; };
/** /**

View file

@ -33,6 +33,7 @@
#include "common/rect.h" #include "common/rect.h"
#include "common/math.h" #include "common/math.h"
#include "common/textconsole.h" #include "common/textconsole.h"
#include "graphics/conversion.h"
#include "graphics/primitives.h" #include "graphics/primitives.h"
#include "graphics/transparent_surface.h" #include "graphics/transparent_surface.h"
#include "graphics/transform_tools.h" #include "graphics/transform_tools.h"
@ -750,7 +751,7 @@ void TransparentSurface::setAlphaMode(AlphaType mode) {
/* /*
The below two functions are adapted from SDL_rotozoom.c, The function below is adapted from SDL_rotozoom.c,
taken from SDL_gfx-2.0.18. taken from SDL_gfx-2.0.18.
Its copyright notice: Its copyright notice:
@ -908,186 +909,16 @@ TransparentSurface *TransparentSurface::rotoscaleT(const TransformStruct &transf
return target; return target;
} }
template <TFilteringMode filteringMode> TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight, bool filtering) const {
TransparentSurface *TransparentSurface::scaleT(uint16 newWidth, uint16 newHeight) const {
TransparentSurface *target = new TransparentSurface(); TransparentSurface *target = new TransparentSurface();
int srcW = w; target->create(newWidth, newHeight, format);
int srcH = h;
int dstW = newWidth;
int dstH = newHeight;
target->create((uint16)dstW, (uint16)dstH, format); if (filtering) {
scaleBlitBilinear((byte *)target->getPixels(), (const byte *)getPixels(), target->pitch, pitch, target->w, target->h, w, h, format);
if (filteringMode == FILTER_BILINEAR) {
assert(format.bytesPerPixel == 4);
bool flipx = false, flipy = false; // TODO: See mirroring comment in RenderTicket ctor
int *sax = new int[dstW + 1];
int *say = new int[dstH + 1];
assert(sax && say);
/*
* Precalculate row increments
*/
int spixelw = (srcW - 1);
int spixelh = (srcH - 1);
int sx = (int)(65536.0f * (float) spixelw / (float) (dstW - 1));
int sy = (int)(65536.0f * (float) spixelh / (float) (dstH - 1));
/* Maximum scaled source size */
int ssx = (srcW << 16) - 1;
int ssy = (srcH << 16) - 1;
/* Precalculate horizontal row increments */
int csx = 0;
int *csax = sax;
for (int x = 0; x <= dstW; x++) {
*csax = csx;
csax++;
csx += sx;
/* Guard from overflows */
if (csx > ssx) {
csx = ssx;
}
}
/* Precalculate vertical row increments */
int csy = 0;
int *csay = say;
for (int y = 0; y <= dstH; y++) {
*csay = csy;
csay++;
csy += sy;
/* Guard from overflows */
if (csy > ssy) {
csy = ssy;
}
}
const tColorRGBA *sp = (const tColorRGBA *) getBasePtr(0, 0);
tColorRGBA *dp = (tColorRGBA *) target->getBasePtr(0, 0);
int spixelgap = srcW;
if (flipx) {
sp += spixelw;
}
if (flipy) {
sp += spixelgap * spixelh;
}
csay = say;
for (int y = 0; y < dstH; y++) {
const tColorRGBA *csp = sp;
csax = sax;
for (int x = 0; x < dstW; x++) {
/*
* Setup color source pointers
*/
int ex = (*csax & 0xffff);
int ey = (*csay & 0xffff);
int cx = (*csax >> 16);
int cy = (*csay >> 16);
const tColorRGBA *c00, *c01, *c10, *c11;
c00 = sp;
c01 = sp;
c10 = sp;
if (cy < spixelh) {
if (flipy) {
c10 -= spixelgap;
} else { } else {
c10 += spixelgap; scaleBlit((byte *)target->getPixels(), (const byte *)getPixels(), target->pitch, pitch, target->w, target->h, w, h, format);
}
}
c11 = c10;
if (cx < spixelw) {
if (flipx) {
c01--;
c11--;
} else {
c01++;
c11++;
}
}
/*
* Draw and interpolate colors
*/
int t1, t2;
t1 = ((((c01->r - c00->r) * ex) >> 16) + c00->r) & 0xff;
t2 = ((((c11->r - c10->r) * ex) >> 16) + c10->r) & 0xff;
dp->r = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->g - c00->g) * ex) >> 16) + c00->g) & 0xff;
t2 = ((((c11->g - c10->g) * ex) >> 16) + c10->g) & 0xff;
dp->g = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->b - c00->b) * ex) >> 16) + c00->b) & 0xff;
t2 = ((((c11->b - c10->b) * ex) >> 16) + c10->b) & 0xff;
dp->b = (((t2 - t1) * ey) >> 16) + t1;
t1 = ((((c01->a - c00->a) * ex) >> 16) + c00->a) & 0xff;
t2 = ((((c11->a - c10->a) * ex) >> 16) + c10->a) & 0xff;
dp->a = (((t2 - t1) * ey) >> 16) + t1;
/*
* Advance source pointer x
*/
int *salastx = csax;
csax++;
int sstepx = (*csax >> 16) - (*salastx >> 16);
if (flipx) {
sp -= sstepx;
} else {
sp += sstepx;
}
/*
* Advance destination pointer x
*/
dp++;
}
/*
* Advance source pointer y
*/
int *salasty = csay;
csay++;
int sstepy = (*csay >> 16) - (*salasty >> 16);
sstepy *= spixelgap;
if (flipy) {
sp = csp - sstepy;
} else {
sp = csp + sstepy;
}
}
delete[] sax;
delete[] say;
} else {
int *scaleCacheX = new int[dstW];
for (int x = 0; x < dstW; x++) {
scaleCacheX[x] = (x * srcW) / dstW;
}
switch (format.bytesPerPixel) {
case 1:
scaleNN<uint8>(scaleCacheX, target);
break;
case 2:
scaleNN<uint16>(scaleCacheX, target);
break;
case 4:
scaleNN<uint32>(scaleCacheX, target);
break;
default:
error("Can only scale 8bpp, 16bpp, and 32bpp");
}
delete[] scaleCacheX;
} }
return target; return target;
@ -1171,32 +1002,11 @@ TransparentSurface *TransparentSurface::convertTo(const PixelFormat &dstFormat,
return surface; return surface;
} }
template <typename Size>
void TransparentSurface::scaleNN(int *scaleCacheX, TransparentSurface *target) const {
for (int y = 0; y < target->h; y++) {
Size *destP = (Size *)target->getBasePtr(0, y);
const Size *srcP = (const Size *)getBasePtr(0, (y * h) / target->h);
for (int x = 0; x < target->w; x++) {
*destP++ = srcP[scaleCacheX[x]];
}
}
}
template TransparentSurface *TransparentSurface::rotoscaleT<FILTER_NEAREST>(const TransformStruct &transform) const; template TransparentSurface *TransparentSurface::rotoscaleT<FILTER_NEAREST>(const TransformStruct &transform) const;
template TransparentSurface *TransparentSurface::rotoscaleT<FILTER_BILINEAR>(const TransformStruct &transform) const; template TransparentSurface *TransparentSurface::rotoscaleT<FILTER_BILINEAR>(const TransformStruct &transform) const;
template TransparentSurface *TransparentSurface::scaleT<FILTER_NEAREST>(uint16 newWidth, uint16 newHeight) const;
template TransparentSurface *TransparentSurface::scaleT<FILTER_BILINEAR>(uint16 newWidth, uint16 newHeight) const;
template void TransparentSurface::scaleNN<uint8>(int *scaleCacheX, TransparentSurface *target) const;
template void TransparentSurface::scaleNN<uint16>(int *scaleCacheX, TransparentSurface *target) const;
template void TransparentSurface::scaleNN<uint32>(int *scaleCacheX, TransparentSurface *target) const;
TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transform) const { TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transform) const {
return rotoscaleT<FILTER_BILINEAR>(transform); return rotoscaleT<FILTER_BILINEAR>(transform);
} }
TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) const {
return scaleT<FILTER_NEAREST>(newWidth, newHeight);
}
} // End of namespace Graphics } // End of namespace Graphics

View file

@ -145,12 +145,10 @@ struct TransparentSurface : public Graphics::Surface {
* *
* @param newWidth the resulting width. * @param newWidth the resulting width.
* @param newHeight the resulting height. * @param newHeight the resulting height.
* @param filtering Whether or not to use bilinear filtering.
* @see TransformStruct * @see TransformStruct
*/ */
template <TFilteringMode filteringMode> TransparentSurface *scale(uint16 newWidth, uint16 newHeight, bool filtering = false) const;
TransparentSurface *scaleT(uint16 newWidth, uint16 newHeight) const;
TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const;
/** /**
* @brief Rotoscale function; this returns a transformed version of this surface after rotation and * @brief Rotoscale function; this returns a transformed version of this surface after rotation and
@ -177,9 +175,6 @@ struct TransparentSurface : public Graphics::Surface {
void setAlphaMode(AlphaType); void setAlphaMode(AlphaType);
private: private:
AlphaType _alphaMode; AlphaType _alphaMode;
template <typename Size>
void scaleNN(int *scaleCacheX, TransparentSurface *target) const;
}; };
/** /**

View file

@ -127,9 +127,9 @@ bool WinCursor::readFromStream(Common::SeekableReadStream &stream) {
if (stream.readUint16LE() != 1) if (stream.readUint16LE() != 1)
return false; return false;
// Only 1bpp and 8bpp supported // Only 1bpp, 4bpp and 8bpp supported
uint16 bitsPerPixel = stream.readUint16LE(); uint16 bitsPerPixel = stream.readUint16LE();
if (bitsPerPixel != 1 && bitsPerPixel != 8) if (bitsPerPixel != 1 && bitsPerPixel != 4 && bitsPerPixel != 8)
return false; return false;
// Compression // Compression
@ -180,6 +180,13 @@ bool WinCursor::readFromStream(Common::SeekableReadStream &stream) {
*rowDest = 0; *rowDest = 0;
} }
} }
} else if (bitsPerPixel == 4) {
// 4bpp
for (uint16 j = 0; j < (_width / 2); j++) {
byte p = src[j];
*rowDest++ = p >> 4;
*rowDest++ = p & 0x0f;
}
} else { } else {
// 8bpp // 8bpp
memcpy(rowDest, src, _width); memcpy(rowDest, src, _width);

View file

@ -476,7 +476,6 @@ void EE::run() {
case Common::EVENT_RETURN_TO_LAUNCHER: case Common::EVENT_RETURN_TO_LAUNCHER:
_shouldQuit = true; _shouldQuit = true;
break; break;
case Common::EVENT_LBUTTONDOWN: case Common::EVENT_LBUTTONDOWN:
break; break;
case Common::EVENT_KEYDOWN: case Common::EVENT_KEYDOWN:
@ -595,13 +594,12 @@ void EE::processKeyDown(Common::Event &e) {
} }
void EE::getPos() { void EE::getPos() {
int tx, velx, bnd;
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
if (_keymove[i][kDirUp] && _frameindex[i] == -1) if (_keymove[i][kDirUp] && _frameindex[i] == -1)
_frameindex[i] = 0; _frameindex[i] = 0;
tx = _x[i] + (velx = _keymove[i][kDirLeft] + _keymove[i][kDirRight]); int velx = _keymove[i][kDirLeft] + _keymove[i][kDirRight];
bnd = 3 + i * 155; int tx = _x[i] + velx;
int bnd = 3 + i * 155;
if (velx > 0) { if (velx > 0) {
if (tx < bnd + 119) if (tx < bnd + 119)
_x[i] = tx; _x[i] = tx;
@ -705,9 +703,7 @@ void EE::calcscore() {
} }
int EE::destination(int pl, int destx, int tol) { int EE::destination(int pl, int destx, int tol) {
int xp; int xp = _x[pl];
xp = _x[pl];
if (abs(xp - destx) < tol) { if (abs(xp - destx) < tol) {
_keymove[pl][kDirLeft] = 0; _keymove[pl][kDirLeft] = 0;
_keymove[pl][kDirRight] = 0; _keymove[pl][kDirRight] = 0;
@ -726,16 +722,13 @@ int EE::destination(int pl, int destx, int tol) {
int reset = false; int reset = false;
bool EE::moveball() { bool EE::moveball() {
int rbvelx, rbvely;
bool hitfloor;
if (!reset) { if (!reset) {
_bx = 4096; _by = 8640; _bvelx = 125; _bvely = -259; _bx = 4096; _by = 8640; _bvelx = 125; _bvely = -259;
reset = true; reset = true;
} }
rbvelx = _bvelx; int rbvelx = _bvelx;
rbvely = _bvely; int rbvely = _bvely;
if (rbvelx > 319) rbvelx = 319; if (rbvelx > 319) rbvelx = 319;
if (rbvelx < -319) rbvelx = -319; if (rbvelx < -319) rbvelx = -319;
if (rbvely > 319) rbvely = 319; if (rbvely > 319) rbvely = 319;
@ -771,6 +764,7 @@ bool EE::moveball() {
rbvelx -= rbvelx >> 4; rbvelx -= rbvelx >> 4;
rbvely -= rbvely >> 4; rbvely -= rbvely >> 4;
} }
bool hitfloor;
if (_by > 11392) { if (_by > 11392) {
_by = 11392; _by = 11392;
rbvely = -rbvely; rbvely = -rbvely;
@ -793,14 +787,12 @@ bool EE::moveball() {
} }
void EE::docollisions() { void EE::docollisions() {
int dx, dy, dist, rndoff;
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
dx = _tbx - _x[i] - i * 7; int dx = _tbx - _x[i] - i * 7;
dy = (_tby - _y[i]) >> 1; int dy = (_tby - _y[i]) >> 1;
dist = (dx >> 2) * dx + dy * dy; int dist = (dx >> 2) * dx + dy * dy;
if (dist < 110) { if (dist < 110) {
rndoff = 8 - (_rnd & 15); int rndoff = 8 - (_rnd & 15);
if (_frameindex[i] > -1) if (_frameindex[i] > -1)
_bvely = -abs(_bvely) + (jump[_frameindex[i]] << (3 << _servevel)); _bvely = -abs(_bvely) + (jump[_frameindex[i]] << (3 << _servevel));
else else
@ -849,7 +841,7 @@ void EE::docollisions() {
} else if ((_tbx > 147 && 161 - _tbx >= polecol[91 - _tby]) || } else if ((_tbx > 147 && 161 - _tbx >= polecol[91 - _tby]) ||
(_tbx < 148 && _tbx - 133 >= polecol[91 - _tby])) { (_tbx < 148 && _tbx - 133 >= polecol[91 - _tby])) {
if (_bvely > 0) { if (_bvely > 0) {
dx = _tbx - 145; int dx = _tbx - 145;
if (dx < -5) _bvelx = -abs(_bvelx); if (dx < -5) _bvelx = -abs(_bvelx);
if (dx > 5) _bvelx = abs(_bvelx); if (dx > 5) _bvelx = abs(_bvelx);
_bvely = -abs(_bvely); _bvely = -abs(_bvely);
@ -862,11 +854,10 @@ void EE::docollisions() {
void EE::computer0() { void EE::computer0() {
int ystep, destx, dx, rndoff, dest = 0;
_keymove[0][kDirUp] = 0; _keymove[0][kDirUp] = 0;
if (_tby < _bytop) _bytop = _tby; if (_tby < _bytop) _bytop = _tby;
rndoff = 5 - _rnd % 10; int rndoff = 5 - _rnd % 10;
int dest = 0;
if (_serve && ((_server & 1) == 0)) { if (_serve && ((_server & 1) == 0)) {
switch (_compserve) { switch (_compserve) {
case 0: case 0:
@ -911,6 +902,7 @@ void EE::computer0() {
} }
_keymove[0][kDirUp] = dest; _keymove[0][kDirUp] = dest;
} else if (_bvely > 0 && _tbx < 140) { } else if (_bvely > 0 && _tbx < 140) {
int ystep, destx;
if (_bvely >> 6 == 0) if (_bvely >> 6 == 0)
ystep = 0; ystep = 0;
else else
@ -921,7 +913,7 @@ void EE::computer0() {
else else
destx = _tbx + (_bvelx >> 6) * ystep - 4; destx = _tbx + (_bvelx >> 6) * ystep - 4;
dx = _x[0] - _tbx; int dx = _x[0] - _tbx;
if (abs(_bvelx) < 128 && _bytop < 75) { if (abs(_bvelx) < 128 && _bytop < 75) {
if ((_tby < 158) ^ (_bvelx < 0)) if ((_tby < 158) ^ (_bvelx < 0))
@ -949,12 +941,11 @@ void EE::computer0() {
} }
void EE::computer1() { void EE::computer1() {
int ystep, destx, dx, rndoff, dest = 0;
_keymove[1][kDirUp] = 0; _keymove[1][kDirUp] = 0;
if (_tby < _bytop) _bytop = _tby; if (_tby < _bytop) _bytop = _tby;
rndoff = 5 - _rnd % 10; int rndoff = 5 - _rnd % 10;
if (_serve && ((_server & 1) == 1)) { if (_serve && ((_server & 1) == 1)) {
int dest = 0;
switch (_compserve) { switch (_compserve) {
case 0: case 0:
dest = destination(1, 232, 2); dest = destination(1, 232, 2);
@ -998,6 +989,7 @@ void EE::computer1() {
} }
_keymove[1][kDirUp] = dest; _keymove[1][kDirUp] = dest;
} else if (_bvely > 0 && _tbx > 125) { } else if (_bvely > 0 && _tbx > 125) {
int ystep, destx;
if (_bvely >> 6 == 0) if (_bvely >> 6 == 0)
ystep = 0; ystep = 0;
else else
@ -1008,7 +1000,7 @@ void EE::computer1() {
else else
destx = _tbx + (_bvelx >> 6) * ystep - 4; destx = _tbx + (_bvelx >> 6) * ystep - 4;
dx = _x[1] - _tbx; int dx = _x[1] - _tbx;
if (abs(_bvelx) < 128 && _bytop < 75) { if (abs(_bvelx) < 128 && _bytop < 75) {
if ((_tby < 158) ^ (_bvelx < 0)) if ((_tby < 158) ^ (_bvelx < 0))
@ -1041,11 +1033,9 @@ void EE::init() {
_rnd = 0; _rnd = 0;
_starter = _winner = _hits = 0; _starter = _winner = _hits = 0;
_bvelx = _bvely = 0; _bvelx = _bvely = 0;
_tbx = 200; _tbx = 200; _tby = 20;
_tby = 20;
_bytop = 200; _bytop = 200;
_x[0] = 64; _x[0] = 64; _x[1] = 226;
_x[1] = 226;
_air = false; _air = false;
@ -1332,7 +1322,7 @@ static const uint32 head[38] = {
}; };
static const uint32 legs[42] = { static const uint32 legs[42] = {
0xa0000000, 0x00000000, 0x80000000, 0x00000002, 0x80000000, 0x00000002,0xa0000000, 0xa0000000, 0x00000000, 0x80000000, 0x00000002, 0x80000000, 0x00000002, 0xa0000000,
0x00000000, 0x50000000, 0x00000000, 0xf0000000, 0x00000003, 0xfc000000, 0x000003ff, 0x00000000, 0x50000000, 0x00000000, 0xf0000000, 0x00000003, 0xfc000000, 0x000003ff,
0xa0000000, 0x00000002, 0x0a000000, 0x0000000a, 0x02400000, 0x00000028, 0x00700000, 0xa0000000, 0x00000002, 0x0a000000, 0x0000000a, 0x02400000, 0x00000028, 0x00700000,

View file

@ -1378,8 +1378,8 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref
for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) { for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
Common::String deviceGuiOption = MidiDriver::musicType2GUIO(d->getMusicType()); Common::String deviceGuiOption = MidiDriver::musicType2GUIO(d->getMusicType());
if ((_domain == Common::ConfigManager::kApplicationDomain && d->getMusicType() != MT_TOWNS // global dialog - skip useless FM-Towns, C64, Amiga, AppleIIGS options there if ((_domain == Common::ConfigManager::kApplicationDomain && d->getMusicType() != MT_TOWNS // global dialog - skip useless FM-Towns, C64, Amiga, AppleIIGS and SegaCD options there
&& d->getMusicType() != MT_C64 && d->getMusicType() != MT_AMIGA && d->getMusicType() != MT_APPLEIIGS && d->getMusicType() != MT_PC98) && d->getMusicType() != MT_C64 && d->getMusicType() != MT_AMIGA && d->getMusicType() != MT_APPLEIIGS && d->getMusicType() != MT_PC98 && d->getMusicType() != MT_SEGACD)
|| (_domain != Common::ConfigManager::kApplicationDomain && !hasMidiDefined) // No flags are specified || (_domain != Common::ConfigManager::kApplicationDomain && !hasMidiDefined) // No flags are specified
|| (_guioptions.contains(deviceGuiOption)) // flag is present || (_guioptions.contains(deviceGuiOption)) // flag is present
// HACK/FIXME: For now we have to show GM devices, even when the game only has GUIO_MIDIMT32 set, // HACK/FIXME: For now we have to show GM devices, even when the game only has GUIO_MIDIMT32 set,
@ -2474,6 +2474,7 @@ void GlobalOptionsDialog::apply() {
#endif #endif
if (isRebuildNeeded) { if (isRebuildNeeded) {
g_gui.setLanguageRTL();
if (_launcher != nullptr) if (_launcher != nullptr)
_launcher->rebuild(); _launcher->rebuild();
rebuild(); rebuild();

View file

@ -302,7 +302,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='5' " "height='5' "
"xpos='left' " "xpos='left' "
"ypos='10' " "ypos='10' "
"padding='2,0,7,0' " "padding='7,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"<drawstep func='triangle' " "<drawstep func='triangle' "
@ -312,7 +312,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='5' " "height='5' "
"xpos='left' " "xpos='left' "
"ypos='4' " "ypos='4' "
"padding='2,0,7,0' " "padding='7,0,0,0' "
"orientation='top' " "orientation='top' "
"/>" "/>"
"<text font='text_default' " "<text font='text_default' "
@ -364,7 +364,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='4' " "height='4' "
"xpos='left' " "xpos='left' "
"ypos='9' " "ypos='9' "
"padding='2,0,3,0' " "padding='3,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"<drawstep func='triangle' " "<drawstep func='triangle' "
@ -374,7 +374,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='4' " "height='4' "
"xpos='left' " "xpos='left' "
"ypos='4' " "ypos='4' "
"padding='2,0,3,0' " "padding='3,0,0,0' "
"orientation='top' " "orientation='top' "
"/>" "/>"
"<text font='text_default' " "<text font='text_default' "
@ -426,7 +426,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='5' " "height='5' "
"xpos='left' " "xpos='left' "
"ypos='10' " "ypos='10' "
"padding='2,0,7,0' " "padding='7,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"<drawstep func='triangle' " "<drawstep func='triangle' "
@ -436,7 +436,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='5' " "height='5' "
"xpos='left' " "xpos='left' "
"ypos='4' " "ypos='4' "
"padding='2,0,7,0' " "padding='7,0,0,0' "
"orientation='top' " "orientation='top' "
"/>" "/>"
"<text font='text_default' " "<text font='text_default' "
@ -488,7 +488,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='4' " "height='4' "
"xpos='left' " "xpos='left' "
"ypos='9' " "ypos='9' "
"padding='2,0,3,0' " "padding='3,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"<drawstep func='triangle' " "<drawstep func='triangle' "
@ -498,7 +498,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='4' " "height='4' "
"xpos='left' " "xpos='left' "
"ypos='4' " "ypos='4' "
"padding='2,0,3,0' " "padding='3,0,0,0' "
"orientation='top' " "orientation='top' "
"/>" "/>"
"<text font='text_default' " "<text font='text_default' "
@ -550,7 +550,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='5' " "height='5' "
"xpos='left' " "xpos='left' "
"ypos='10' " "ypos='10' "
"padding='2,0,7,0' " "padding='7,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"<drawstep func='triangle' " "<drawstep func='triangle' "
@ -560,7 +560,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='5' " "height='5' "
"xpos='left' " "xpos='left' "
"ypos='4' " "ypos='4' "
"padding='2,0,7,0' " "padding='7,0,0,0' "
"orientation='top' " "orientation='top' "
"/>" "/>"
"<text font='text_default' " "<text font='text_default' "
@ -612,7 +612,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='4' " "height='4' "
"xpos='left' " "xpos='left' "
"ypos='9' " "ypos='9' "
"padding='2,0,3,0' " "padding='3,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"<drawstep func='triangle' " "<drawstep func='triangle' "
@ -622,7 +622,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='4' " "height='4' "
"xpos='left' " "xpos='left' "
"ypos='4' " "ypos='4' "
"padding='2,0,3,0' " "padding='3,0,0,0' "
"orientation='top' " "orientation='top' "
"/>" "/>"
"<text font='text_default' " "<text font='text_default' "
@ -745,7 +745,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='6' " "height='6' "
"xpos='left' " "xpos='left' "
"ypos='center' " "ypos='center' "
"padding='2,0,4,0' " "padding='4,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"<drawstep func='line' " "<drawstep func='line' "
@ -849,7 +849,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='6' " "height='6' "
"xpos='left' " "xpos='left' "
"ypos='center' " "ypos='center' "
"padding='2,0,4,0' " "padding='4,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"<drawstep func='line' " "<drawstep func='line' "
@ -953,7 +953,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='6' " "height='6' "
"xpos='left' " "xpos='left' "
"ypos='center' " "ypos='center' "
"padding='2,0,4,0' " "padding='4,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"<drawstep func='line' " "<drawstep func='line' "
@ -1057,7 +1057,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='6' " "height='6' "
"xpos='left' " "xpos='left' "
"ypos='center' " "ypos='center' "
"padding='2,0,4,0' " "padding='4,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"<drawstep func='line' " "<drawstep func='line' "
@ -1153,7 +1153,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='6' " "height='6' "
"xpos='left' " "xpos='left' "
"ypos='center' " "ypos='center' "
"padding='2,0,4,0' " "padding='4,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"</drawdata>" "</drawdata>"
@ -1241,7 +1241,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"height='6' " "height='6' "
"xpos='left' " "xpos='left' "
"ypos='center' " "ypos='center' "
"padding='2,0,4,0' " "padding='4,0,0,0' "
"orientation='bottom' " "orientation='bottom' "
"/>" "/>"
"</drawdata>" "</drawdata>"

Binary file not shown.

View file

@ -543,7 +543,7 @@
height = '5' height = '5'
xpos = 'left' xpos = 'left'
ypos = '10' ypos = '10'
padding = '2, 0, 6, 0' padding = '6, 0, 0, 0'
orientation = 'bottom' orientation = 'bottom'
/> />
@ -554,7 +554,7 @@
height = '5' height = '5'
xpos = 'left' xpos = 'left'
ypos = '4' ypos = '4'
padding = '2, 0, 6, 0' padding = '6, 0, 0, 0'
orientation = 'top' orientation = 'top'
/> />
@ -620,7 +620,7 @@
height = '4' height = '4'
xpos = 'left' xpos = 'left'
ypos = '9' ypos = '9'
padding = '2, 0, 3, 0' padding = '3, 0, 0, 0'
orientation = 'bottom' orientation = 'bottom'
/> />
@ -631,7 +631,7 @@
height = '4' height = '4'
xpos = 'left' xpos = 'left'
ypos = '4' ypos = '4'
padding = '2, 0, 3, 0' padding = '3, 0, 0, 0'
orientation = 'top' orientation = 'top'
/> />
@ -698,7 +698,7 @@
height = '5' height = '5'
xpos = 'left' xpos = 'left'
ypos = '10' ypos = '10'
padding = '2, 0, 6, 0' padding = '6, 0, 0, 0'
orientation = 'bottom' orientation = 'bottom'
/> />
@ -709,7 +709,7 @@
height = '5' height = '5'
xpos = 'left' xpos = 'left'
ypos = '4' ypos = '4'
padding = '2, 0, 6, 0' padding = '6, 0, 0, 0'
orientation = 'top' orientation = 'top'
/> />
@ -775,7 +775,7 @@
height = '4' height = '4'
xpos = 'left' xpos = 'left'
ypos = '9' ypos = '9'
padding = '2, 0, 3, 0' padding = '3, 0, 0, 0'
orientation = 'bottom' orientation = 'bottom'
/> />
@ -786,7 +786,7 @@
height = '4' height = '4'
xpos = 'left' xpos = 'left'
ypos = '4' ypos = '4'
padding = '2, 0, 3, 0' padding = '3, 0, 0, 0'
orientation = 'top' orientation = 'top'
/> />
@ -853,7 +853,7 @@
height = '5' height = '5'
xpos = 'left' xpos = 'left'
ypos = '10' ypos = '10'
padding = '2, 0, 6, 0' padding = '6, 0, 0, 0'
orientation = 'bottom' orientation = 'bottom'
/> />
@ -864,7 +864,7 @@
height = '5' height = '5'
xpos = 'left' xpos = 'left'
ypos = '4' ypos = '4'
padding = '2, 0, 6, 0' padding = '6, 0, 0, 0'
orientation = 'top' orientation = 'top'
/> />
@ -930,7 +930,7 @@
height = '4' height = '4'
xpos = 'left' xpos = 'left'
ypos = '9' ypos = '9'
padding = '2, 0, 3, 0' padding = '3, 0, 0, 0'
orientation = 'bottom' orientation = 'bottom'
/> />
@ -941,7 +941,7 @@
height = '4' height = '4'
xpos = 'left' xpos = 'left'
ypos = '4' ypos = '4'
padding = '2, 0, 3, 0' padding = '3, 0, 0, 0'
orientation = 'top' orientation = 'top'
/> />
@ -1141,7 +1141,7 @@
height = '6' height = '6'
xpos = 'left' xpos = 'left'
ypos = 'center' ypos = 'center'
padding = '2,0,2,0' padding = '2,0,0,0'
orientation = 'bottom' orientation = 'bottom'
/> />
</drawdata> </drawdata>
@ -1256,7 +1256,7 @@
height = '6' height = '6'
xpos = 'left' xpos = 'left'
ypos = 'center' ypos = 'center'
padding = '2,0,2,0' padding = '2,0,0,0'
orientation = 'bottom' orientation = 'bottom'
/> />
</drawdata> </drawdata>
@ -1373,7 +1373,7 @@
height = '6' height = '6'
xpos = 'left' xpos = 'left'
ypos = 'center' ypos = 'center'
padding = '2,0,2,0' padding = '2,0,0,0'
orientation = 'bottom' orientation = 'bottom'
/> />
</drawdata> </drawdata>
@ -1488,7 +1488,7 @@
height = '6' height = '6'
xpos = 'left' xpos = 'left'
ypos = 'center' ypos = 'center'
padding = '2,0,2,0' padding = '2,0,0,0'
orientation = 'bottom' orientation = 'bottom'
/> />
</drawdata> </drawdata>
@ -1605,7 +1605,7 @@
height = '6' height = '6'
xpos = 'left' xpos = 'left'
ypos = 'center' ypos = 'center'
padding = '2,0,2,0' padding = '2,0,0,0'
orientation = 'bottom' orientation = 'bottom'
/> />
</drawdata> </drawdata>
@ -1726,7 +1726,7 @@
height = '6' height = '6'
xpos = 'left' xpos = 'left'
ypos = 'center' ypos = 'center'
padding = '2,0,2,0' padding = '2,0,0,0'
orientation = 'bottom' orientation = 'bottom'
/> />
</drawdata> </drawdata>
@ -1786,7 +1786,7 @@
height = '6' height = '6'
xpos = 'left' xpos = 'left'
ypos = 'center' ypos = 'center'
padding = '0,0,0,0' padding = '0,0,2,0'
orientation = 'bottom' orientation = 'bottom'
/> />
</drawdata> </drawdata>

View file

@ -163,8 +163,9 @@ bool EditableWidget::handleKeyDown(Common::KeyState state) {
case Common::KEYCODE_DOWN: case Common::KEYCODE_DOWN:
case Common::KEYCODE_END: case Common::KEYCODE_END:
// Move caret to end // Move caret to end
dirty = setCaretPos(_editString.size()); setCaretPos(_editString.size());
forcecaret = true; forcecaret = true;
dirty = true;
break; break;
case Common::KEYCODE_LEFT: case Common::KEYCODE_LEFT:
@ -188,8 +189,9 @@ bool EditableWidget::handleKeyDown(Common::KeyState state) {
case Common::KEYCODE_UP: case Common::KEYCODE_UP:
case Common::KEYCODE_HOME: case Common::KEYCODE_HOME:
// Move caret to start // Move caret to start
dirty = setCaretPos(0); setCaretPos(0);
forcecaret = true; forcecaret = true;
dirty = true;
break; break;
case Common::KEYCODE_v: case Common::KEYCODE_v:

View file

@ -273,6 +273,9 @@ Codec *createQuickTimeCodec(uint32 tag, int width, int height, int bitsPerPixel)
case MKTAG('Q','k','B','k'): case MKTAG('Q','k','B','k'):
// CDToons: Used by most of the Broderbund games. // CDToons: Used by most of the Broderbund games.
return new CDToonsDecoder(width, height); return new CDToonsDecoder(width, height);
case MKTAG('r','a','w',' '):
// Used my L-Zone-mac (Director game)
return new BitmapRawDecoder(width, height, bitsPerPixel);
default: default:
warning("Unsupported QuickTime codec \'%s\'", tag2str(tag)); warning("Unsupported QuickTime codec \'%s\'", tag2str(tag));
} }

View file

@ -24,6 +24,10 @@ TEST_CFLAGS := $(CFLAGS) -I$(srcdir)/test/cxxtest
TEST_LDFLAGS := $(LDFLAGS) $(LIBS) TEST_LDFLAGS := $(LDFLAGS) $(LIBS)
TEST_CXXFLAGS := $(filter-out -Wglobal-constructors,$(CXXFLAGS)) TEST_CXXFLAGS := $(filter-out -Wglobal-constructors,$(CXXFLAGS))
ifdef WIN32
TEST_LDFLAGS := $(filter-out -mwindows,$(TEST_LDFLAGS))
endif
ifdef N64 ifdef N64
TEST_LDFLAGS := $(filter-out -mno-crt0,$(TEST_LDFLAGS)) TEST_LDFLAGS := $(filter-out -mno-crt0,$(TEST_LDFLAGS))
endif endif