summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-03-23 02:34:07 +0000
committerBrian Paul <[email protected]>2002-03-23 02:34:07 +0000
commite69bfe74d7f887fb516f300f575d43b9903d9ab3 (patch)
tree87e79df2f9aaaba93074607a084a67ea4c872c05 /src
parent6211144e056954f5b7a2d5c29f5a337154895217 (diff)
DOS/Mesa driver updates (Daniel Borca)
Diffstat (limited to 'src')
-rw-r--r--src/glu/mesa/Makefile.DJ20
-rw-r--r--src/glut/dos/Makefile.DJ20
-rw-r--r--src/glut/dos/PC_HW/pc_keyb.c13
-rw-r--r--src/glut/dos/PC_HW/pc_mouse.c11
-rw-r--r--src/glut/dos/init.c83
-rw-r--r--src/mesa/drivers/dos/dmesa.c9
-rw-r--r--src/mesa/drivers/dos/video.c8
-rw-r--r--src/mesa/drivers/dos/video.h4
-rw-r--r--src/mesa/main/Makefile.DJ20
9 files changed, 119 insertions, 69 deletions
diff --git a/src/glu/mesa/Makefile.DJ b/src/glu/mesa/Makefile.DJ
index e09780626ba..0232fe55922 100644
--- a/src/glu/mesa/Makefile.DJ
+++ b/src/glu/mesa/Makefile.DJ
@@ -20,7 +20,7 @@
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-# DOS/DJGPP glu makefile v0.1 for Mesa 4.0
+# DOS/DJGPP glu makefile v0.4 for Mesa 4.0
#
# Copyright (C) 2002 - Borca Daniel
# Email : [email protected]
@@ -36,7 +36,15 @@ AR = ar
ARFLAGS = ruv
LIBDIR = $(TOP)/lib
+ifeq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
+DXE2GEN =
+else
+DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
+endif
+
GLU_LIB = libglu.a
+GLU_DXE = glu.dxe
+GLU_IMP = libiglu.a
CORE_SOURCES = \
glu.c \
@@ -58,11 +66,19 @@ OBJECTS = $(SOURCES:.c=.o)
.c.o:
gcc -o $@ -c $(CFLAGS) $<
-all: $(LIBDIR)/$(GLU_LIB)
+all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP)
$(LIBDIR)/$(GLU_LIB): $(OBJECTS)
$(AR) $(ARFLAGS) $(LIBDIR)/$(GLU_LIB) $(OBJECTS)
+$(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)
+ifeq ($(DXE2GEN),)
+ @echo Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN
+ @echo somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.
+else
+ dxe2gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) $(OBJECTS) -D "Glu" -U
+endif
+
clean:
-$(RM) *.o
diff --git a/src/glut/dos/Makefile.DJ b/src/glut/dos/Makefile.DJ
index 7cacd8d0090..7a26eb2d0c9 100644
--- a/src/glut/dos/Makefile.DJ
+++ b/src/glut/dos/Makefile.DJ
@@ -20,7 +20,7 @@
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-# DOS/DJGPP glut makefile v0.2 for Mesa 4.0
+# DOS/DJGPP glut makefile v0.4 for Mesa 4.0
#
# Copyright (C) 2002 - Borca Daniel
# Email : [email protected]
@@ -36,7 +36,15 @@ AR = ar
ARFLAGS = ruv
LIBDIR = $(TOP)/lib
+ifeq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
+DXE2GEN =
+else
+DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
+endif
+
GLUT_LIB = libglut.a
+GLUT_DXE = glut.dxe
+GLUT_IMP = libiglut.a
CORE_SOURCES = \
callback.c \
@@ -69,11 +77,19 @@ OBJECTS = $(SOURCES:.c=.o) $(PC_HW_OBJECTS)
.c.o:
gcc -o $@ -c $(CFLAGS) $<
-all: $(LIBDIR)/$(GLUT_LIB)
+all: $(LIBDIR)/$(GLUT_LIB) $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP)
$(LIBDIR)/$(GLUT_LIB): $(OBJECTS)
$(AR) $(ARFLAGS) $(LIBDIR)/$(GLUT_LIB) $(OBJECTS)
+$(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
+ifeq ($(DXE2GEN),)
+ @echo Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN
+ @echo somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.
+else
+ dxe2gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) $(OBJECTS) -D "DOS Glut" -U
+endif
+
clean:
-$(RM) *.o
-$(RM) PC_HW\*.o
diff --git a/src/glut/dos/PC_HW/pc_keyb.c b/src/glut/dos/PC_HW/pc_keyb.c
index f5f4bd8e764..d3987d8e340 100644
--- a/src/glut/dos/PC_HW/pc_keyb.c
+++ b/src/glut/dos/PC_HW/pc_keyb.c
@@ -1,5 +1,5 @@
/*
- * PC/HW routine collection v0.1 for DOS/DJGPP
+ * PC/HW routine collection v0.4 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
* Email : [email protected]
@@ -32,7 +32,7 @@ static volatile struct {
static volatile int key_enhanced, key_pause_loop, key_shifts;
static int leds_ok = TRUE;
static int in_a_terrupt = FALSE;
-volatile char pc_key[KEY_MAX];
+static volatile char pc_key[KEY_MAX];
@@ -400,6 +400,10 @@ static int keyboard ()
}
if (((temp==0x4F)||(temp==0x53))&&(key_shifts&KB_CTRL_FLAG)&&(key_shifts&KB_ALT_FLAG)) {
+ /* Hack alert:
+ only SIGINT (but not Ctrl-Break)
+ calls the destructors and will safely clean up
+ */
__asm__("\n\
movb $0x79, %%al \n\
call ___djgpp_hw_exception \n\
@@ -436,6 +440,11 @@ int pc_readkey (void)
}
}
+int pc_keydown (int code)
+{
+ return pc_key[code];
+}
+
void pc_remove_keyb (void)
{
if (keyboard_installed) {
diff --git a/src/glut/dos/PC_HW/pc_mouse.c b/src/glut/dos/PC_HW/pc_mouse.c
index 2a692eceb66..aa1fbe4da73 100644
--- a/src/glut/dos/PC_HW/pc_mouse.c
+++ b/src/glut/dos/PC_HW/pc_mouse.c
@@ -1,5 +1,5 @@
/*
- * PC/HW routine collection v0.2 for DOS/DJGPP
+ * PC/HW routine collection v0.4 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
* Email : [email protected]
@@ -29,7 +29,7 @@ static void *mouse_stack;
static long mouse_callback;
static __dpmi_regs mouse_regs;
-volatile int pc_mouse_x, pc_mouse_y, pc_mouse_b;
+static volatile int pc_mouse_x, pc_mouse_y, pc_mouse_b;
static int minx = 0;
static int maxx = 319;
@@ -205,6 +205,13 @@ void pc_mouse_speed (int xspeed, int yspeed)
ENABLE();
}
+int pc_query_mouse (int *x, int *y)
+{
+ *x = pc_mouse_x;
+ *y = pc_mouse_y;
+ return pc_mouse_b;
+}
+
void pc_show_mouse (void)
{
/* not implemented */
diff --git a/src/glut/dos/init.c b/src/glut/dos/init.c
index 41170e37c92..9cda3a8b5b5 100644
--- a/src/glut/dos/init.c
+++ b/src/glut/dos/init.c
@@ -19,7 +19,7 @@
*/
/*
- * DOS/DJGPP glut driver v0.2 for Mesa 4.0
+ * DOS/DJGPP glut driver v0.4 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : [email protected]
@@ -27,30 +27,13 @@
*/
-#include <signal.h>
#include "GL/glut.h"
#include "internal.h"
-static void *old_sig_int = NULL;
-
-
-static void signal_handler (int num)
-{
- signal(SIGINT, old_sig_int);
-
- raise(num);
-}
-
-
void APIENTRY glutInit (int *argcp, char **argv)
{
glutGet(GLUT_ELAPSED_TIME);
- /* Hack alert:
- only SIGINT (but not Ctrl-Break)
- calls the destructors and will safely clean up
- */
- old_sig_int = signal(SIGINT, signal_handler);
}
@@ -133,34 +116,42 @@ void APIENTRY glutMainLoop (void)
}
}
- if (g_mouse && motion_func && ((pc_mouse_x != old_mouse_x) || (pc_mouse_y != old_mouse_y))) {
- idle = GL_FALSE;
- old_mouse_x = pc_mouse_x;
- old_mouse_y = pc_mouse_y;
-
- motion_func(old_mouse_x, old_mouse_y);
- }
-
- if (g_mouse && mouse_func && (pc_mouse_b != old_mouse_b)) {
- int new_mouse_b = pc_mouse_b;
-
- if ((old_mouse_b & 1) && !(new_mouse_b & 1))
- mouse_func(GLUT_LEFT_BUTTON, GLUT_UP, pc_mouse_x, pc_mouse_y);
- else if (!(old_mouse_b & 1) && (new_mouse_b & 1))
- mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN, pc_mouse_x, pc_mouse_y);
-
- if ((old_mouse_b & 2) && !(new_mouse_b & 2))
- mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP, pc_mouse_x, pc_mouse_y);
- else if (!(old_mouse_b & 2) && (new_mouse_b & 2))
- mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN, pc_mouse_x, pc_mouse_y);
-
- if ((old_mouse_b & 4) && !(new_mouse_b & 4))
- mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP, pc_mouse_x, pc_mouse_y);
- else if (!(old_mouse_b & 3) && (new_mouse_b & 4))
- mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, pc_mouse_x, pc_mouse_y);
-
- idle = GL_FALSE;
- old_mouse_b = new_mouse_b;
+ if (g_mouse) {
+ int mouse_x;
+ int mouse_y;
+ int mouse_b;
+
+ mouse_b = pc_query_mouse(&mouse_x, &mouse_y);
+
+ if (motion_func && ((mouse_x != old_mouse_x) || (mouse_y != old_mouse_y))) {
+ idle = GL_FALSE;
+ old_mouse_x = mouse_x;
+ old_mouse_y = mouse_y;
+
+ motion_func(old_mouse_x, old_mouse_y);
+ }
+
+ if (mouse_func && (mouse_b != old_mouse_b)) {
+ int new_mouse_b = mouse_b;
+
+ if ((old_mouse_b & 1) && !(new_mouse_b & 1))
+ mouse_func(GLUT_LEFT_BUTTON, GLUT_UP, mouse_x, mouse_y);
+ else if (!(old_mouse_b & 1) && (new_mouse_b & 1))
+ mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN, mouse_x, mouse_y);
+
+ if ((old_mouse_b & 2) && !(new_mouse_b & 2))
+ mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP, mouse_x, mouse_y);
+ else if (!(old_mouse_b & 2) && (new_mouse_b & 2))
+ mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN, mouse_x, mouse_y);
+
+ if ((old_mouse_b & 4) && !(new_mouse_b & 4))
+ mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP, mouse_x, mouse_y);
+ else if (!(old_mouse_b & 3) && (new_mouse_b & 4))
+ mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, mouse_x, mouse_y);
+
+ idle = GL_FALSE;
+ old_mouse_b = new_mouse_b;
+ }
}
if (idle && idle_func)
diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c
index d150cdca5ac..454b891c08b 100644
--- a/src/mesa/drivers/dos/dmesa.c
+++ b/src/mesa/drivers/dos/dmesa.c
@@ -540,13 +540,8 @@ static GLboolean set_draw_buffer (GLcontext *ctx, GLenum mode)
* If anything special has to been done when the buffer/window is
* resized, do it now.
*/
-static void get_buffer_size (GLframebuffer *buffer, GLuint *width, GLuint *height)
+static void get_buffer_size (GLcontext *ctx, GLuint *width, GLuint *height)
{
- /* XXX this may not be right. We should query the size of the DOS window
- * associated with <buffer>. This function should work whether or
- * not there is a current context.
- */
- GET_CURRENT_CONTEXT(ctx);
DMesaContext c = (DMesaContext)ctx->DriverCtx;
*width = c->Buffer->width;
@@ -641,7 +636,7 @@ void dmesa_init_pointers (GLcontext *ctx)
ctx->Driver.Accum = _swrast_Accum;
ctx->Driver.Bitmap = _swrast_Bitmap;
ctx->Driver.Clear = clear;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
+ ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers;
ctx->Driver.CopyPixels = _swrast_CopyPixels;
ctx->Driver.DrawPixels = _swrast_DrawPixels;
ctx->Driver.ReadPixels = _swrast_ReadPixels;
diff --git a/src/mesa/drivers/dos/video.c b/src/mesa/drivers/dos/video.c
index 5c2c84a84f7..9d50952c527 100644
--- a/src/mesa/drivers/dos/video.c
+++ b/src/mesa/drivers/dos/video.c
@@ -23,7 +23,7 @@
*/
/*
- * DOS/DJGPP device driver v0.3 for Mesa 4.0
+ * DOS/DJGPP device driver v0.4 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : [email protected]
@@ -180,9 +180,9 @@ void vl_rect (void *buffer, int x, int y, int width, int height, int color)
/*
* virtual dumping:
*/
-void *(*vl_flip) (void *buffer, int width, int height);
+void (*vl_flip) (void *buffer, int width, int height);
-extern void *b_dump_virtual (void *buffer, int width, int height);
+extern void b_dump_virtual (void *buffer, int width, int height);
__asm__("\n\
.text \n\
.balign 4 \n\
@@ -242,7 +242,7 @@ _b_dump_virtual: \n\
popl %esi \n\
popl %ebx \n\
ret");
-extern void *l_dump_virtual (void *buffer, int width, int height);
+extern void l_dump_virtual (void *buffer, int width, int height);
__asm__("\n\
.text \n\
.balign 4 \n\
diff --git a/src/mesa/drivers/dos/video.h b/src/mesa/drivers/dos/video.h
index ff81ac9d2e9..c806aa7c885 100644
--- a/src/mesa/drivers/dos/video.h
+++ b/src/mesa/drivers/dos/video.h
@@ -23,7 +23,7 @@
*/
/*
- * DOS/DJGPP device driver v0.3 for Mesa 4.0
+ * DOS/DJGPP device driver v0.4 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : [email protected]
@@ -42,7 +42,7 @@ void *vl_sync_buffer (void *buffer, int x, int y, int width, int height);
extern void (*vl_clear) (void *buffer, int len, int color);
void vl_rect (void *buffer, int x, int y, int width, int height, int color);
-void *(*vl_flip) (void *buffer, int width, int height);
+void (*vl_flip) (void *buffer, int width, int height);
extern int (*vl_mixrgba) (const unsigned char rgba[]);
extern int (*vl_mixrgb) (const unsigned char rgb[]);
diff --git a/src/mesa/main/Makefile.DJ b/src/mesa/main/Makefile.DJ
index 214882d1cfa..fc540dc60bb 100644
--- a/src/mesa/main/Makefile.DJ
+++ b/src/mesa/main/Makefile.DJ
@@ -20,7 +20,7 @@
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-# DOS/DJGPP core makefile v0.2 for Mesa 4.0
+# DOS/DJGPP core makefile v0.4 for Mesa 4.0
#
# Copyright (C) 2002 - Borca Daniel
# Email : [email protected]
@@ -36,7 +36,15 @@ AR = ar
ARFLAGS = ruv
LIBDIR = $(TOP)/lib
+ifeq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
+DXE2GEN =
+else
+DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
+endif
+
GL_LIB = libgl.a
+GL_DXE = gl.dxe
+GL_IMP = libigl.a
CORE_SOURCES = \
swrast_setup/ss_context.c \
@@ -166,11 +174,19 @@ OBJECTS = $(SOURCES:.c=.o)
.c.o:
gcc -o $@ -c $(CFLAGS) $<
-all: $(LIBDIR)/$(GL_LIB)
+all: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP)
$(LIBDIR)/$(GL_LIB): $(OBJECTS)
$(AR) $(ARFLAGS) $(LIBDIR)/$(GL_LIB) $(OBJECTS)
+$(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP): $(OBJECTS)
+ifeq ($(DXE2GEN),)
+ @echo Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN
+ @echo somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.
+else
+ dxe2gen -o $(LIBDIR)/$(GL_DXE) -I $(LIBDIR)/$(GL_IMP) $(OBJECTS) -D "DOS Mesa" -U
+endif
+
clean:
-$(RM) *.o
-$(RM) DOS\*.o