misc fixes to get -wgl to cross compile

This commit is contained in:
Bill Currie 2001-08-15 18:07:55 +00:00
parent d74f867b06
commit 305fc0c371
5 changed files with 96 additions and 42 deletions

View file

@ -454,16 +454,18 @@ AC_SUBST(SVGA_CFLAGS)
AC_SUBST(SVGA_LIBS) AC_SUBST(SVGA_LIBS)
dnl Checks for X11 and XShm dnl Checks for X11 and XShm
AC_PATH_XTRA if test "x$mingw" != xyes; then
if test "x$no_x" = x; then AC_PATH_XTRA
HAVE_X=yes if test "x$no_x" = x; then
AC_CHECK_LIB(Xext, XShmQueryExtension, HAVE_X=yes
X_SHM_LIB=-lXext, AC_CHECK_LIB(Xext, XShmQueryExtension,
HAVE_X=no, X_SHM_LIB=-lXext,
[ $X_LIBS -lX11 $X_EXTRA_LIBS ] HAVE_X=no,
) [ $X_LIBS -lX11 $X_EXTRA_LIBS ]
)
fi
AC_SUBST(X_SHM_LIB)
fi fi
AC_SUBST(X_SHM_LIB)
dnl Check for XFree86-VidMode support dnl Check for XFree86-VidMode support
AC_ARG_ENABLE(vidmode, AC_ARG_ENABLE(vidmode,
@ -573,19 +575,26 @@ if test "x$HAVE_GLX" != xno; then
fi fi
CPPFLAGS="$save_CPPFLAGS" CPPFLAGS="$save_CPPFLAGS"
dnl Make sure -lGL or -lMesaGL works dnl Make sure -lGL or -lMesaGL or -lopengl32 works
if test "x$glx_libraries" != xauto -a "x$glx_libraries" != xno -a "x$glx_libraries" != x; then if test "x$glx_libraries" != xauto -a "x$glx_libraries" != xno -a "x$glx_libraries" != x; then
if test "x$HAVE_GLX" = xyes; then if test "x$HAVE_GLX" = xyes; then
HAVE_GLX=no HAVE_GLX=no
AC_CHECK_LIB(GL, glColor4f, AC_CHECK_LIB(GL, glColor4f,
HAVE_GLX=yes HAVE_GLX=yes
OGL_NAME=GL,, OGL_NAME=GL,,
[ -L$glx_libraries ] [ -L$glx_libraries -lX11 $X_EXTRA_LIBS ]
) )
if test "x$HAVE_GLX" != xyes; then if test "x$HAVE_GLX" != xyes; then
AC_CHECK_LIB(MesaGL, glColor4f, AC_CHECK_LIB(MesaGL, glColor4f,
HAVE_GLX=yes HAVE_GLX=yes
OGL_NAME=MesaGL,, OGL_NAME=MesaGL,,
[ -L$glx_libraries -lX11 $X_EXTRA_LIBS ]
)
fi
if test "x$HAVE_GLX" != xyes; then
AC_CHECK_LIB(opengl32, glColor4f,
HAVE_GLX=yes
OGL_NAME=opengl32,,
[ -L$glx_libraries ] [ -L$glx_libraries ]
) )
fi fi
@ -611,6 +620,20 @@ else
[ $X_LIBS ] [ $X_LIBS ]
) )
fi fi
if test "x$HAVE_GLX" != xyes; then
LIBS_save="$LIBS"
LIBS="$LIBS -lopengl32"
AC_MSG_CHECKING(for glColor4f in -lopengl32)
AC_TRY_LINK(
[#include <GL/gl.h>],
[glColor4f(0,0,0,0);],
HAVE_GLX=yes
OGL_NAME=opengl32
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
LIBS="$LIBS_save"
fi
fi fi
fi fi
@ -626,14 +649,20 @@ fi
AC_SUBST(GLX_CFLAGS) AC_SUBST(GLX_CFLAGS)
AC_SUBST(GLX_LIBS) AC_SUBST(GLX_LIBS)
dnl SDL/SDL-GL checks AC_ARG_ENABLE(sdl,
AM_PATH_SDL(1.0.1, HAVE_SDL=yes, HAVE_SDL=no) [ --disable-sdl disable checking for SDL],
)
if test "x$HAVE_SDL" != xno; then if test "x$enable_sdl" != xno; then
AM_CHECK_SGL(1.1.1, HAVE_SGL=yes, HAVE_SGL=no) dnl SDL/SDL-GL checks
AM_PATH_SDL(1.0.1, HAVE_SDL=yes, HAVE_SDL=no)
if test "x$HAVE_SDL" != xno; then
AM_CHECK_SGL(1.1.1, HAVE_SGL=yes, HAVE_SGL=no)
fi
AC_SUBST(HAVE_SDL)
AC_SUBST(HAVE_SGL)
fi fi
AC_SUBST(HAVE_SDL)
AC_SUBST(HAVE_SGL)
# 3Dfx stuff.. # 3Dfx stuff..
@ -828,7 +857,7 @@ fi
dnl Win32 dnl Win32
if test -z "$SNDTYPE" -a "x$ac_cv_header_windows_h" = "xyes" -a \ if test -z "$SNDTYPE" -a "x$ac_cv_header_windows_h" = "xyes" -a \
"x$ac_cv_header_mmsystem_h" = "xyes"; then "x$ac_cv_header_dsound_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[ AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <windows.h> #include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
@ -932,11 +961,11 @@ QF_maGiC_VALUE
CD_LIBS="-lcdaudio -lmediad -lds" CD_LIBS="-lcdaudio -lmediad -lds"
) )
fi fi
if test -z "$CDTYPE"; then if test -z "$CDTYPE"; then
AC_EGREP_CPP([QF_maGIC_VALUE], AC_EGREP_CPP([QF_maGiC_VALUE],
[ [
#include <windows.h> #include <windows.h>
#include <mmsystem.h>
#if defined(MCI_SET_DOOR_OPEN) #if defined(MCI_SET_DOOR_OPEN)
QF_maGiC_VALUE QF_maGiC_VALUE
#endif #endif
@ -1283,6 +1312,7 @@ if test "$clients" = "all"; then
ENABLE_SDL=yes ENABLE_SDL=yes
ENABLE_SGL=yes ENABLE_SGL=yes
ENABLE_SVGA=yes ENABLE_SVGA=yes
ENABLE_WGL=yes
ENABLE_X11=yes ENABLE_X11=yes
else else
ENABLE_3DFX=no ENABLE_3DFX=no
@ -1293,6 +1323,7 @@ else
ENABLE_SDL=no ENABLE_SDL=no
ENABLE_SGL=no ENABLE_SGL=no
ENABLE_SVGA=no ENABLE_SVGA=no
ENABLE_WGL=no
ENABLE_X11=no ENABLE_X11=no
IFS="," IFS=","
for client in $clients; do for client in $clients; do
@ -1321,6 +1352,9 @@ else
svga) svga)
ENABLE_SVGA=yes ENABLE_SVGA=yes
;; ;;
wgl)
ENABLE_WGL=yes
;;
x11) x11)
ENABLE_X11=yes ENABLE_X11=yes
;; ;;
@ -1372,6 +1406,12 @@ if test "x$HAVE_SVGA" = xyes -a "x$ENABLE_SVGA" = xyes; then
TARGETS="$TARGETS qf-client-svga\$(EXEEXT)" TARGETS="$TARGETS qf-client-svga\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS SVGAlib" CL_TARGETS="$CL_TARGETS SVGAlib"
fi fi
if test "x$mingw" = xyes; then
if test "x$ENABLE_WGL" = xyes; then
TARGETS="$TARGETS qf-client-wgl\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS WGL"
fi
fi
if test "x$HAVE_X" = xyes -a "x$ENABLE_X11" = xyes; then if test "x$HAVE_X" = xyes -a "x$ENABLE_X11" = xyes; then
TARGETS="$TARGETS qf-client-x11\$(EXEEXT)" TARGETS="$TARGETS qf-client-x11\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS X11" CL_TARGETS="$CL_TARGETS X11"

