summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.c
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-01-21 15:18:31 -0500
committerFranklin Wei <git@fwei.tk>2017-12-23 21:01:26 -0500
commita855d6202536ff28e5aae4f22a0f31d8f5b325d0 (patch)
tree8c75f224dd64ed360505afa8843d016b0d75000b /apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.c
parent01c6dcf6c7b9bb1ad2fa0450f99bacc5f3d3e04b (diff)
downloadrockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.tar.gz
rockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.zip
Port of Duke Nukem 3D
This ports Fabien Sanglard's Chocolate Duke to run on a version of SDL for Rockbox. Change-Id: I8f2c4c78af19de10c1633ed7bb7a997b43256dd9
Diffstat (limited to 'apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.c')
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.c106
1 files changed, 106 insertions, 0 deletions
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.c b/apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.c
new file mode 100644
index 0000000000..a99ee18c5b
--- /dev/null
+++ b/apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.c
@@ -0,0 +1,106 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21*/
22#include "SDL_config.h"
23
24/*
25 Milan Xbios video functions
26
27 Patrice Mandin
28*/
29
30#include <mint/cookie.h>
31#include <mint/falcon.h>
32
33#include "SDL_xbios.h"
34#include "SDL_xbios_milan.h"
35
36#define NUM_PREDEFINED_MODES 7
37
38typedef struct {
39 Uint16 width, height;
40} predefined_mode_t;
41
42static const predefined_mode_t mode_list[NUM_PREDEFINED_MODES]={
43 {640,400},
44 {640,480},
45 {800,608},
46 {1024,768},
47 {1152,864},
48 {1280,1024},
49 {1600,1200}
50};
51
52static const Uint8 mode_bpp[4]={
53 8, 15, 16, 32
54};
55
56/*--- Variables ---*/
57
58static int enum_actually_add;
59static SDL_VideoDevice *enum_this;
60
61/*--- Functions ---*/
62
63static unsigned long /*cdecl*/ enumfunc(SCREENINFO *inf, unsigned long flag)
64{
65 xbiosmode_t modeinfo;
66
67 modeinfo.number = inf->devID;
68 modeinfo.width = inf->scrWidth;
69 modeinfo.height = inf->scrHeight;
70 modeinfo.depth = inf->scrPlanes;
71 modeinfo.flags = 0;
72
73 SDL_XBIOS_AddMode(enum_this, enum_actually_add, &modeinfo);
74
75 return ENUMMODE_CONT;
76}
77
78void SDL_XBIOS_ListMilanModes(_THIS, int actually_add)
79{
80 int i;
81
82 /* Read validated predefined modes */
83 for (i=0; i<NUM_PREDEFINED_MODES; i++) {
84 int j;
85 Uint16 deviceid = 0x1000 + (i<<4);
86
87 for (j=1; j<4; j++) {
88 if (Validmode(deviceid + j)) {
89 xbiosmode_t modeinfo;
90
91 modeinfo.number = deviceid + j;
92 modeinfo.width = mode_list[i].width;
93 modeinfo.height = mode_list[i].height;
94 modeinfo.depth = mode_bpp[j-1];
95 modeinfo.flags = 0;
96
97 SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
98 }
99 }
100 }
101
102 /* Read custom created modes */
103 enum_this = this;
104 enum_actually_add = actually_add;
105 VsetScreen(-1, &enumfunc, MI_MAGIC, CMD_ENUMMODES);
106}