aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorThanasis Antoniou2019-09-16 11:59:52 +0300
committerThanasis Antoniou2019-09-16 12:00:25 +0300
commit7c20b07ffb3b9260d3b9f250a7d6041769ad7b5f (patch)
tree8ef5fae30b13914b910eab989e069637e315ec77 /engines
parent5453653a4cfb3098e098df0e753b4d302edc896b (diff)
downloadscummvm-rg350-7c20b07ffb3b9260d3b9f250a7d6041769ad7b5f.tar.gz
scummvm-rg350-7c20b07ffb3b9260d3b9f250a7d6041769ad7b5f.tar.bz2
scummvm-rg350-7c20b07ffb3b9260d3b9f250a7d6041769ad7b5f.zip
BLADERUNNER: Add engine gui option to avoid use of delayMillis()
Diffstat (limited to 'engines')
-rw-r--r--engines/bladerunner/bladerunner.cpp16
-rw-r--r--engines/bladerunner/bladerunner.h1
-rw-r--r--engines/bladerunner/detection.cpp9
-rw-r--r--engines/bladerunner/detection_tables.h36
-rw-r--r--engines/bladerunner/framelimiter.cpp6
-rw-r--r--engines/bladerunner/ui/kia.cpp8
6 files changed, 51 insertions, 25 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index b0d322f324..76a95ab5d8 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -111,9 +111,10 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des
_subtitlesEnabled = false;
- _sitcomMode = false;
- _shortyMode = false;
- _cutContent = Common::String(desc->gameId).contains("bladerunner-final");
+ _sitcomMode = false;
+ _shortyMode = false;
+ _noDelayMillisFramelimiter = false;
+ _cutContent = Common::String(desc->gameId).contains("bladerunner-final");
_playerLosesControlCounter = 0;
@@ -559,8 +560,13 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
// get value from the ScummVM configuration manager
syncSoundSettings();
- _sitcomMode = ConfMan.getBool("sitcom");
- _shortyMode = ConfMan.getBool("shorty");
+ _sitcomMode = ConfMan.getBool("sitcom");
+ _shortyMode = ConfMan.getBool("shorty");
+
+ if (!ConfMan.hasKey("nodelaymillisfl")) {
+ ConfMan.setBool("nodelaymillisfl", false);
+ }
+ _noDelayMillisFramelimiter = ConfMan.getBool("nodelaymillisfl");
// BLADE.INI was read here, but it was replaced by ScummVM configuration
_chapters = new Chapters(this);
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index 95b85f3708..e02e4fb1d2 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -215,6 +215,7 @@ public:
bool _subtitlesEnabled; // tracks the state of whether subtitles are enabled or disabled from ScummVM GUI option or KIA checkbox (the states are synched)
bool _sitcomMode;
bool _shortyMode;
+ bool _noDelayMillisFramelimiter;
bool _cutContent;
int _walkSoundId;
diff --git a/engines/bladerunner/detection.cpp b/engines/bladerunner/detection.cpp
index 33c3dda169..26772e2b48 100644
--- a/engines/bladerunner/detection.cpp
+++ b/engines/bladerunner/detection.cpp
@@ -60,6 +60,15 @@ static const ADExtraGuiOptionsMap optionsList[] = {
false
}
},
+ {
+ GAMEOPTION_FRAMELIMITER_NODELAYMILLIS,
+ {
+ _s("Frame limiter high performance mode"),
+ _s("This mode may result in high CPU usage! It avoids use of delayMillis() function."),
+ "nodelaymillisfl",
+ false
+ }
+ },
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
diff --git a/engines/bladerunner/detection_tables.h b/engines/bladerunner/detection_tables.h
index 7f45c611c4..b077529ce9 100644
--- a/engines/bladerunner/detection_tables.h
+++ b/engines/bladerunner/detection_tables.h
@@ -25,9 +25,9 @@
#include "engines/advancedDetector.h"
-#define GAMEOPTION_SITCOM GUIO_GAMEOPTIONS1
-#define GAMEOPTION_SHORTY GUIO_GAMEOPTIONS2
-#define GAMEOPTION_CUT_CONTENT GUIO_GAMEOPTIONS3
+#define GAMEOPTION_SITCOM GUIO_GAMEOPTIONS1
+#define GAMEOPTION_SHORTY GUIO_GAMEOPTIONS2
+#define GAMEOPTION_FRAMELIMITER_NODELAYMILLIS GUIO_GAMEOPTIONS3
namespace BladeRunner {
@@ -40,7 +40,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_TESTING,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (German)
@@ -51,7 +51,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_TESTING,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (French) - Bug #9722
@@ -62,7 +62,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_TESTING,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (Italian)
@@ -73,7 +73,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformWindows,
ADGF_TESTING,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc.)
@@ -84,7 +84,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformWindows,
ADGF_TESTING,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc. + Siberian Studio, R3)
@@ -95,7 +95,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformWindows,
ADGF_TESTING,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc. + Siberian Studio, R4)
@@ -106,7 +106,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformWindows,
ADGF_TESTING,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (Spanish)
@@ -117,7 +117,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_TESTING,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// Versions with restored content
@@ -130,7 +130,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (German)
@@ -141,7 +141,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (French)
@@ -152,7 +152,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (Italian)
@@ -163,7 +163,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc.)
@@ -174,7 +174,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc. + Siberian Studio, R3)
@@ -185,7 +185,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
// BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc. + Siberian Studio, R4)
@@ -196,7 +196,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY)
+ GUIO3(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY, GAMEOPTION_FRAMELIMITER_NODELAYMILLIS)
},
AD_TABLE_END_MARKER
diff --git a/engines/bladerunner/framelimiter.cpp b/engines/bladerunner/framelimiter.cpp
index 5a2dee1f54..20f60ceaca 100644
--- a/engines/bladerunner/framelimiter.cpp
+++ b/engines/bladerunner/framelimiter.cpp
@@ -56,7 +56,11 @@ void Framelimiter::wait() {
uint32 frameDuration = timeNow - _timeFrameStart;
if (frameDuration < _speedLimitMs) {
uint32 waittime = _speedLimitMs - frameDuration;
- _vm->_system->delayMillis(waittime);
+ if (_vm->_noDelayMillisFramelimiter) {
+ while (_vm->_time->currentSystem() - timeNow < waittime) { }
+ } else {
+ _vm->_system->delayMillis(waittime);
+ }
timeNow += waittime;
}
// debug("frametime %i ms", timeNow - _timeFrameStart);
diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp
index 32704fc7d2..65e3e84c40 100644
--- a/engines/bladerunner/ui/kia.cpp
+++ b/engines/bladerunner/ui/kia.cpp
@@ -666,8 +666,14 @@ void KIA::mouseDownCallback(int buttonId, void *callbackData) {
int endTrackId = self->_vm->_audioPlayer->playAud(self->_vm->_gameInfo->getSfxTrack(kSfxSHUTDOWN), 70, 0, 0, 50, 0);
if (endTrackId != -1) {
// wait until the full clip has played (similar to the original)
+ uint32 timeNow = self->_vm->_time->currentSystem();
+ uint32 waittime = 16;
while (self->_vm->_audioPlayer->isActive(endTrackId)) {
- self->_vm->_system->delayMillis(16);
+ if (self->_vm->_noDelayMillisFramelimiter) {
+ while (self->_vm->_time->currentSystem() - timeNow < waittime) { }
+ } else {
+ self->_vm->_system->delayMillis(waittime);
+ }
}
}
}