[Scummvm-git-logs] scummvm master -> b4e9f6696bbac8d624f7bba6033c88cd0ce2df00
yuv422
yuv422 at users.noreply.github.com
Sun Jun 7 04:50:38 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b4e9f6696b DRAGONS: Added error dialog when incorrectly extracted STR and DTSPEECH.XA files detected.
Commit: b4e9f6696bbac8d624f7bba6033c88cd0ce2df00
https://github.com/scummvm/scummvm/commit/b4e9f6696bbac8d624f7bba6033c88cd0ce2df00
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-06-07T14:45:41+10:00
Commit Message:
DRAGONS: Added error dialog when incorrectly extracted STR and DTSPEECH.XA files detected.
Changed paths:
A engines/dragons/POTFILES
engines/dragons/dragons.cpp
engines/dragons/dragons.h
diff --git a/engines/dragons/POTFILES b/engines/dragons/POTFILES
new file mode 100644
index 0000000000..4985e3816d
--- /dev/null
+++ b/engines/dragons/POTFILES
@@ -0,0 +1 @@
+engines/dragons/dragons.cpp
diff --git a/engines/dragons/dragons.cpp b/engines/dragons/dragons.cpp
index 440ae7e2e2..ab2ee22364 100644
--- a/engines/dragons/dragons.cpp
+++ b/engines/dragons/dragons.cpp
@@ -19,9 +19,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
+#include "gui/message.h"
#include "common/config-manager.h"
#include "common/keyboard.h"
#include "common/language.h"
+#include "common/translation.h"
#include "engines/util.h"
#include "graphics/thumbnail.h"
#include "common/error.h"
@@ -210,6 +212,10 @@ void DragonsEngine::updateEvents() {
}
Common::Error DragonsEngine::run() {
+ if(!checkAudioVideoFiles()) {
+ return Common::kNoGameDataFoundError;
+ }
+
_screen = new Screen();
_bigfileArchive = new BigfileArchive(this, "bigfile.dat");
_talk = new Talk(this, _bigfileArchive);
@@ -1722,6 +1728,39 @@ void DragonsEngine::loadingScreenUpdate() {
}
}
+bool DragonsEngine::checkAudioVideoFiles() {
+ return validateAVFile("crystald.str") &&
+ validateAVFile("illusion.str") &&
+ validateAVFile("labintro.str") &&
+ validateAVFile("previews.str") &&
+ validateAVFile("dtspeech.xa");
+}
+
+bool DragonsEngine::validateAVFile(const char *filename) {
+ const byte fileSignature[12] = {0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00};
+ byte buf[12];
+ Common::File file;
+ bool fileValid = false;
+
+ if (!file.open(filename)) {
+ error("Failed to open %s", filename);
+ }
+
+ if ((file.size() % 2352) == 0) {
+ file.read(buf, 12);
+ if (!memcmp(fileSignature, buf, 12)) {
+ fileValid = true;
+ }
+ }
+
+ file.close();
+
+ if(!fileValid) {
+ GUIErrorMessage(Common::String::format(_("Error: The file '%s' hasn't been extracted properly.\nPlease refer to the wiki page\nhttps://wiki.scummvm.org/index.php?title=HOWTO-PlayStation_Videos for details on how to properly extract the DTSPEECH.XA and *.STR files from your game disc."), filename));
+ }
+ return fileValid;
+}
+
void (*DragonsEngine::getSceneUpdateFunction())() {
return _sceneUpdateFunction;
}
diff --git a/engines/dragons/dragons.h b/engines/dragons/dragons.h
index 8632f18bc6..271709564d 100644
--- a/engines/dragons/dragons.h
+++ b/engines/dragons/dragons.h
@@ -353,6 +353,9 @@ private:
void loadingScreen();
void mainMenu();
+
+ bool checkAudioVideoFiles();
+ bool validateAVFile(const char *filename);
};
DragonsEngine *getEngine();
More information about the Scummvm-git-logs
mailing list