View file

@ -35,14 +35,27 @@
# pragma warning( disable : 4229 ) /* mgraph gets this */ # pragma warning( disable : 4229 ) /* mgraph gets this */
#endif #endif
#define byte __hide_byte
#define LPCWAVEFORMATEX __hide_LPCWAVEFORMATEX_
#include <windows.h> #include <windows.h>
#include <ddraw.h> #undef LPCWAVEFORMATEX
#ifdef WINNT
#undef WINNT
#include <dsound.h> #include <dsound.h>
#include <ddraw.h>
#define WINNT
#else
#include <dsound.h>
#include <ddraw.h>
#endif
#ifdef HAVE_MGRAPH_H #ifdef HAVE_MGRAPH_H
# include <mgraph.h> # include <mgraph.h>
#endif #endif
#undef byte
#include "qtypes.h" #include "qtypes.h"
#ifndef WM_MOUSEWHEEL #ifndef WM_MOUSEWHEEL

View file

@ -302,10 +302,10 @@ qf_client_sgl_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs
# #
# SGI/Microsoft WGL (Windows OpenGL) # SGI/Microsoft WGL (Windows OpenGL)
# #
wgl_SOURCES= vid_wgl.c wgl_SOURCES= vid_wgl.c in_win.c
qf_client_wgl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES) $(wgl_SOURCES) qf_client_wgl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES) $(wgl_SOURCES)
qf_client_wgl_LDADD= $(CLIENT_LIBS) qf_client_wgl_LDADD= $(CLIENT_LIBS) $(GLX_LIBS) -lgdi32 -lwinmm
qf_client_wgl_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a qf_client_wgl_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
# #

