aboutsummaryrefslogtreecommitdiff
path: root/engines/tony
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tony')
-rw-r--r--engines/tony/detection.cpp29
-rw-r--r--engines/tony/game.cpp3
-rw-r--r--engines/tony/gfxcore.h4
-rw-r--r--engines/tony/mpal/mpal.cpp16
-rw-r--r--engines/tony/sound.cpp6
-rw-r--r--engines/tony/window.cpp8
6 files changed, 43 insertions, 23 deletions
diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp
index 1094950e2c..d355450153 100644
--- a/engines/tony/detection.cpp
+++ b/engines/tony/detection.cpp
@@ -154,26 +154,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,6 +173,7 @@ SaveStateDescriptor TonyMetaEngine::querySaveMetaInfos(const char *target, int s
return desc;
}
+ delete to;
return SaveStateDescriptor();
}
diff --git a/engines/tony/game.cpp b/engines/tony/game.cpp
index 501a588ff5..ca7c07ad8c 100644
--- a/engines/tony/game.cpp
+++ b/engines/tony/game.cpp
@@ -508,7 +508,8 @@ void RMOptionScreen::refreshThumbnails() {
_curThumb[i] = NULL;
_curThumbName[i].clear();
_curThumbDiff[i] = 11;
- }
+ } else
+ _curThumb[i]->prepareImage();
}
}
diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h
index 2548968e81..9e8f5225c0 100644
--- a/engines/tony/gfxcore.h
+++ b/engines/tony/gfxcore.h
@@ -208,8 +208,10 @@ public:
* 16-bit color source
*/
class RMGfxSourceBuffer16 : public RMGfxSourceBuffer {
-protected:
+public:
virtual void prepareImage();
+
+protected:
bool _bTrasp0;
public:
diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp
index fff8676a89..5e6d44f0a3 100644
--- a/engines/tony/mpal/mpal.cpp
+++ b/engines/tony/mpal/mpal.cpp
@@ -2035,7 +2035,13 @@ int mpalGetSaveStateSize() {
void mpalSaveState(byte *buf) {
lockVar();
WRITE_LE_UINT32(buf, GLOBALS._nVars);
- memcpy(buf + 4, (byte *)GLOBALS._lpmvVars, GLOBALS._nVars * sizeof(MpalVar));
+ buf += 4;
+ for (uint i = 0; i < GLOBALS._nVars; ++i) {
+ LpMpalVar var = &GLOBALS._lpmvVars[i];
+ WRITE_LE_UINT32(buf, var->_dwVal);
+ memcpy(buf + 4, var->_lpszVarName, sizeof(var->_lpszVarName));
+ buf += (4 + sizeof(var->_lpszVarName));
+ }
unlockVar();
}
@@ -2050,10 +2056,16 @@ int mpalLoadState(byte *buf) {
globalFree(GLOBALS._hVars);
GLOBALS._nVars = READ_LE_UINT32(buf);
+ buf += 4;
GLOBALS._hVars = globalAllocate(GMEM_ZEROINIT | GMEM_MOVEABLE, GLOBALS._nVars * sizeof(MpalVar));
lockVar();
- memcpy((byte *)GLOBALS._lpmvVars, buf + 4, GLOBALS._nVars * sizeof(MpalVar));
+ for (uint i = 0; i < GLOBALS._nVars; ++i) {
+ LpMpalVar var = &GLOBALS._lpmvVars[i];
+ var->_dwVal = READ_LE_UINT32(buf);
+ memcpy(var->_lpszVarName, buf + 4, sizeof(var->_lpszVarName));
+ buf += (4 + sizeof(var->_lpszVarName));
+ }
unlockVar();
return GLOBALS._nVars * sizeof(MpalVar) + 4;
diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp
index 90ae241db0..547f31906e 100644
--- a/engines/tony/sound.cpp
+++ b/engines/tony/sound.cpp
@@ -500,7 +500,13 @@ bool FPStream::loadFile(const Common::String &fileName, uint32 codec, int bufSiz
break;
case FPCODEC_ADPCM:
+#ifdef __amigaos4__
+ // HACK: AmigaOS 4 has weird performance problems with reading in the audio thread,
+ // so we read the whole stream into memory.
+ _rewindableStream = Audio::makeADPCMStream(_file.readStream(_size), DisposeAfterUse::YES, 0, Audio::kADPCMDVI, 44100, 2);
+#else
_rewindableStream = Audio::makeADPCMStream(&_file, DisposeAfterUse::NO, 0, Audio::kADPCMDVI, 44100, 2);
+#endif
break;
default:
diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp
index 61497a8066..a732862854 100644
--- a/engines/tony/window.cpp
+++ b/engines/tony/window.cpp
@@ -330,6 +330,14 @@ void RMSnapshot::grabScreenshot(byte *lpBuf, int dezoom, uint16 *lpDestBuf) {
src += RM_BBX * dezoom;
}
}
+
+#ifdef SCUMM_BIG_ENDIAN
+ if (lpDestBuf != NULL) {
+ for (int i = 0; i < dimx * dimy; i++) {
+ lpDestBuf[i] = SWAP_BYTES_16(lpDestBuf[i]);
+ }
+ }
+#endif
}
} // End of namespace Tony