comparison src/video/nds/SDL_ndsvideo.c @ 2673:24a6b3588eac gsoc2008_nds

Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
author Darren Alton <dalton@stevens.edu>
date Thu, 19 Jun 2008 07:11:35 +0000
parents 74ac057679d5
children 6386764eb222
comparison
equal deleted inserted replaced
2672:74ac057679d5 2673:24a6b3588eac
61 61
62 static int 62 static int
63 NDS_Available(void) 63 NDS_Available(void)
64 { 64 {
65 const char *envr = SDL_getenv("SDL_VIDEODRIVER"); 65 const char *envr = SDL_getenv("SDL_VIDEODRIVER");
66 /*printf("NDS_Available()\n");*/ 66 /*printf("NDS_Available()\n"); */
67 return (1); 67 return (1);
68 } 68 }
69 69
70 static void 70 static void
71 NDS_DeleteDevice(SDL_VideoDevice * device) 71 NDS_DeleteDevice(SDL_VideoDevice * device)
75 75
76 static SDL_VideoDevice * 76 static SDL_VideoDevice *
77 NDS_CreateDevice(int devindex) 77 NDS_CreateDevice(int devindex)
78 { 78 {
79 SDL_VideoDevice *device; 79 SDL_VideoDevice *device;
80 /*printf("NDS_CreateDevice(%d)\n", devindex);*/ 80 /*printf("NDS_CreateDevice(%d)\n", devindex); */
81 81
82 /* Initialize all variables that we clean on shutdown */ 82 /* Initialize all variables that we clean on shutdown */
83 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); 83 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
84 if (!device) { 84 if (!device) {
85 SDL_OutOfMemory(); 85 SDL_OutOfMemory();
111 NDS_VideoInit(_THIS) 111 NDS_VideoInit(_THIS)
112 { 112 {
113 SDL_DisplayMode mode; 113 SDL_DisplayMode mode;
114 int i; 114 int i;
115 115
116 /* simple 256x192x16x60 for now */ 116 /* simple 256x192x15x60 for now */
117 mode.w = 256; 117 mode.w = 256;
118 mode.h = 192; 118 mode.h = 192;
119 mode.format = SDL_PIXELFORMAT_RGB555; 119 mode.format = SDL_PIXELFORMAT_BGR555;
120 mode.refresh_rate = 60; 120 mode.refresh_rate = 60;
121 mode.driverdata = NULL; 121 mode.driverdata = NULL;
122 122
123 SDL_AddBasicVideoDisplay(&mode); 123 SDL_AddBasicVideoDisplay(&mode);
124 SDL_AddRenderDriver(0, &SDL_NDS_RenderDriver); 124 SDL_AddRenderDriver(0, &SDL_NDS_RenderDriver);
139 /* set up console for debug text 'n stuff */ 139 /* set up console for debug text 'n stuff */
140 SUB_BG0_CR = BG_MAP_BASE(31); 140 SUB_BG0_CR = BG_MAP_BASE(31);
141 BG_PALETTE_SUB[255] = RGB15(31, 31, 31); 141 BG_PALETTE_SUB[255] = RGB15(31, 31, 31);
142 consoleInitDefault((u16 *) SCREEN_BASE_BLOCK_SUB(31), 142 consoleInitDefault((u16 *) SCREEN_BASE_BLOCK_SUB(31),
143 (u16 *) CHAR_BASE_BLOCK_SUB(0), 16); 143 (u16 *) CHAR_BASE_BLOCK_SUB(0), 16);
144 for (i = 0; i < 256 * 192; ++i) { 144
145 ((u16 *) VRAM_A)[i] = i;
146 }
147
148 /*NDS_SetDisplayMode(_this, &mode); */ 145 /*NDS_SetDisplayMode(_this, &mode); */
149 return 0; 146 return 0;
150 } 147 }
151 148
152 static int 149 static int
153 NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode) 150 NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
154 { 151 {
155 /* right now this function is just hard-coded for 256x192 ARGB1555 */ 152 /* right now this function is just hard-coded for 256x192 ABGR1555 */
156 #if 0 153 #if 0
157 videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE); /* display on main core */ 154 videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE); /* display on main core */
158 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */ 155 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */
159 vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_LCD, 156 vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_LCD,
160 VRAM_C_SUB_BG, VRAM_D_LCD); 157 VRAM_C_SUB_BG, VRAM_D_LCD);