[AD] ModeX fix

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Two patches attached that address the problem of split_modex_screen not 
being defined.
It's a bit ugly and does a bit more than simply making the symbol available 
on all systems. I'll first repeat why this is nescessary: The Mode-X 
driver is now defined on all UNIX systems, regardless of wether a VGA card 
is actually present or not. This means that split_modex_screen must always 
be defined on those systems as well. The becomes configure hell and even 
worse, it makes it harder for the user to be able to check if 
split_modex_screen is available at all. So for that reason, I've exposed 
the function under all circumstances and simply let it do nothing except 
when a real Mode-X driver is present. Because split_modex_screen is an 
inappropriate name for a function that is always defined, I've also 
renamed it split_screen() and deprecated the split_modex_screen function.
This is a bit ugly because there's no proper vtable entry for splitting the 
screen, but it's the best I could think of for the time being.
Short of removing the functionality alltogether, which we probably could 
also have done without anyone noticing.

I can water down the patch to not rename the function if that is going too 
far, but I vastly prefer the current version (obviously). Tested on my 
Linux box, but I don't think it has a Mode-X driver enabled anyway, so 
more testing needed.

Thoughts, comments?

Evert
Index: src/graphics.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/graphics.c,v
retrieving revision 1.60
diff -u -r1.60 graphics.c
--- src/graphics.c	14 Mar 2005 11:41:59 -0000	1.60
+++ src/graphics.c	18 Jun 2005 08:20:25 -0000
@@ -1673,3 +1673,18 @@
 }
 
 
+
+/* split_screen:
+ *  Enables a horizontal split screen at the specified line. Actually only
+ *  defined if a ModeX driver is in use, in which case it is already defined
+ *  in gfx/misc/modex.c. 
+ *  FIXME: The proper way to do this would be with a vtable entry but this 
+ *  wasn't done because of time constrains.
+ */
+#if !defined GFX_HAS_VGA && defined GFX_MODEX
+void split_screen(int line)
+{
+}
+#endif
+
+
Index: src/misc/modex.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/misc/modex.c,v
retrieving revision 1.33
diff -u -r1.33 modex.c
--- src/misc/modex.c	25 Jan 2005 23:25:54 -0000	1.33
+++ src/misc/modex.c	18 Jun 2005 08:20:26 -0000
@@ -1617,7 +1617,7 @@
 
 
 
-/* split_modex_screen:
+/* split_screen:
  *  Enables a horizontal split screen at the specified line.
  *  Based on code from Paul Fenwick's XLIBDJ, which was in turn based 
  *  on Michael Abrash's routines in PC Techniques, June 1991.
@@ -1625,7 +1625,7 @@
 #ifdef ALLEGRO_MODULE
 static void module_split_modex_screen(int line)
 #else
-void split_modex_screen(int line)
+void split_screen(int line)
 #endif
 {
    if (gfx_driver != &gfx_modex)
@@ -1662,7 +1662,7 @@
 
 void (*_split_modex_screen_ptr)(int);
 
-void (split_modex_screen)(int line)
+void (split_screen)(int line)
 {
    _split_modex_screen_ptr(line);
 }
@@ -1686,10 +1686,4 @@
 #endif
 
 
-#else      /* ifdef GFX_HAS_VGA */
-
-void split_modex_screen(int line)
-{
-}
-
 #endif
Index: include/allegro/alcompat.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/alcompat.h,v
retrieving revision 1.18
diff -u -r1.18 alcompat.h
--- include/allegro/alcompat.h	7 Mar 2005 22:55:21 -0000	1.18
+++ include/allegro/alcompat.h	18 Jun 2005 08:20:26 -0000
@@ -229,6 +229,13 @@
 })
 
 
+/* split_modex_screen: should be split_screen() now */
+AL_INLINE_DEPRECATED(void, split_modex_screen, (int line),
+{
+   split_screen(line);
+})
+
+
 /* DOS-ish monitor retrace ideas that don't work elsewhere */
 AL_FUNCPTR(void, retrace_proc, (void));
 
Index: include/allegro/gfx.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/gfx.h,v
retrieving revision 1.16
diff -u -r1.16 gfx.h
--- include/allegro/gfx.h	7 Mar 2005 22:55:22 -0000	1.16
+++ include/allegro/gfx.h	18 Jun 2005 08:20:27 -0000
@@ -393,6 +393,7 @@
 AL_FUNC(int, show_video_bitmap, (BITMAP *bitmap));
 AL_FUNC(int, request_video_bitmap, (BITMAP *bitmap));
 AL_FUNC(int, enable_triple_buffer, (void));
