119 |
|
mode.depth = VDEPTH_8BIT; |
120 |
|
break; |
121 |
|
case 15: |
122 |
– |
mode.depth = VDEPTH_16BIT; |
123 |
– |
break; |
122 |
|
case 16: |
123 |
|
mode.depth = VDEPTH_16BIT; |
124 |
|
break; |
129 |
|
} |
130 |
|
|
131 |
|
VideoModes.push_back(mode); |
132 |
+ |
video_init_depth_list(); |
133 |
|
VideoMonitor.mode = mode; |
134 |
|
} |
135 |
|
|
155 |
|
TAG_END |
156 |
|
); |
157 |
|
if (the_win == NULL) { |
158 |
< |
ErrorAlert(GetString(STR_OPEN_WINDOW_ERR)); |
158 |
> |
ErrorAlert(STR_OPEN_WINDOW_ERR); |
159 |
|
return false; |
160 |
|
} |
161 |
|
|
162 |
|
// Create bitmap ("height + 2" for safety) |
163 |
|
the_bitmap = AllocBitMap(width, height + 2, 1, BMF_CLEAR, NULL); |
164 |
|
if (the_bitmap == NULL) { |
165 |
< |
ErrorAlert(GetString(STR_NO_MEM_ERR)); |
165 |
> |
ErrorAlert(STR_NO_MEM_ERR); |
166 |
|
return false; |
167 |
|
} |
168 |
|
|
207 |
|
TAG_END |
208 |
|
); |
209 |
|
if (the_win == NULL || error) { |
210 |
< |
ErrorAlert(GetString(STR_OPEN_WINDOW_ERR)); |
210 |
> |
ErrorAlert(STR_OPEN_WINDOW_ERR); |
211 |
|
return false; |
212 |
|
} |
213 |
|
|
215 |
|
p96PIP_GetTags(the_win, P96PIP_SourceBitMap, (ULONG)&the_bitmap, TAG_END); |
216 |
|
|
217 |
|
// Add resolution and set VideoMonitor |
219 |
– |
set_video_monitor(width, height, p96GetBitMapAttr(the_bitmap, P96BMA_BYTESPERROW), 16); |
218 |
|
VideoMonitor.mac_frame_base = p96GetBitMapAttr(the_bitmap, P96BMA_MEMORY); |
219 |
+ |
set_video_monitor(width, height, p96GetBitMapAttr(the_bitmap, P96BMA_BYTESPERROW), 16); |
220 |
|
return true; |
221 |
|
} |
222 |
|
|
236 |
|
case 15: |
237 |
|
case 16: |
238 |
|
if (format != RGBFB_R5G5B5) { |
239 |
< |
ErrorAlert(GetString(STR_WRONG_SCREEN_FORMAT_ERR)); |
239 |
> |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
240 |
|
return false; |
241 |
|
} |
242 |
|
break; |
243 |
|
case 24: |
244 |
|
case 32: |
245 |
|
if (format != RGBFB_A8R8G8B8) { |
246 |
< |
ErrorAlert(GetString(STR_WRONG_SCREEN_FORMAT_ERR)); |
246 |
> |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
247 |
|
return false; |
248 |
|
} |
249 |
|
break; |
250 |
|
default: |
251 |
< |
ErrorAlert(GetString(STR_WRONG_SCREEN_DEPTH_ERR)); |
251 |
> |
ErrorAlert(STR_WRONG_SCREEN_DEPTH_ERR); |
252 |
|
return false; |
253 |
|
} |
254 |
|
|
267 |
|
TAG_END |
268 |
|
); |
269 |
|
if (the_screen == NULL) { |
270 |
< |
ErrorAlert(GetString(STR_OPEN_SCREEN_ERR)); |
270 |
> |
ErrorAlert(STR_OPEN_SCREEN_ERR); |
271 |
|
return false; |
272 |
|
} |
273 |
|
|
284 |
|
TAG_END |
285 |
|
); |
286 |
|
if (the_win == NULL) { |
287 |
< |
ErrorAlert(GetString(STR_OPEN_WINDOW_ERR)); |
287 |
> |
ErrorAlert(STR_OPEN_WINDOW_ERR); |
288 |
|
return false; |
289 |
|
} |
290 |
|
|
313 |
|
case 16: |
314 |
|
// !!! PIXFMT_RGB15 is correct !!! |
315 |
|
if (format != PIXFMT_RGB15) { |
316 |
< |
ErrorAlert(GetString(STR_WRONG_SCREEN_FORMAT_ERR)); |
316 |
> |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
317 |
|
return false; |
318 |
|
} |
319 |
|
break; |
320 |
|
case 24: |
321 |
|
case 32: |
322 |
|
if (format != PIXFMT_ARGB32) { |
323 |
< |
ErrorAlert(GetString(STR_WRONG_SCREEN_FORMAT_ERR)); |
323 |
> |
ErrorAlert(STR_WRONG_SCREEN_FORMAT_ERR); |
324 |
|
return false; |
325 |
|
} |
326 |
|
break; |
327 |
|
default: |
328 |
< |
ErrorAlert(GetString(STR_WRONG_SCREEN_DEPTH_ERR)); |
328 |
> |
ErrorAlert(STR_WRONG_SCREEN_DEPTH_ERR); |
329 |
|
return false; |
330 |
|
} |
331 |
|
|
342 |
|
TAG_END |
343 |
|
); |
344 |
|
if (the_screen == NULL) { |
345 |
< |
ErrorAlert(GetString(STR_OPEN_SCREEN_ERR)); |
345 |
> |
ErrorAlert(STR_OPEN_SCREEN_ERR); |
346 |
|
return false; |
347 |
|
} |
348 |
|
|
359 |
|
TAG_END |
360 |
|
); |
361 |
|
if (the_win == NULL) { |
362 |
< |
ErrorAlert(GetString(STR_OPEN_WINDOW_ERR)); |
362 |
> |
ErrorAlert(STR_OPEN_WINDOW_ERR); |
363 |
|
return false; |
364 |
|
} |
365 |
|
|
384 |
|
// Allocate blank mouse pointer data |
385 |
|
null_pointer = (UWORD *)AllocMem(12, MEMF_PUBLIC | MEMF_CHIP | MEMF_CLEAR); |
386 |
|
if (null_pointer == NULL) { |
387 |
< |
ErrorAlert(GetString(STR_NO_MEM_ERR)); |
387 |
> |
ErrorAlert(STR_NO_MEM_ERR); |
388 |
|
return false; |
389 |
|
} |
390 |
|
|
415 |
|
else if (CyberGfxBase && IsCyberModeID(mode_id)) |
416 |
|
display_type = DISPLAY_SCREEN_CGFX; |
417 |
|
else { |
418 |
< |
ErrorAlert(GetString(STR_NO_P96_MODE_ERR)); |
418 |
> |
ErrorAlert(STR_NO_P96_MODE_ERR); |
419 |
|
return false; |
420 |
|
} |
421 |
|
} |
452 |
|
TAG_END |
453 |
|
); |
454 |
|
if (periodic_proc == NULL) { |
455 |
< |
ErrorAlert(GetString(STR_NO_MEM_ERR)); |
455 |
> |
ErrorAlert(STR_NO_MEM_ERR); |
456 |
|
return false; |
457 |
|
} |
458 |
|
return true; |
537 |
|
* Set palette |
538 |
|
*/ |
539 |
|
|
540 |
< |
void video_set_palette(uint8 *pal) |
540 |
> |
void video_set_palette(uint8 *pal, in num) |
541 |
|
{ |
542 |
< |
if (display_type == DISPLAY_SCREEN_P96 || display_type == DISPLAY_SCREEN_CGFX) { |
542 |
> |
if ((display_type == DISPLAY_SCREEN_P96 || display_type == DISPLAY_SCREEN_CGFX) |
543 |
> |
&& !IsDirectMode(VideoMonitor.mode)) { |
544 |
|
|
545 |
|
// Convert palette to 32 bits |
546 |
|
ULONG table[2 + 256 * 3]; |
547 |
< |
table[0] = 256 << 16; |
548 |
< |
table[256 * 3 + 1] = 0; |
549 |
< |
for (int i=0; i<256; i++) { |
547 |
> |
table[0] = num << 16; |
548 |
> |
table[num * 3 + 1] = 0; |
549 |
> |
for (int i=0; i<num; i++) { |
550 |
|
table[i*3+1] = pal[i*3] * 0x01010101; |
551 |
|
table[i*3+2] = pal[i*3+1] * 0x01010101; |
552 |
|
table[i*3+3] = pal[i*3+2] * 0x01010101; |