diff options
Diffstat (limited to 'engines/tony/detection.cpp')
-rw-r--r-- | engines/tony/detection.cpp | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp index 1094950e2c..9bb768d1ed 100644 --- a/engines/tony/detection.cpp +++ b/engines/tony/detection.cpp @@ -8,17 +8,16 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * */ #include "base/plugins.h" @@ -154,26 +153,16 @@ void TonyMetaEngine::removeSaveState(const char *target, int slot) const { SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String saveName; byte difficulty; - byte thumbData[160 * 120 * 2]; - - if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slot, thumbData, saveName, difficulty)) { - // Convert the 565 thumbnail data to the needed overlay format - Common::MemoryReadStream thumbStream(thumbData, 160 * 120 * 2); - Graphics::PixelFormat destFormat = g_system->getOverlayFormat(); - Graphics::Surface *to = new Graphics::Surface(); - to->create(160, 120, destFormat); - - OverlayColor *pixels = (OverlayColor *)to->pixels; - for (int y = 0; y < to->h; ++y) { - for (int x = 0; x < to->w; ++x) { - uint8 r, g, b; - Graphics::colorToRGB<Graphics::ColorMasks<555> >(thumbStream.readUint16LE(), r, g, b); - - // converting to current OSystem Color - *pixels++ = destFormat.RGBToColor(r, g, b); - } - } + Graphics::Surface *to = new Graphics::Surface(); + to->create(160, 120, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); + + if (Tony::RMOptionScreen::loadThumbnailFromSaveState(slot, (byte *)to->getPixels(), saveName, difficulty)) { +#ifdef SCUMM_BIG_ENDIAN + uint16 *pixels = (uint16 *)to->getPixels(); + for (int i = 0; i < to->w * to->h; ++i) + pixels[i] = READ_LE_UINT16(pixels + i); +#endif // Create the return descriptor SaveStateDescriptor desc(slot, saveName); desc.setDeletableFlag(true); @@ -183,11 +172,12 @@ SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int s return desc; } + delete to; return SaveStateDescriptor(); } #if PLUGIN_ENABLED_DYNAMIC(TONY) -REGISTER_PLUGIN_DYNAMIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine); + REGISTER_PLUGIN_DYNAMIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine); #else -REGISTER_PLUGIN_STATIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine); + REGISTER_PLUGIN_STATIC(TONY, PLUGIN_TYPE_ENGINE, TonyMetaEngine); #endif |