+AL_FUNC(void, split_screen, (int line));
 AL_FUNC(BITMAP *, create_bitmap, (int width, int height));
 AL_FUNC(BITMAP *, create_bitmap_ex, (int color_depth, int width, int height));
 AL_FUNC(BITMAP *, create_sub_bitmap, (BITMAP *parent, int x, int y, int width, int height));
Index: include/allegro/platform/aldos.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/platform/aldos.h,v
retrieving revision 1.7
diff -u -r1.7 aldos.h
--- include/allegro/platform/aldos.h	7 Mar 2005 22:55:25 -0000	1.7
+++ include/allegro/platform/aldos.h	18 Jun 2005 08:20:27 -0000
@@ -262,8 +262,6 @@
 AL_VAR(GFX_VTABLE, __modex_vtable);
 
 
-AL_FUNC(void, split_modex_screen, (int lyne));
-
 
 AL_INLINE(void, _set_color, (int index, AL_CONST RGB *p),
 {
Index: include/allegro/platform/alunix.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/platform/alunix.h,v
retrieving revision 1.18
diff -u -r1.18 alunix.h
--- include/allegro/platform/alunix.h	7 Mar 2005 22:55:25 -0000	1.18
+++ include/allegro/platform/alunix.h	18 Jun 2005 08:20:27 -0000
@@ -219,8 +219,6 @@
 
 AL_VAR(JOYSTICK_DRIVER, joystick_linux_analogue);
 
-AL_FUNC(void, split_modex_screen, (int lyne));
-
 
 /* Port I/O functions -- maybe these should be internal */
 
Index: docs/src/allegro._tx
===================================================================
RCS file: /cvsroot/alleg/allegro/docs/src/allegro._tx,v
retrieving revision 1.339
diff -u -r1.339 allegro._tx
--- docs/src/allegro._tx	10 Jun 2005 13:32:13 -0000	1.339
+++ docs/src/allegro._tx	18 Jun 2005 08:25:28 -0000
@@ -4327,6 +4327,21 @@
 @retval
    Returns zero if triple buffering is enabled, -1 otherwise.
 
+@@void @split_screen(int line);
+@xref set_gfx_mode, scroll_screen
+@eref exscroll
+@shortdesc Splits the display in two parts.
+   This function splits the display into two parts at the specified line.
+   The top half of the screen can be scrolled to any part of video memory with 
+   the scroll_screen() function, but the part below the specified line number
+   will remain fixed and will display from position (0, 0) of the screen 
+   bitmap. After splitting the screen you will generally want to scroll so
+   that the top part of the display starts lower down in video memory, and
+   then create two sub-bitmaps to access the two sections 
+   (see examples/exscroll.c for a demonstration of how this could be done). To 
+   disable the split, call split_screen(0).
+   Note that this function will only work properly in ModeX on VGA hardware.
+
 @@int @scroll_screen(int x, int y);
 @xref set_gfx_mode, show_video_bitmap, request_scroll, request_video_bitmap
 @eref exscroll
@@ -12296,21 +12311,6 @@
 
 @hnode DOS integration routines
 
-@domain.hid @split_modex_screen(int line);
-@domain.hid set_gfx_mode, scroll_screen
-@domain.hid exscroll
-@domain.hid Splits into two parts the VGA display in mode-X.
-   This function is only available in mode-X. It splits the VGA display into 
-   two parts at the specified line. The top half of the screen can be 
-   scrolled to any part of video memory with the scroll_screen() function, 
-   but the part below the specified line number will remain fixed and will 
-   display from position (0, 0) of the screen bitmap. After splitting the 
-   screen you will generally want to scroll so that the top part of the 
-   display starts lower down in video memory, and then create two 
-   sub-bitmaps to access the two sections (see examples/exscroll.c for a 
-   demonstration of how this could be done). To disable the split, call 
-   split_modex_screen(0).
-
 @@extern int @i_love_bill;
 @xref install_timer, allegro_init, os_type
 @shortdesc Tells if Allegro has to used fixed rate timers.
@@ -14489,7 +14489,7 @@
 @xref allegro_init, allegro_message, clear_keybuf, create_sub_bitmap
 @xref desktop_palette, destroy_bitmap, font, install_keyboard, keypressed
 @xref line, rectfill, release_bitmap, screen, scroll_screen, set_color
-@domain.hid set_gfx_mode, set_palette, split_modex_screen, textout_ex, vline
+@xref set_gfx_mode, set_palette, split_screen, textout_ex, vline
 @shortdesc Mode-X hardware scrolling and split screens.
    This program demonstrates how to use hardware scrolling and split
    screens in mode-X. The split screen part only works on DOS and Linux


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/