[Scummvm-git-logs] scummvm branch-2-3 -> 2a9b430a382cc6c944012ae34e06dc391edc2edb
antoniou79
a.antoniou79 at gmail.com
Mon Sep 6 13:21:27 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
03b61ddb67 CONFIGURE: Use -fsigned-char as extra building flag for Android
2a9b430a38 STARK: Detect TLJ Steam version to fix missing bg resource (#3318)
Commit: 03b61ddb6715b0013823b49d9e888d551208ccf8
https://github.com/scummvm/scummvm/commit/03b61ddb6715b0013823b49d9e888d551208ccf8
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2021-09-06T16:19:45+03:00
Commit Message:
CONFIGURE: Use -fsigned-char as extra building flag for Android
Needed for Android ARM architectures, where compilers assumes char is unsigned
Addresses issues like outlining fonts in AGS (https://forums.scummvm.org/viewtopic.php?f=17&p=95919#p95919)
See: https://stackoverflow.com/questions/7414355/is-it-safe-to-build-with-fsigned-char-with-android-ndk
Changed paths:
configure
diff --git a/configure b/configure
index ef24f2adc5..f01de2e01f 100755
--- a/configure
+++ b/configure
@@ -6090,6 +6090,12 @@ case $_host_os in
fi
;;
android)
+ # Force treating unqualified char variables as signed by default.
+ # NDK compiler for ARM will treat them as unsigned otherwise, which creates bugs in the code.
+ # We apply this to all Android architectures (arm, arm64, and x86, x86-64)
+ # albeit only the ARM architectures really required it (the others are not affected by this addition).
+ echo "(Android) Treating char as signed char by default"
+ append_var CXXFLAGS "-fsigned-char"
# ssp at this point so the cxxtests link
if test "$_debug_build" = yes; then
append_var CXXFLAGS "-fstack-protector"
Commit: 2a9b430a382cc6c944012ae34e06dc391edc2edb
https://github.com/scummvm/scummvm/commit/2a9b430a382cc6c944012ae34e06dc391edc2edb
Author: Antoniou Athanasios (a.antoniou79 at gmail.com)
Date: 2021-09-06T16:21:08+03:00
Commit Message:
STARK: Detect TLJ Steam version to fix missing bg resource (#3318)
STARK: Detect TLJ Steam version to fix missing bg resource
An alternative fix for bug https://bugs.scummvm.org/ticket/12762 that replaces the previous fix.
This fix will set a flag at detection time (when adding the game to ScummVM)
so that the Steam version will skip trying to load a background image resource
from the exe file (game.exe), since that specific version is missing a valid version
of this resource which leads to an assertion fault.
It wont be necessary to re-add (redetect) the game, if it has already been added before this fix. The current AdvancedDetector implementation takes care of setting the flag at game launch. (As explained by sev) we run detection on every run and returning the relevant detection entry.
The previous fix was this commit which was based only on version info of the exe file:
https://github.com/scummvm/scummvm/commit/565a0559ed09660daa83cd529afa4e0efb6949c5
That one also works without having to re-add/re-detect the game, but perhaps just checking
version info is not the best approach.
Changed paths:
A engines/stark/detection.h
engines/advancedDetector.h
engines/stark/detection.cpp
engines/stark/services/userinterface.cpp
engines/stark/services/userinterface.h
engines/stark/stark.cpp
engines/stark/stark.h
engines/stark/ui/dialogbox.cpp
engines/stark/ui/dialogbox.h
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index a2df57e0a7..ceeab21e7a 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -79,6 +79,12 @@ struct ADGameFileDescription {
*/
#define AD_ENTRY2s(f1, x1, s1, f2, x2, s2) {{f1, 0, x1, s1}, {f2, 0, x2, s2}, AD_LISTEND}
+/**
+ * A shortcut to produce a list of ADGameFileDescription records with only three
+ * records that contain just a filename with an MD5, plus a file size.
+ */
+#define AD_ENTRY3s(f1, x1, s1, f2, x2, s2, f3, x3, s3) {{f1, 0, x1, s1}, {f2, 0, x2, s2}, {f3, 0, x3, s3}, AD_LISTEND}
+
/**
* Flags used in the game description.
*/
diff --git a/engines/stark/detection.cpp b/engines/stark/detection.cpp
index e60aebe604..653e84ca50 100644
--- a/engines/stark/detection.cpp
+++ b/engines/stark/detection.cpp
@@ -24,6 +24,7 @@
#include "common/translation.h"
+#include "stark/detection.h"
#include "stark/debug.h"
namespace Stark {
@@ -44,6 +45,20 @@ static const DebugChannelDef debugFlagList[] = {
};
static const ADGameDescription gameDescriptions[] = {
+
+ // The Longest Journey
+ // English Steam (game.exe missing valid 147.bmp resource for dialog boxes background)
+ {
+ "tlj", "Steam",
+ AD_ENTRY3s("x.xarc", "de8327850d7bba90b690b141eaa23f61", 3032,
+ "chapters.ini", "5b5a1f1dd2297d9ce0d3d12216d5d2c5", 485,
+ "game.exe", "2a68bd64e71635c74a5c6bb172ec1cb1", 95744),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ GF_MISSING_EXE_RESOURCES|ADGF_NO_FLAGS,
+ GUIO_NONE
+ },
+
// The Longest Journey
// English DVD
{
diff --git a/engines/stark/detection.h b/engines/stark/detection.h
new file mode 100644
index 0000000000..b78e4699ed
--- /dev/null
+++ b/engines/stark/detection.h
@@ -0,0 +1,34 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef STARK_DETECTION_H
+#define STARK_DETECTION_H
+
+namespace Stark {
+
+enum GameFlags {
+ GF_MISSING_EXE_RESOURCES = 1 << 0
+};
+
+} // End of namespace Stark
+
+#endif // STARK_DETECTION_H
diff --git a/engines/stark/services/userinterface.cpp b/engines/stark/services/userinterface.cpp
index 13aae647de..1b7bb761b8 100644
--- a/engines/stark/services/userinterface.cpp
+++ b/engines/stark/services/userinterface.cpp
@@ -60,7 +60,7 @@
namespace Stark {
-UserInterface::UserInterface(Gfx::Driver *gfx) :
+UserInterface::UserInterface(StarkEngine *vm, Gfx::Driver *gfx) :
_gfx(gfx),
_cursor(nullptr),
_diaryIndexScreen(nullptr),
@@ -82,6 +82,7 @@ UserInterface::UserInterface(Gfx::Driver *gfx) :
_currentScreen(nullptr),
_gameWindowThumbnail(nullptr),
_modalDialog(nullptr) {
+ _vm = vm;
}
UserInterface::~UserInterface() {
@@ -114,7 +115,7 @@ void UserInterface::init() {
_diaryPagesScreen = new DiaryPagesScreen(_gfx, _cursor);
_dialogScreen = new DialogScreen(_gfx, _cursor);
_fmvScreen = new FMVScreen(_gfx, _cursor);
- _modalDialog = new DialogBox(_gfx, _cursor);
+ _modalDialog = new DialogBox(_vm, _gfx, _cursor);
_prevScreenNameStack.push(Screen::kScreenMainMenu);
_currentScreen = _fmvScreen;
diff --git a/engines/stark/services/userinterface.h b/engines/stark/services/userinterface.h
index ec2af77e34..5851313dbd 100644
--- a/engines/stark/services/userinterface.h
+++ b/engines/stark/services/userinterface.h
@@ -23,6 +23,7 @@
#ifndef STARK_SERVICES_USER_INTERFACE_H
#define STARK_SERVICES_USER_INTERFACE_H
+#include "engines/stark/stark.h"
#include "engines/stark/ui/screen.h"
#include "engines/stark/services/gamemessage.h"
@@ -73,7 +74,7 @@ enum {
*/
class UserInterface {
public:
- explicit UserInterface(Gfx::Driver *gfx);
+ explicit UserInterface(StarkEngine *vm, Gfx::Driver *gfx);
virtual ~UserInterface();
void init();
@@ -200,6 +201,7 @@ private:
void cycleInventory(bool forward);
+ StarkEngine *_vm;
GameScreen *_gameScreen;
FMVScreen *_fmvScreen;
DiaryIndexScreen *_diaryIndexScreen;
diff --git a/engines/stark/stark.cpp b/engines/stark/stark.cpp
index e8ae24c5cb..412f5d7f3b 100644
--- a/engines/stark/stark.cpp
+++ b/engines/stark/stark.cpp
@@ -54,6 +54,7 @@
#include "common/savefile.h"
#include "common/system.h"
#include "common/translation.h"
+#include "engines/advancedDetector.h"
#include "gui/message.h"
namespace Stark {
@@ -114,7 +115,7 @@ Common::Error StarkEngine::run() {
services.dialogPlayer = new DialogPlayer();
services.diary = new Diary();
services.gameInterface = new GameInterface();
- services.userInterface = new UserInterface(services.gfx);
+ services.userInterface = new UserInterface(this, services.gfx);
services.settings = new Settings(_mixer, _gameDescription);
services.gameChapter = new GameChapter();
services.gameMessage = new GameMessage();
@@ -523,4 +524,6 @@ void StarkEngine::onScreenChanged() const {
}
}
+uint32 StarkEngine::getGameFlags() const { return _gameDescription->flags; }
+
} // End of namespace Stark
diff --git a/engines/stark/stark.h b/engines/stark/stark.h
index 54638a4233..3eddbbe349 100644
--- a/engines/stark/stark.h
+++ b/engines/stark/stark.h
@@ -26,6 +26,7 @@
#include "engines/engine.h"
#include "common/events.h"
#include "common/str-array.h"
+#include "stark/detection.h"
struct ADGameDescription;
@@ -70,6 +71,8 @@ public:
/** Extract the save slot number from the provided save file name */
static int getSaveNameSlot(const char *target, const Common::String &saveName);
+ uint32 getGameFlags() const;
+
protected:
// Engine APIs
Common::Error run() override;
diff --git a/engines/stark/ui/dialogbox.cpp b/engines/stark/ui/dialogbox.cpp
index 29c972b2eb..b475ba8b1f 100644
--- a/engines/stark/ui/dialogbox.cpp
+++ b/engines/stark/ui/dialogbox.cpp
@@ -46,11 +46,11 @@ static const uint buttonHorizontalMargin = 25;
static const uint buttonVerticalMargin = 5;
static const Color textColor = Color(0xFF, 0xFF, 0xFF);
-DialogBox::DialogBox(Gfx::Driver *gfx, Cursor *cursor) :
+DialogBox::DialogBox(StarkEngine *vm, Gfx::Driver *gfx, Cursor *cursor) :
Window(gfx, cursor),
_foregroundTexture(nullptr),
_confirmCallback(nullptr) {
-
+ _vm = vm;
_surfaceRenderer = gfx->createSurfaceRenderer();
Graphics::Surface *background = loadBackground();
@@ -227,13 +227,8 @@ Graphics::Surface *DialogBox::loadBackground() {
// Steam version of The Longest Journey is 1.0.0.161 "Enno's two-CD Version"
// GOG version of The Longest Journey is 1.0.0.142 "RC1" (Special Build: "Paper Sun")
// Steam's game.exe does not contain a valid resource for the background bitmap id 147
- // so we skip trying to retrieve it based on build number.
- Common::WinResources::VersionInfo *versionInfo = executable.getVersionResource(1);
- if (versionInfo
- && versionInfo->fileVersion[0] == 1
- && versionInfo->fileVersion[1] == 0
- && versionInfo->fileVersion[2] == 0
- && versionInfo->fileVersion[3] == 161) {
+ // so we skip trying to retrieve it.
+ if (_vm->getGameFlags() & GF_MISSING_EXE_RESOURCES) {
warning("Steam version does not contain the modal dialog background bitmap in 'game.exe'. Using fallback color for dialog background...");
return nullptr;
}
diff --git a/engines/stark/ui/dialogbox.h b/engines/stark/ui/dialogbox.h
index 6da165a83d..58e0343963 100644
--- a/engines/stark/ui/dialogbox.h
+++ b/engines/stark/ui/dialogbox.h
@@ -23,6 +23,7 @@
#ifndef STARK_UI_DIALOG_BOX_H
#define STARK_UI_DIALOG_BOX_H
+#include "engines/stark/stark.h"
#include "engines/stark/ui/window.h"
#include "common/keyboard.h"
@@ -47,7 +48,7 @@ class VisualText;
*/
class DialogBox : public Window {
public:
- DialogBox(Gfx::Driver *gfx, Cursor *cursor);
+ DialogBox(StarkEngine *vm, Gfx::Driver *gfx, Cursor *cursor);
~DialogBox() override;
/** Make the dialog visible with the specified message */
@@ -68,13 +69,15 @@ protected:
void onClick(const Common::Point &pos) override;
private:
- static Graphics::Surface *loadBackground();
+ Graphics::Surface *loadBackground();
static void drawBevel(Graphics::Surface *surface, const Common::Rect &rect);
static Common::Rect centerRect(const Common::Rect &container, const Common::Rect &size);
void freeForeground();
void recomputeLayout();
+ StarkEngine *_vm;
+
Gfx::SurfaceRenderer *_surfaceRenderer;
Gfx::Texture *_backgroundTexture;
Gfx::Texture *_foregroundTexture;
More information about the Scummvm-git-logs
mailing list