[Scummvm-git-logs] scummvm master -> 0f85939bc5e57116a20bb3a276fb46599cafa4d1
mikrosk
noreply at scummvm.org
Thu Nov 21 10:32:34 UTC 2024
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
10665fb723 BACKENDS: ATARI: Use DISABLE_TEXT_CONSOLE for release builds
feef4e1bf1 BACKENDS: ATARI: Final screen resolution changes
0f85939bc5 BACKENDS: ATARI: Remove move16 code
Commit: 10665fb7236d8839f6754b316057c34cf6b11505
https://github.com/scummvm/scummvm/commit/10665fb7236d8839f6754b316057c34cf6b11505
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2024-11-21T11:31:25+01:00
Commit Message:
BACKENDS: ATARI: Use DISABLE_TEXT_CONSOLE for release builds
This shaves off a good 800 KB from all the engines. However, do keep
local atari debug messages for diagnostic purposes.
Also, use natfeats for debug output when possible else the classic
stdout/stderr (not both as before).
Changed paths:
A backends/platform/atari/atari-debug.cpp
A backends/platform/atari/atari-debug.h
backends/graphics/atari/atari-cursor.cpp
backends/graphics/atari/atari-graphics-supervidel.h
backends/graphics/atari/atari-graphics.cpp
backends/graphics/atari/atari-screen.cpp
backends/mixer/atari/atari-mixer.cpp
backends/platform/atari/module.mk
backends/platform/atari/native_features.cpp
backends/platform/atari/osystem_atari.cpp
configure
diff --git a/backends/graphics/atari/atari-cursor.cpp b/backends/graphics/atari/atari-cursor.cpp
index 1de6e72a504..b109a45fc75 100644
--- a/backends/graphics/atari/atari-cursor.cpp
+++ b/backends/graphics/atari/atari-cursor.cpp
@@ -187,7 +187,7 @@ bool Cursor::restoreBackground(const Graphics::Surface &srcSurface, bool force)
Graphics::Surface &dstSurface = *_parentScreen->offsettedSurf;
const int dstBitsPerPixel = _manager->getBitsPerPixel(dstSurface.format);
- //debug("Cursor::restoreBackground: %d %d %d %d", _savedRect.left, _savedRect.top, _savedRect.width(), _savedRect.height());
+ //atari_debug("Cursor::restoreBackground: %d %d %d %d", _savedRect.left, _savedRect.top, _savedRect.width(), _savedRect.height());
if (srcSurface.getPixels()) {
_manager->copyRectToSurface(
@@ -217,7 +217,7 @@ bool Cursor::draw(bool directRendering, bool force) {
Graphics::Surface &dstSurface = *_parentScreen->offsettedSurf;
const int dstBitsPerPixel = _manager->getBitsPerPixel(dstSurface.format);
- //debug("Cursor::draw: %d %d %d %d", _dstRect.left, _dstRect.top, _dstRect.width(), _dstRect.height());
+ //atari_debug("Cursor::draw: %d %d %d %d", _dstRect.left, _dstRect.top, _dstRect.width(), _dstRect.height());
// always work with aligned rect
_savedRect = _manager->alignRect(_dstRect);
diff --git a/backends/graphics/atari/atari-graphics-supervidel.h b/backends/graphics/atari/atari-graphics-supervidel.h
index 898473c0be2..8dc7affe37f 100644
--- a/backends/graphics/atari/atari-graphics-supervidel.h
+++ b/backends/graphics/atari/atari-graphics-supervidel.h
@@ -39,33 +39,33 @@ extern mspace g_mspace;
#endif
#include "backends/graphics/atari/atari-graphics-superblitter.h"
-#include "common/debug.h" // error() & warning()
+#include "backends/platform/atari/atari-debug.h"
#include "common/scummsys.h"
class AtariSuperVidelManager : public AtariGraphicsManager {
public:
AtariSuperVidelManager() {
#ifdef USE_SV_BLITTER
- debug("SuperVidel FW Revision: %d, using %s", superVidelFwVersion, superVidelFwVersion >= 9
+ atari_debug("SuperVidel FW Revision: %d, using %s", superVidelFwVersion, superVidelFwVersion >= 9
? "fast async FIFO" : "slower sync blitting");
#else
- debug("SuperVidel FW Revision: %d, SuperBlitter not used", superVidelFwVersion);
+ atari_debug("SuperVidel FW Revision: %d, SuperBlitter not used", superVidelFwVersion);
#endif
if (Supexec(hasSvRamBoosted))
- debug("SV_XBIOS has the pmmu boost enabled");
+ atari_debug("SV_XBIOS has the pmmu boost enabled");
else
- warning("SV_XBIOS has the pmmu boost disabled, set 'pmmu_boost = true' in C:\\SV.INF");
+ atari_warning("SV_XBIOS has the pmmu boost disabled, set 'pmmu_boost = true' in C:\\SV.INF");
#ifdef USE_SV_BLITTER
size_t vramSize = ct60_vmalloc(-1) - (16 * 1024 * 1024); // SV XBIOS seems to forget the initial 16 MB ST RAM mirror
_vramBase = vramSize > 0 ? (void *)ct60_vmalloc(vramSize) : nullptr;
if (_vramBase) {
g_mspace = create_mspace_with_base(_vramBase, vramSize, 0);
- debug("Allocated VRAM at %p (%ld bytes)", _vramBase, vramSize);
+ atari_debug("Allocated VRAM at %p (%ld bytes)", _vramBase, vramSize);
}
if (!g_mspace)
- warning("VRAM allocation failed");
+ atari_warning("VRAM allocation failed");
#endif
// using virtual methods so must be done here
allocateSurfaces();
diff --git a/backends/graphics/atari/atari-graphics.cpp b/backends/graphics/atari/atari-graphics.cpp
index 010bd38d70e..c1f104b612c 100644
--- a/backends/graphics/atari/atari-graphics.cpp
+++ b/backends/graphics/atari/atari-graphics.cpp
@@ -28,12 +28,12 @@
#include <mint/osbind.h>
#include <mint/sysvars.h>
+#include "backends/platform/atari/atari-debug.h"
#include "backends/platform/atari/dlmalloc.h"
#include "backends/keymapper/action.h"
#include "backends/keymapper/keymap.h"
#include "common/config-manager.h"
#include "common/str.h"
-#include "common/textconsole.h" // for warning() & error()
#include "common/translation.h"
#include "engines/engine.h"
#include "graphics/blit.h"
@@ -190,7 +190,7 @@ void AtariGraphicsShutdown() {
}
AtariGraphicsManager::AtariGraphicsManager() {
- debug("AtariGraphicsManager()");
+ atari_debug("AtariGraphicsManager()");
enum {
VDO_NO_ATARI_HW = 0xffff,
@@ -285,7 +285,7 @@ AtariGraphicsManager::AtariGraphicsManager() {
}
AtariGraphicsManager::~AtariGraphicsManager() {
- debug("~AtariGraphicsManager()");
+ atari_debug("~AtariGraphicsManager()");
g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this);
@@ -295,14 +295,14 @@ AtariGraphicsManager::~AtariGraphicsManager() {
bool AtariGraphicsManager::hasFeature(OSystem::Feature f) const {
switch (f) {
case OSystem::Feature::kFeatureAspectRatioCorrection:
- //debug("hasFeature(kFeatureAspectRatioCorrection): %d", !_tt);
+ //atari_debug("hasFeature(kFeatureAspectRatioCorrection): %d", !_tt);
return !_tt;
case OSystem::Feature::kFeatureCursorPalette:
// FIXME: pretend to have cursor palette at all times, this function
// can get (and it is) called any time, before and after showOverlay()
// (overlay cursor uses the cross if kFeatureCursorPalette returns false
// here too soon)
- //debug("hasFeature(kFeatureCursorPalette): %d", isOverlayVisible());
+ //atari_debug("hasFeature(kFeatureCursorPalette): %d", isOverlayVisible());
//return isOverlayVisible();
return true;
default:
@@ -320,7 +320,7 @@ void AtariGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
switch (f) {
case OSystem::Feature::kFeatureAspectRatioCorrection:
- //debug("setFeatureState(kFeatureAspectRatioCorrection): %d", enable);
+ //atari_debug("setFeatureState(kFeatureAspectRatioCorrection): %d", enable);
if (_aspectRatioCorrection != enable) {
_aspectRatioCorrection = enable;
_pendingScreenChange |= kPendingAspectRatioCorrection;
@@ -334,10 +334,10 @@ void AtariGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
bool AtariGraphicsManager::getFeatureState(OSystem::Feature f) const {
switch (f) {
case OSystem::Feature::kFeatureAspectRatioCorrection:
- //debug("getFeatureState(kFeatureAspectRatioCorrection): %d", _aspectRatioCorrection);
+ //atari_debug("getFeatureState(kFeatureAspectRatioCorrection): %d", _aspectRatioCorrection);
return _aspectRatioCorrection;
case OSystem::Feature::kFeatureCursorPalette:
- //debug("getFeatureState(kFeatureCursorPalette): %d", isOverlayVisible());
+ //atari_debug("getFeatureState(kFeatureCursorPalette): %d", isOverlayVisible());
//return isOverlayVisible();
return true;
default:
@@ -346,7 +346,7 @@ bool AtariGraphicsManager::getFeatureState(OSystem::Feature f) const {
}
bool AtariGraphicsManager::setGraphicsMode(int mode, uint flags) {
- debug("setGraphicsMode: %d, %d", mode, flags);
+ atari_debug("setGraphicsMode: %d, %d", mode, flags);
_pendingState.mode = (GraphicsMode)mode;
@@ -355,7 +355,7 @@ bool AtariGraphicsManager::setGraphicsMode(int mode, uint flags) {
}
void AtariGraphicsManager::initSize(uint width, uint height, const Graphics::PixelFormat *format) {
- debug("initSize: %d, %d, %d", width, height, format ? format->bytesPerPixel : 1);
+ atari_debug("initSize: %d, %d, %d", width, height, format ? format->bytesPerPixel : 1);
_pendingState.width = width;
_pendingState.height = height;
@@ -363,14 +363,14 @@ void AtariGraphicsManager::initSize(uint width, uint height, const Graphics::Pix
}
void AtariGraphicsManager::beginGFXTransaction() {
- debug("beginGFXTransaction");
+ atari_debug("beginGFXTransaction");
_pendingState = GraphicsState();
_pendingScreenChange &= ~kPendingTransaction;
}
OSystem::TransactionError AtariGraphicsManager::endGFXTransaction() {
- debug("endGFXTransaction");
+ atari_debug("endGFXTransaction");
int error = OSystem::TransactionError::kTransactionSuccess;
@@ -386,7 +386,7 @@ OSystem::TransactionError AtariGraphicsManager::endGFXTransaction() {
if (_pendingState.width > getMaximumScreenWidth() || _pendingState.height > getMaximumScreenHeight()) {
error |= OSystem::TransactionError::kTransactionSizeChangeFailed;
} else if (_pendingState.width % 16 != 0 && !hasSuperVidel()) {
- warning("Requested width not divisible by 16, please report");
+ atari_warning("Requested width not divisible by 16, please report");
error |= OSystem::TransactionError::kTransactionSizeChangeFailed;
} else if (_currentState.width != _pendingState.width || _currentState.height != _pendingState.height) {
_pendingScreenChange |= kPendingVideoMode;
@@ -398,7 +398,7 @@ OSystem::TransactionError AtariGraphicsManager::endGFXTransaction() {
error |= OSystem::TransactionError::kTransactionFormatNotSupported;
if (error != OSystem::TransactionError::kTransactionSuccess) {
- warning("endGFXTransaction failed: %02x", (int)error);
+ atari_warning("endGFXTransaction failed: %02x", (int)error);
_pendingScreenChange &= ~kPendingTransaction;
return static_cast<OSystem::TransactionError>(error);
}
@@ -447,7 +447,7 @@ OSystem::TransactionError AtariGraphicsManager::endGFXTransaction() {
}
void AtariGraphicsManager::setPalette(const byte *colors, uint start, uint num) {
- //debug("setPalette: %d, %d", start, num);
+ //atari_debug("setPalette: %d, %d", start, num);
if (_tt) {
uint16 *pal = &_palette.tt[start];
@@ -471,7 +471,7 @@ void AtariGraphicsManager::setPalette(const byte *colors, uint start, uint num)
}
void AtariGraphicsManager::grabPalette(byte *colors, uint start, uint num) const {
- //debug("grabPalette: %d, %d", start, num);
+ //atari_debug("grabPalette: %d, %d", start, num);
if (_tt) {
const uint16 *pal = &_palette.tt[start];
@@ -493,7 +493,7 @@ void AtariGraphicsManager::grabPalette(byte *colors, uint start, uint num) const
}
void AtariGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
- //debug("copyRectToScreen: %d, %d, %d(%d), %d", x, y, w, pitch, h);
+ //atari_debug("copyRectToScreen: %d, %d, %d(%d), %d", x, y, w, pitch, h);
copyRectToScreenInternal(buf, pitch, x, y, w, h,
PIXELFORMAT_CLUT8,
@@ -504,7 +504,7 @@ void AtariGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, i
// this is not really locking anything but it's an useful function
// to return current rendering surface :)
Graphics::Surface *AtariGraphicsManager::lockScreen() {
- //debug("lockScreen");
+ //atari_debug("lockScreen");
if (isOverlayVisible() && !isOverlayDirectRendering())
return &_overlaySurface;
@@ -515,7 +515,7 @@ Graphics::Surface *AtariGraphicsManager::lockScreen() {
}
void AtariGraphicsManager::unlockScreen() {
- //debug("unlockScreen: %d x %d", _workScreen->surf.w, _workScreen->surf.h);
+ //atari_debug("unlockScreen: %d x %d", _workScreen->surf.w, _workScreen->surf.h);
const Graphics::Surface &dstSurface = *lockScreen();
@@ -530,7 +530,7 @@ void AtariGraphicsManager::unlockScreen() {
}
void AtariGraphicsManager::fillScreen(uint32 col) {
- //debug("fillScreen: %d", col);
+ //atari_debug("fillScreen: %d", col);
Graphics::Surface *screen = lockScreen();
@@ -540,7 +540,7 @@ void AtariGraphicsManager::fillScreen(uint32 col) {
}
void AtariGraphicsManager::fillScreen(const Common::Rect &r, uint32 col) {
- //debug("fillScreen: %dx%d %d", r.width(), r.height(), col);
+ //atari_debug("fillScreen: %dx%d %d", r.width(), r.height(), col);
Graphics::Surface *screen = lockScreen();
@@ -556,9 +556,9 @@ void AtariGraphicsManager::fillScreen(const Common::Rect &r, uint32 col) {
}
void AtariGraphicsManager::updateScreen() {
- //debug("updateScreen");
+ //atari_debug("updateScreen");
- // avoid falling into the debugger (screen may not not initialized yet)
+ // avoid falling into the atari_debugger (screen may not not initialized yet)
Common::setErrorHandler(nullptr);
if (_checkUnalignedPitch) {
@@ -570,7 +570,7 @@ void AtariGraphicsManager::updateScreen() {
const Common::String engineId = activeDomain->getValOrDefault("engineid");
const Common::String gameId = activeDomain->getValOrDefault("gameid");
- debug("checking %s/%s", engineId.c_str(), gameId.c_str());
+ atari_debug("checking %s/%s", engineId.c_str(), gameId.c_str());
if (engineId == "composer"
|| engineId == "hypno"
@@ -616,7 +616,7 @@ void AtariGraphicsManager::updateScreen() {
screenUpdated = updateScreenInternal(_chunkySurface);
break;
default:
- warning("Unknown graphics mode %d", (int)_currentState.mode);
+ atari_warning("Unknown graphics mode %d", (int)_currentState.mode);
}
}
@@ -665,7 +665,7 @@ void AtariGraphicsManager::updateScreen() {
const int oldPendingScreenChange = _pendingScreenChange;
const bool oldAspectRatioCorrection = _aspectRatioCorrection;
if (_overlayPending) {
- debug("Forcing overlay pending state");
+ atari_debug("Forcing overlay pending state");
_aspectRatioCorrection = false;
_pendingScreenChange = kPendingAll;
}
@@ -734,7 +734,7 @@ void AtariGraphicsManager::updateScreen() {
doSuperVidelReset = false;
}
- debug("VsetMode: %04x", _workScreen->mode);
+ atari_debug("VsetMode: %04x", _workScreen->mode);
VsetMode(_workScreen->mode);
}
@@ -784,11 +784,11 @@ void AtariGraphicsManager::updateScreen() {
_overlayPending = false;
}
- //debug("end of updateScreen");
+ //atari_debug("end of updateScreen");
}
void AtariGraphicsManager::setShakePos(int shakeXOffset, int shakeYOffset) {
- //debug("setShakePos: %d, %d", shakeXOffset, shakeYOffset);
+ //atari_debug("setShakePos: %d, %d", shakeXOffset, shakeYOffset);
if (_tt) {
// as TT can't horizontally shake anything, do it at least vertically
@@ -802,7 +802,7 @@ void AtariGraphicsManager::setShakePos(int shakeXOffset, int shakeYOffset) {
}
void AtariGraphicsManager::showOverlay(bool inGUI) {
- debug("showOverlay (visible: %d)", _overlayVisible);
+ atari_debug("showOverlay (visible: %d)", _overlayVisible);
if (_overlayVisible)
return;
@@ -825,7 +825,7 @@ void AtariGraphicsManager::showOverlay(bool inGUI) {
}
void AtariGraphicsManager::hideOverlay() {
- debug("hideOverlay (ignore: %d, visible: %d)", _ignoreHideOverlay, _overlayVisible);
+ atari_debug("hideOverlay (ignore: %d, visible: %d)", _ignoreHideOverlay, _overlayVisible);
if (!_overlayVisible)
return;
@@ -859,7 +859,7 @@ void AtariGraphicsManager::clearOverlay() {
if (isOverlayDirectRendering())
return;
- debug("clearOverlay");
+ atari_debug("clearOverlay");
if (!_overlayVisible)
return;
@@ -937,7 +937,7 @@ void AtariGraphicsManager::clearOverlay() {
}
void AtariGraphicsManager::grabOverlay(Graphics::Surface &surface) const {
- debug("grabOverlay: %d(%d), %d", surface.w, surface.pitch, surface.h);
+ atari_debug("grabOverlay: %d(%d), %d", surface.w, surface.pitch, surface.h);
if (isOverlayDirectRendering()) {
memset(surface.getPixels(), 0, surface.h * surface.pitch);
@@ -954,7 +954,7 @@ void AtariGraphicsManager::grabOverlay(Graphics::Surface &surface) const {
}
void AtariGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
- //debug("copyRectToOverlay: %d, %d, %d(%d), %d", x, y, w, pitch, h);
+ //atari_debug("copyRectToOverlay: %d, %d, %d(%d), %d", x, y, w, pitch, h);
copyRectToScreenInternal(buf, pitch, x, y, w, h,
getOverlayFormat(),
@@ -963,7 +963,7 @@ void AtariGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x,
}
bool AtariGraphicsManager::showMouse(bool visible) {
- //debug("showMouse: %d", visible);
+ //atari_debug("showMouse: %d", visible);
bool last = _workScreen->cursor.setVisible(visible);
@@ -979,7 +979,7 @@ bool AtariGraphicsManager::showMouse(bool visible) {
}
void AtariGraphicsManager::warpMouse(int x, int y) {
- //debug("warpMouse: %d, %d", x, y);
+ //atari_debug("warpMouse: %d, %d", x, y);
_workScreen->cursor.setPosition(x, y);
@@ -991,10 +991,10 @@ void AtariGraphicsManager::warpMouse(int x, int y) {
void AtariGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor,
bool dontScale, const Graphics::PixelFormat *format, const byte *mask) {
- //debug("setMouseCursor: %d, %d, %d, %d, %d, %d", w, h, hotspotX, hotspotY, keycolor, format ? format->bytesPerPixel : 1);
+ //atari_debug("setMouseCursor: %d, %d, %d, %d, %d, %d", w, h, hotspotX, hotspotY, keycolor, format ? format->bytesPerPixel : 1);
if (mask)
- warning("AtariGraphicsManager::setMouseCursor: Masks are not supported");
+ atari_warning("AtariGraphicsManager::setMouseCursor: Masks are not supported");
if (format)
assert(*format == PIXELFORMAT_CLUT8);
@@ -1008,7 +1008,7 @@ void AtariGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int h
}
void AtariGraphicsManager::setCursorPalette(const byte *colors, uint start, uint num) {
- debug("setCursorPalette: %d, %d", start, num);
+ atari_debug("setCursorPalette: %d, %d", start, num);
if (isOverlayVisible()) {
// cursor palette is supported only in the overlay
@@ -1101,7 +1101,7 @@ void AtariGraphicsManager::freeSurfaces() {
}
bool AtariGraphicsManager::updateScreenInternal(const Graphics::Surface &srcSurface) {
- //debug("updateScreenInternal");
+ //atari_debug("updateScreenInternal");
const Screen::DirtyRects &dirtyRects = _workScreen->dirtyRects;
Graphics::Surface *dstSurface = _workScreen->offsettedSurf;
diff --git a/backends/graphics/atari/atari-screen.cpp b/backends/graphics/atari/atari-screen.cpp
index a5e8ca713bc..6c6521cd167 100644
--- a/backends/graphics/atari/atari-screen.cpp
+++ b/backends/graphics/atari/atari-screen.cpp
@@ -140,7 +140,7 @@ void Screen::addDirtyRect(const Graphics::Surface &srcSurface, const Common::Rec
if ((rect.width() == srcSurface.w && rect.height() == srcSurface.h)
|| dirtyRects.size() == 128) { // 320x200 can hold at most 250 16x16 rectangles
- //debug("addDirtyRect[%d]: purge %d x %d", (int)dirtyRects.size(), srcSurface.w, srcSurface.h);
+ //atari_debug("addDirtyRect[%d]: purge %d x %d", (int)dirtyRects.size(), srcSurface.w, srcSurface.h);
dirtyRects.clear();
dirtyRects.emplace(srcSurface.w, srcSurface.h);
diff --git a/backends/mixer/atari/atari-mixer.cpp b/backends/mixer/atari/atari-mixer.cpp
index e7eae85fd91..d7bc2c63f61 100644
--- a/backends/mixer/atari/atari-mixer.cpp
+++ b/backends/mixer/atari/atari-mixer.cpp
@@ -27,8 +27,8 @@
#include <mint/ostruct.h>
#include <usound.h> // https://github.com/mikrosk/usound
+#include "backends/platform/atari/atari-debug.h"
#include "common/config-manager.h"
-#include "common/debug.h"
#define DEFAULT_OUTPUT_RATE 24585
#define DEFAULT_OUTPUT_CHANNELS 2
@@ -54,7 +54,7 @@ static void __attribute__((interrupt)) timerA(void)
}
AtariMixerManager::AtariMixerManager() : MixerManager() {
- debug("AtariMixerManager()");
+ atari_debug("AtariMixerManager()");
suspendAudio();
@@ -77,7 +77,7 @@ AtariMixerManager::AtariMixerManager() : MixerManager() {
}
AtariMixerManager::~AtariMixerManager() {
- debug("~AtariMixerManager()");
+ atari_debug("~AtariMixerManager()");
g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this);
@@ -119,9 +119,9 @@ void AtariMixerManager::init() {
ConfMan.setInt("output_channels", _outputChannels);
ConfMan.setInt("audio_buffer_size", _samples);
- debug("setting %d Hz mixing frequency (%d-bit, %s)",
+ atari_debug("setting %d Hz mixing frequency (%d-bit, %s)",
_outputRate, obtained.format == AudioFormatSigned8 ? 8 : 16, _outputChannels == 1 ? "mono" : "stereo");
- debug("sample buffer size: %d", _samples);
+ atari_debug("sample buffer size: %d", _samples);
ConfMan.flushToDisk();
@@ -145,7 +145,7 @@ void AtariMixerManager::init() {
}
void AtariMixerManager::suspendAudio() {
- debug("suspendAudio");
+ atari_debug("suspendAudio");
Buffoper(0x00);
muted = true;
@@ -153,7 +153,7 @@ void AtariMixerManager::suspendAudio() {
}
int AtariMixerManager::resumeAudio() {
- debug("resumeAudio");
+ atari_debug("resumeAudio");
_audioSuspended = false;
update();
@@ -167,7 +167,7 @@ bool AtariMixerManager::notifyEvent(const Common::Event &event) {
if (!muted) {
Buffoper(0x00);
muted = true;
- debug("silencing the mixer");
+ atari_debug("silencing the mixer");
}
return false;
default:
@@ -248,6 +248,6 @@ void AtariMixerManager::update() {
}
if (processed > 0 && processed != _samples) {
- warning("processed: %d, _samples: %d", processed, _samples);
+ atari_warning("processed: %d, _samples: %d", processed, _samples);
}
}
diff --git a/backends/platform/atari/atari-debug.cpp b/backends/platform/atari/atari-debug.cpp
new file mode 100644
index 00000000000..e5a95041773
--- /dev/null
+++ b/backends/platform/atari/atari-debug.cpp
@@ -0,0 +1,40 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "backends/platform/atari/atari-debug.h"
+
+#ifdef DISABLE_TEXT_CONSOLE
+
+void atari_debug(const char *s, ...) {
+ va_list va;
+
+ va_start(va, s);
+
+ Common::String buf = Common::String::vformat(s, va);
+ buf += '\n';
+
+ if (g_system)
+ g_system->logMessage(LogMessageType::kDebug, buf.c_str());
+
+ va_end(va);
+}
+
+#endif
diff --git a/backends/platform/atari/atari-debug.h b/backends/platform/atari/atari-debug.h
new file mode 100644
index 00000000000..6132449d4d0
--- /dev/null
+++ b/backends/platform/atari/atari-debug.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef PLATFORM_ATARI_DEBUG_H
+#define PLATFORM_ATARI_DEBUG_H
+
+#include "common/debug.h"
+#include "common/str.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+
+#ifdef DISABLE_TEXT_CONSOLE
+
+void atari_debug(const char *s, ...);
+#define atari_warning atari_debug
+
+#else
+
+#define atari_debug debug
+#define atari_warning warning
+
+#endif
+
+#endif
diff --git a/backends/platform/atari/module.mk b/backends/platform/atari/module.mk
index 015ae50f7eb..033fca681ee 100644
--- a/backends/platform/atari/module.mk
+++ b/backends/platform/atari/module.mk
@@ -2,6 +2,7 @@ MODULE := backends/platform/atari
MODULE_OBJS := \
osystem_atari.o \
+ atari-debug.o \
atari_ikbd.o \
native_features.o \
dlmalloc.o
diff --git a/backends/platform/atari/native_features.cpp b/backends/platform/atari/native_features.cpp
index 9763ec8ceae..c0ea04017e1 100644
--- a/backends/platform/atari/native_features.cpp
+++ b/backends/platform/atari/native_features.cpp
@@ -82,7 +82,7 @@ static long _nf_detect_tos(void) {
return ret;
}
-static long nf_stderr_id;
+long nf_stderr_id;
void nf_init(void) {
long ret = Supexec(_nf_detect_tos);
diff --git a/backends/platform/atari/osystem_atari.cpp b/backends/platform/atari/osystem_atari.cpp
index 3617b1b3f2f..4827d1df3cd 100644
--- a/backends/platform/atari/osystem_atari.cpp
+++ b/backends/platform/atari/osystem_atari.cpp
@@ -54,10 +54,10 @@
#include "backends/keymapper/hardware-input.h"
#include "backends/mixer/atari/atari-mixer.h"
#include "backends/mutex/null/null-mutex.h"
+#include "backends/platform/atari/atari-debug.h"
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
#include "base/main.h"
-#include "gui/debugger.h"
#define INPUT_ACTIVE
@@ -221,7 +221,7 @@ OSystem_Atari::OSystem_Atari() {
}
OSystem_Atari::~OSystem_Atari() {
- debug("OSystem_Atari::~OSystem_Atari()");
+ atari_debug("OSystem_Atari::~OSystem_Atari()");
// _audiocdManager needs to be deleted before _mixerManager to avoid a crash.
delete _audiocdManager;
@@ -364,7 +364,7 @@ void OSystem_Atari::delayMillis(uint msecs) {
}
void OSystem_Atari::getTimeAndDate(TimeDate &td, bool skipRecord) const {
- //debug("getTimeAndDate");
+ //atari_debug("getTimeAndDate");
time_t curTime = time(0);
struct tm t = *localtime(&curTime);
td.tm_sec = t.tm_sec;
@@ -394,26 +394,30 @@ Common::HardwareInputSet *OSystem_Atari::getHardwareInputSet() {
}
void OSystem_Atari::quit() {
- debug("OSystem_Atari::quit()");
+ atari_debug("OSystem_Atari::quit()");
g_system->destroy();
}
void OSystem_Atari::logMessage(LogMessageType::Type type, const char *message) {
- FILE *output = 0;
-
- if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
- output = stdout;
- else
- output = stderr;
+ extern long nf_stderr_id;
static char str[1024+1];
snprintf(str, sizeof(str), "[%08d] %s", getMillis(), message);
- fputs(str, output);
- fflush(output);
+ if (nf_stderr_id) {
+ nf_print(str);
+ } else {
+ FILE *output = 0;
- nf_print(str);
+ if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
+ output = stdout;
+ else
+ output = stderr;
+
+ fputs(str, output);
+ fflush(output);
+ }
}
void OSystem_Atari::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
@@ -471,7 +475,7 @@ void OSystem_Atari::update() {
} else if (checkGameDomain) {
const Common::ConfigManager::Domain *activeDomain = ConfMan.getActiveDomain();
if (activeDomain) {
- warning("%s/%s calls update() from timer",
+ atari_warning("%s/%s calls update() from timer",
activeDomain->getValOrDefault("engineid").c_str(),
activeDomain->getValOrDefault("gameid").c_str());
diff --git a/configure b/configure
index 5392ed472c3..86a37688816 100755
--- a/configure
+++ b/configure
@@ -3662,7 +3662,7 @@ if test -n "$_host"; then
if test "$_release_build" = "yes"; then
# --enable-release
append_var DEFINES "-DNDEBUG"
- #append_var DEFINES "-DDISABLE_TEXT_CONSOLE"
+ append_var DEFINES "-DDISABLE_TEXT_CONSOLE"
fi
append_var LDFLAGS "-Wl,--msuper-memory"
Commit: feef4e1bf1690224ff498de37620a1c2b99e2a57
https://github.com/scummvm/scummvm/commit/feef4e1bf1690224ff498de37620a1c2b99e2a57
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2024-11-21T11:31:25+01:00
Commit Message:
BACKENDS: ATARI: Final screen resolution changes
- seamless resolution/palette switching (at least in theory, it still
isn't artifact-free, no clue why)
- bugfixes (shake offset, some s_screenSurf corner cases)
- simplification the triple-buffering code
Changed paths:
A backends/graphics/atari/atari-pendingscreenchanges.cpp
A backends/graphics/atari/atari-pendingscreenchanges.h
backends/graphics/atari/atari-graphics.cpp
backends/graphics/atari/atari-graphics.h
backends/module.mk
diff --git a/backends/graphics/atari/atari-graphics.cpp b/backends/graphics/atari/atari-graphics.cpp
index c1f104b612c..491898a2492 100644
--- a/backends/graphics/atari/atari-graphics.cpp
+++ b/backends/graphics/atari/atari-graphics.cpp
@@ -50,13 +50,11 @@ static const Graphics::PixelFormat PIXELFORMAT_CLUT8 = Graphics::PixelFormat::cr
static const Graphics::PixelFormat PIXELFORMAT_RGB332 = Graphics::PixelFormat(1, 3, 3, 2, 0, 5, 2, 0, 0);
static const Graphics::PixelFormat PIXELFORMAT_RGB121 = Graphics::PixelFormat(1, 1, 2, 1, 0, 3, 1, 0, 0);
-static bool s_shrinkVidelVisibleArea;
-
static void shrinkVidelVisibleArea() {
// Active VGA screen area consists of 960 half-lines, i.e. 480 raster lines.
// In case of 320x240, the number is still 480 but data is fetched
// only for 240 lines so it doesn't make a difference to us.
-
+#ifdef SCREEN_ACTIVE
if (hasSuperVidel()) {
const int vOffset = ((480 - 400) / 2) * 2; // *2 because of half-lines
@@ -77,33 +75,42 @@ static void shrinkVidelVisibleArea() {
*((volatile int16*)0xFFFF82A2) = 889;
*((volatile int16*)0xFFFF82AC) = 889 + vss;
}
+#endif
}
static bool s_tt;
static int s_shakeXOffset;
static int s_shakeYOffset;
static int s_aspectRatioCorrectionYOffset;
+static bool s_shrinkVidelVisibleArea;
+static bool s_setScreenOffsets;
static Graphics::Surface *s_screenSurf;
static void VblHandler() {
- if (s_screenSurf) {
+ // for easier querying
+ static Graphics::Surface *surf;
+
+ if (s_screenSurf)
+ surf = s_screenSurf;
+
+ if (s_screenSurf || s_setScreenOffsets) {
#ifdef SCREEN_ACTIVE
- uintptr p = (uintptr)s_screenSurf->getBasePtr(0, MAX_V_SHAKE + s_shakeYOffset + s_aspectRatioCorrectionYOffset);
+ uintptr p = (unsigned long)surf->getBasePtr(0, MAX_V_SHAKE + s_shakeYOffset + s_aspectRatioCorrectionYOffset);
if (!s_tt) {
- const int bitsPerPixel = (s_screenSurf->format == PIXELFORMAT_RGB121 ? 4 : 8);
+ const int bitsPerPixel = (surf->format == PIXELFORMAT_RGB121 ? 4 : 8);
- s_shakeXOffset = -s_shakeXOffset;
+ int shakeXOffset = -s_shakeXOffset;
- if (s_shakeXOffset >= 0) {
+ if (shakeXOffset >= 0) {
p += MAX_HZ_SHAKE;
- *((volatile char *)0xFFFF8265) = s_shakeXOffset;
+ *((volatile char *)0xFFFF8265) = shakeXOffset;
} else {
- *((volatile char *)0xFFFF8265) = MAX_HZ_SHAKE + s_shakeXOffset;
+ *((volatile char *)0xFFFF8265) = MAX_HZ_SHAKE + shakeXOffset;
}
// subtract 4 or 8 words if scrolling
- *((volatile short *)0xFFFF820E) = s_shakeXOffset == 0
+ *((volatile short *)0xFFFF820E) = shakeXOffset == 0
? (2 * MAX_HZ_SHAKE * bitsPerPixel / 8) / 2
: (2 * MAX_HZ_SHAKE * bitsPerPixel / 8) / 2 - bitsPerPixel;
}
@@ -116,10 +123,12 @@ static void VblHandler() {
*((volatile byte *)0xFFFF820D) = sptr.c[3];
#endif
s_screenSurf = nullptr;
+ s_setScreenOffsets = false;
}
if (s_shrinkVidelVisibleArea) {
- shrinkVidelVisibleArea();
+ if (!s_tt)
+ shrinkVidelVisibleArea();
s_shrinkVidelVisibleArea = false;
}
}
@@ -189,7 +198,8 @@ void AtariGraphicsShutdown() {
}
}
-AtariGraphicsManager::AtariGraphicsManager() {
+AtariGraphicsManager::AtariGraphicsManager()
+ : _pendingScreenChanges(this) {
atari_debug("AtariGraphicsManager()");
enum {
@@ -316,14 +326,20 @@ void AtariGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
if (!hasFeature(f))
return;
- // flags must be set to _currentState and _pendingScreenChange here
-
+ // flags must be set to _pendingScreenChanges here
+
switch (f) {
case OSystem::Feature::kFeatureAspectRatioCorrection:
//atari_debug("setFeatureState(kFeatureAspectRatioCorrection): %d", enable);
if (_aspectRatioCorrection != enable) {
_aspectRatioCorrection = enable;
- _pendingScreenChange |= kPendingAspectRatioCorrection;
+
+ if (!_overlayVisible) {
+ _pendingScreenChanges.queueAspectRatioCorrection();
+
+ if (!_pendingState.inTransaction)
+ updateScreen();
+ }
}
break;
default:
@@ -350,6 +366,9 @@ bool AtariGraphicsManager::setGraphicsMode(int mode, uint flags) {
_pendingState.mode = (GraphicsMode)mode;
+ if (!_pendingState.inTransaction)
+ return endGFXTransaction() == OSystem::kTransactionSuccess;
+
// this doesn't seem to be checked anywhere
return true;
}
@@ -360,25 +379,32 @@ void AtariGraphicsManager::initSize(uint width, uint height, const Graphics::Pix
_pendingState.width = width;
_pendingState.height = height;
_pendingState.format = format ? *format : PIXELFORMAT_CLUT8;
+
+ if (!_pendingState.inTransaction)
+ endGFXTransaction();
}
void AtariGraphicsManager::beginGFXTransaction() {
atari_debug("beginGFXTransaction");
_pendingState = GraphicsState();
- _pendingScreenChange &= ~kPendingTransaction;
+ _pendingState.inTransaction = true;
+ _pendingScreenChanges.clearTransaction();
}
OSystem::TransactionError AtariGraphicsManager::endGFXTransaction() {
atari_debug("endGFXTransaction");
+ _pendingState.inTransaction = false;
+
int error = OSystem::TransactionError::kTransactionSuccess;
+ bool hasPendingGraphicsMode = false; // no need to have a global flag
if (_pendingState.mode != GraphicsMode::Unknown) {
if (_pendingState.mode < GraphicsMode::DirectRendering || _pendingState.mode > GraphicsMode::TripleBuffering) {
error |= OSystem::TransactionError::kTransactionModeSwitchFailed;
} else if (_currentState.mode != _pendingState.mode) {
- _pendingScreenChange |= kPendingScreenAddress;
+ hasPendingGraphicsMode = true;
}
}
@@ -388,8 +414,8 @@ OSystem::TransactionError AtariGraphicsManager::endGFXTransaction() {
} else if (_pendingState.width % 16 != 0 && !hasSuperVidel()) {
atari_warning("Requested width not divisible by 16, please report");
error |= OSystem::TransactionError::kTransactionSizeChangeFailed;
- } else if (_currentState.width != _pendingState.width || _currentState.height != _pendingState.height) {
- _pendingScreenChange |= kPendingVideoMode;
+ } else if (_overlayVisible || _currentState.width != _pendingState.width || _currentState.height != _pendingState.height) {
+ _pendingScreenChanges.queueVideoMode();
}
}
@@ -399,35 +425,35 @@ OSystem::TransactionError AtariGraphicsManager::endGFXTransaction() {
if (error != OSystem::TransactionError::kTransactionSuccess) {
atari_warning("endGFXTransaction failed: %02x", (int)error);
- _pendingScreenChange &= ~kPendingTransaction;
+ _pendingScreenChanges.clearTransaction();
return static_cast<OSystem::TransactionError>(error);
}
- if (_pendingScreenChange & kPendingScreenAddress)
+ if (hasPendingGraphicsMode)
_currentState.mode = _pendingState.mode;
- if ((_pendingScreenChange & kPendingVideoMode)
- || (_overlayVisible && _pendingState.width > 0 && _pendingState.height > 0 && _pendingState.format == PIXELFORMAT_CLUT8)) {
+ if (_pendingScreenChanges.videoMode()) {
_currentState.width = _pendingState.width;
_currentState.height = _pendingState.height;
_currentState.format = _pendingState.format;
if (_overlayVisible) {
- // that's it, really. updateScreen() will take care of everything.
_checkUnalignedPitch = true;
_ignoreHideOverlay = false;
_overlayVisible = false;
// if being in the overlay, reset everything (same as hideOverlay() does)
- _pendingScreenChange |= kPendingAll;
+ // s_screenSurf will be set below
+ _pendingScreenChanges.queueAll();
}
} else if (_overlayVisible) {
// don't exit overlay unless there is real video mode to be set
_ignoreHideOverlay = true;
- _pendingScreenChange &= ~kPendingTransaction;
+ _pendingState = GraphicsState();
+ _pendingScreenChanges.clearTransaction();
return OSystem::kTransactionSuccess;
}
- if (_pendingScreenChange & (kPendingScreenAddress | kPendingVideoMode)) {
+ if (_pendingScreenChanges.videoMode() || hasPendingGraphicsMode) {
_chunkySurface.init(_currentState.width, _currentState.height, _currentState.width,
_chunkySurface.getPixels(), _currentState.format);
@@ -435,11 +461,14 @@ OSystem::TransactionError AtariGraphicsManager::endGFXTransaction() {
_screen[BACK_BUFFER1]->reset(_currentState.width, _currentState.height, 8, true);
_screen[BACK_BUFFER2]->reset(_currentState.width, _currentState.height, 8, true);
_workScreen = _screen[_currentState.mode <= GraphicsMode::SingleBuffering ? FRONT_BUFFER : BACK_BUFFER1];
+ _pendingScreenChanges.setScreenSurface(&_screen[FRONT_BUFFER]->surf);
_palette.clear();
- _pendingScreenChange |= kPendingPalette;
+ _pendingScreenChanges.queuePalette();
}
+ _pendingState = GraphicsState();
+
// apply new screen changes
updateScreen();
@@ -467,7 +496,7 @@ void AtariGraphicsManager::setPalette(const byte *colors, uint start, uint num)
}
}
- _pendingScreenChange |= kPendingPalette;
+ _pendingScreenChanges.queuePalette();
}
void AtariGraphicsManager::grabPalette(byte *colors, uint start, uint num) const {
@@ -622,29 +651,34 @@ void AtariGraphicsManager::updateScreen() {
_workScreen->clearDirtyRects();
+ if (_overlayPending) {
+ atari_debug("Forcing overlay pending state");
+ // must be done here because first updateScreen() is not called from showOverlay()
+ _pendingScreenChanges.queueAll();
+ _overlayPending = false;
+ }
+
+#ifdef SCREEN_ACTIVE
+ // this assume that the screen surface is not going to be used yet
+ _pendingScreenChanges.applyBeforeVblLock();
+#endif
+
+ set_sysvar_to_short(vblsem, 0); // lock vbl
+
if (screenUpdated
&& !isOverlayVisible()
&& _currentState.mode == GraphicsMode::TripleBuffering) {
// Triple buffer:
// - alternate BACK_BUFFER1 and BACK_BUFFER2
- // - check if FRONT_BUFFER has been displayed for at least one frame
- // - display the most recent buffer (BACK_BUFFER2 in our case)
- // - alternate BACK_BUFFER2 and FRONT_BUFFER (only if BACK_BUFFER2
- // has been updated)
-
- set_sysvar_to_short(vblsem, 0); // lock vbl
+ // - present BACK_BUFFER1 (as BACK_BUFFER2)
+ // - check if BACK_BUFFER2 has been displayed, if so, switch
+ // BACK_BUFFER2 and FRONT_BUFFER and make previous BACK_BUFFER2 work screen
- static long old_vbclock = get_sysvar(_vbclock);
- long curr_vbclock = get_sysvar(_vbclock);
-
- if (old_vbclock != curr_vbclock) {
- // at least one vbl has passed since setting new video base
- // guard BACK_BUFFER2 from overwriting while presented
+ if (s_screenSurf == nullptr) {
+ // BACK_BUFFER2 has been set; guard it from overwriting while presented
Screen *tmp = _screen[BACK_BUFFER2];
_screen[BACK_BUFFER2] = _screen[FRONT_BUFFER];
_screen[FRONT_BUFFER] = tmp;
-
- old_vbclock = curr_vbclock;
}
// swap back buffers
@@ -653,136 +687,27 @@ void AtariGraphicsManager::updateScreen() {
_screen[BACK_BUFFER2] = tmp;
// queue BACK_BUFFER2 with the most recent frame content
- s_screenSurf = &_screen[BACK_BUFFER2]->surf;
-
- set_sysvar_to_short(vblsem, 1); // unlock vbl
-
+ _pendingScreenChanges.setScreenSurface(&_screen[BACK_BUFFER2]->surf);
_workScreen = _screen[BACK_BUFFER1];
- // BACK_BUFFER2: now contains finished frame
- // FRONT_BUFFER is displayed and still contains previously finished frame
- }
-
- const int oldPendingScreenChange = _pendingScreenChange;
- const bool oldAspectRatioCorrection = _aspectRatioCorrection;
- if (_overlayPending) {
- atari_debug("Forcing overlay pending state");
- _aspectRatioCorrection = false;
- _pendingScreenChange = kPendingAll;
- }
-
- bool doShrinkVidelVisibleArea = false;
- bool doSuperVidelReset = false;
- if (_pendingScreenChange & kPendingAspectRatioCorrection) {
- assert(_workScreen->mode != -1);
-
- if (_aspectRatioCorrection && _currentState.height == 200 && !isOverlayVisible()) {
- // apply machine-specific aspect ratio correction
- if (!_vgaMonitor) {
- _workScreen->mode &= ~PAL;
- // 60 Hz
- _workScreen->mode |= NTSC;
- _pendingScreenChange |= kPendingVideoMode;
- } else {
- Screen *screen = _screen[FRONT_BUFFER];
- s_aspectRatioCorrectionYOffset = (screen->surf.h - 2*MAX_V_SHAKE - screen->offsettedSurf->h) / 2;
- _pendingScreenChange |= kPendingShakeScreen;
-
- if (_pendingScreenChange & kPendingVideoMode)
- doShrinkVidelVisibleArea = true;
- else
- s_shrinkVidelVisibleArea = true;
- }
- } else {
- // reset back to default mode
- if (!_vgaMonitor) {
- _workScreen->mode &= ~NTSC;
- // 50 Hz
- _workScreen->mode |= PAL;
- _pendingScreenChange |= kPendingVideoMode;
- } else {
- s_aspectRatioCorrectionYOffset = 0;
- s_shrinkVidelVisibleArea = false;
-
- if (hasSuperVidel())
- doSuperVidelReset = true;
- _pendingScreenChange |= kPendingVideoMode;
- }
- }
-
- _pendingScreenChange &= ~kPendingAspectRatioCorrection;
}
#ifdef SCREEN_ACTIVE
- if (_pendingScreenChange & kPendingVideoMode) {
- if (_workScreen->rez != -1) {
- // unfortunately this reinitializes VDI, too
- Setscreen(SCR_NOCHANGE, SCR_NOCHANGE, _workScreen->rez);
-
- // strictly speaking, this is necessary only if kScreenAddress is set but makes code easier
- static uint16 black[256];
- // Vsync(); // done by Setscreen() above
- EsetPalette(0, isOverlayVisible() ? 16 : 256, black);
- } else if (_workScreen->mode != -1) {
- // VsetMode() must be called first: it resets all hz/v, scrolling and line width registers
- // so even if kScreenAddress wasn't scheduled, we have to set new s_screenSurf to refresh them
- static _RGB black[256];
- VsetRGB(0, 256, black);
- // Vsync(); // done by (either) VsetMode() below
-
- if (doSuperVidelReset) {
- VsetMode(SVEXT | SVEXT_BASERES(0) | COL80 | BPS8C); // resync to proper 640x480
- doSuperVidelReset = false;
- }
-
- atari_debug("VsetMode: %04x", _workScreen->mode);
- VsetMode(_workScreen->mode);
- }
-
- // due to implied Vsync() above
- assert(s_screenSurf == nullptr);
-
- // refresh Videl register settings
- s_screenSurf = isOverlayVisible() ? &_screen[OVERLAY_BUFFER]->surf : &_screen[FRONT_BUFFER]->surf;
- s_shrinkVidelVisibleArea = doShrinkVidelVisibleArea;
-
- // keep kVideoMode for resetting the palette later
- _pendingScreenChange &= ~(kPendingScreenAddress | kPendingShakeScreen);
- }
-
- if (_pendingScreenChange & kPendingScreenAddress) {
- // takes effect in the nearest VBL interrupt but we always wait for Vsync() in this case
- Vsync();
- assert(s_screenSurf == nullptr);
-
- s_screenSurf = isOverlayVisible() ? &_screen[OVERLAY_BUFFER]->surf : &_screen[FRONT_BUFFER]->surf;
- _pendingScreenChange &= ~kPendingScreenAddress;
- }
+ _pendingScreenChanges.applyAfterVblLock();
+#endif
- if (_pendingScreenChange & kPendingShakeScreen) {
- // takes effect in the nearest VBL interrupt
- if (!s_screenSurf)
- s_screenSurf = isOverlayVisible() ? &_screen[OVERLAY_BUFFER]->surf : &_screen[FRONT_BUFFER]->surf;
- _pendingScreenChange &= ~kPendingShakeScreen;
+ if (_pendingScreenChanges.screenSurface()) {
+ s_screenSurf = _pendingScreenChanges.screenSurface();
+ _pendingScreenChanges.setScreenSurface(nullptr);
}
- if (_pendingScreenChange & (kPendingVideoMode | kPendingPalette)) {
- if (!_tt) {
- // takes effect in the nearest VBL interrupt
- VsetRGB(0, isOverlayVisible() ? getOverlayPaletteSize() : 256, _workScreen->palette->falcon);
- } else {
- // takes effect immediatelly (it's possible that Vsync() hasn't been called: that's expected,
- // don't cripple framerate only for a palette change)
- EsetPalette(0, isOverlayVisible() ? getOverlayPaletteSize() : 256, _workScreen->palette->tt);
- }
- _pendingScreenChange &= ~(kPendingVideoMode | kPendingPalette);
- }
-#endif
+ if (_pendingScreenChanges.aspectRatioCorrectionYOffset().second)
+ s_aspectRatioCorrectionYOffset = _pendingScreenChanges.aspectRatioCorrectionYOffset().first;
+ if (_pendingScreenChanges.screenOffsets().second)
+ s_setScreenOffsets = _pendingScreenChanges.screenOffsets().first;
+ if (_pendingScreenChanges.shrinkVidelVisibleArea().second)
+ s_shrinkVidelVisibleArea = _pendingScreenChanges.shrinkVidelVisibleArea().first;
- if (_overlayPending) {
- _aspectRatioCorrection = oldAspectRatioCorrection;
- _pendingScreenChange = oldPendingScreenChange;
- _overlayPending = false;
- }
+ set_sysvar_to_short(vblsem, 1); // unlock vbl
//atari_debug("end of updateScreen");
}
@@ -798,7 +723,7 @@ void AtariGraphicsManager::setShakePos(int shakeXOffset, int shakeYOffset) {
s_shakeYOffset = shakeYOffset;
}
- _pendingScreenChange |= kPendingShakeScreen;
+ _pendingScreenChanges.queueShakeScreen();
}
void AtariGraphicsManager::showOverlay(bool inGUI) {
@@ -813,13 +738,17 @@ void AtariGraphicsManager::showOverlay(bool inGUI) {
_oldWorkScreen = _workScreen;
_workScreen = _screen[OVERLAY_BUFFER];
+ _pendingScreenChanges.setScreenSurface(&_workScreen->surf);
// do not cache dirtyRects and oldCursorRect
_workScreen->reset(getOverlayWidth(), getOverlayHeight(), getBitsPerPixel(getOverlayFormat()), false);
_overlayVisible = true;
- assert(_pendingScreenChange == kPendingNone);
+ if (!_pendingScreenChanges.empty()) {
+ warning("showOverlay: _pendingScreenChanges is %02x", _pendingScreenChanges.get());
+ }
+ //_pendingScreenChanges.queueAll(); // must be called in updateScreen() ...
_overlayPending = true;
updateScreen();
}
@@ -837,13 +766,18 @@ void AtariGraphicsManager::hideOverlay() {
return;
}
+ // BACK_BUFFER2 is intentional: regardless of the state before calling showOverlay(),
+ // this always contains the next desired frame buffer to show
+ _pendingScreenChanges.setScreenSurface(&_screen[_currentState.mode == GraphicsMode::TripleBuffering ? BACK_BUFFER2 : FRONT_BUFFER]->surf);
_workScreen = _oldWorkScreen;
_oldWorkScreen = nullptr;
_overlayVisible = false;
- assert(_pendingScreenChange == kPendingNone);
- _pendingScreenChange = kPendingAll;
+ if (!_pendingScreenChanges.empty()) {
+ warning("hideOverlay: _pendingScreenChanges is %02x", _pendingScreenChanges.get());
+ }
+ _pendingScreenChanges.queueAll();
updateScreen();
}
@@ -1046,9 +980,12 @@ bool AtariGraphicsManager::notifyEvent(const Common::Event &event) {
case kActionToggleAspectRatioCorrection:
if (hasFeature(OSystem::Feature::kFeatureAspectRatioCorrection)) {
_aspectRatioCorrection = !_aspectRatioCorrection;
- _pendingScreenChange |= kPendingAspectRatioCorrection;
- updateScreen();
+ if (!_overlayVisible) {
+ _pendingScreenChanges.queueAspectRatioCorrection();
+
+ updateScreen();
+ }
return true;
}
break;
@@ -1084,6 +1021,7 @@ void AtariGraphicsManager::allocateSurfaces() {
// overlay is the default screen upon start
_workScreen = _screen[OVERLAY_BUFFER] = new Screen(this, getOverlayWidth(), getOverlayHeight(), getOverlayFormat(), &_overlayPalette);
_workScreen->reset(getOverlayWidth(), getOverlayHeight(), getBitsPerPixel(getOverlayFormat()), true);
+ _pendingScreenChanges.setScreenSurface(&_workScreen->surf);
_chunkySurface.create(getMaximumScreenWidth(), getMaximumScreenHeight(), PIXELFORMAT_CLUT8);
_overlaySurface.create(getOverlayWidth(), getOverlayHeight(), getOverlayFormat());
diff --git a/backends/graphics/atari/atari-graphics.h b/backends/graphics/atari/atari-graphics.h
index 8fc77943337..0a8a843d5b3 100644
--- a/backends/graphics/atari/atari-graphics.h
+++ b/backends/graphics/atari/atari-graphics.h
@@ -31,6 +31,7 @@
#include "graphics/surface.h"
#include "atari-cursor.h"
+#include "atari-pendingscreenchanges.h"
#include "atari-screen.h"
#define MAX_HZ_SHAKE 16 // Falcon only
@@ -38,6 +39,7 @@
class AtariGraphicsManager : public GraphicsManager, Common::EventObserver {
friend class Cursor;
+ friend class PendingScreenChanges;
friend class Screen;
public:
@@ -178,12 +180,14 @@ private:
struct GraphicsState {
GraphicsState()
- : mode(GraphicsMode::Unknown)
+ : inTransaction(false)
+ , mode(GraphicsMode::Unknown)
, width(0)
, height(0)
, format(Graphics::PixelFormat()) {
}
+ bool inTransaction;
GraphicsMode mode;
int width;
int height;
@@ -195,17 +199,7 @@ private:
// feature flags
bool _aspectRatioCorrection = false;
- enum PendingScreenChange {
- kPendingNone = 0,
- kPendingVideoMode = 1<<0,
- kPendingScreenAddress = 1<<1,
- kPendingAspectRatioCorrection = 1<<2,
- kPendingPalette = 1<<3,
- kPendingShakeScreen = 1<<4,
- kPendingTransaction = kPendingVideoMode | kPendingScreenAddress | kPendingAspectRatioCorrection,
- kPendingAll = kPendingTransaction | kPendingPalette | kPendingShakeScreen
- };
- int _pendingScreenChange = kPendingNone;
+ PendingScreenChanges _pendingScreenChanges;
enum {
FRONT_BUFFER,
diff --git a/backends/graphics/atari/atari-pendingscreenchanges.cpp b/backends/graphics/atari/atari-pendingscreenchanges.cpp
new file mode 100644
index 00000000000..e0e05c093da
--- /dev/null
+++ b/backends/graphics/atari/atari-pendingscreenchanges.cpp
@@ -0,0 +1,158 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "atari-pendingscreenchanges.h"
+
+#include <cassert>
+#include <mint/falcon.h>
+
+#include "backends/platform/atari/atari-debug.h"
+#include "graphics/surface.h"
+
+#include "atari-graphics.h"
+#include "atari-graphics-superblitter.h"
+
+void PendingScreenChanges::queueAll() {
+ _changes |= kAll;
+
+ if (_manager->_tt)
+ _changes &= ~kAspectRatioCorrection;
+}
+
+/*
+ * VsetRGB() - stores the palette in a buffer and applyBeforeVblLock in nearest VBL
+ * EsetPalette() - immediatelly applies the palette
+ * (V)SetScreen() - immediatelly sets physbase/logbase but explicitly calls Vsync() for resolution changes
+ * VsetMode() - explicitly calls Vsync()
+ */
+
+void PendingScreenChanges::applyBeforeVblLock() {
+ _resetSuperVidel = false;
+ _switchToBlackPalette = (_changes & kVideoMode);
+
+ _aspectRatioCorrectionYOffset.second = false;
+ _setScreenOffsets.second = false;
+ _shrinkVidelVisibleArea.second = false;
+
+ if (_changes & kAspectRatioCorrection) {
+ processAspectRatioCorrection();
+ _changes &= ~kAspectRatioCorrection;
+ }
+
+ _switchToBlackPalette |= _resetSuperVidel;
+
+ if (_changes & kVideoMode) {
+ processVideoMode();
+ // don't reset kVideoMode yet
+ }
+}
+
+void PendingScreenChanges::applyAfterVblLock() {
+ // VBL doesn't process new palette nor screen address updates
+
+ if (_changes & kShakeScreen) {
+ _setScreenOffsets = std::make_pair(true, true);
+ _changes &= ~kShakeScreen;
+ }
+
+ // restore current (kVideoMode) or set new (kPalette) palette
+ if (_changes & (kVideoMode | kPalette)) {
+ if (_switchToBlackPalette || (_changes & kPalette)) {
+ if (_manager->_tt) {
+ if (_changes & kPalette)
+ Vsync();
+ EsetPalette(0, _manager->isOverlayVisible() ? _manager->getOverlayPaletteSize() : 256, _manager->_workScreen->palette->tt);
+ } else {
+ VsetRGB(0, _manager->isOverlayVisible() ? _manager->getOverlayPaletteSize() : 256, _manager->_workScreen->palette->falcon);
+ if (_changes & kPalette)
+ Vsync();
+ }
+ }
+
+ _changes &= ~(kVideoMode | kPalette);
+ }
+
+ assert(_changes == kNone);
+}
+
+void PendingScreenChanges::processAspectRatioCorrection() {
+ assert(!_manager->_tt);
+
+ if (_manager->_aspectRatioCorrection && _manager->_currentState.height == 200 && !_manager->isOverlayVisible()) {
+ // apply machine-specific aspect ratio correction
+ if (!_manager->_vgaMonitor) {
+ _manager->_workScreen->mode &= ~PAL;
+ // 60 Hz
+ _manager->_workScreen->mode |= NTSC;
+ _changes |= kVideoMode;
+ } else {
+ _aspectRatioCorrectionYOffset =
+ std::make_pair((_manager->_workScreen->surf.h - 2*MAX_V_SHAKE - _manager->_workScreen->offsettedSurf->h) / 2, true);
+ _shrinkVidelVisibleArea = std::make_pair(true, true);
+ }
+ } else {
+ // reset back to default mode
+ if (!_manager->_vgaMonitor) {
+ _manager->_workScreen->mode &= ~NTSC;
+ // 50 Hz
+ _manager->_workScreen->mode |= PAL;
+ _changes |= kVideoMode;
+ } else {
+ _aspectRatioCorrectionYOffset = std::make_pair(0, true);
+ _shrinkVidelVisibleArea = std::make_pair(false, true);
+
+ if (hasSuperVidel())
+ _resetSuperVidel = true;
+
+ // kPendingVideoMode will reset the shrunken Videl area
+ _changes |= kVideoMode;
+ }
+ }
+
+ // for VsetMode() and/or _aspectRatioCorrectionYOffset
+ _setScreenOffsets = std::make_pair(true, true);
+}
+
+void PendingScreenChanges::processVideoMode() {
+ // changing video mode implies an additional Vsync(): there's no way to change resolution
+ // and set new screen address (and/or shake offsets etc) in one go
+ if (_manager->_workScreen->rez != -1) {
+ if (_switchToBlackPalette) {
+ static uint16 black[256];
+ EsetPalette(0, _manager->isOverlayVisible() ? _manager->getOverlayPaletteSize() : 256, black);
+ }
+
+ // unfortunately this reinitializes VDI, too
+ Setscreen(SCR_NOCHANGE, SCR_NOCHANGE, _manager->_workScreen->rez);
+ } else if (_manager->_workScreen->mode != -1) {
+ if (_switchToBlackPalette) {
+ static _RGB black[256];
+ VsetRGB(0, _manager->isOverlayVisible() ? _manager->getOverlayPaletteSize() : 256, black);
+ }
+
+ // VsetMode() must be called first: it resets all hz/v, scrolling and line width registers
+ if (_resetSuperVidel)
+ VsetMode(SVEXT | SVEXT_BASERES(0) | COL80 | BPS8C); // resync to proper 640x480
+
+ atari_debug("VsetMode: %04x", _manager->_workScreen->mode);
+ VsetMode(_manager->_workScreen->mode);
+ }
+}
diff --git a/backends/graphics/atari/atari-pendingscreenchanges.h b/backends/graphics/atari/atari-pendingscreenchanges.h
new file mode 100644
index 00000000000..227814a28e3
--- /dev/null
+++ b/backends/graphics/atari/atari-pendingscreenchanges.h
@@ -0,0 +1,116 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef BACKENDS_GRAPHICS_ATARI_PENDINGSCREENCHANGES_H
+#define BACKENDS_GRAPHICS_ATARI_PENDINGSCREENCHANGES_H
+
+#include <utility>
+
+class AtariGraphicsManager;
+namespace Graphics {
+class Surface;
+}
+
+class PendingScreenChanges {
+public:
+ PendingScreenChanges(AtariGraphicsManager *manager)
+ : _manager(manager) {
+ }
+
+ void clearTransaction() {
+ _changes &= ~kTransaction;
+ }
+
+ void setScreenSurface(Graphics::Surface *surface) {
+ _surface = surface;
+ }
+
+ void queueVideoMode() {
+ _changes |= kVideoMode;
+ }
+ void queueAspectRatioCorrection() {
+ _changes |= kAspectRatioCorrection;
+ }
+ void queuePalette() {
+ _changes |= kPalette;
+ }
+ void queueShakeScreen() {
+ _changes |= kShakeScreen;
+ }
+ void queueAll();
+
+ int get() const {
+ return _changes;
+ }
+
+ bool videoMode() const {
+ return _changes & kVideoMode;
+ }
+ bool empty() const {
+ return _changes == kNone;
+ }
+
+ Graphics::Surface *screenSurface() const {
+ return _surface;
+ }
+ const std::pair<int, bool>& aspectRatioCorrectionYOffset() const {
+ return _aspectRatioCorrectionYOffset;
+ }
+ const std::pair<bool, bool>& screenOffsets() const {
+ return _setScreenOffsets;
+ }
+ const std::pair<bool, bool>& shrinkVidelVisibleArea() const {
+ return _shrinkVidelVisibleArea;
+ }
+
+ void applyBeforeVblLock();
+ void applyAfterVblLock();
+
+private:
+ void processAspectRatioCorrection();
+ void processVideoMode();
+
+ enum Change {
+ kNone = 0,
+ kVideoMode = 1<<0,
+ kAspectRatioCorrection = 1<<1,
+ kPalette = 1<<2,
+ kShakeScreen = 1<<3,
+ kTransaction = kVideoMode | kAspectRatioCorrection,
+ kAll = kTransaction | kPalette | kShakeScreen
+ };
+ int _changes = kNone;
+
+ AtariGraphicsManager *_manager;
+
+ Graphics::Surface *_surface = nullptr;
+
+ bool _resetSuperVidel;
+ bool _switchToBlackPalette;
+
+ // <value, set> ... std::optional would be so much better!
+ std::pair<int, bool> _aspectRatioCorrectionYOffset;
+ std::pair<bool, bool> _setScreenOffsets;
+ std::pair<bool, bool> _shrinkVidelVisibleArea;
+
+};
+
+#endif // ATARI-PENDINGSCREENCHANGES_H
diff --git a/backends/module.mk b/backends/module.mk
index 8be83686573..8f0a51138f4 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -370,6 +370,7 @@ MODULE_OBJS += \
graphics/atari/atari-cursor.o \
graphics/atari/atari-graphics.o \
graphics/atari/atari-graphics-asm.o \
+ graphics/atari/atari-pendingscreenchanges.o \
graphics/atari/atari-screen.o \
mixer/atari/atari-mixer.o
endif
Commit: 0f85939bc5e57116a20bb3a276fb46599cafa4d1
https://github.com/scummvm/scummvm/commit/0f85939bc5e57116a20bb3a276fb46599cafa4d1
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2024-11-21T11:31:25+01:00
Commit Message:
BACKENDS: ATARI: Remove move16 code
There's no evidence of that code being faster than the already optimized
memcpy().
Changed paths:
backends/platform/atari/build-release.sh
graphics/blit/blit-atari.cpp
diff --git a/backends/platform/atari/build-release.sh b/backends/platform/atari/build-release.sh
index 2cb132152e7..2e0861852a0 100755
--- a/backends/platform/atari/build-release.sh
+++ b/backends/platform/atari/build-release.sh
@@ -10,7 +10,7 @@ PLATFORM=m68k-atari-mintelf
FASTCALL=false
export ASFLAGS="-m68020-60"
-export CXXFLAGS="-m68020-60 -DUSE_MOVE16 -DUSE_SUPERVIDEL -DUSE_SV_BLITTER"
+export CXXFLAGS="-m68020-60 -DUSE_SUPERVIDEL -DUSE_SV_BLITTER"
export LDFLAGS="-m68020-60"
export PKG_CONFIG_LIBDIR="$(${PLATFORM}-gcc -print-sysroot)/usr/lib/m68020-60/pkgconfig"
diff --git a/graphics/blit/blit-atari.cpp b/graphics/blit/blit-atari.cpp
index 2b7b392a75c..40753637820 100644
--- a/graphics/blit/blit-atari.cpp
+++ b/graphics/blit/blit-atari.cpp
@@ -66,14 +66,6 @@ static void syncSuperBlitter() {
}
#endif
-#ifdef USE_MOVE16
-static inline bool hasMove16() {
- long val;
- static bool hasMove16 = Getcookie(C__CPU, &val) == C_FOUND && val >= 40;
- return hasMove16;
-}
-#endif
-
void lockSuperBlitter() {
#ifdef USE_SV_BLITTER
assert(!isSuperBlitterLocked);
@@ -189,152 +181,12 @@ void copyBlit(byte *dst, const byte *src,
} else
#endif
if (dstPitch == srcPitch && dstPitch == (w * bytesPerPixel)) {
-#ifdef USE_MOVE16
- if (hasMove16() && ((uintptr)src & (ALIGN - 1)) == 0 && ((uintptr)dst & (ALIGN - 1)) == 0) {
- __asm__ volatile(
- " move.l %2,%%d0\n"
- " lsr.l #4,%%d0\n"
- " beq.b 3f\n"
-
- " moveq #0x0f,%%d1\n"
- " and.l %%d0,%%d1\n"
- " neg.l %%d1\n"
- " lsr.l #4,%%d0\n"
- " jmp (2f,%%pc,%%d1.l*4)\n"
- "1:\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- "2:\n"
- " dbra %%d0,1b\n"
- // handle also the unlikely case when 'dstPitch'
- // is not divisible by 16 but 'src' and 'dst' are
- "3:\n"
- " moveq #0x0f,%%d0\n"
- " and.l %2,%%d0\n"
- " neg.l %%d0\n"
- " jmp (4f,%%pc,%%d0.l*2)\n"
- // only 15x move.b as 16 would be handled above
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- "4:\n"
- : // outputs
- : "a"(src), "a"(dst), "g"(dstPitch * h) // inputs
- : "d0", "d1", "cc" AND_MEMORY
- );
- } else {
-#else
- {
-#endif
- memcpy(dst, src, dstPitch * h);
- }
+ memcpy(dst, src, dstPitch * h);
} else {
-#ifdef USE_MOVE16
- if (hasMove16() && ((uintptr)src & (ALIGN - 1)) == 0 && ((uintptr)dst & (ALIGN - 1)) == 0
- && (srcPitch & (ALIGN - 1)) == 0 && (dstPitch & (ALIGN - 1)) == 0) {
- __asm__ volatile(
- " move.l %2,%%d0\n"
-
- " moveq #0x0f,%%d1\n"
- " and.l %%d0,%%d1\n"
- " neg.l %%d1\n"
- " lea (4f,%%pc,%%d1.l*2),%%a0\n"
- " move.l %%a0,%%a1\n"
-
- " lsr.l #4,%%d0\n"
- " beq.b 3f\n"
-
- " moveq #0x0f,%%d1\n"
- " and.l %%d0,%%d1\n"
- " neg.l %%d1\n"
- " lea (2f,%%pc,%%d1.l*4),%%a0\n"
- " lsr.l #4,%%d0\n"
- " move.l %%d0,%%d1\n"
- "0:\n"
- " move.l %%d1,%%d0\n"
- " jmp (%%a0)\n"
- "1:\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- " move16 (%0)+,(%1)+\n"
- "2:\n"
- " dbra %%d0,1b\n"
- // handle (w * bytesPerPixel) % 16
- "3:\n"
- " jmp (%%a1)\n"
- // only 15x move.b as 16 would be handled above
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- " move.b (%0)+,(%1)+\n"
- "4:\n"
- " add.l %4,%1\n"
- " add.l %5,%0\n"
- " dbra %3,0b\n"
- : // outputs
- : "a"(src), "a"(dst), "g"(w * bytesPerPixel), "d"(h - 1),
- "g"(dstPitch - w * bytesPerPixel), "g"(srcPitch - w * bytesPerPixel) // inputs
- : "d0", "d1", "a0", "a1", "cc" AND_MEMORY
- );
- } else {
-#else
- {
-#endif
- for (uint i = 0; i < h; ++i) {
- memcpy(dst, src, w * bytesPerPixel);
- dst += dstPitch;
- src += srcPitch;
- }
+ for (uint i = 0; i < h; ++i) {
+ memcpy(dst, src, w * bytesPerPixel);
+ dst += dstPitch;
+ src += srcPitch;
}
}
}
More information about the Scummvm-git-logs
mailing list