diff options
-rw-r--r-- | backends/platform/ds/arm9/source/dsmain.cpp | 55 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.cpp | 13 |
2 files changed, 17 insertions, 51 deletions
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp index 45f0a16deb..860aa41828 100644 --- a/backends/platform/ds/arm9/source/dsmain.cpp +++ b/backends/platform/ds/arm9/source/dsmain.cpp @@ -333,49 +333,25 @@ void initSprites() { void saveGameBackBuffer() { #ifdef DISABLE_SCUMM if (savedBuffer == NULL) savedBuffer = new u8[gameWidth * gameHeight]; - if(isCpuScalerEnabled()) - { - memcpy(savedBuffer, get8BitBackBuffer(), gameWidth * gameHeight); - } - else - { - for (int r = 0; r < gameHeight; r++) { - memcpy(savedBuffer + (r * gameWidth), ((u8 *) (get8BitBackBuffer())) + (r * 512), gameWidth); - } - } + for (int r = 0; r < gameHeight; r++) { + memcpy(savedBuffer + (r * gameWidth), ((u8 *) (get8BitBackBuffer())) + (r * 512), gameWidth); #endif } void restoreGameBackBuffer() { #ifdef DISABLE_SCUMM if (savedBuffer) { - if(isCpuScalerEnabled()) - { - memcpy(get8BitBackBuffer(), savedBuffer, gameWidth * gameHeight); - // TODO Synchronize with framebuffer if necessary - } - else - { - for (int r = 0; r < gameHeight; r++) { - memcpy(((u8 *) (BG_GFX_SUB)) + (r * 512), savedBuffer + (r * gameWidth), gameWidth); - memcpy(((u8 *) (get8BitBackBuffer())) + (r * 512), savedBuffer + (r * gameWidth), gameWidth); - } - } + for (int r = 0; r < gameHeight; r++) { + memcpy(((u8 *) (BG_GFX_SUB)) + (r * 512), savedBuffer + (r * gameWidth), gameWidth); + memcpy(((u8 *) (get8BitBackBuffer())) + (r * 512), savedBuffer + (r * gameWidth), gameWidth); + } delete savedBuffer; savedBuffer = NULL; } #else - if(isCpuScalerEnabled()) - { - memset(get8BitBackBuffer(), 0, 320 * 200); - // TODO Synchronize with framebuffer if necessary - } - else - { - memset(get8BitBackBuffer(), 0, 512 * 256); - memset(BG_GFX_SUB, 0, 512 * 256); - } + memset(get8BitBackBuffer(), 0, 512 * 256); + memset(BG_GFX_SUB, 0, 512 * 256); if (Scumm::g_scumm) { Scumm::g_scumm->markRectAsDirty(Scumm::kMainVirtScreen, 0, gameWidth - 1, 0, gameHeight - 1, 1); Scumm::g_scumm->markRectAsDirty(Scumm::kTextVirtScreen, 0, gameWidth - 1, 0, gameHeight - 1, 1); @@ -1019,18 +995,9 @@ void setKeyboardEnable(bool en) { // the same. u16* buffer = get8BitBackBuffer(); - if(isCpuScalerEnabled()) - { - for (int y = 0; y < gameHeight; ++y) - for (int x = 0; x < gameWidth / 2; ++x) - BG_GFX_SUB[y*256 + x] = buffer[y*gameWidth/2 + x]; - } - else - { - for (int r = 0; r < (512 * 256) >> 1; r++) { - BG_GFX_SUB[r] = buffer[r]; - } - } + for (int r = 0; r < (512 * 256) >> 1; r++) + BG_GFX_SUB[r] = buffer[r]; + SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE; // Turn off keyboard layer SUB_DISPLAY_CR |= DISPLAY_BG3_ACTIVE; // Turn on game layer } else { diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 43fd629a2f..a804369b26 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -173,8 +173,8 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int u16* src = (u16 *) buf; if (DS::getKeyboardEnable()) { - - for (int dy = y; dy < y + h; dy++) { + for (int dy = y; dy < y + h; dy++) + { u16* dest = bg + (dy << 8) + (x >> 1); DC_FlushRange(src, w << 1); @@ -185,7 +185,8 @@ void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int } } else { - for (int dy = y; dy < y + h; dy++) { + for (int dy = y; dy < y + h; dy++) + { u16* dest1 = bg + (dy << 8) + (x >> 1); u16* dest2 = bgSub + (dy << 8) + (x >> 1); @@ -478,16 +479,14 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) { // Ensure we copy using 16 bit quantities due to limitation of VRAM addressing - size_t imageStrideInBytes = DS::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 * imageStrideInWords), DS::getGameWidth()); + DC_FlushRange(image + (y << 8), DS::getGameWidth()); for (int x = 0; x < DS::getGameWidth() >> 1; x++) { - *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x]; + *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y << 8 + x]; } } |