Mercurial > sdl-ios-xcode
comparison src/video/nds/SDL_ndsvideo.c @ 2671:c3e7c0698cbb gsoc2008_nds
some changes to the dummy driver for debug purposes that should be reverted.
most importantly, commenting out a check for an env. var.
author | Darren Alton <dalton@stevens.edu> |
---|---|
date | Thu, 12 Jun 2008 02:38:49 +0000 |
parents | 6e4669f4db49 |
children | 74ac057679d5 |
comparison
equal
deleted
inserted
replaced
2670:6e4669f4db49 | 2671:c3e7c0698cbb |
---|---|
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(); |
93 device->VideoInit = NDS_VideoInit; | 93 device->VideoInit = NDS_VideoInit; |
94 device->VideoQuit = NDS_VideoQuit; | 94 device->VideoQuit = NDS_VideoQuit; |
95 device->SetDisplayMode = NDS_SetDisplayMode; | 95 device->SetDisplayMode = NDS_SetDisplayMode; |
96 device->PumpEvents = NDS_PumpEvents; | 96 device->PumpEvents = NDS_PumpEvents; |
97 | 97 |
98 device->num_displays = 2; /* DS = dual screens */ | 98 device->num_displays = 2; /* DS = dual screens */ |
99 | 99 |
100 device->free = NDS_DeleteDevice; | 100 device->free = NDS_DeleteDevice; |
101 | 101 |
102 return device; | 102 return device; |
103 } | 103 } |
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 256x192x16x60 for now */ |
117 mode.w = 256; mode.h = 192; | 117 mode.w = 256; |
118 mode.h = 192; | |
118 mode.format = SDL_PIXELFORMAT_ARGB1555; | 119 mode.format = SDL_PIXELFORMAT_ARGB1555; |
119 mode.refresh_rate = 60; | 120 mode.refresh_rate = 60; |
120 mode.driverdata = NULL; | 121 mode.driverdata = NULL; |
121 | 122 |
122 SDL_AddBasicVideoDisplay(&mode); | 123 SDL_AddBasicVideoDisplay(&mode); |
123 SDL_AddRenderDriver(0, &SDL_NDS_RenderDriver); | 124 SDL_AddRenderDriver(0, &SDL_NDS_RenderDriver); |
124 | 125 |
125 SDL_zero(mode); | 126 SDL_zero(mode); |
126 SDL_AddDisplayMode(0, &mode); | 127 SDL_AddDisplayMode(0, &mode); |
127 | 128 |
128 /* hackish stuff to get things up and running for now, and for a console */ | 129 /* hackish stuff to get things up and running for now, and for a console */ |
129 powerON(POWER_ALL); | 130 powerON(POWER_ALL); |
130 videoSetMode(MODE_FB0); | 131 videoSetMode(MODE_FB0); |
131 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */ | 132 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */ |
132 vramSetBankA(VRAM_A_LCD); | 133 |
133 vramSetBankC(VRAM_C_SUB_BG); | 134 vramSetBankA(VRAM_A_LCD); |
134 irqInit(); | 135 vramSetBankC(VRAM_C_SUB_BG); |
135 irqEnable(IRQ_VBLANK); | 136 |
137 irqInit(); | |
138 irqEnable(IRQ_VBLANK); | |
136 /* set up console for debug text 'n stuff */ | 139 /* set up console for debug text 'n stuff */ |
137 SUB_BG0_CR = BG_MAP_BASE(31); BG_PALETTE_SUB[255] = RGB15(31,31,31); | 140 SUB_BG0_CR = BG_MAP_BASE(31); |
138 consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), | 141 BG_PALETTE_SUB[255] = RGB15(31, 31, 31); |
139 (u16*)CHAR_BASE_BLOCK_SUB(0), 16); | 142 consoleInitDefault((u16 *) SCREEN_BASE_BLOCK_SUB(31), |
140 for(i = 0; i < 256*192; ++i) { | 143 (u16 *) CHAR_BASE_BLOCK_SUB(0), 16); |
141 ((u16*)VRAM_A)[i] = i; | 144 for (i = 0; i < 256 * 192; ++i) { |
142 } | 145 ((u16 *) VRAM_A)[i] = i; |
143 for(i = 0; i < 60; ++i) swiWaitForVBlank(); | 146 } |
144 /*NDS_SetDisplayMode(_this, &mode);*/ | 147 for (i = 0; i < 60; ++i) |
148 swiWaitForVBlank(); | |
149 | |
150 /*NDS_SetDisplayMode(_this, &mode); */ | |
145 return 0; | 151 return 0; |
146 } | 152 } |
147 | 153 |
148 static int | 154 static int |
149 NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode) | 155 NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode) |
150 { | 156 { |
151 /* right now this function is just hard-coded for 256x192 ARGB1555 */ | 157 /* right now this function is just hard-coded for 256x192 ARGB1555 */ |
152 #if 0 | 158 #if 0 |
153 videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE); /* display on main core */ | 159 videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE); /* display on main core */ |
154 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */ | 160 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */ |
155 vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_LCD, | 161 vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_LCD, |
156 VRAM_C_SUB_BG, VRAM_D_LCD); | 162 VRAM_C_SUB_BG, VRAM_D_LCD); |
157 | 163 |
158 /* maps well to the 256x192 screen anyway. note: need VRAM_B for bigger */ | 164 /* maps well to the 256x192 screen anyway. note: need VRAM_B for bigger */ |
159 BG3_CR = BG_BMP16_256x256; | 165 BG3_CR = BG_BMP16_256x256; |
160 /* affine transformation matrix. nothing too fancy here */ | 166 /* affine transformation matrix. nothing too fancy here */ |
161 BG3_XDX = 0x100; BG3_XDY = 0; | 167 BG3_XDX = 0x100; |
162 BG3_YDX = 0; BG3_YDY = 0x100; | 168 BG3_XDY = 0; |
163 /* x/y position */ | 169 BG3_YDX = 0; |
164 BG3_CX = 0; BG3_CY = 0; | 170 BG3_YDY = 0x100; |
171 /* x/y position */ | |
172 BG3_CX = 0; | |
173 BG3_CY = 0; | |
165 #endif | 174 #endif |
166 return 0; | 175 return 0; |
167 } | 176 } |
168 | 177 |
169 void | 178 void |