From 4827cc914a128b956d88ea3eae66d8866d9cd40e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 10 Jun 2011 00:30:48 +0200 Subject: ENGINES: Change incorrect use of 'target' to 'gameid' --- engines/lure/detection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/lure') diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index ced0be0cfb..69bc7d551a 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -182,9 +182,9 @@ static const ADParams detectionParams = { sizeof(Lure::LureGameDescription), // Number of bytes to compute MD5 sum for 1024, - // List of all engine targets + // List of all engine gameid lureGames, - // Structure for autoupgrading obsolete targets + // Structure for autoupgrading obsolete gameids 0, // Name of single gameid (optional) "lure", -- cgit v1.2.3 From 3491bf5b789f8fdc824e4aae346c7824550e841c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 10 Jun 2011 15:53:53 +0200 Subject: LURE: Switch to alternate AdvancedMetaEngine, avoid ADParams --- engines/lure/detection.cpp | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) (limited to 'engines/lure') diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 69bc7d551a..83ede92569 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -175,34 +175,14 @@ static const LureGameDescription gameDescriptions[] = { } // End of namespace Lure -static const ADParams detectionParams = { - // Pointer to ADGameDescription or its superset structure - (const byte *)Lure::gameDescriptions, - // Size of that superset structure - sizeof(Lure::LureGameDescription), - // Number of bytes to compute MD5 sum for - 1024, - // List of all engine gameid - lureGames, - // Structure for autoupgrading obsolete gameids - 0, - // Name of single gameid (optional) - "lure", - // List of files for file-based fallback detection (optional) - 0, - // Flags - kADFlagUseExtraAsHint, - // Additional GUI options (for every game} - Common::GUIO_NOSPEECH, - // Maximum directory depth - 1, - // List of directory globs - 0 -}; - class LureMetaEngine : public AdvancedMetaEngine { public: - LureMetaEngine() : AdvancedMetaEngine(detectionParams) {} + LureMetaEngine() : AdvancedMetaEngine(Lure::gameDescriptions, sizeof(Lure::LureGameDescription), lureGames) { + params.md5Bytes = 1024; + params.singleid = "lure"; + params.flags = kADFlagUseExtraAsHint; + params.guioptions = Common::GUIO_NOSPEECH; + } virtual const char *getName() const { return "Lure"; -- cgit v1.2.3 From 7c992d6598743fce09e6666f2c9a0f550ac5e870 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 11 Jun 2011 17:52:32 +0200 Subject: DETECTOR: Merge ADParams into AdvancedMetaEngine --- engines/lure/detection.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/lure') diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 83ede92569..397d965396 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -178,10 +178,10 @@ static const LureGameDescription gameDescriptions[] = { class LureMetaEngine : public AdvancedMetaEngine { public: LureMetaEngine() : AdvancedMetaEngine(Lure::gameDescriptions, sizeof(Lure::LureGameDescription), lureGames) { - params.md5Bytes = 1024; - params.singleid = "lure"; - params.flags = kADFlagUseExtraAsHint; - params.guioptions = Common::GUIO_NOSPEECH; + _md5Bytes = 1024; + _singleid = "lure"; + _flags = kADFlagUseExtraAsHint; + _guioptions = Common::GUIO_NOSPEECH; } virtual const char *getName() const { -- cgit v1.2.3 From 7e7748d69257d0cc24cfccd51c0d6b7d9213a986 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 14 Jun 2011 16:36:54 +0200 Subject: LURE: Add a comment explaining why kADFlagUseExtraAsHint is used For the records, this was introduced by Eugene in SVN revision 30106, corresponding to git commit b87b0f21 --- engines/lure/detection.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/lure') diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 397d965396..081625863d 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -180,6 +180,9 @@ public: LureMetaEngine() : AdvancedMetaEngine(Lure::gameDescriptions, sizeof(Lure::LureGameDescription), lureGames) { _md5Bytes = 1024; _singleid = "lure"; + + // Use kADFlagUseExtraAsHint to distinguish between EGA and VGA versions + // of italian Lure when their datafiles sit in the same directory. _flags = kADFlagUseExtraAsHint; _guioptions = Common::GUIO_NOSPEECH; } -- cgit v1.2.3 From 88913c0139ac6d1dfb356d3048702b7bc8ef4079 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 20 Jun 2011 00:59:48 +0200 Subject: ALL: Remove trailing whitespaces This tries to make our code a bit more compliant with our code formatting conventions. For future use, this is the command I used: git ls-files "*.cpp" "*.h" | xargs sed -i -e 's/[ \t]*$//' --- engines/lure/res_struct.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/lure') diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h index 49b6ef78ba..8d6c557297 100644 --- a/engines/lure/res_struct.h +++ b/engines/lure/res_struct.h @@ -470,7 +470,7 @@ public: bool isEmpty() const { return _actions.begin() == _actions.end(); } void clear() { _actions.clear(); } CurrentActionEntry &top() { return **_actions.begin(); } - CurrentActionEntry &bottom() { + CurrentActionEntry &bottom() { ActionsList::iterator i = _actions.end(); --i; return **i; -- cgit v1.2.3 From 2f200ac49322ff8ccd13c5e8b7a22abbf6ff2610 Mon Sep 17 00:00:00 2001 From: Julien Date: Sat, 4 Jun 2011 03:43:16 +0800 Subject: ANALYSIS: Fix potential memory leak when using realloc When reallocation is unsuccessful, the passed buffer is not freed. In this case, assigning the result (NULL) will result in a leak of the original memory buffer. See http://msdn.microsoft.com/en-us/library/kkedhy7c.aspx --- engines/lure/memory.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'engines/lure') diff --git a/engines/lure/memory.cpp b/engines/lure/memory.cpp index c5c28fa8bc..137a8f6bee 100644 --- a/engines/lure/memory.cpp +++ b/engines/lure/memory.cpp @@ -93,8 +93,12 @@ void MemoryBlock::copyFrom(const byte *src, uint32 srcPos, uint32 destPos, uint3 void MemoryBlock::reallocate(uint32 size1) { _size = size1; - _data = (byte *) realloc(_data, size1); - if (!_data) error ("Failed reallocating memory block"); + + byte *tmp = (byte *) realloc(_data, size1); + if (!tmp) + error ("[MemoryBlock::reallocate] Failed reallocating memory block"); + + _data = tmp; } } // End of namespace Lure -- cgit v1.2.3 From 9ff993382e17d1d7aef96105ad5fa2fe35043b7a Mon Sep 17 00:00:00 2001 From: Julien Date: Sun, 5 Jun 2011 06:03:54 +0800 Subject: LURE: Allocate debug strings buffer on the heap --- engines/lure/debugger.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'engines/lure') diff --git a/engines/lure/debugger.cpp b/engines/lure/debugger.cpp index 68410875f7..ef4a22f73a 100644 --- a/engines/lure/debugger.cpp +++ b/engines/lure/debugger.cpp @@ -549,14 +549,19 @@ bool Debugger::cmd_showAnim(int argc, const char **argv) { } bool Debugger::cmd_saveStrings(int argc, const char **argv) { - StringData &strings = StringData::getReference(); - char buffer[32768]; - if (argc != 2) { DebugPrintf("strings \n"); return true; } + StringData &strings = StringData::getReference(); + + char *buffer = (char *)malloc(32768); + if (!buffer) { + DebugPrintf("Cannot allocate strings buffer\n"); + return true; + } + uint16 id = strToInt(argv[1]); strings.getString(id, buffer, NULL, NULL); DebugPrintf("%s\n", buffer); @@ -577,6 +582,9 @@ bool Debugger::cmd_saveStrings(int argc, const char **argv) { DebugPrintf("Done\n"); */ + + free(buffer); + return true; } -- cgit v1.2.3