comparison src/video/nds/SDL_ndsvideo.c @ 2672:74ac057679d5 gsoc2008_nds

NDS video driver is now functional, using software rendering and framebuffer.
author Darren Alton <dalton@stevens.edu>
date Tue, 17 Jun 2008 08:26:36 +0000
parents c3e7c0698cbb
children 24a6b3588eac
comparison
equal deleted inserted replaced
2671:c3e7c0698cbb 2672:74ac057679d5
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();
114 int i; 114 int i;
115 115
116 /* simple 256x192x16x60 for now */ 116 /* simple 256x192x16x60 for now */
117 mode.w = 256; 117 mode.w = 256;
118 mode.h = 192; 118 mode.h = 192;
119 mode.format = SDL_PIXELFORMAT_ARGB1555; 119 mode.format = SDL_PIXELFORMAT_RGB555;
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);
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 for (i = 0; i < 256 * 192; ++i) {
145 ((u16 *) VRAM_A)[i] = i; 145 ((u16 *) VRAM_A)[i] = i;
146 } 146 }
147 for (i = 0; i < 60; ++i)
148 swiWaitForVBlank();
149 147
150 /*NDS_SetDisplayMode(_this, &mode); */ 148 /*NDS_SetDisplayMode(_this, &mode); */
151 return 0; 149 return 0;
152 } 150 }
153 151