[Scummvm-cvs-logs] scummvm master -> ffcab2fa5dfea99601cd214a08cdce0a0f0d5301
csnover
csnover at users.noreply.github.com
Wed Jun 15 04:04:15 CEST 2016
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:
b56266d28d SCI32: Fix video performance benchmarking in most SCI32 games
ffcab2fa5d SCI: Fix memory leaks in resource patcher
Commit: b56266d28dad338243dd0982328fed7f48633e84
https://github.com/scummvm/scummvm/commit/b56266d28dad338243dd0982328fed7f48633e84
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-06-14T20:58:53-05:00
Commit Message:
SCI32: Fix video performance benchmarking in most SCI32 games
Most SCI32 games draw a "fred" object to the screen when the game
first starts to benchmark video performance. When framerate
throttling is enabled (which fixes many/most timing-related bugs
and reduces system load caused by unnecessary graphics updates),
the game's performance check will think that video card is slow,
causing some "high-performance" game features to be disabled.
To avoid this, we simply disable throttling during benchmarking by
detecting the "fred" object.
Changed paths:
engines/sci/engine/kgraphics32.cpp
engines/sci/graphics/frameout.cpp
engines/sci/graphics/frameout.h
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index 6c51ec4..b140062 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -133,8 +133,6 @@ reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv) {
reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) {
bool showBits = argc > 0 ? argv[0].toUint16() : true;
g_sci->_gfxFrameout->kernelFrameOut(showBits);
- s->speedThrottler(16);
- s->_throttleTrigger = true;
return s->r_acc;
}
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 009ae28..2d44e38 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -77,6 +77,8 @@ GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAd
_screen(screen),
_segMan(segMan),
_paint32(paint32),
+ _benchmarkingFinished(false),
+ _throttleFrameOut(true),
_showStyles(nullptr),
// TODO: Stop using _gfxScreen
_currentBuffer(screen->getDisplayWidth(), screen->getDisplayHeight(), nullptr),
@@ -258,6 +260,17 @@ void GfxFrameout::syncWithScripts(bool addElements) {
#pragma mark Screen items
void GfxFrameout::kernelAddScreenItem(const reg_t object) {
+ // The "fred" object is used to test graphics performance;
+ // it is impacted by framerate throttling, so disable the
+ // throttling when this item is on the screen for the
+ // performance check to pass.
+ if (!_benchmarkingFinished && (
+ (int16)readSelectorValue(_segMan, object, SELECTOR(view)) == -556 ||
+ Common::String(_segMan->getObjectName(object)) == "fred"
+ )) {
+ _throttleFrameOut = false;
+ }
+
const reg_t planeObject = readSelector(_segMan, object, SELECTOR(plane));
_segMan->getObject(object)->setInfoSelectorFlag(kInfoFlagViewInserted);
@@ -297,6 +310,18 @@ void GfxFrameout::kernelUpdateScreenItem(const reg_t object) {
}
void GfxFrameout::kernelDeleteScreenItem(const reg_t object) {
+ // The "fred" object is used to test graphics performance;
+ // it is impacted by framerate throttling, so disable the
+ // throttling when this item is on the screen for the
+ // performance check to pass.
+ if (!_benchmarkingFinished && (
+ (int16)readSelectorValue(_segMan, object, SELECTOR(view)) == -556 ||
+ Common::String(_segMan->getObjectName(object)) == "fred"
+ )) {
+ _benchmarkingFinished = true;
+ _throttleFrameOut = true;
+ }
+
_segMan->getObject(object)->clearInfoSelectorFlag(kInfoFlagViewInserted);
const reg_t planeObject = readSelector(_segMan, object, SELECTOR(plane));
@@ -1395,6 +1420,11 @@ void GfxFrameout::kernelFrameOut(const bool shouldShowBits) {
frameOut(shouldShowBits);
}
+
+ if (_throttleFrameOut) {
+ g_sci->getEngineState()->speedThrottler(16);
+ g_sci->getEngineState()->_throttleTrigger = true;
+ }
}
#pragma mark -
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index 8ed95a0..0f06ee1 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -179,6 +179,22 @@ public:
void run();
#pragma mark -
+#pragma mark Benchmarking
+private:
+ /**
+ * Optimization to avoid the more expensive object name
+ * comparision on every call to kAddScreenItem and
+ * kRemoveScreenItem.
+ */
+ bool _benchmarkingFinished;
+
+ /**
+ * Whether or not calls to kFrameOut should be framerate
+ * limited to ~60fps.
+ */
+ bool _throttleFrameOut;
+
+#pragma mark -
#pragma mark Screen items
private:
void deleteScreenItem(ScreenItem *screenItem, const reg_t plane);
Commit: ffcab2fa5dfea99601cd214a08cdce0a0f0d5301
https://github.com/scummvm/scummvm/commit/ffcab2fa5dfea99601cd214a08cdce0a0f0d5301
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-06-14T20:58:53-05:00
Commit Message:
SCI: Fix memory leaks in resource patcher
Changed paths:
engines/sci/resource.cpp
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 6a5af1a..9f977aa 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -1352,6 +1352,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource
Common::File *file = new Common::File();
if (!file->open(source->getLocationName())) {
warning("ResourceManager::processPatch(): failed to open %s", source->getLocationName().c_str());
+ delete source;
return;
}
fileStream = file;
@@ -1360,6 +1361,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource
int fsize = fileStream->size();
if (fsize < 3) {
debug("Patching %s failed - file too small", source->getLocationName().c_str());
+ delete source;
return;
}
@@ -1370,6 +1372,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource
if (patchType != checkForType) {
debug("Patching %s failed - resource type mismatch", source->getLocationName().c_str());
+ delete source;
return;
}
@@ -1394,6 +1397,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource
if (patchDataOffset + 2 >= fsize) {
debug("Patching %s failed - patch starting at offset %d can't be in file of size %d",
source->getLocationName().c_str(), patchDataOffset + 2, fsize);
+ delete source;
return;
}
More information about the Scummvm-git-logs
mailing list