Mercurial > sdl-ios-xcode
annotate src/video/nds/SDL_ndsvideo.c @ 2679:bc3e3e889f6d gsoc2008_nds
More NDS video driver work.
author | Darren Alton <dalton@stevens.edu> |
---|---|
date | Sun, 13 Jul 2008 04:28:54 +0000 |
parents | 6386764eb222 |
children | 4135aa9c5645 |
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 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
24 /* Dummy SDL video driver implementation; this is just enough to make an |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
25 * SDL-based application THINK it's got a working video driver, for |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
26 * applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it, |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
27 * and also for use as a collection of stubs when porting SDL to a new |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
28 * platform for which you haven't yet written a valid video driver. |
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 * This is also a great way to determine bottlenecks: if you think that SDL |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
31 * is a performance problem for a given platform, enable this driver, and |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
32 * then see if your application runs faster without video overhead. |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
33 * |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
34 * 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
|
35 * 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
|
36 * 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
|
37 */ |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
38 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
39 #include <stdio.h> |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
40 #include <stdlib.h> |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
41 #include <nds.h> |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
42 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
43 #include "SDL_video.h" |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
44 #include "SDL_mouse.h" |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
45 #include "../SDL_sysvideo.h" |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
46 #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
|
47 #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
|
48 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
49 #include "SDL_ndsvideo.h" |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
50 #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
|
51 #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
|
52 |
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 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
60 /* DUMMY driver bootstrap functions */ |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
61 |
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 { |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
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 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
82 /* 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
|
83 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
|
84 if (!device) { |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
85 SDL_OutOfMemory(); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
86 if (device) { |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
87 SDL_free(device); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
88 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
89 return (0); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
90 } |
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 /* Set the function pointers */ |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
93 device->VideoInit = NDS_VideoInit; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
94 device->VideoQuit = NDS_VideoQuit; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
95 device->SetDisplayMode = NDS_SetDisplayMode; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
96 device->PumpEvents = NDS_PumpEvents; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
97 |
2671
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
98 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
|
99 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
100 device->free = NDS_DeleteDevice; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
101 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
102 return device; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
103 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
104 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
105 VideoBootStrap NDS_bootstrap = { |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
106 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
|
107 NDS_Available, NDS_CreateDevice |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
108 }; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
109 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
110 int |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
111 NDS_VideoInit(_THIS) |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
112 { |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
113 SDL_DisplayMode mode; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
114 int i; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
115 |
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
|
116 /* simple 256x192x15x60 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
|
117 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
|
118 mode.h = 192; |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
119 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
|
120 mode.refresh_rate = 60; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
121 mode.driverdata = NULL; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
122 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
123 SDL_AddBasicVideoDisplay(&mode); |
2677
6386764eb222
Starting to work on a more complete video driver.
Darren Alton <dalton@stevens.edu>
parents:
2673
diff
changeset
|
124 SDL_AddRenderDriver(0, &NDS_RenderDriver); |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
125 /*SDL_AddBasicVideoDisplay(&mode); two screens, same mode. uncomment later |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
126 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
|
127 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
128 SDL_zero(mode); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
129 SDL_AddDisplayMode(0, &mode); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
130 |
2671
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
131 /* hackish stuff to get things up and running for now, and for a console */ |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
132 powerON(POWER_ALL); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
133 irqInit(); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
134 irqEnable(IRQ_VBLANK); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
135 NDS_SetDisplayMode(_this, &mode); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
136 return 0; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
137 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
138 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
139 static int |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
140 NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode) |
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
|
141 { |
2671
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
142 /* right now this function is just hard-coded for 256x192 ABGR1555 */ |
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
143 videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE); /* display on main core */ |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
144 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */ |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
145 vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_LCD, |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
146 VRAM_C_SUB_BG, VRAM_D_LCD); |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
147 |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
148 /* set up console for debug text 'n stuff */ |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
149 SUB_BG0_CR = BG_MAP_BASE(31); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
150 BG_PALETTE_SUB[255] = RGB15(31, 31, 31); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
151 consoleInitDefault((u16 *) SCREEN_BASE_BLOCK_SUB(31), |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
152 (u16 *) CHAR_BASE_BLOCK_SUB(0), 16); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
153 |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
154 #if 0 |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
155 /* we should be using this as a texture for rendering, not as a framebuffer */ |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
156 /* maps well to the 256x192 screen anyway. note: need VRAM_B for bigger */ |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
157 BACKGROUND.control[3] = BG_BMP16_256x256; |
2671
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
158 /* affine transformation matrix. nothing too fancy here */ |
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
159 BG3_XDX = 0x100; |
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
160 BG3_XDY = 0; |
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
161 BG3_YDX = 0; |
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
162 BG3_YDY = 0x100; |
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
163 /* x/y position */ |
c3e7c0698cbb
some changes to the dummy driver for debug purposes that should be reverted.
Darren Alton <dalton@stevens.edu>
parents:
2670
diff
changeset
|
164 BG3_CX = 0; |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
165 BG3_CY = 0; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
166 #endif |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
167 return 0; |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
168 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
169 |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
170 void |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
171 NDS_VideoQuit(_THIS) |
2679
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
172 { |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
173 videoSetMode(DISPLAY_SCREEN_OFF); |
bc3e3e889f6d
More NDS video driver work.
Darren Alton <dalton@stevens.edu>
parents:
2677
diff
changeset
|
174 videoSetModeSub(DISPLAY_SCREEN_OFF); |
2670
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
175 vramSetMainBanks(VRAM_A_LCD, VRAM_B_LCD, VRAM_C_LCD, VRAM_D_LCD); |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
176 } |
6e4669f4db49
Fix for the previous commit: actually 'svn add'ed some files.
Darren Alton <dalton@stevens.edu>
parents:
diff
changeset
|
177 |