changeset 2682:f7594fc66bda gsoc2008_nds

Some debug work on the video driver, shows an error in the BG's vertical placement
author Darren Alton <dalton@stevens.edu>
date Sat, 26 Jul 2008 05:52:59 +0000
parents c15b6c758be5
children e858ac8868b6
files src/video/nds/SDL_ndsrender.c src/video/nds/SDL_ndsvideo.c
diffstat 2 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/nds/SDL_ndsrender.c	Fri Jul 25 23:39:14 2008 +0000
+++ b/src/video/nds/SDL_ndsrender.c	Sat Jul 26 05:52:59 2008 +0000
@@ -100,7 +100,6 @@
     bg_attribute *bg;
     u8 bg_taken[4];
     int sub;
-    SDL_DirtyRectList dirty;
 } NDS_RenderData;
 
 typedef struct
@@ -249,6 +248,7 @@
 {
     NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata;
     NDS_TextureData *txdat = NULL;
+    int i;
 printf("+NDS_CreateTexture\n");
     if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) {
         SDL_SetError("Unsupported texture format");
@@ -299,6 +299,10 @@
                 txdat->dim.bpp = bpp;
                 txdat->vram = (u16*)(data->sub ?
                     BG_BMP_RAM_SUB(whichbg) : BG_BMP_RAM(whichbg));
+                for(i = 0; i < 256*256; ++i) {
+                    txdat->vram[i] = 0x8000|RGB15(0,31,31);
+                }
+                for(i = 0; i < 60; ++i) swiWaitForVBlank();
             } else {
                 SDL_SetError("Out of NDS backgrounds.");
             }
@@ -439,7 +443,7 @@
         NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata;
 
         if (markDirty) {
-            SDL_AddDirtyRect(&txdat->dirty, rect);
+            /*SDL_AddDirtyRect(&txdat->dirty, rect);*/
         }
 
         *pixels = (void *) ((u8 *)txdat->vram + rect->y * txdat->dim.pitch
@@ -496,9 +500,13 @@
     NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata;
 //    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
 //    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
-
+    int i;
 printf("+NDS_RenderCopy\n");
-
+    for(i = 0; i <= 0xFFFF; ++i) {
+        txdat->vram[i] = 0x8000|i;
+    }
+    printf("/txdat->hw_index = %d\n", txdat->hw_index);
+#if 0
     if (txdat->dirty.list) {
         SDL_DirtyRect *dirty;
         void *pixels;
@@ -518,9 +526,9 @@
         }
         SDL_ClearDirtyRects(&txdat->dirty);
     }
-
+#endif
 printf("-NDS_RenderCopy\n");
-    return status;
+    return 0;
 }
 
 
@@ -547,7 +555,7 @@
     } else {
         /* free anything else allocated for texture */
         NDS_TextureData *txdat = texture->driverdata;
-        SDL_FreeDirtyRects(&txdat->dirty);
+        /*SDL_FreeDirtyRects(&txdat->dirty);*/
         SDL_free(txdat);
     }
 printf("-NDS_DestroyTexture\n");
--- a/src/video/nds/SDL_ndsvideo.c	Fri Jul 25 23:39:14 2008 +0000
+++ b/src/video/nds/SDL_ndsvideo.c	Sat Jul 26 05:52:59 2008 +0000
@@ -199,11 +199,11 @@
 printf("+NDS_SetDisplayMode\n");
     /* right now this function is just hard-coded for 256x192 ABGR1555 */
     videoSetMode(MODE_5_2D |
-        DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE
+        DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE |
         DISPLAY_SPR_1D_LAYOUT | DISPLAY_SPR_ACTIVE); /* display on main core */
     videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */
     vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_MAIN_BG_0x06020000,
-                     VRAM_C_SUB_BG_0x06200000,  VRAM_D_SUB_BG_0x06220000);
+                     VRAM_C_SUB_BG_0x06200000,  VRAM_D_MAIN_BG_0x06040000);
     vramSetBankE(VRAM_E_MAIN_SPRITE);
     /* set up console for debug text 'n stuff */
     SUB_BG0_CR = BG_MAP_BASE(31);