aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/fs/ds/ds-fs.h8
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp2
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp14
3 files changed, 21 insertions, 3 deletions
diff --git a/backends/fs/ds/ds-fs.h b/backends/fs/ds/ds-fs.h
index 951d15799b..5b9bd84a0d 100644
--- a/backends/fs/ds/ds-fs.h
+++ b/backends/fs/ds/ds-fs.h
@@ -123,7 +123,8 @@ struct fileHandle {
//
// A #define is the only way, as redefinig the functions would cause linker errors.
-// These functions need to be #undef'ed, as their definition is done with #includes
+// These functions need to be #undef'ed, as their original definition
+// in devkitarm is done with #includes (ugh!)
#undef feof
#undef stderr
#undef stdout
@@ -175,6 +176,11 @@ int std_ferror(FILE* handle);
#define getcwd(dir, dunno) DS::std_getcwd(dir, dunno)
#define ferror(handle) DS::std_ferror(handle)
+#ifdef assert
+#undef assert
+#endif
+
+#define assert(s) if (!(s)) consolePrintf("Assertion failed: '##s##' at file %s, line %d\n", __FILE__, __LINE__)
}
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;
}