annotate src/video/nds/SDL_ndsvideo.c @ 2690:ca01c20274c0 gsoc2008_nds

More work and some bugfixes on the graphics driver.
author Darren Alton <dalton@stevens.edu>
date Sat, 16 Aug 2008 07:44:35 +0000
parents 71c56e900f8b
children c04a266c277a
rev   line source
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
1 /*
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
4
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
9
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
13 Lesser General Public License for more details.
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
14
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
18
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
19 Sam Lantinga
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
20 slouken@libsdl.org
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
21 */
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
22 #include "SDL_config.h"
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
23
2680
4135aa9c5645 More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents: 2679
diff changeset
24 /* SDL Nintendo DS video driver implementation
4135aa9c5645 More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents: 2679
diff changeset
25 * based on dummy driver:
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
26 * Initial work by Ryan C. Gordon (icculus@icculus.org). A good portion
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
27 * of this was cut-and-pasted from Stephane Peter's work in the AAlib
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
28 * SDL video driver. Renamed to "DUMMY" by Sam Lantinga.
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
29 */
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
30
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
31 #include <stdio.h>
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
32 #include <stdlib.h>
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
33 #include <nds.h>
2680
4135aa9c5645 More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents: 2679
diff changeset
34 #include <nds/arm9/video.h>
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
35
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
36 #include "SDL_video.h"
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
37 #include "SDL_mouse.h"
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
38 #include "../SDL_sysvideo.h"
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
39 #include "../SDL_pixels_c.h"
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
40 #include "../../events/SDL_events_c.h"
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
41
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
42 #include "SDL_ndsvideo.h"
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
43 #include "SDL_ndsevents_c.h"
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
44 #include "SDL_ndsrender_c.h"
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
45
2690
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
46
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
47
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
48 #define TRACE
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
49 //#define TRACE printf
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
50
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
51
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
52
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
53 #define NDSVID_DRIVER_NAME "nds"
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
54
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
55 /* Initialization/Query functions */
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
56 static int NDS_VideoInit(_THIS);
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
57 static int NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode);
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
58 static void NDS_VideoQuit(_THIS);
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
59
2680
4135aa9c5645 More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents: 2679
diff changeset
60
4135aa9c5645 More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents: 2679
diff changeset
61 /* SDL NDS driver bootstrap functions */
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
62 static int
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
63 NDS_Available(void)
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
64 {
2680
4135aa9c5645 More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents: 2679
diff changeset
65 /*const char *envr = SDL_getenv("SDL_VIDEODRIVER");*/
2673
24a6b3588eac Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents: 2672
diff changeset
66 /*printf("NDS_Available()\n"); */
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
67 return (1);
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
68 }
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
69
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
70 static void
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
71 NDS_DeleteDevice(SDL_VideoDevice * device)
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
72 {
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
73 SDL_free(device);
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
74 }
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
75
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
76 static SDL_VideoDevice *
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
77 NDS_CreateDevice(int devindex)
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
78 {
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
79 SDL_VideoDevice *device;
2673
24a6b3588eac Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents: 2672
diff changeset
80 /*printf("NDS_CreateDevice(%d)\n", devindex); */
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
81
2690
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
82 TRACE("+NDS_CreateDevice\n");
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
83 /* Initialize all variables that we clean on shutdown */
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
84 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
85 if (!device) {
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
86 SDL_OutOfMemory();
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
87 if (device) {
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
88 SDL_free(device);
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
89 }
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
90 return (0);
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
91 }
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
92
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
93 /* Set the function pointers */
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
94 device->VideoInit = NDS_VideoInit;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
95 device->VideoQuit = NDS_VideoQuit;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
96 device->SetDisplayMode = NDS_SetDisplayMode;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
97 device->PumpEvents = NDS_PumpEvents;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
98
2671
c3e7c0698cbb some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents: 2670
diff changeset
99 device->num_displays = 2; /* DS = dual screens */
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
100
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
101 device->free = NDS_DeleteDevice;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
102
2690
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
103 TRACE("-NDS_CreateDevice\n");
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
104 return device;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
105 }
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
106
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
107 VideoBootStrap NDS_bootstrap = {
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
108 NDSVID_DRIVER_NAME, "SDL NDS video driver",
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
109 NDS_Available, NDS_CreateDevice
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
110 };
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
111
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
112 int
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
113 NDS_VideoInit(_THIS)
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
114 {
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
115 SDL_DisplayMode mode;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
116 int i;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
117
2690
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
118 TRACE("+NDS_VideoInit\n");
2680
4135aa9c5645 More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents: 2679
diff changeset
119 /* simple 256x192x16x60 for now */
2671
c3e7c0698cbb some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents: 2670
diff changeset
120 mode.w = 256;
c3e7c0698cbb some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents: 2670
diff changeset
121 mode.h = 192;
2679
bc3e3e889f6d More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents: 2677
diff changeset
122 mode.format = SDL_PIXELFORMAT_ABGR1555;
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
123 mode.refresh_rate = 60;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
124 mode.driverdata = NULL;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
125
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
126 SDL_AddBasicVideoDisplay(&mode);
2677
6386764eb222 Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents: 2673
diff changeset
127 SDL_AddRenderDriver(0, &NDS_RenderDriver);
2679
bc3e3e889f6d More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents: 2677
diff changeset
128 /*SDL_AddBasicVideoDisplay(&mode); two screens, same mode. uncomment later
bc3e3e889f6d More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents: 2677
diff changeset
129 SDL_AddRenderDriver(1, &NDS_RenderDriver);*/
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
130
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
131 SDL_zero(mode);
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
132 SDL_AddDisplayMode(0, &mode);
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
133
2671
c3e7c0698cbb some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents: 2670
diff changeset
134 /* hackish stuff to get things up and running for now, and for a console */
2680
4135aa9c5645 More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents: 2679
diff changeset
135 powerON(POWER_ALL_2D);
2679
bc3e3e889f6d More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents: 2677
diff changeset
136 irqInit();
bc3e3e889f6d More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents: 2677
diff changeset
137 irqEnable(IRQ_VBLANK);
2690
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
138 NDS_SetDisplayMode(_this, &mode);
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
139
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
140 TRACE("-NDS_VideoInit\n");
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
141 return 0;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
142 }
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
143
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
144 static int
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
145 NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
2690
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
146 {
2673
24a6b3588eac Cleaned up and added joypad support from 1.2.9 NDS port. Also some minor video driver bugfixes.
Darren Alton <dalton@stevens.edu>
parents: 2672
diff changeset
147 TRACE("+NDS_SetDisplayMode\n");
2681
c15b6c758be5 Some small bug fixes and more work on video
Darren Alton <dalton@stevens.edu>
parents: 2680
diff changeset
148 /* right now this function is just hard-coded for 256x192 ABGR1555 */
2688
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
149 videoSetMode(MODE_5_2D |
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
150 DISPLAY_BG2_ACTIVE |
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
151 DISPLAY_BG3_ACTIVE |
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
152 DISPLAY_BG_EXT_PALETTE |
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
153 DISPLAY_SPR_1D_LAYOUT |
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
154 DISPLAY_SPR_ACTIVE |
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
155 DISPLAY_SPR_EXT_PALETTE); /* display on main core
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
156 with lots of flags set for
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
157 flexibility/capacity to render */
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
158
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
159 /* hopefully these cover all the various things we might need to do */
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
160 vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
161 vramSetBankB(VRAM_B_MAIN_BG_0x06020000);
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
162 vramSetBankC(VRAM_C_SUB_BG_0x06200000);
2680
4135aa9c5645 More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
Darren Alton <dalton@stevens.edu>
parents: 2679
diff changeset
163 vramSetBankD(VRAM_D_MAIN_BG_0x06040000); /* not a typo. vram d can't sub */
2688
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
164 vramSetBankE(VRAM_E_MAIN_SPRITE);
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
165 vramSetBankF(VRAM_F_OBJ_EXT_PALETTE);
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
166 vramSetBankG(VRAM_G_BG_EXT_PALETTE);
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
167 vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE);
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
168 vramSetBankI(VRAM_I_SUB_SPRITE);
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
169
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
170 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
171 TODO: this will change
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
172 when multi-head is
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
173 introduced in render */
2690
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
174
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
175 TRACE("-NDS_SetDisplayMode\n");
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
176 return 0;
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
177 }
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
178
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
179 void
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
180 NDS_VideoQuit(_THIS)
2690
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
181 {
2679
bc3e3e889f6d More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents: 2677
diff changeset
182 TRACE("+NDS_VideoQuit\n");
bc3e3e889f6d More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents: 2677
diff changeset
183 videoSetMode(DISPLAY_SCREEN_OFF);
bc3e3e889f6d More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents: 2677
diff changeset
184 videoSetModeSub(DISPLAY_SCREEN_OFF);
2688
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
185 vramSetMainBanks(VRAM_A_LCD, VRAM_B_LCD, VRAM_C_LCD, VRAM_D_LCD);
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
186 vramSetBankE(VRAM_E_LCD);
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
187 vramSetBankF(VRAM_F_LCD);
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
188 vramSetBankG(VRAM_G_LCD);
71c56e900f8b Cleaning up the renderer code to hopefully squish any problems. Starting to incorporate sprites, as well
Darren Alton <dalton@stevens.edu>
parents: 2682
diff changeset
189 vramSetBankH(VRAM_H_LCD);
2690
ca01c20274c0 More work and some bugfixes on the graphics driver.
Darren Alton <dalton@stevens.edu>
parents: 2688
diff changeset
190 vramSetBankI(VRAM_I_LCD);
2670
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
191 TRACE("-NDS_VideoQuit\n");
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
192 }
6e4669f4db49 Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff changeset
193