src/video/nds/SDL_ndsvideo.c
branchgsoc2008_nds
changeset 2679 bc3e3e889f6d
parent 2677 6386764eb222
child 2680 4135aa9c5645
     1.1 --- a/src/video/nds/SDL_ndsvideo.c	Thu Jul 10 23:35:01 2008 +0000
     1.2 +++ b/src/video/nds/SDL_ndsvideo.c	Sun Jul 13 04:28:54 2008 +0000
     1.3 @@ -116,31 +116,22 @@
     1.4      /* simple 256x192x15x60 for now */
     1.5      mode.w = 256;
     1.6      mode.h = 192;
     1.7 -    mode.format = SDL_PIXELFORMAT_BGR555;
     1.8 +    mode.format = SDL_PIXELFORMAT_ABGR1555;
     1.9      mode.refresh_rate = 60;
    1.10      mode.driverdata = NULL;
    1.11  
    1.12      SDL_AddBasicVideoDisplay(&mode);
    1.13      SDL_AddRenderDriver(0, &NDS_RenderDriver);
    1.14 +    /*SDL_AddBasicVideoDisplay(&mode); two screens, same mode. uncomment later
    1.15 +    SDL_AddRenderDriver(1, &NDS_RenderDriver);*/
    1.16  
    1.17      SDL_zero(mode);
    1.18      SDL_AddDisplayMode(0, &mode);
    1.19  
    1.20      /* hackish stuff to get things up and running for now, and for a console */
    1.21 -    powerON(POWER_ALL);
    1.22 -    videoSetMode(MODE_FB0);
    1.23 -    videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);    /* debug text on sub */
    1.24 -    
    1.25     vramSetBankA(VRAM_A_LCD);
    1.26 -    vramSetBankC(VRAM_C_SUB_BG);
    1.27 -    
    1.28     irqInit();
    1.29 -    irqEnable(IRQ_VBLANK);
    1.30 -    /* set up console for debug text 'n stuff */
    1.31 -    SUB_BG0_CR = BG_MAP_BASE(31);
    1.32 -    BG_PALETTE_SUB[255] = RGB15(31, 31, 31);
    1.33 -    consoleInitDefault((u16 *) SCREEN_BASE_BLOCK_SUB(31),
    1.34 -                       (u16 *) CHAR_BASE_BLOCK_SUB(0), 16);
    1.35 -
    1.36 -    /*NDS_SetDisplayMode(_this, &mode); */
    1.37 +    powerON(POWER_ALL);
    1.38     irqInit();
    1.39 +    irqEnable(IRQ_VBLANK);
    1.40 +    NDS_SetDisplayMode(_this, &mode);
    1.41      return 0;
    1.42  }
    1.43  
    1.44 @@ -148,14 +139,21 @@
    1.45  NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
    1.46  {
    1.47      /* right now this function is just hard-coded for 256x192 ABGR1555 */
    1.48 -#if 0
    1.49      videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE);       /* display on main core */
    1.50      videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);    /* debug text on sub */
    1.51      vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_LCD,
    1.52                       VRAM_C_SUB_BG, VRAM_D_LCD);
    1.53  
    1.54 +    /* set up console for debug text 'n stuff */
    1.55 +    SUB_BG0_CR = BG_MAP_BASE(31);
    1.56 +    BG_PALETTE_SUB[255] = RGB15(31, 31, 31);
    1.57 +    consoleInitDefault((u16 *) SCREEN_BASE_BLOCK_SUB(31),
    1.58 +                       (u16 *) CHAR_BASE_BLOCK_SUB(0), 16);
    1.59 +
    1.60 +#if 0
    1.61 +/* we should be using this as a texture for rendering, not as a framebuffer */
    1.62      /* maps well to the 256x192 screen anyway.  note: need VRAM_B for bigger */
    1.63 -    BG3_CR = BG_BMP16_256x256;
    1.64 +    BACKGROUND.control[3] = BG_BMP16_256x256;
    1.65      /* affine transformation matrix.  nothing too fancy here */
    1.66      BG3_XDX = 0x100;
    1.67      BG3_XDY = 0;
    1.68 @@ -171,6 +169,9 @@
    1.69  void
    1.70  NDS_VideoQuit(_THIS)
    1.71  {
    1.72 +    videoSetMode(DISPLAY_SCREEN_OFF);
    1.73 +    videoSetModeSub(DISPLAY_SCREEN_OFF);
    1.74 +    vramSetMainBanks(VRAM_A_LCD, VRAM_B_LCD, VRAM_C_LCD, VRAM_D_LCD);
    1.75  }
    1.76  
    1.77  /* vi: set ts=4 sw=4 expandtab: */