[Scummvm-git-logs] scummvm master -> bf3a8df7417d2203f1b1a11a93cd80c70388043d
bluegr
bluegr at gmail.com
Sun Feb 9 11:18:42 UTC 2020
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:
f3082a5588 GUI: add optional 'alignment' parameter to 'MessageDialog'
bf3a8df741 SCI: GK2: if subtitles patch is missing, explain how to install it
Commit: f3082a558844873e6525629081a501a225f09558
https://github.com/scummvm/scummvm/commit/f3082a558844873e6525629081a501a225f09558
Author: Zvika Haramaty (haramaty.zvika at gmail.com)
Date: 2020-02-09T13:18:37+02:00
Commit Message:
GUI: add optional 'alignment' parameter to 'MessageDialog'
Changed paths:
gui/message.cpp
gui/message.h
diff --git a/gui/message.cpp b/gui/message.cpp
index 3478440..471ca8e 100644
--- a/gui/message.cpp
+++ b/gui/message.cpp
@@ -35,9 +35,10 @@ enum {
};
+
// TODO: The default button should be visibly distinct from the alternate button
-MessageDialog::MessageDialog(const Common::String &message, const char *defaultButton, const char *altButton)
+MessageDialog::MessageDialog(const Common::String &message, const char *defaultButton, const char *altButton, Graphics::TextAlign alignment)
: Dialog(30, 20, 260, 124) {
const int screenW = g_system->getOverlayWidth();
@@ -79,7 +80,7 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB
// Each line is represented by one static text item.
for (int i = 0; i < lineCount; i++) {
new StaticTextWidget(this, 10, 10 + i * kLineHeight, maxlineWidth, kLineHeight,
- lines[i], Graphics::kTextAlignCenter);
+ lines[i], alignment);
}
if (defaultButton && altButton) {
diff --git a/gui/message.h b/gui/message.h
index b22297e..0a31157 100644
--- a/gui/message.h
+++ b/gui/message.h
@@ -41,7 +41,7 @@ enum {
*/
class MessageDialog : public Dialog {
public:
- MessageDialog(const Common::String &message, const char *defaultButton = "OK", const char *altButton = nullptr);
+ MessageDialog(const Common::String &message, const char *defaultButton = "OK", const char *altButton = nullptr, Graphics::TextAlign alignment = Graphics::kTextAlignCenter);
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
};
Commit: bf3a8df7417d2203f1b1a11a93cd80c70388043d
https://github.com/scummvm/scummvm/commit/bf3a8df7417d2203f1b1a11a93cd80c70388043d
Author: Zvika Haramaty (haramaty.zvika at gmail.com)
Date: 2020-02-09T13:18:37+02:00
Commit Message:
SCI: GK2: if subtitles patch is missing, explain how to install it
Changed paths:
engines/sci/detection_tables.h
engines/sci/engine/script_patches.cpp
engines/sci/engine/script_patches.h
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index bab16ae..c817c8c 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -873,8 +873,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
GUIO_NOLAUNCHLOAD, \
GUIO_NOASPECT, \
GAMEOPTION_HQ_VIDEO)
-#define GUIO_GK2 GUIO7(GUIO_NOSUBTITLES, \
- GUIO_LINKSPEECHTOSFX, \
+#define GUIO_GK2 GUIO6(GUIO_LINKSPEECHTOSFX, \
GUIO_NOMIDI, \
GUIO_NOASPECT, \
GAMEOPTION_ORIGINAL_SAVELOAD, \
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index b6f8045..d53627b 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -30,7 +30,12 @@
#include "sci/engine/guest_additions.h"
#endif
+#include "common/config-manager.h"
#include "common/util.h"
+#include "common/translation.h"
+#include "common/system.h"
+#include "gui/message.h"
+
namespace Sci {
@@ -18460,6 +18465,42 @@ void ScriptPatcher::applyPatch(const SciScriptPatcherEntry *patchEntry, SciSpan<
}
}
+
+// TODO: suggest automatic installation
+void ScriptPatcher::suggestDownloadGK2SubTitlesPatch() {
+ if (ConfMan.getBool("subtitles")) {
+
+ const char *altButton;
+ Common::String downloadMessage;
+
+ if (g_system->hasFeature(OSystem::kFeatureOpenUrl)) {
+ altButton = _("Download patch");
+ downloadMessage = _("(or click 'Download patch' button. But note - it only downloads, you will have to continue from there)\n");
+ } else {
+ altButton = nullptr;
+ downloadMessage = "";
+ }
+
+ GUI::MessageDialog dialog(_("GK2 has a fan made subtitles, available thanks to the good persons at SierraHelp.\n\n"
+ "Installation:\n"
+ "- download http://www.sierrahelp.com/Files/Patches/GabrielKnight/GK2Subtitles.zip\n" +
+ downloadMessage +
+ "- extract zip file\n"
+ "- no need to run the .exe file\n"
+ "- extract the .exe file with a file archiver, like 7-zip\n"
+ "- create a PATCHES subdirectory inside your GK2 directory\n"
+ "- copy the content of GK2Subtitles\\SUBPATCH to the PATCHES subdirectory\n"
+ "- replace files with similar names\n"
+ "- restart the game\n"), _("OK"), altButton, Graphics::kTextAlignLeft);
+ int result = dialog.runModal();
+ if (!result) {
+ char url[] = "http://www.sierrahelp.com/Files/Patches/GabrielKnight/GK2Subtitles.zip";
+ g_system->openUrl(url);
+ }
+
+ }
+}
+
bool ScriptPatcher::verifySignature(uint32 byteOffset, const uint16 *signatureData, const char *signatureDescription, const SciSpan<const byte> &scriptData) {
uint16 sigSelector = 0;
@@ -18947,6 +18988,8 @@ void ScriptPatcher::processScript(uint16 scriptNr, SciSpan<byte> scriptData) {
// Enable subtitle compatibility if a sync resource is present
if (g_sci->getResMan()->testResource(ResourceId(kResourceTypeSync, 10))) {
enablePatch(signatureTable, "subtitle patch compatibility");
+ } else {
+ suggestDownloadGK2SubTitlesPatch();
}
break;
case GID_KQ5:
diff --git a/engines/sci/engine/script_patches.h b/engines/sci/engine/script_patches.h
index 69f9794..32e47b5 100644
--- a/engines/sci/engine/script_patches.h
+++ b/engines/sci/engine/script_patches.h
@@ -120,6 +120,10 @@ private:
// Applies a patch to a given script + offset (overwrites parts)
void applyPatch(const SciScriptPatcherEntry *patchEntry, SciSpan<byte> scriptData, int32 signatureOffset);
+ // suggest to download GK2 subtitles patch
+ // in the future, we might refactor it to something more generic, if will needed
+ void suggestDownloadGK2SubTitlesPatch();
+
Selector *_selectorIdTable;
SciScriptPatcherRuntimeEntry *_runtimeTable;
bool _isMacSci11;
More information about the Scummvm-git-logs
mailing list