diff --git a/backends/graphics/atari/atari-graphics.cpp b/backends/graphics/atari/atari-graphics.cpp index df27441c77e..d58c2451e5b 100644 --- a/backends/graphics/atari/atari-graphics.cpp +++ b/backends/graphics/atari/atari-graphics.cpp @@ -43,7 +43,6 @@ #define SCREEN_ACTIVE -bool g_unalignedPitch = false; mspace g_mspace = nullptr; static const Graphics::PixelFormat PIXELFORMAT_CLUT8 = Graphics::PixelFormat::createFormatCLUT8(); @@ -473,7 +472,6 @@ OSystem::TransactionError AtariGraphicsManager::endGFXTransaction() { _pendingScreenChanges.queuePalette(); if (_overlayState == kOverlayIgnoredHide) { - _checkUnalignedPitch = true; _overlayState = kOverlayHidden; _ignoreHideOverlay = false; _pendingScreenChanges.queueAll(); @@ -602,36 +600,6 @@ void AtariGraphicsManager::updateScreen() { // avoid falling into the atari_debugger (screen may not not initialized yet) Common::setErrorHandler(nullptr); - if (_checkUnalignedPitch) { - const Common::ConfigManager::Domain *activeDomain = ConfMan.getActiveDomain(); - if (activeDomain) { - // FIXME: Some engines are too bound to linear surfaces that it is very - // hard to repair them. So instead of polluting the engine with - // Surface::init() & delete[] Surface::getPixels() just use this hack. - const Common::String engineId = activeDomain->getValOrDefault("engineid"); - const Common::String gameId = activeDomain->getValOrDefault("gameid"); - - atari_debug("checking %s/%s", engineId.c_str(), gameId.c_str()); - - if (engineId == "composer" - || engineId == "hypno" - || engineId == "mohawk" - || engineId == "parallaction" - || engineId == "private" - || (engineId == "sci" - && (gameId == "phantasmagoria" || gameId == "shivers")) - || engineId == "sherlock" - || engineId == "teenagent" - || engineId == "tsage") { - g_unalignedPitch = true; - } else { - g_unalignedPitch = false; - } - } - - _checkUnalignedPitch = false; - } - Screen *workScreen = nullptr; Graphics::Surface *srcSurface = nullptr; if (_overlayState == kOverlayVisible || _overlayState == kOverlayIgnoredHide) { diff --git a/backends/graphics/atari/atari-graphics.h b/backends/graphics/atari/atari-graphics.h index fd437228d3d..4eb9e261e4c 100644 --- a/backends/graphics/atari/atari-graphics.h +++ b/backends/graphics/atari/atari-graphics.h @@ -177,7 +177,6 @@ private: bool _vgaMonitor = true; bool _tt = false; - bool _checkUnalignedPitch = false; struct GraphicsState { GraphicsState() diff --git a/backends/platform/atari/osystem_atari.cpp b/backends/platform/atari/osystem_atari.cpp index 597001fab2d..9658910fd35 100644 --- a/backends/platform/atari/osystem_atari.cpp +++ b/backends/platform/atari/osystem_atari.cpp @@ -66,6 +66,8 @@ */ #include "backends/fs/posix/posix-fs-factory.h" +bool g_unalignedPitch = false; + extern "C" void atari_kbdvec(void *); extern "C" void atari_mousevec(void *); typedef void (*KBDVEC)(void *); @@ -347,6 +349,34 @@ void OSystem_Atari::initBackend() { BaseBackend::initBackend(); } +void OSystem_Atari::engineInit() { + const Common::ConfigManager::Domain *activeDomain = ConfMan.getActiveDomain(); + if (activeDomain) { + // FIXME: Some engines are too bound to linear surfaces that it is very + // hard to repair them. So instead of polluting the engine with + // Surface::init() & delete[] Surface::getPixels() just use this hack. + const Common::String engineId = activeDomain->getValOrDefault("engineid"); + const Common::String gameId = activeDomain->getValOrDefault("gameid"); + + atari_debug("checking %s/%s", engineId.c_str(), gameId.c_str()); + + if (engineId == "composer" + || engineId == "hypno" + || engineId == "mohawk" + || engineId == "parallaction" + || engineId == "private" + || (engineId == "sci" + && (gameId == "phantasmagoria" || gameId == "shivers")) + || engineId == "sherlock" + || engineId == "teenagent" + || engineId == "tsage") { + g_unalignedPitch = true; + } else { + g_unalignedPitch = false; + } + } +} + Common::MutexInternal *OSystem_Atari::createMutex() { return new NullMutexInternal(); } diff --git a/backends/platform/atari/osystem_atari.h b/backends/platform/atari/osystem_atari.h index 6f428a64859..a15cad924ff 100644 --- a/backends/platform/atari/osystem_atari.h +++ b/backends/platform/atari/osystem_atari.h @@ -31,6 +31,8 @@ public: void initBackend() override; + void engineInit() override; + Common::MutexInternal *createMutex() override; uint32 getMillis(bool skipRecord = false) override; void delayMillis(uint msecs) override; diff --git a/graphics/blit/blit-atari.cpp b/graphics/blit/blit-atari.cpp index 40753637820..02ba8a6fe88 100644 --- a/graphics/blit/blit-atari.cpp +++ b/graphics/blit/blit-atari.cpp @@ -84,8 +84,9 @@ void unlockSuperBlitter() { #endif } -// see atari-graphics.cpp +// see osystem-atari.cpp extern bool g_unalignedPitch; +// see atari-graphics.cpp extern mspace g_mspace; namespace Graphics {