From 0c82694f4782ad913b4d482f533f1e05f7219dc1 Mon Sep 17 00:00:00 2001 From: Neil Millstone Date: Sat, 20 Jan 2007 17:29:20 +0000 Subject: Ported changes from branch-0-9-0 to fix grabRawScreen(), and palette corruption. svn-id: r25129 --- backends/platform/ds/arm9/source/dsmain.cpp | 2 +- backends/platform/ds/arm9/source/osystem_ds.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'backends/platform/ds/arm9/source') diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index bb764bc75a..e0332f91b5 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -517,7 +517,7 @@ void displayMode8Bit() { BG0_Y0 = 0; // Restore palette entry used by text in the front-end - PALETTE_SUB[255] = savedPalEntry255; +// PALETTE_SUB[255] = savedPalEntry255; consoleInitDefault((u16*)SCREEN_BASE_BLOCK(0), (u16*)CHAR_BASE_BLOCK(1), 16); consolePrintSet(0, 23); diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 247b4e73de..70299ae5b2 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -471,7 +471,19 @@ Common::SaveFileManager* OSystem_DS::getSavefileManager() bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) { surf->create(DS::getGameWidth(), DS::getGameHeight(), 1); - memcpy(surf->pixels, DS::get8BitBackBuffer(), DS::getGameWidth() * DS::getGameHeight()); + + // 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) + u16* image = (u16 *) DS::get8BitBackBuffer(); + for (int y = 0; y < DS::getGameHeight(); y++) + { + DC_FlushRange((image + (y * 512)), DS::getGameWidth()); + for (int x = 0; x < DS::getGameWidth() >> 1; x++) + { + *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = *(image + y * 256 + x); + } + } + return true; } -- cgit v1.2.3