comparison src/video/gem/SDL_gemvideo.c @ 319:189a6a3416c7

*** empty log message ***
author Sam Lantinga <slouken@libsdl.org>
date Tue, 26 Mar 2002 17:37:31 +0000
parents 9c6613983e85
children 9ff7e90aaa94
comparison
equal deleted inserted replaced
318:0910a3034576 319:189a6a3416c7
49 #include "SDL_video.h" 49 #include "SDL_video.h"
50 #include "SDL_mouse.h" 50 #include "SDL_mouse.h"
51 #include "SDL_sysvideo.h" 51 #include "SDL_sysvideo.h"
52 #include "SDL_pixels_c.h" 52 #include "SDL_pixels_c.h"
53 #include "SDL_events_c.h" 53 #include "SDL_events_c.h"
54 #include "SDL_cursor_c.h"
54 55
55 #include "SDL_ataric2p_s.h" 56 #include "SDL_ataric2p_s.h"
56 #include "SDL_ataric2p060_c.h" 57 #include "SDL_ataric2p060_c.h"
57 #include "SDL_atarieddi_s.h" 58 #include "SDL_atarieddi_s.h"
58 #include "SDL_atarimxalloc_c.h" 59 #include "SDL_atarimxalloc_c.h"
93 static int GEM_ToggleFullScreen(_THIS, int on); 94 static int GEM_ToggleFullScreen(_THIS, int on);
94 #endif 95 #endif
95 96
96 /* Internal functions */ 97 /* Internal functions */
97 static void GEM_FreeBuffers(_THIS); 98 static void GEM_FreeBuffers(_THIS);
99 static void GEM_ClearScreen(_THIS);
100 static void GEM_LockScreen(_THIS);
101 static void GEM_UnlockScreen(_THIS);
98 static void refresh_window(_THIS, int winhandle, short *rect); 102 static void refresh_window(_THIS, int winhandle, short *rect);
99 103
100 /* GEM driver bootstrap functions */ 104 /* GEM driver bootstrap functions */
101 105
102 static int GEM_Available(void) 106 static int GEM_Available(void)
172 176
173 /* Mouse */ 177 /* Mouse */
174 device->FreeWMCursor = GEM_FreeWMCursor; 178 device->FreeWMCursor = GEM_FreeWMCursor;
175 device->CreateWMCursor = GEM_CreateWMCursor; 179 device->CreateWMCursor = GEM_CreateWMCursor;
176 device->ShowWMCursor = GEM_ShowWMCursor; 180 device->ShowWMCursor = GEM_ShowWMCursor;
177 device->WarpWMCursor = GEM_WarpWMCursor; 181 device->WarpWMCursor = NULL /*GEM_WarpWMCursor*/;
178 device->CheckMouseMode = GEM_CheckMouseMode; 182 device->CheckMouseMode = GEM_CheckMouseMode;
179 183
180 /* Joystick */ 184 /* Joystick + Mouse relative motion */
181 SDL_AtariXbios_InstallVectors(ATARI_XBIOS_JOYSTICKEVENTS); 185 SDL_AtariXbios_InstallVectors(ATARI_XBIOS_MOUSEEVENTS|ATARI_XBIOS_JOYSTICKEVENTS);
182 186
183 device->free = GEM_DeleteDevice; 187 device->free = GEM_DeleteDevice;
184 188
185 return device; 189 return device;
186 } 190 }
312 Uint16 *tmp_p; 316 Uint16 *tmp_p;
313 317
314 tmp_p = (Uint16 *)&work_out[16]; 318 tmp_p = (Uint16 *)&work_out[16];
315 319
316 for (i=0;i<256;i++) { 320 for (i=0;i<256;i++) {
317 vdi_index[i] = *tmp_p++; 321 vdi_index[*tmp_p++] = i;
318 } 322 }
319 } 323 }
320 break; 324 break;
321 case VDI_CLUT_SOFTWARE: 325 case VDI_CLUT_SOFTWARE:
322 if (EdDI_version < EDDI_11) { 326 if (EdDI_version < EDDI_11) {
350 VDI_alphamask |= 1<< valeur; 354 VDI_alphamask |= 1<< valeur;
351 break; 355 break;
352 } 356 }
353 } 357 }
354 } 358 }
355 359 }
356 /* Remove lower green bits for Intel endian screen */ 360
357 if ((VDI_greenmask == ((7<<13)|3)) || (VDI_greenmask == ((7<<13)|7))) { 361 /* Remove lower green bits for Intel endian screen */
358 VDI_greenmask &= ~(7<<13); 362 if ((VDI_greenmask == ((7<<13)|3)) || (VDI_greenmask == ((7<<13)|7))) {
359 } 363 VDI_greenmask &= ~(7<<13);
360 } 364 }
361 break; 365 break;
362 case VDI_CLUT_NONE: 366 case VDI_CLUT_NONE:
363 break; 367 break;
364 } 368 }
472 GEM_win_fulled = SDL_FALSE; 476 GEM_win_fulled = SDL_FALSE;
473 477
474 VDI_screen = NULL; 478 VDI_screen = NULL;
475 VDI_ReadExtInfo(this, work_out); 479 VDI_ReadExtInfo(this, work_out);
476 if (VDI_screen == NULL) { 480 if (VDI_screen == NULL) {
477 VDI_pitch = VDI_w * ((VDI_bpp)>>3); 481 VDI_pitch = VDI_w * VDI_pixelsize;
478 VDI_format = VDI_FORMAT_UNKNOWN; 482 VDI_format = VDI_FORMAT_UNKNOWN;
479 VDI_redmask = VDI_greenmask = VDI_bluemask = VDI_alphamask = 0; 483 VDI_redmask = VDI_greenmask = VDI_bluemask = VDI_alphamask = 0;
480 } 484 }
481 485
482 /* Setup destination mfdb */ 486 /* Setup destination mfdb */
534 /* Destroy window */ 538 /* Destroy window */
535 if (GEM_handle>=0) { 539 if (GEM_handle>=0) {
536 wind_close(GEM_handle); 540 wind_close(GEM_handle);
537 wind_delete(GEM_handle); 541 wind_delete(GEM_handle);
538 GEM_handle=-1; 542 GEM_handle=-1;
543 }
544 }
545
546 static void GEM_ClearScreen(_THIS)
547 {
548 short rgb[3]={0,0,0};
549 short oldrgb[3];
550 short pxy[4];
551
552 v_hide_c(VDI_handle);
553
554 vq_color(VDI_handle, vdi_index[0], 0, oldrgb);
555 vs_color(VDI_handle, vdi_index[0], rgb);
556
557 pxy[0] = pxy[1] = 0;
558 pxy[2] = VDI_w - 1;
559 pxy[3] = VDI_h - 1;
560 vsf_color(VDI_handle,0);
561 vsf_interior(VDI_handle,1);
562 vsf_perimeter(VDI_handle,0);
563 v_bar(VDI_handle,pxy);
564
565 vs_color(VDI_handle, vdi_index[0], oldrgb);
566
567 v_show_c(VDI_handle, 1);
568 }
569
570 static void GEM_LockScreen(_THIS)
571 {
572 if (!GEM_locked) {
573 /* Reserve memory space, used to be sure of compatibility */
574 form_dial( FMD_START, 0,0,0,0, 0,0,VDI_w,VDI_h);
575 /* Lock AES */
576 wind_update(BEG_UPDATE);
577 wind_update(BEG_MCTRL);
578
579 GEM_locked=SDL_TRUE;
580 }
581 }
582
583 static void GEM_UnlockScreen(_THIS)
584 {
585 if (GEM_locked) {
586 /* Restore screen memory, and send REDRAW to all apps */
587 form_dial( FMD_FINISH, 0,0,0,0, 0,0,VDI_w,VDI_h);
588 /* Unlock AES */
589 wind_update(END_MCTRL);
590 wind_update(END_UPDATE);
591
592 GEM_locked=SDL_FALSE;
539 } 593 }
540 } 594 }
541 595
542 SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, 596 SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
543 int width, int height, int bpp, Uint32 flags) 597 int width, int height, int bpp, Uint32 flags)
572 626
573 /*--- Allocate shadow buffer if needed ---*/ 627 /*--- Allocate shadow buffer if needed ---*/
574 use_shadow=SDL_FALSE; 628 use_shadow=SDL_FALSE;
575 if (flags & SDL_FULLSCREEN) { 629 if (flags & SDL_FULLSCREEN) {
576 if (!VDI_screen) { 630 if (!VDI_screen) {
631 /* No access to real framebuffer, use shadow surface */
577 use_shadow=SDL_TRUE; 632 use_shadow=SDL_TRUE;
578 } else if (VDI_format==VDI_FORMAT_INTER) { 633 } else {
579 use_shadow=SDL_TRUE; 634 if (VDI_format==VDI_FORMAT_INTER) {
635 /* Real framebuffer, interleaved bitplanes,
636 use shadow surface */
637 use_shadow=SDL_TRUE;
638 } else if (flags & SDL_DOUBLEBUF) {
639 /* Real framebuffer, double-buffered,
640 use shadow surface */
641 use_shadow=SDL_TRUE;
642 modeflags |= SDL_DOUBLEBUF;
643 }
580 } 644 }
581 } else { 645 } else {
646 /* Windowed mode, always with shadow surface */
582 use_shadow=SDL_TRUE; 647 use_shadow=SDL_TRUE;
583 } 648 }
584 649
585 if (use_shadow) { 650 if (use_shadow) {
586 screensize = width * height * VDI_pixelsize; 651 screensize = width * height * VDI_pixelsize;
593 memset(GEM_buffer, 0, screensize); 658 memset(GEM_buffer, 0, screensize);
594 } 659 }
595 660
596 /*--- Initialize screen ---*/ 661 /*--- Initialize screen ---*/
597 if (flags & SDL_FULLSCREEN) { 662 if (flags & SDL_FULLSCREEN) {
598 short rgb[3]={0,0,0}; 663 GEM_LockScreen(this);
599 short pxy[4]; 664
600 665 GEM_ClearScreen(this);
601 if (!GEM_locked) {
602 /* Reserve memory space, used to be sure of compatibility */
603 form_dial( FMD_START, 0,0,0,0, 0,0,VDI_w,VDI_h);
604 /* Lock AES */
605 while (!wind_update(BEG_UPDATE|BEG_MCTRL));
606
607 GEM_locked=SDL_TRUE;
608 }
609
610 /* Clear screen */
611 pxy[0] = pxy[1] = 0;
612 pxy[2] = VDI_w - 1;
613 pxy[3] = VDI_h - 1;
614 vs_color(VDI_handle, vdi_index[0], rgb);
615 vsf_color(VDI_handle,0);
616 vsf_interior(VDI_handle,1);
617 vsf_perimeter(VDI_handle,0);
618 v_bar(VDI_handle,pxy);
619 666
620 modeflags |= SDL_FULLSCREEN; 667 modeflags |= SDL_FULLSCREEN;
621 if (VDI_screen && (VDI_format==VDI_FORMAT_PACK)) { 668 if (VDI_screen && (VDI_format==VDI_FORMAT_PACK) && !use_shadow) {
622 modeflags |= SDL_HWSURFACE; 669 modeflags |= SDL_HWSURFACE;
623 } else { 670 } else {
624 modeflags |= SDL_SWSURFACE; 671 modeflags |= SDL_SWSURFACE;
625 } 672 }
626 } else { 673 } else {
627 int posx,posy; 674 int posx,posy;
628 short x2,y2,w2,h2; 675 short x2,y2,w2,h2;
629 676
630 if (GEM_locked) { 677 GEM_UnlockScreen(this);
631 /* Restore screen memory, and send REDRAW to all apps */
632 form_dial( FMD_FINISH, 0,0,0,0, 0,0,VDI_w,VDI_h);
633 /* Unlock AES */
634 wind_update(END_UPDATE|END_MCTRL);
635 GEM_locked=SDL_FALSE;
636 }
637 678
638 /* Center our window */ 679 /* Center our window */
639 posx = GEM_desk_x; 680 posx = GEM_desk_x;
640 posy = GEM_desk_y; 681 posy = GEM_desk_y;
641 if (width<GEM_desk_w) 682 if (width<GEM_desk_w)
720 } 761 }
721 762
722 static void GEM_UpdateRectsFullscreen(_THIS, int numrects, SDL_Rect *rects) 763 static void GEM_UpdateRectsFullscreen(_THIS, int numrects, SDL_Rect *rects)
723 { 764 {
724 SDL_Surface *surface; 765 SDL_Surface *surface;
766 MFDB mfdb_src;
767 short blitcoords[8];
768 int i;
725 769
726 surface = this->screen; 770 surface = this->screen;
727 771
728 if (VDI_screen) { 772 if (VDI_screen) {
729 if (VDI_format==VDI_FORMAT_INTER) { 773 if (VDI_format==VDI_FORMAT_INTER) {
732 776
733 destscr = VDI_screen; 777 destscr = VDI_screen;
734 destscr += VDI_pitch * ((VDI_h - surface->h) >> 1); 778 destscr += VDI_pitch * ((VDI_h - surface->h) >> 1);
735 destx = (VDI_w - surface->w) >> 1; 779 destx = (VDI_w - surface->w) >> 1;
736 destx &= ~15; 780 destx &= ~15;
737 destscr += VDI_pixelsize * destx; 781 destscr += destx;
782
783 for (i=0;i<numrects;i++) {
784 void *source,*destination;
785 int x1,x2;
786
787 x1 = rects[i].x & ~15;
788 x2 = rects[i].x+rects[i].w;
789 if (x2 & 15) {
790 x2 = (x2 | 15) +1;
791 }
792
793 source = surface->pixels;
794 source += surface->pitch * rects[i].y;
795 source += x1;
796
797 destination = destscr;
798 destination += VDI_pitch * rects[i].y;
799 destination += x1;
800
801 /* Convert chunky to planar screen */
802 Atari_C2pConvert(
803 source,
804 destination,
805 x2-x1,
806 rects[i].h,
807 SDL_FALSE,
808 surface->pitch,
809 VDI_pitch
810 );
811
812 }
813
814 return;
815 }
816
817 if (!(surface->flags & SDL_DOUBLEBUF)) {
818 return;
819 }
820 }
821
822 mfdb_src.fd_addr=surface->pixels;
823 mfdb_src.fd_w=surface->w;
824 mfdb_src.fd_h=surface->h;
825 mfdb_src.fd_wdwidth=(surface->w) >> 4;
826 mfdb_src.fd_stand=0;
827 mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
828 mfdb_src.fd_r1=0;
829 mfdb_src.fd_r2=0;
830 mfdb_src.fd_r3=0;
831
832 for ( i=0; i<numrects; ++i ) {
833 blitcoords[0] = rects[i].x;
834 blitcoords[1] = rects[i].y;
835 blitcoords[2] = blitcoords[0] + rects[i].w - 1;
836 blitcoords[3] = blitcoords[1] + rects[i].h - 1;
837
838 blitcoords[4] = rects[i].x + ((VDI_w - surface->w) >> 1);
839 blitcoords[5] = rects[i].y + ((VDI_h - surface->h) >> 1);
840 blitcoords[6] = blitcoords[4] + rects[i].w - 1;
841 blitcoords[7] = blitcoords[5] + rects[i].h - 1;
842
843 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
844 }
845 }
846
847 static void GEM_UpdateRectsWindowed(_THIS, int numrects, SDL_Rect *rects)
848 {
849 short pxy[8], wind_pxy[8];
850 int i;
851
852 wind_get(GEM_handle, WF_WORKXYWH, &wind_pxy[0], &wind_pxy[1], &wind_pxy[2], &wind_pxy[3]);
853
854 for ( i=0; i<numrects; ++i ) {
855 pxy[0] = wind_pxy[0] + rects[i].x;
856 pxy[1] = wind_pxy[1] + rects[i].y;
857 pxy[2] = rects[i].w;
858 pxy[3] = rects[i].h;
859
860 GEM_wind_redraw(this, GEM_handle, pxy);
861 }
862 }
863
864 static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
865 {
866 SDL_Surface *surface;
867
868 surface = this->screen;
869
870 if (surface->flags & SDL_FULLSCREEN) {
871 GEM_UpdateRectsFullscreen(this, numrects, rects);
872 } else {
873 GEM_UpdateRectsWindowed(this, numrects, rects);
874 }
875 }
876
877 static int GEM_FlipHWSurfaceFullscreen(_THIS, SDL_Surface *surface)
878 {
879 MFDB mfdb_src;
880 short blitcoords[8];
881
882 if (VDI_screen) {
883 if (VDI_format==VDI_FORMAT_INTER) {
884 void *destscr;
885 int destx;
886
887 /* Center on destination screen */
888 destscr = VDI_screen;
889 destscr += VDI_pitch * ((VDI_h - surface->h) >> 1);
890 destx = (VDI_w - surface->w) >> 1;
891 destx &= ~15;
892 destscr += destx;
738 893
739 /* Convert chunky to planar screen */ 894 /* Convert chunky to planar screen */
740 Atari_C2pConvert( 895 Atari_C2pConvert(
741 surface->pixels, 896 surface->pixels,
742 destscr, 897 destscr,
744 surface->h, 899 surface->h,
745 SDL_FALSE, 900 SDL_FALSE,
746 surface->pitch, 901 surface->pitch,
747 VDI_pitch 902 VDI_pitch
748 ); 903 );
749 } 904
750 } else { 905 return(0);
751 MFDB mfdb_src; 906 }
752 short blitcoords[8]; 907
753 int i; 908 if (!(surface->flags & SDL_DOUBLEBUF)) {
754 909 return(0);
755 mfdb_src.fd_addr=surface->pixels; 910 }
756 mfdb_src.fd_w=surface->w; 911 }
757 mfdb_src.fd_h=surface->h; 912
758 mfdb_src.fd_wdwidth=(surface->w) >> 4; 913 mfdb_src.fd_addr=surface->pixels;
759 mfdb_src.fd_stand=0; 914 mfdb_src.fd_w=surface->w;
760 mfdb_src.fd_nplanes=surface->format->BitsPerPixel; 915 mfdb_src.fd_h=surface->h;
761 mfdb_src.fd_r1=0; 916 mfdb_src.fd_wdwidth=(surface->w) >> 4;
762 mfdb_src.fd_r2=0; 917 mfdb_src.fd_stand=0;
763 mfdb_src.fd_r3=0; 918 mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
764 919 mfdb_src.fd_r1=0;
765 for ( i=0; i<numrects; ++i ) { 920 mfdb_src.fd_r2=0;
766 blitcoords[0] = rects[i].x; 921 mfdb_src.fd_r3=0;
767 blitcoords[1] = rects[i].y; 922
768 blitcoords[2] = blitcoords[0] + rects[i].w - 1; 923 blitcoords[0] = 0;
769 blitcoords[3] = blitcoords[1] + rects[i].h - 1; 924 blitcoords[1] = 0;
770 925 blitcoords[2] = surface->w - 1;
771 blitcoords[4] = rects[i].x + ((VDI_w - surface->w) >> 1); 926 blitcoords[3] = surface->h - 1;
772 blitcoords[5] = rects[i].y + ((VDI_h - surface->h) >> 1); 927 blitcoords[4] = (VDI_w - surface->w) >> 1;
773 blitcoords[6] = blitcoords[4] + rects[i].w - 1; 928 blitcoords[5] = (VDI_h - surface->h) >> 1;
774 blitcoords[7] = blitcoords[5] + rects[i].h - 1; 929 blitcoords[6] = blitcoords[4] + surface->w - 1;
775 930 blitcoords[7] = blitcoords[5] + surface->h - 1;
776 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb); 931
777 } 932 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
778 }
779 }
780
781 static void GEM_UpdateRectsWindowed(_THIS, int numrects, SDL_Rect *rects)
782 {
783 short pxy[8], wind_pxy[8];
784 int i;
785
786 wind_get(GEM_handle, WF_WORKXYWH, &wind_pxy[0], &wind_pxy[1], &wind_pxy[2], &wind_pxy[3]);
787
788 for ( i=0; i<numrects; ++i ) {
789 pxy[0] = wind_pxy[0] + rects[i].x;
790 pxy[1] = wind_pxy[1] + rects[i].y;
791 pxy[2] = rects[i].w;
792 pxy[3] = rects[i].h;
793
794 GEM_wind_redraw(this, GEM_handle, pxy);
795 }
796 }
797
798 static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
799 {
800 SDL_Surface *surface;
801
802 surface = this->screen;
803
804 if (surface->flags & SDL_FULLSCREEN) {
805 GEM_UpdateRectsFullscreen(this, numrects, rects);
806 } else {
807 GEM_UpdateRectsWindowed(this, numrects, rects);
808 }
809 }
810
811 static int GEM_FlipHWSurfaceFullscreen(_THIS, SDL_Surface *surface)
812 {
813 if (VDI_screen) {
814 if (VDI_format==VDI_FORMAT_INTER) {
815 void *destscr;
816 int destx;
817
818 /* Center on destination screen */
819 destscr = VDI_screen;
820 destscr += VDI_pitch * ((VDI_h - surface->h) >> 1);
821 destx = (VDI_w - surface->w) >> 1;
822 destx &= ~15;
823 destscr += VDI_pixelsize * destx;
824
825 /* Convert chunky to planar screen */
826 Atari_C2pConvert(
827 surface->pixels,
828 destscr,
829 surface->w,
830 surface->h,
831 SDL_FALSE,
832 surface->pitch,
833 VDI_pitch
834 );
835 }
836 } else {
837 MFDB mfdb_src;
838 short blitcoords[8];
839
840 mfdb_src.fd_addr=surface->pixels;
841 mfdb_src.fd_w=surface->w;
842 mfdb_src.fd_h=surface->h;
843 mfdb_src.fd_wdwidth=(surface->w) >> 4;
844 mfdb_src.fd_stand=0;
845 mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
846 mfdb_src.fd_r1=0;
847 mfdb_src.fd_r2=0;
848 mfdb_src.fd_r3=0;
849
850 blitcoords[0] = 0;
851 blitcoords[1] = 0;
852 blitcoords[2] = surface->w - 1;
853 blitcoords[3] = surface->h - 1;
854 blitcoords[4] = (VDI_w - surface->w) >> 1;
855 blitcoords[5] = (VDI_h - surface->h) >> 1;
856 blitcoords[6] = blitcoords[4] + surface->w - 1;
857 blitcoords[7] = blitcoords[5] + surface->h - 1;
858
859 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
860 }
861 933
862 return(0); 934 return(0);
863 } 935 }
864 936
865 static int GEM_FlipHWSurfaceWindowed(_THIS, SDL_Surface *surface) 937 static int GEM_FlipHWSurfaceWindowed(_THIS, SDL_Surface *surface)
892 surface = this->screen; 964 surface = this->screen;
893 if (surface->format->BitsPerPixel > 8) { 965 if (surface->format->BitsPerPixel > 8) {
894 return 1; 966 return 1;
895 } 967 }
896 968
897
898 for(i = 0; i < ncolors; i++) 969 for(i = 0; i < ncolors; i++)
899 { 970 {
900 int r, g, b; 971 int r, g, b;
901 short rgb[3]; 972 short rgb[3];
902 973
916 987
917 #if 0 988 #if 0
918 static int GEM_ToggleFullScreen(_THIS, int on) 989 static int GEM_ToggleFullScreen(_THIS, int on)
919 { 990 {
920 if (on) { 991 if (on) {
921 if (!GEM_locked) { 992 GEM_LockScreen(this);
922 /* Lock AES */
923 while (!wind_update(BEG_UPDATE|BEG_MCTRL));
924 GEM_locked=SDL_TRUE;
925 }
926 } else { 993 } else {
927 if (GEM_locked) { 994 GEM_UnlockScreen(this);
928 /* Unlock AES */
929 wind_update(END_UPDATE|END_MCTRL);
930 GEM_locked=SDL_FALSE;
931 }
932 /* Redraw all screen */
933 } 995 }
934 996
935 return(1); 997 return(1);
936 } 998 }
937 #endif 999 #endif
943 { 1005 {
944 SDL_AtariXbios_RestoreVectors(); 1006 SDL_AtariXbios_RestoreVectors();
945 1007
946 GEM_FreeBuffers(this); 1008 GEM_FreeBuffers(this);
947 1009
948 if (GEM_locked) { 1010 GEM_UnlockScreen(this);
949 /* Restore screen memory, and send REDRAW to all apps */ 1011
950 form_dial( FMD_FINISH, 0,0,0,0, 0,0,VDI_w,VDI_h);
951 /* Unlock AES */
952 wind_update(END_UPDATE|END_MCTRL);
953 GEM_locked=SDL_FALSE;
954 }
955
956 /* Close AES application */
957 appl_exit(); 1012 appl_exit();
958 1013
959 /* Restore palette */ 1014 /* Restore palette */
960 if (VDI_oldnumcolors) { 1015 if (VDI_oldnumcolors) {
961 int i; 1016 int i;
988 void GEM_wind_redraw(_THIS, int winhandle, short *inside) 1043 void GEM_wind_redraw(_THIS, int winhandle, short *inside)
989 { 1044 {
990 short todo[4]; 1045 short todo[4];
991 1046
992 /* Tell AES we are going to update */ 1047 /* Tell AES we are going to update */
993 while (!wind_update(BEG_UPDATE)); 1048 wind_update(BEG_UPDATE);
994 1049
995 v_hide_c(VDI_handle); 1050 v_hide_c(VDI_handle);
996 1051
997 /* Browse the rectangle list to redraw */ 1052 /* Browse the rectangle list to redraw */
998 wind_get(winhandle, WF_FIRSTXYWH, &todo[0], &todo[1], &todo[2], &todo[3]); 1053 wind_get(winhandle, WF_FIRSTXYWH, &todo[0], &todo[1], &todo[2], &todo[3]);