Rev 6380 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6380 | Rev 6386 | ||
---|---|---|---|
1 | #include |
1 | #include |
2 | #include |
2 | #include |
3 | #include |
3 | #include |
4 | #include "SDL.h" |
4 | #include "SDL.h" |
5 | #include "SDL_error.h" |
5 | #include "SDL_error.h" |
6 | #include "SDL_video.h" |
6 | #include "SDL_video.h" |
7 | #include "SDL_mouse.h" |
7 | #include "SDL_mouse.h" |
8 | #include "SDL_sysvideo.h" |
8 | #include "SDL_sysvideo.h" |
9 | #include "SDL_pixels_c.h" |
9 | #include "SDL_pixels_c.h" |
10 | #include "SDL_events_c.h" |
10 | #include "SDL_events_c.h" |
11 | #include "SDL_menuetvideo.h" |
11 | #include "SDL_menuetvideo.h" |
12 | #include |
12 | #include |
13 | - | ||
14 | struct process_table_entry |
- | |
15 | { |
- | |
16 | uint32_t cpu_usage; |
- | |
17 | uint16_t pos_in_windowing_stack; |
- | |
18 | uint16_t win_stack_val_at_ecx; |
- | |
19 | uint16_t reserved1; |
- | |
20 | char name[12]; |
- | |
21 | uint32_t memstart; |
- | |
22 | uint32_t memused; |
- | |
23 | uint32_t pid; |
- | |
24 | uint32_t winx_start,winy_start; |
- | |
25 | uint32_t winx_size,winy_size; |
- | |
26 | uint16_t thread_state; |
- | |
27 | uint16_t reserved2; |
- | |
28 | uint32_t client_left,client_top,client_width,client_height; |
- | |
29 | uint8_t window_state; |
- | |
30 | uint8_t reserved3[1024-71]; |
- | |
31 | }; |
- | |
32 | 13 | ||
33 | static SDL_VideoDevice * vm_suf=NULL; |
14 | static SDL_VideoDevice * vm_suf=NULL; |
34 | static int was_initialized=0; |
15 | static int was_initialized=0; |
35 | 16 | ||
36 | static int has_null_cursor=0; |
17 | static int has_null_cursor=0; |
37 | static int null_cursor; |
18 | static int null_cursor; |
38 | 19 | ||
39 | inline int get_skinh(void) |
20 | inline int get_skinh(void) |
40 | { |
21 | { |
41 | int res; |
22 | int res; |
42 | __asm__ ("int $0x40" : "=a"(res) : "a"(48),"b"(4)); |
23 | __asm__ ("int $0x40" : "=a"(res) : "a"(48),"b"(4)); |
43 | return res; |
24 | return res; |
44 | } |
25 | } |
45 | 26 | ||
46 | //#define KEEP_OBSOLETE_STYLE3 |
27 | //#define KEEP_OBSOLETE_STYLE3 |
47 | 28 | ||
48 | #ifdef KEEP_OBSOLETE_STYLE3 |
29 | #ifdef KEEP_OBSOLETE_STYLE3 |
49 | static int IsStyle4Available=0; |
30 | static int IsStyle4Available=0; |
50 | #endif |
31 | #endif |
51 | 32 | ||
52 | void MenuetOS_SDL_RepaintWnd(void) |
33 | void MenuetOS_SDL_RepaintWnd(void) |
53 | { |
34 | { |
54 | begin_draw(); |
35 | __menuet__window_redraw(1); |
55 | sys_create_window(1,1,vm_suf->hidden->win_size_x+9,vm_suf->hidden->win_size_y+get_skinh()+4, (int)vm_suf->hidden->__title, 0x000000,0x34000000); |
36 | __menuet__define_window(1,1,vm_suf->hidden->win_size_x+9,vm_suf->hidden->win_size_y+get_skinh()+4, |
- | 37 | #ifdef KEEP_OBSOLETE_STYLE3 |
|
- | 38 | IsStyle4Available?0x34000000:0x33000000 |
|
- | 39 | #else |
|
- | 40 | 0x34000000 |
|
- | 41 | #endif |
|
- | 42 | ,0,(int)vm_suf->hidden->__title); |
|
- | 43 | ||
- | 44 | // __asm__ __volatile__("int3"); |
|
56 | 45 | ||
57 | if(vm_suf && vm_suf->hidden->__video_buffer) |
46 | if(vm_suf && vm_suf->hidden->__video_buffer) |
58 | put_image(1,1, |
47 | __menuet__putimage(0,0, |
59 | vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y, |
48 | vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y, |
60 | vm_suf->hidden->__video_buffer); |
- | |
61 | 49 | vm_suf->hidden->__video_buffer); |
|
62 | end_draw(); |
50 | __menuet__window_redraw(2); |
63 | } |
51 | } |
64 | 52 | ||
65 | static int MenuetOS_AllocHWSurface(_THIS,SDL_Surface * surface) |
53 | static int MenuetOS_AllocHWSurface(_THIS,SDL_Surface * surface) |
66 | { |
54 | { |
67 | return -1; |
55 | return -1; |
68 | } |
56 | } |
69 | 57 | ||
70 | static void MenuetOS_FreeHWSurface(_THIS,SDL_Surface * surface) |
58 | static void MenuetOS_FreeHWSurface(_THIS,SDL_Surface * surface) |
71 | { |
59 | { |
72 | } |
60 | } |
73 | 61 | ||
74 | static int MenuetOS_LockHWSurface(_THIS,SDL_Surface * surface) |
62 | static int MenuetOS_LockHWSurface(_THIS,SDL_Surface * surface) |
75 | { |
63 | { |
76 | return 0; |
64 | return 0; |
77 | } |
65 | } |
78 | 66 | ||
79 | static void MenuetOS_UnlockHWSurface(_THIS,SDL_Surface * surface) |
67 | static void MenuetOS_UnlockHWSurface(_THIS,SDL_Surface * surface) |
80 | { |
68 | { |
81 | } |
69 | } |
82 | 70 | ||
83 | static void MenuetOS_DirectUpdate(_THIS,int numrects,SDL_Rect * rects) |
71 | static void MenuetOS_DirectUpdate(_THIS,int numrects,SDL_Rect * rects) |
84 | { |
72 | { |
85 | if(numrects) |
73 | if(numrects) |
86 | { |
74 | { |
87 | put_image(1,1, |
75 | __menuet__putimage(0,0, |
88 | vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y, |
76 | vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y, |
89 | this->hidden->__video_buffer); |
77 | this->hidden->__video_buffer); |
90 | } |
78 | } |
91 | } |
79 | } |
92 | 80 | ||
93 | int MenuetOS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) |
81 | int MenuetOS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) |
94 | { |
82 | { |
95 | return 0; |
83 | return 0; |
96 | } |
84 | } |
97 | 85 | ||
98 | void MenuetOS_VideoQuit(_THIS) |
86 | void MenuetOS_VideoQuit(_THIS) |
99 | { |
87 | { |
100 | if (has_null_cursor) |
88 | if (has_null_cursor) |
101 | { |
89 | { |
102 | __asm__("int $0x40"::"a"(37),"b"(6),"c"(null_cursor)); |
90 | __asm__("int $0x40"::"a"(37),"b"(6),"c"(null_cursor)); |
103 | has_null_cursor = 0; |
91 | has_null_cursor = 0; |
104 | } |
92 | } |
105 | } |
93 | } |
106 | 94 | ||
107 | void MenuetOS_FinalQuit(void) |
95 | void MenuetOS_FinalQuit(void) |
108 | { |
96 | { |
109 | } |
97 | } |
110 | 98 | ||
111 | void MenuetOS_SetCaption(_THIS,const char * title,const char * icon) |
99 | void MenuetOS_SetCaption(_THIS,const char * title,const char * icon) |
112 | { |
100 | { |
113 | this->hidden->__title=(char *)title; |
101 | this->hidden->__title=(char *)title; |
114 | if(was_initialized) __asm__("int $0x40"::"a"(71),"b"(1),"c"(title)); |
102 | if(was_initialized) __asm__("int $0x40"::"a"(71),"b"(1),"c"(title)); |
115 | } |
103 | } |
116 | 104 | ||
117 | SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags) |
105 | SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags) |
118 | { |
106 | { |
119 | int ly; |
107 | int ly; |
120 | char * lx; |
108 | char * lx; |
121 | if(bpp!=24) return NULL; |
109 | if(bpp!=24) return NULL; |
122 | current->flags=flags; |
110 | current->flags=flags; |
123 | current->w=width; |
111 | current->w=width; |
124 | current->h=height; |
112 | current->h=height; |
125 | current->pitch=width*(bpp>>3); |
113 | current->pitch=width*(bpp>>3); |
- | 114 | ||
- | 115 | char info[100]; |
|
- | 116 | sprintf(info, "width = %d, height = %d, pitch = %d, bpp = %d\n", current->w, current->h, current->pitch, bpp); |
|
- | 117 | ||
- | 118 | void debug_board_write_byte(const char ch){ |
|
- | 119 | __asm__ __volatile__( |
|
- | 120 | "int $0x40" |
|
- | 121 | : |
|
- | 122 | :"a"(63), "b"(1), "c"(ch)); |
|
- | 123 | } |
|
- | 124 | ||
- | 125 | void debug_board_write_str(const char* str){ |
|
- | 126 | while(*str) |
|
- | 127 | debug_board_write_byte(*str++); |
|
- | 128 | } |
|
- | 129 | ||
- | 130 | debug_board_write_str(info); |
|
- | 131 | // __asm__ __volatile__("int3"); |
|
- | 132 | ||
126 | current->pixels=this->hidden->__video_buffer=realloc(this->hidden->__video_buffer, |
133 | current->pixels=this->hidden->__video_buffer=realloc(this->hidden->__video_buffer, |
127 | current->pitch*current->h); |
134 | current->pitch*current->h); |
128 | this->hidden->__lines=(unsigned char **)realloc(this->hidden->__lines, |
135 | this->hidden->__lines=(unsigned char **)realloc(this->hidden->__lines, |
129 | sizeof(unsigned char *)*current->h); |
136 | sizeof(unsigned char *)*current->h); |
- | 137 | ||
130 | for(ly=0,lx=current->pixels;ly |
138 | for(ly=0,lx=current->pixels;ly |
131 | this->hidden->__lines[ly]=lx; |
139 | this->hidden->__lines[ly]=lx; |
- | 140 | ||
132 | this->UpdateRects=MenuetOS_DirectUpdate; |
141 | this->UpdateRects=MenuetOS_DirectUpdate; |
133 | this->hidden->win_size_x=width; |
142 | this->hidden->win_size_x=width; |
134 | this->hidden->win_size_y=height; |
143 | this->hidden->win_size_y=height; |
135 | vm_suf=this; |
144 | vm_suf=this; |
136 | if (was_initialized) |
145 | if (was_initialized) |
137 | { |
146 | { |
138 | unsigned newheight = height+get_skinh()+4; |
147 | unsigned newheight = height+get_skinh()+4; |
139 | unsigned newwidth = width+9; |
148 | unsigned newwidth = width+9; |
140 | __asm__("int $0x40"::"a"(67),"b"(-1),"c"(-1),"d"(newwidth),"S"(newheight)); |
149 | __asm__("int $0x40"::"a"(67),"b"(-1),"c"(-1),"d"(newwidth),"S"(newheight)); |
141 | } |
150 | } |
142 | else |
151 | else |
143 | { |
152 | { |
144 | set_wanted_events_mask(0x27); |
153 | __menuet__set_bitfield_for_wanted_events(0x27); |
145 | was_initialized=1; |
154 | was_initialized=1; |
146 | MenuetOS_SDL_RepaintWnd(); |
155 | MenuetOS_SDL_RepaintWnd(); |
147 | } |
156 | } |
148 | return current; |
157 | return current; |
149 | } |
158 | } |
150 | 159 | ||
151 | /*static SDL_Rect video_mode[4]; |
160 | /*static SDL_Rect video_mode[4]; |
152 | static SDL_Rect * SDL_modelist[4]={NULL,NULL,NULL,NULL};*/ |
161 | static SDL_Rect * SDL_modelist[4]={NULL,NULL,NULL,NULL};*/ |
153 | 162 | ||
154 | static SDL_Rect ** MenuetOS_ListModes(_THIS,SDL_PixelFormat * fmt,Uint32 flags) |
163 | static SDL_Rect ** MenuetOS_ListModes(_THIS,SDL_PixelFormat * fmt,Uint32 flags) |
155 | { |
164 | { |
156 | // return (&SDL_modelist[((fmt->BitsPerPixel+7)/8)-1]); |
165 | // return (&SDL_modelist[((fmt->BitsPerPixel+7)/8)-1]); |
157 | if (fmt->BitsPerPixel==24) |
166 | if (fmt->BitsPerPixel==24) |
158 | return (SDL_Rect**)-1; |
167 | return (SDL_Rect**)-1; |
159 | else |
168 | else |
160 | return NULL; |
169 | return NULL; |
161 | } |
170 | } |
162 | 171 | ||
163 | static int MenuetOS_Available(void) |
172 | static int MenuetOS_Available(void) |
164 | { |
173 | { |
165 | return 1; |
174 | return 1; |
166 | } |
175 | } |
167 | 176 | ||
168 | static void MenuetOS_DeleteDevice(_THIS) |
177 | static void MenuetOS_DeleteDevice(_THIS) |
169 | { |
178 | { |
170 | // free(this->hidden->__video_buffer); // it will be freed as current->pixels |
179 | // free(this->hidden->__video_buffer); // it will be freed as current->pixels |
171 | free(this->hidden->__lines); |
180 | free(this->hidden->__lines); |
172 | } |
181 | } |
173 | 182 | ||
174 | static int MenuetOS_VideoInit(_THIS,SDL_PixelFormat * vformat) |
183 | static int MenuetOS_VideoInit(_THIS,SDL_PixelFormat * vformat) |
175 | { |
184 | { |
176 | #ifdef KEEP_OBSOLETE_STYLE3 |
185 | #ifdef KEEP_OBSOLETE_STYLE3 |
177 | char buf[16]; |
186 | char buf[16]; |
178 | __asm__("int $0x40"::"a"(18),"b"(13),"c"(buf)); |
187 | __asm__("int $0x40"::"a"(18),"b"(13),"c"(buf)); |
179 | if (buf[5]=='K' && buf[6]=='o' && buf[7]=='l' && buf[8]=='i') |
188 | if (buf[5]=='K' && buf[6]=='o' && buf[7]=='l' && buf[8]=='i') |
180 | /* kernels up to 0.7.0.0 do not support style 4 */; |
189 | /* kernels up to 0.7.0.0 do not support style 4 */; |
181 | else if (*(unsigned*)(buf+5) >= 549) |
190 | else if (*(unsigned*)(buf+5) >= 549) |
182 | /* window style 4 was introduced in revision 549 */ |
191 | /* window style 4 was introduced in revision 549 */ |
183 | IsStyle4Available = 1; |
192 | IsStyle4Available = 1; |
184 | #endif |
193 | #endif |
185 | vformat->BitsPerPixel=24; |
194 | vformat->BitsPerPixel=24; |
186 | vformat->BytesPerPixel=3; |
195 | vformat->BytesPerPixel=3; |
187 | this->info.wm_available=1; |
196 | this->info.wm_available=1; |
188 | this->info.hw_available=0; |
197 | this->info.hw_available=0; |
189 | this->info.video_mem=0x200000; |
198 | this->info.video_mem=0x200000; |
190 | /* video_mode[3].x=0; |
199 | /* video_mode[3].x=0; |
191 | video_mode[3].y=0; |
200 | video_mode[3].y=0; |
192 | video_mode[3].w=320; |
201 | video_mode[3].w=320; |
193 | video_mode[3].h=200; |
202 | video_mode[3].h=200; |
194 | video_mode[2].x=0; |
203 | video_mode[2].x=0; |
195 | video_mode[2].y=0; |
204 | video_mode[2].y=0; |
196 | video_mode[2].w=640; |
205 | video_mode[2].w=640; |
197 | video_mode[2].h=400; |
206 | video_mode[2].h=400; |
198 | video_mode[1].x=0; |
207 | video_mode[1].x=0; |
199 | video_mode[1].y=0; |
208 | video_mode[1].y=0; |
200 | video_mode[1].w=320; |
209 | video_mode[1].w=320; |
201 | video_mode[1].h=240; |
210 | video_mode[1].h=240; |
202 | video_mode[0].x=0; |
211 | video_mode[0].x=0; |
203 | video_mode[0].y=0; |
212 | video_mode[0].y=0; |
204 | video_mode[0].w=640; |
213 | video_mode[0].w=640; |
205 | video_mode[0].h=480; |
214 | video_mode[0].h=480; |
206 | SDL_modelist[2]=video_mode+0;*/ |
215 | SDL_modelist[2]=video_mode+0;*/ |
207 | return 0; |
216 | return 0; |
208 | } |
217 | } |
209 | 218 | ||
210 | static int MenuetOS_FlipHWSurface(_THIS,SDL_Surface * surface) |
219 | static int MenuetOS_FlipHWSurface(_THIS,SDL_Surface * surface) |
211 | { |
220 | { |
212 | put_image(1,1,surface->w,surface->h, surface->pixels); |
221 | __menuet__putimage(0,0,surface->w,surface->h, |
- | 222 | surface->pixels); |
|
213 | return 0; |
223 | return 0; |
214 | } |
224 | } |
215 | 225 | ||
216 | WMcursor* KolibriOS_CreateWMCursor(_THIS, |
226 | WMcursor* KolibriOS_CreateWMCursor(_THIS, |
217 | Uint8* data, Uint8* mask, int w, int h, int hot_x, int hot_y) |
227 | Uint8* data, Uint8* mask, int w, int h, int hot_x, int hot_y) |
218 | { |
228 | { |
219 | int i,j; |
229 | int i,j; |
220 | Uint32* cursor; |
230 | Uint32* cursor; |
221 | WMcursor* res; |
231 | WMcursor* res; |
222 | 232 | ||
223 | if (w>32 || h>32) return NULL; |
233 | if (w>32 || h>32) return NULL; |
224 | if (w%8 || h%8) return NULL; |
234 | if (w%8 || h%8) return NULL; |
225 | cursor = (Uint32*)malloc(32*32*4); |
235 | cursor = (Uint32*)malloc(32*32*4); |
226 | if (!cursor) return NULL; |
236 | if (!cursor) return NULL; |
227 | for (i=0;i<32;i++) |
237 | for (i=0;i<32;i++) |
228 | for (j=0;j<32;j++) |
238 | for (j=0;j<32;j++) |
229 | { |
239 | { |
230 | if (i>=h || j>=w) |
240 | if (i>=h || j>=w) |
231 | { |
241 | { |
232 | cursor[i*32+j] = 0x00000000; |
242 | cursor[i*32+j] = 0x00000000; |
233 | continue; |
243 | continue; |
234 | } |
244 | } |
235 | if (mask[i*w/8+j/8] & (0x80>>(j&7))) |
245 | if (mask[i*w/8+j/8] & (0x80>>(j&7))) |
236 | cursor[i*32+j] = (data[i*w/8+j/8] & (0x80>>(j&7)))?0xFF000000:0xFFFFFFFF; |
246 | cursor[i*32+j] = (data[i*w/8+j/8] & (0x80>>(j&7)))?0xFF000000:0xFFFFFFFF; |
237 | else |
247 | else |
238 | cursor[i*32+j] = 0x00000000; |
248 | cursor[i*32+j] = 0x00000000; |
239 | } |
249 | } |
240 | __asm__ ("int $0x40" : "=a"(res) : "a"(37),"b"(4), |
250 | __asm__ ("int $0x40" : "=a"(res) : "a"(37),"b"(4), |
241 | "c"(cursor),"d"((hot_x<<24)+(hot_y<<16)+2)); |
251 | "c"(cursor),"d"((hot_x<<24)+(hot_y<<16)+2)); |
242 | free(cursor); |
252 | free(cursor); |
243 | return res; |
253 | return res; |
244 | } |
254 | } |
245 | int KolibriOS_ShowWMCursor(_THIS,WMcursor*cursor) |
255 | int KolibriOS_ShowWMCursor(_THIS,WMcursor*cursor) |
246 | { |
256 | { |
247 | if (!cursor) |
257 | if (!cursor) |
248 | { |
258 | { |
249 | if (!has_null_cursor) |
259 | if (!has_null_cursor) |
250 | { |
260 | { |
251 | unsigned* u = malloc(32*32*4); |
261 | unsigned* u = malloc(32*32*4); |
252 | if (!u) return 1; |
262 | if (!u) return 1; |
253 | memset(u,0,32*32*4); |
263 | memset(u,0,32*32*4); |
254 | __asm__("int $0x40":"=a"(null_cursor): |
264 | __asm__("int $0x40":"=a"(null_cursor): |
255 | "a"(37),"b"(4),"c"(u),"d"(2)); |
265 | "a"(37),"b"(4),"c"(u),"d"(2)); |
256 | free(u); |
266 | free(u); |
257 | has_null_cursor = 1; |
267 | has_null_cursor = 1; |
258 | } |
268 | } |
259 | cursor = (WMcursor*)null_cursor; |
269 | cursor = (WMcursor*)null_cursor; |
260 | } |
270 | } |
261 | __asm__("int $0x40" : : "a"(37),"b"(5),"c"(cursor)); |
271 | __asm__("int $0x40" : : "a"(37),"b"(5),"c"(cursor)); |
262 | return 1; |
272 | return 1; |
263 | } |
273 | } |
264 | void KolibriOS_FreeWMCursor(_THIS,WMcursor*cursor) |
274 | void KolibriOS_FreeWMCursor(_THIS,WMcursor*cursor) |
265 | { |
275 | { |
266 | __asm__("int $0x40" : : "a"(37),"b"(6),"c"(cursor)); |
276 | __asm__("int $0x40" : : "a"(37),"b"(6),"c"(cursor)); |
267 | } |
277 | } |
268 | void KolibriOS_CheckMouseMode(_THIS) |
278 | void KolibriOS_CheckMouseMode(_THIS) |
269 | { |
279 | { |
270 | if (this->input_grab == SDL_GRAB_OFF) |
280 | if (this->input_grab == SDL_GRAB_OFF) |
271 | return; |
281 | return; |
272 | struct process_table_entry buf; |
282 | struct process_table_entry buf; |
273 | int res; |
283 | int res; |
274 | __asm__ volatile("int $0x40" : "=a"(res): "a"(9), "b"(&buf), "c"(-1)); |
284 | __asm__ volatile("int $0x40" : "=a"(res): "a"(9), "b"(&buf), "c"(-1)); |
275 | if (res == buf.pos_in_windowing_stack) |
285 | if (res == buf.pos_in_windowing_stack) |
276 | { |
286 | { |
277 | int x = buf.winx_start + buf.client_left + this->hidden->win_size_x/2; |
287 | int x = buf.winx_start + buf.client_left + this->hidden->win_size_x/2; |
278 | int y = buf.winy_start + buf.client_top + this->hidden->win_size_y/2; |
288 | int y = buf.winy_start + buf.client_top + this->hidden->win_size_y/2; |
279 | __asm__("int $0x40" : : "a"(18),"b"(19),"c"(4), |
289 | __asm__("int $0x40" : : "a"(18),"b"(19),"c"(4), |
280 | "d"(x*65536+y)); |
290 | "d"(x*65536+y)); |
281 | } |
291 | } |
282 | } |
292 | } |
283 | 293 | ||
284 | char def_title[] = "KolibriOS SDL App"; |
294 | char def_title[] = "KolibriOS SDL App"; |
285 | static SDL_VideoDevice * MenuetOS_CreateDevice(int indx) |
295 | static SDL_VideoDevice * MenuetOS_CreateDevice(int indx) |
286 | { |
296 | { |
287 | SDL_VideoDevice * dev; |
297 | SDL_VideoDevice * dev; |
288 | dev=(SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); |
298 | dev=(SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); |
289 | if(dev) |
299 | if(dev) |
290 | { |
300 | { |
291 | memset(dev,0,(sizeof *dev)); |
301 | memset(dev,0,(sizeof *dev)); |
292 | dev->hidden = (struct SDL_PrivateVideoData *)malloc((sizeof *dev->hidden)); |
302 | dev->hidden = (struct SDL_PrivateVideoData *)malloc((sizeof *dev->hidden)); |
293 | } |
303 | } |
294 | if((dev==NULL) || (dev->hidden==NULL)) |
304 | if((dev==NULL) || (dev->hidden==NULL)) |
295 | { |
305 | { |
296 | SDL_OutOfMemory(); |
306 | SDL_OutOfMemory(); |
297 | if(dev) |
307 | if(dev) |
298 | { |
308 | { |
299 | free(dev); |
309 | free(dev); |
300 | } |
310 | } |
301 | return(0); |
311 | return(0); |
302 | } |
312 | } |
303 | memset(dev->hidden,0,(sizeof *dev->hidden)); |
313 | memset(dev->hidden,0,(sizeof *dev->hidden)); |
304 | dev->hidden->__title = def_title; |
314 | dev->hidden->__title = def_title; |
305 | dev->VideoInit=MenuetOS_VideoInit; |
315 | dev->VideoInit=MenuetOS_VideoInit; |
306 | dev->ListModes=MenuetOS_ListModes; |
316 | dev->ListModes=MenuetOS_ListModes; |
307 | dev->SetVideoMode=MenuetOS_SetVideoMode; |
317 | dev->SetVideoMode=MenuetOS_SetVideoMode; |
308 | dev->SetColors=MenuetOS_SetColors; |
318 | dev->SetColors=MenuetOS_SetColors; |
309 | dev->UpdateRects=NULL; |
319 | dev->UpdateRects=NULL; |
310 | dev->VideoQuit=MenuetOS_VideoQuit; |
320 | dev->VideoQuit=MenuetOS_VideoQuit; |
311 | dev->AllocHWSurface=MenuetOS_AllocHWSurface; |
321 | dev->AllocHWSurface=MenuetOS_AllocHWSurface; |
312 | dev->CheckHWBlit=NULL; |
322 | dev->CheckHWBlit=NULL; |
313 | dev->FillHWRect=NULL; |
323 | dev->FillHWRect=NULL; |
314 | dev->SetHWColorKey=NULL; |
324 | dev->SetHWColorKey=NULL; |
315 | dev->SetHWAlpha=NULL; |
325 | dev->SetHWAlpha=NULL; |
316 | dev->LockHWSurface=MenuetOS_LockHWSurface; |
326 | dev->LockHWSurface=MenuetOS_LockHWSurface; |
317 | dev->UnlockHWSurface=MenuetOS_UnlockHWSurface; |
327 | dev->UnlockHWSurface=MenuetOS_UnlockHWSurface; |
318 | dev->FlipHWSurface=MenuetOS_FlipHWSurface; |
328 | dev->FlipHWSurface=MenuetOS_FlipHWSurface; |
319 | dev->FreeHWSurface=MenuetOS_FreeHWSurface; |
329 | dev->FreeHWSurface=MenuetOS_FreeHWSurface; |
320 | dev->SetCaption=MenuetOS_SetCaption; |
330 | dev->SetCaption=MenuetOS_SetCaption; |
321 | dev->SetIcon=NULL; |
331 | dev->SetIcon=NULL; |
322 | dev->IconifyWindow=NULL; |
332 | dev->IconifyWindow=NULL; |
323 | dev->GrabInput=NULL; |
333 | dev->GrabInput=NULL; |
324 | dev->GetWMInfo=NULL; |
334 | dev->GetWMInfo=NULL; |
325 | dev->InitOSKeymap=MenuetOS_InitOSKeymap; |
335 | dev->InitOSKeymap=MenuetOS_InitOSKeymap; |
326 | dev->PumpEvents=MenuetOS_PumpEvents; |
336 | dev->PumpEvents=MenuetOS_PumpEvents; |
327 | dev->free=MenuetOS_DeleteDevice; |
337 | dev->free=MenuetOS_DeleteDevice; |
328 | dev->CreateWMCursor = KolibriOS_CreateWMCursor; |
338 | dev->CreateWMCursor = KolibriOS_CreateWMCursor; |
329 | dev->FreeWMCursor = KolibriOS_FreeWMCursor; |
339 | dev->FreeWMCursor = KolibriOS_FreeWMCursor; |
330 | dev->ShowWMCursor = KolibriOS_ShowWMCursor; |
340 | dev->ShowWMCursor = KolibriOS_ShowWMCursor; |
331 | dev->CheckMouseMode = KolibriOS_CheckMouseMode; |
341 | dev->CheckMouseMode = KolibriOS_CheckMouseMode; |
332 | return dev; |
342 | return dev; |
333 | } |
343 | } |
334 | 344 | ||
335 | VideoBootStrap mosvideo_bootstrab={ |
345 | VideoBootStrap mosvideo_bootstrab={ |
336 | "menuetos","MenuetOS Device Driver", |
346 | "menuetos","MenuetOS Device Driver", |
337 | MenuetOS_Available,MenuetOS_CreateDevice, |
347 | MenuetOS_Available,MenuetOS_CreateDevice, |
338 | };16)+2)); |
348 | };16)+2)); |
339 | ><16)+2)); |
349 | ><16)+2)); |
340 | >24)+(hot_y<<16)+2)); |
350 | >24)+(hot_y<<16)+2)); |
341 | ><24)+(hot_y<<16)+2)); |
351 | ><24)+(hot_y<<16)+2)); |
342 | >32;j++) |
352 | >32;j++) |
343 | >32;i++) |
353 | >32;i++) |
344 | > |
354 | > |