aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ds/arm9
diff options
context:
space:
mode:
authorBertrand Augereau2007-06-15 09:04:08 +0000
committerBertrand Augereau2007-06-15 09:04:08 +0000
commit03d82560c76e6dc61b63afc1897bd239f1e8550f (patch)
tree941af14d107adfbf62608cff8f603dea83cab2dc /backends/platform/ds/arm9
parentf8b030991dc63ff39df3836029d0725f294de156 (diff)
downloadscummvm-rg350-03d82560c76e6dc61b63afc1897bd239f1e8550f.tar.gz
scummvm-rg350-03d82560c76e6dc61b63afc1897bd239f1e8550f.tar.bz2
scummvm-rg350-03d82560c76e6dc61b63afc1897bd239f1e8550f.zip
DS :
* grabRawScreen should work with the scaler enabled * the address given to DC_FlushRange in grabRawScreen was mixing a u16 base address and a u8 stride, skipping every odd line and buffer-overrunning (if I'm not mistaken :) ) svn-id: r27415
Diffstat (limited to 'backends/platform/ds/arm9')
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 9ff2c5ba63..35cf81ef4b 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -477,14 +477,17 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) {
surf->create(DS::getGameWidth(), DS::getGameHeight(), 1);
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
- // TODO: Change this to work with the software scalar (hint: video ram format is different)
+
+ size_t imageStrideInBytes = isCpuScalerEnabled() DS::getGameWidth() ? 512;
+ size_t imageStrideInWords = imageStrideInBytes / 2;
+
u16* image = (u16 *) DS::get8BitBackBuffer();
for (int y = 0; y < DS::getGameHeight(); y++)
{
- DC_FlushRange((image + (y * 512)), DS::getGameWidth());
+ DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth());
for (int x = 0; x < DS::getGameWidth() >> 1; x++)
{
- *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = *(image + y * 256 + x);
+ *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x];
}
}