View file

@ -63,7 +63,7 @@ CDAudio_Eject (void)
dwReturn = mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, dwReturn = mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN,
(DWORD) NULL); (DWORD) NULL);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn); Con_DPrintf ("MCI_SET_DOOR_OPEN failed (%li)\n", dwReturn);
} }
} }
@ -76,7 +76,7 @@ CDAudio_CloseDoor (void)
dwReturn = dwReturn =
mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD) NULL); mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD) NULL);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn); Con_DPrintf ("MCI_SET_DOOR_CLOSED failed (%li)\n", dwReturn);
} }
} }
@ -153,7 +153,7 @@ CDAudio_Play (byte track, qboolean looping)
MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT,
(DWORD) (LPVOID) & mciStatusParms); (DWORD) (LPVOID) & mciStatusParms);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_STATUS failed (%i)\n", dwReturn); Con_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn);
return; return;
} }
if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO) { if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO) {
@ -168,7 +168,7 @@ CDAudio_Play (byte track, qboolean looping)
MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT,
(DWORD) (LPVOID) & mciStatusParms); (DWORD) (LPVOID) & mciStatusParms);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_STATUS failed (%i)\n", dwReturn); Con_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn);
return; return;
} }
@ -185,7 +185,7 @@ CDAudio_Play (byte track, qboolean looping)
mciSendCommand (wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, mciSendCommand (wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO,
(DWORD) (LPVOID) & mciPlayParms); (DWORD) (LPVOID) & mciPlayParms);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); Con_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
return; return;
} }
@ -211,7 +211,7 @@ CDAudio_Stop (void)
dwReturn = mciSendCommand (wDeviceID, MCI_STOP, 0, (DWORD) NULL); dwReturn = mciSendCommand (wDeviceID, MCI_STOP, 0, (DWORD) NULL);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_STOP failed (%i)", dwReturn); Con_DPrintf ("MCI_STOP failed (%li)", dwReturn);
} }
wasPlaying = false; wasPlaying = false;
@ -236,7 +236,7 @@ CDAudio_Pause (void)
mciSendCommand (wDeviceID, MCI_PAUSE, 0, mciSendCommand (wDeviceID, MCI_PAUSE, 0,
(DWORD) (LPVOID) & mciGenericParms); (DWORD) (LPVOID) & mciGenericParms);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_PAUSE failed (%i)", dwReturn); Con_DPrintf ("MCI_PAUSE failed (%li)", dwReturn);
} }
wasPlaying = playing; wasPlaying = playing;
@ -266,7 +266,7 @@ CDAudio_Resume (void)
mciSendCommand (wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, mciSendCommand (wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY,
(DWORD) (LPVOID) & mciPlayParms); (DWORD) (LPVOID) & mciPlayParms);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); Con_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
return; return;
} }
playing = true; playing = true;
@ -456,7 +456,7 @@ CDAudio_Init (void)
mciSendCommand (0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, mciSendCommand (0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE,
(DWORD) (LPVOID) & mciOpenParms); (DWORD) (LPVOID) & mciOpenParms);
if (dwReturn) { if (dwReturn) {
Con_Printf ("CDAudio_Init: MCI_OPEN failed (%i)\n", dwReturn); Con_Printf ("CDAudio_Init: MCI_OPEN failed (%li)\n", dwReturn);
return -1; return -1;
} }
wDeviceID = mciOpenParms.wDeviceID; wDeviceID = mciOpenParms.wDeviceID;
@ -467,7 +467,7 @@ CDAudio_Init (void)
mciSendCommand (wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, mciSendCommand (wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT,
(DWORD) (LPVOID) & mciSetParms); (DWORD) (LPVOID) & mciSetParms);
if (dwReturn) { if (dwReturn) {
Con_Printf ("MCI_SET_TIME_FORMAT failed (%i)\n", dwReturn); Con_Printf ("MCI_SET_TIME_FORMAT failed (%li)\n", dwReturn);
mciSendCommand (wDeviceID, MCI_CLOSE, 0, (DWORD) NULL); mciSendCommand (wDeviceID, MCI_CLOSE, 0, (DWORD) NULL);
return -1; return -1;
} }

