Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
208 lines (166 loc) · 5.41 KB

SDL_gemvideo.c

File metadata and controls

208 lines (166 loc) · 5.41 KB
 
1
2
/*
SDL - Simple DirectMedia Layer
Feb 1, 2006
Feb 1, 2006
3
Copyright (C) 1997-2006 Sam Lantinga
4
5
This library is free software; you can redistribute it and/or
Feb 1, 2006
Feb 1, 2006
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
Feb 1, 2006
Feb 1, 2006
8
version 2.1 of the License, or (at your option) any later version.
9
10
11
12
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Feb 1, 2006
Feb 1, 2006
13
Lesser General Public License for more details.
Feb 1, 2006
Feb 1, 2006
15
16
17
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19
20
21
Sam Lantinga
slouken@libsdl.org
*/
Feb 21, 2006
Feb 21, 2006
22
#include "SDL_config.h"
Nov 12, 2003
Nov 12, 2003
25
26
27
28
29
30
GEM video driver
Patrice Mandin
and work from
Olivier Landemarre, Johan Klockars, Xavier Joubert, Claude Attard
*/
31
32
33
34
35
/* Mint includes */
#include <gem.h>
#include <gemx.h>
#include <mint/osbind.h>
Dec 7, 2002
Dec 7, 2002
36
#include <mint/cookie.h>
37
38
39
#include "SDL_video.h"
#include "SDL_mouse.h"
Feb 16, 2006
Feb 16, 2006
40
41
#include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h"
Nov 25, 2004
Nov 25, 2004
42
43
44
45
#include "SDL_gemvideo.h"
/* Initialization/Query functions */
Jul 13, 2007
Jul 13, 2007
46
static int GEM_VideoInit(_THIS);
47
48
static void GEM_VideoQuit(_THIS);
Nov 21, 2004
Nov 21, 2004
49
50
static void GEM_GL_SwapBuffers(_THIS);
Jul 10, 2006
Jul 10, 2006
52
53
static int
GEM_Available(void)
Jul 10, 2006
Jul 10, 2006
55
56
57
/* Test if AES available */
if (appl_init() == -1)
return 0;
Jul 10, 2006
Jul 10, 2006
59
60
appl_exit();
return 1;
Jul 10, 2006
Jul 10, 2006
63
64
static void
GEM_DeleteDevice(SDL_VideoDevice * device)
Jul 13, 2007
Jul 13, 2007
66
67
68
SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
SDL_free(device->driverdata);
Jul 10, 2006
Jul 10, 2006
69
SDL_free(device);
Jul 10, 2006
Jul 10, 2006
72
73
static SDL_VideoDevice *
GEM_CreateDevice(int devindex)
Jul 10, 2006
Jul 10, 2006
75
SDL_VideoDevice *device;
Jul 13, 2007
Jul 13, 2007
76
SDL_VideoData *data;
Jul 10, 2006
Jul 10, 2006
77
78
/* Initialize all variables that we clean on shutdown */
Jul 13, 2007
Jul 13, 2007
79
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
Jul 10, 2006
Jul 10, 2006
80
if (device) {
Jul 13, 2007
Jul 13, 2007
81
data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
Jul 10, 2006
Jul 10, 2006
82
}
Jul 13, 2007
Jul 13, 2007
83
if (!device || !data) {
Jul 10, 2006
Jul 10, 2006
84
85
86
87
SDL_OutOfMemory();
if (device) {
SDL_free(device);
}
Jul 13, 2007
Jul 13, 2007
88
return NULL;
Jul 10, 2006
Jul 10, 2006
89
}
Jul 13, 2007
Jul 13, 2007
90
device->driverdata = data;
Jul 10, 2006
Jul 10, 2006
91
92
93
94
/* Set the function pointers */
device->VideoInit = GEM_VideoInit;
device->VideoQuit = GEM_VideoQuit;
Jul 13, 2007
Jul 13, 2007
95
96
device->GetDisplayModes = GEM_GetDisplayModes;
device->SetDisplayMode = GEM_SetDisplayMode;
Jul 10, 2006
Jul 10, 2006
97
98
device->PumpEvents = GEM_PumpEvents;
Jul 13, 2007
Jul 13, 2007
99
100
101
102
103
104
105
106
107
108
109
110
111
112
device->CreateWindow = GEM_CreateWindow;
device->CreateWindowFrom = GEM_CreateWindowFrom;
device->SetWindowTitle = GEM_SetWindowTitle;
device->SetWindowPosition = GEM_SetWindowPosition;
device->SetWindowSize = GEM_SetWindowSize;
device->ShowWindow = GEM_ShowWindow;
device->HideWindow = GEM_HideWindow;
device->RaiseWindow = GEM_RaiseWindow;
device->MaximizeWindow = GEM_MaximizeWindow;
device->MinimizeWindow = GEM_MinimizeWindow;
device->RestoreWindow = GEM_RestoreWindow;
device->SetWindowGrab = GEM_SetWindowGrab;
device->DestroyWindow = GEM_DestroyWindow;
device->GetWindowWMInfo = GEM_GetWindowWMInfo;
Feb 16, 2006
Feb 16, 2006
114
#if SDL_VIDEO_OPENGL
Jul 10, 2006
Jul 10, 2006
115
116
device->GL_LoadLibrary = SDL_AtariGL_LoadLibrary;
device->GL_GetProcAddress = SDL_AtariGL_GetProcAddress;
Jul 13, 2007
Jul 13, 2007
117
device->GL_CreateContext = SDL_AtariGL_CreateContext;
Jul 10, 2006
Jul 10, 2006
118
device->GL_MakeCurrent = SDL_AtariGL_MakeCurrent;
Jul 13, 2007
Jul 13, 2007
119
120
121
122
device->GL_SetSwapInterval = SDL_AtariGL_SetSwapInterval;
device->GL_GetSwapInterval = SDL_AtariGL_GetSwapInterval;
device->GL_SwapWindow = GEM_GL_SwapWindow;
device->GL_DeleteContext = SDL_AtariGL_DeleteContext;
Nov 21, 2004
Nov 21, 2004
123
124
#endif
Jul 10, 2006
Jul 10, 2006
125
device->free = GEM_DeleteDevice;
Jul 10, 2006
Jul 10, 2006
127
return device;
128
129
130
}
VideoBootStrap GEM_bootstrap = {
Jul 13, 2007
Jul 13, 2007
131
"gem", "Atari GEM video driver",
Jul 10, 2006
Jul 10, 2006
132
GEM_Available, GEM_CreateDevice
133
134
};
Jul 10, 2006
Jul 10, 2006
135
int
Jul 13, 2007
Jul 13, 2007
136
GEM_VideoInit(_THIS)
Jul 13, 2007
Jul 13, 2007
138
int i;
Jul 10, 2006
Jul 10, 2006
139
short work_in[12], work_out[272], dummy;
Jul 13, 2007
Jul 13, 2007
140
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
Jul 10, 2006
Jul 10, 2006
141
142
143
144
145
146
147
148
/* Open AES (Application Environment Services) */
if (appl_init() == -1) {
fprintf(stderr, "Can not open AES\n");
return 1;
}
/* Read version and features */
Jul 13, 2007
Jul 13, 2007
149
150
if (aes_global[0] >= 0x0410) {
short ap_gout[4];
Jul 10, 2006
Jul 10, 2006
151
Jul 13, 2007
Jul 13, 2007
152
153
data->wfeatures = 0;
if (appl_getinfo(AES_WINDOW, &ap_gout[0], &ap_gout[1], &ap_gout[2],
Jul 15, 2007
Jul 15, 2007
154
&ap_gout[3]) == 0) {
Jul 13, 2007
Jul 13, 2007
155
data->wfeatures = ap_gout[0];
Jul 10, 2006
Jul 10, 2006
156
157
158
159
}
}
/* Ask VDI physical workstation handle opened by AES */
Jul 13, 2007
Jul 13, 2007
160
data->vdi_handle = graf_handle(&dummy, &dummy, &dummy, &dummy);
Jul 10, 2006
Jul 10, 2006
161
162
163
164
165
166
167
/* Open virtual VDI workstation */
work_in[0] = Getrez() + 2;
for (i = 1; i < 10; i++)
work_in[i] = 1;
work_in[10] = 2;
Jul 13, 2007
Jul 13, 2007
168
169
v_opnvwk(work_in, &(data->vdi_handle), work_out);
if (data->vdi_handle == 0) {
Jul 10, 2006
Jul 10, 2006
170
171
172
173
174
175
fprintf(stderr, "Can not open VDI virtual workstation\n");
return 1;
}
/* Set mouse cursor to arrow */
graf_mouse(ARROW, NULL);
Jul 10, 2006
Jul 10, 2006
177
/* Setup VDI fill functions */
Jul 13, 2007
Jul 13, 2007
178
179
180
vsf_color(data->vdi_handle, 0);
vsf_interior(data->vdi_handle, 1);
vsf_perimeter(data->vdi_handle, 0);
Jun 6, 2005
Jun 6, 2005
181
Jul 13, 2007
Jul 13, 2007
182
GEM_InitModes(_this);
Jul 17, 2004
Jul 17, 2004
183
Jul 13, 2007
Jul 13, 2007
184
185
GEM_InitKeyboard(_this);
GEM_InitMouse(_this);
Jul 17, 2004
Jul 17, 2004
186
Jul 10, 2006
Jul 10, 2006
187
return (0);
Jul 10, 2006
Jul 10, 2006
190
191
void
GEM_VideoQuit(_THIS)
Jul 13, 2007
Jul 13, 2007
193
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
Mar 10, 2002
Mar 10, 2002
194
Jul 13, 2007
Jul 13, 2007
195
196
GEM_QuitMouse(_this);
GEM_QuitKeyboard(_this);
Jul 13, 2007
Jul 13, 2007
198
GEM_QuitModes(_this);
Jul 10, 2006
Jul 10, 2006
200
/* Close VDI workstation */
Jul 13, 2007
Jul 13, 2007
201
202
if (data->vdi_handle) {
v_clsvwk(data->vdi_handle);
Jul 10, 2006
Jul 10, 2006
203
204
}
Jul 13, 2007
Jul 13, 2007
205
appl_exit();
Nov 22, 2004
Nov 22, 2004
206
207
}
Jul 10, 2006
Jul 10, 2006
208
/* vi: set ts=4 sw=4 expandtab: */