View file

@ -30,6 +30,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include "winquake.h"
#include "cdaudio.h" #include "cdaudio.h"
#include "cmd.h" #include "cmd.h"
#include "console.h" #include "console.h"
@ -46,7 +48,6 @@
#include "sound.h" #include "sound.h"
#include "sys.h" #include "sys.h"
#include "va.h" #include "va.h"
#include "winquake.h"
extern void (*vid_menudrawfn) (void); extern void (*vid_menudrawfn) (void);
extern void (*vid_menukeyfn) (int); extern void (*vid_menukeyfn) (int);
@ -253,7 +254,7 @@ VID_SetWindowedMode (int modenum)
global_hInstance, NULL); global_hInstance, NULL);
if (!mainwindow) if (!mainwindow)
Sys_Error ("Couldn't create DIB window (%x)\r\n",GetLastError()); Sys_Error ("Couldn't create DIB window (%lx)\r\n",GetLastError());
// Center and show the window // Center and show the window
CenterWindow (mainwindow, WindowRect.right - WindowRect.left, CenterWindow (mainwindow, WindowRect.right - WindowRect.left,
@ -309,7 +310,7 @@ VID_SetFullDIBMode (int modenum)
if (ChangeDisplaySettings (&gdevmode, CDS_FULLSCREEN) != if (ChangeDisplaySettings (&gdevmode, CDS_FULLSCREEN) !=
DISP_CHANGE_SUCCESSFUL) DISP_CHANGE_SUCCESSFUL)
Sys_Error ("Couldn't set fullscreen DIB mode (%x)\r\n",GetLastError()); Sys_Error ("Couldn't set fullscreen DIB mode (%lx)\r\n",GetLastError());
} }
lastmodestate = modestate; lastmodestate = modestate;
@ -343,7 +344,7 @@ VID_SetFullDIBMode (int modenum)
global_hInstance, NULL); global_hInstance, NULL);
if (!mainwindow) if (!mainwindow)
Sys_Error ("Couldn't create DIB window (%x)\r\n",GetLastError()); Sys_Error ("Couldn't create DIB window (%lx)\r\n",GetLastError());
ShowWindow (mainwindow, SW_SHOWDEFAULT); ShowWindow (mainwindow, SW_SHOWDEFAULT);
UpdateWindow (mainwindow); UpdateWindow (mainwindow);
@ -884,7 +885,7 @@ AppActivate (BOOL fActive, BOOL minimize)
if (ChangeDisplaySettings (&gdevmode, CDS_FULLSCREEN) != if (ChangeDisplaySettings (&gdevmode, CDS_FULLSCREEN) !=
DISP_CHANGE_SUCCESSFUL) { DISP_CHANGE_SUCCESSFUL) {
IN_ShowMouse (); IN_ShowMouse ();
Sys_Error ("Couldn't set fullscreen DIB mode\n(try upgrading your video drivers)\r\n (%x)",GetLastError()); Sys_Error ("Couldn't set fullscreen DIB mode\n(try upgrading your video drivers)\r\n (%lx)",GetLastError());
} }
ShowWindow (mainwindow, SW_SHOWNORMAL); ShowWindow (mainwindow, SW_SHOWNORMAL);
@ -1205,7 +1206,7 @@ VID_InitDIB (HINSTANCE hInstance)
wc.lpszClassName = "QuakeForge"; wc.lpszClassName = "QuakeForge";
if (!RegisterClass (&wc)) if (!RegisterClass (&wc))
Sys_Error ("Couldn't register window class (%x)\r\n",GetLastError()); Sys_Error ("Couldn't register window class (%lx)\r\n",GetLastError());
modelist[0].type = MS_WINDOWED; modelist[0].type = MS_WINDOWED;
@ -1421,7 +1422,7 @@ void
VID_Init (unsigned char *palette) VID_Init (unsigned char *palette)
{ {
int i, existingmode; int i, existingmode;
int basenummodes, width, height, bpp, findbpp, done; int basenummodes, width, height=480, bpp, findbpp, done;
char gldir[MAX_OSPATH]; char gldir[MAX_OSPATH];
HDC hdc; HDC hdc;
DEVMODE devmode; DEVMODE devmode;
@ -1620,7 +1621,7 @@ VID_Init (unsigned char *palette)
lasterror=GetLastError(); lasterror=GetLastError();
if (maindc && mainwindow) if (maindc && mainwindow)
ReleaseDC (mainwindow, maindc); ReleaseDC (mainwindow, maindc);
Sys_Error("Could not initialize GL (wglCreateContext failed).\n\nMake sure you in are 65535 color mode, and try running -window. \nError code: (%x)\r\n",lasterror); Sys_Error("Could not initialize GL (wglCreateContext failed).\n\nMake sure you in are 65535 color mode, and try running -window. \nError code: (%lx)\r\n",lasterror);
} }
if (!wglMakeCurrent (maindc, baseRC)) { if (!wglMakeCurrent (maindc, baseRC)) {
@ -1629,7 +1630,7 @@ VID_Init (unsigned char *palette)
wglDeleteContext (baseRC); wglDeleteContext (baseRC);
if (maindc && mainwindow) if (maindc && mainwindow)
ReleaseDC (mainwindow, maindc); ReleaseDC (mainwindow, maindc);
Sys_Error ("wglMakeCurrent failed (%x)\r\n",lasterror); Sys_Error ("wglMakeCurrent failed (%lx)\r\n",lasterror);
} }
GL_Init (); GL_Init ();