mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
Get QF cross-compiling using MXE/mingw32
This includes -win clients (no clue if anything actually works yet).
This commit is contained in:
parent
c4a0f3cc73
commit
88ff254f42
58 changed files with 2448 additions and 2139 deletions
|
@ -26,7 +26,7 @@ NOCONV_DIST= \
|
|||
|
||||
BUILT_SOURCES = $(top_srcdir)/.version
|
||||
#AM_CFLAGS= @PREFER_NON_PIC@
|
||||
AM_CPPFLAGS= -I$(top_srcdir)/include $(PTHREAD_CFLAGS)
|
||||
AM_CPPFLAGS= -I$(top_srcdir)/include $(PTHREAD_CFLAGS) $(FNM_FLAGS) $(NCURSES_CFLAGS)
|
||||
|
||||
common_ldflags= -export-dynamic @PTHREAD_LDFLAGS@
|
||||
|
||||
|
@ -69,6 +69,8 @@ XMMS_LIBS= @XMMS_LIBS@
|
|||
PAK=$(top_builddir)/pak$(EXEEXT)
|
||||
QFCC_DEP=qfcc$(EXEEXT)
|
||||
QFCC=$(top_builddir)/$(QFCC_DEP)
|
||||
QWAQ_CURSES=$(top_builddir)/ruamoko/qwaq/qwaq-curses$(EXEEXT)
|
||||
|
||||
GZ=@progs_gz@
|
||||
|
||||
V_QFCC = $(V_QFCC_@AM_V@)
|
||||
|
|
|
@ -224,52 +224,52 @@ if test "x$ENABLE_servers_qw" = xyes; then
|
|||
fi
|
||||
|
||||
if test "x$ENABLE_tools_bsp2img" = xyes; then
|
||||
BSP2IMG_TARGETS=bsp2img
|
||||
BSP2IMG_TARGETS="bsp2img\$(EXEEXT)"
|
||||
QF_NEED(tools,[bsp2img])
|
||||
QF_NEED(libs,[image util])
|
||||
fi
|
||||
if test "x$ENABLE_tools_carne" = xyes; then
|
||||
CARNE_TARGETS=carne
|
||||
CARNE_TARGETS="carne\$(EXEEXT)"
|
||||
QF_NEED(tools,[carne])
|
||||
QF_NEED(libs,[gib ruamoko gamecode util])
|
||||
fi
|
||||
if test "x$ENABLE_tools_pak" = xyes; then
|
||||
PAK_TARGETS=pak
|
||||
PAK_TARGETS="pak\$(EXEEXT)"
|
||||
QF_NEED(tools,[pak])
|
||||
QF_NEED(libs,[util])
|
||||
fi
|
||||
if test "x$ENABLE_tools_qfbsp" = xyes; then
|
||||
QFBSP_TARGETS=qfbsp
|
||||
QFBSP_TARGETS="qfbsp\$(EXEEXT)"
|
||||
QF_NEED(tools,[qfbsp])
|
||||
QF_NEED(libs,[models image util])
|
||||
fi
|
||||
if test "x$ENABLE_tools_qfcc" = xyes; then
|
||||
QFCC_TARGETS=qfcc qfprogs
|
||||
QFCC_TARGETS="qfcc qfprogs\$(EXEEXT)"
|
||||
QF_NEED(tools,[qfcc])
|
||||
QF_NEED(libs,[gamecode util])
|
||||
fi
|
||||
if test "x$ENABLE_tools_qflight" = xyes; then
|
||||
QFLIGHT_TARGETS=qflight
|
||||
QFLIGHT_TARGETS="qflight\$(EXEEXT)"
|
||||
QF_NEED(tools,[qflight])
|
||||
QF_NEED(libs,[util])
|
||||
fi
|
||||
if test "x$ENABLE_tools_qflmp" = xyes; then
|
||||
QFLMP_TARGETS=qflmp
|
||||
QFLMP_TARGETS="qflmp\$(EXEEXT)"
|
||||
QF_NEED(tools,[qflmp])
|
||||
QF_NEED(libs,[util])
|
||||
fi
|
||||
if test "x$ENABLE_tools_qfmodelgen" = xyes; then
|
||||
QFMODELGEN_TARGETS=qfmodelgen
|
||||
QFMODELGEN_TARGETS="qfmodelgen\$(EXEEXT)"
|
||||
QF_NEED(tools,[qfmodelgen])
|
||||
QF_NEED(libs,[util])
|
||||
fi
|
||||
if test "x$ENABLE_tools_qfspritegen" = xyes; then
|
||||
QFSPRITEGEN_TARGETS=qfspritegen
|
||||
QFSPRITEGEN_TARGETS="qfspritegen\$(EXEEXT)"
|
||||
QF_NEED(tools,[qfspritegen])
|
||||
QF_NEED(libs,[util])
|
||||
fi
|
||||
if test "x$ENABLE_tools_qfvis" = xyes; then
|
||||
QFVIS_TARGETS=qfvis
|
||||
QFVIS_TARGETS="qfvis\$(EXEEXT)"
|
||||
QF_NEED(tools,[qfvis])
|
||||
QF_NEED(libs,[util])
|
||||
fi
|
||||
|
@ -282,12 +282,12 @@ if test "x$ENABLE_tools_qwaq" = xyes; then
|
|||
QF_NEED(libs,[ruamoko gamecode util])
|
||||
fi
|
||||
if test "x$ENABLE_tools_wad" = xyes; then
|
||||
WAD_TARGETS=wad
|
||||
WAD_TARGETS="wad\$(EXEEXT)"
|
||||
QF_NEED(tools,[wad])
|
||||
QF_NEED(libs,[image util])
|
||||
fi
|
||||
if test "x$ENABLE_tools_wav" = xyes; then
|
||||
WAV_TARGETS=qfwavinfo
|
||||
WAV_TARGETS="qfwavinfo\$(EXEEXT)"
|
||||
QF_NEED(tools,[wav])
|
||||
QF_NEED(libs,[util])
|
||||
fi
|
||||
|
|
|
@ -27,8 +27,7 @@ AC_TRY_LINK(
|
|||
AC_MSG_RESULT(yes)
|
||||
)
|
||||
AH_VERBATIM([HAVE_C99INLINE],
|
||||
[/* Define this if the GCC __attribute__ keyword is available */
|
||||
#undef HAVE_C99INLINE
|
||||
[#undef HAVE_C99INLINE
|
||||
#ifdef HAVE_C99INLINE
|
||||
# define GNU89INLINE
|
||||
#else
|
||||
|
|
|
@ -2,44 +2,52 @@ AC_ARG_ENABLE(curses,
|
|||
[ --disable-curses disable curses support]
|
||||
)
|
||||
if test "x$enable_curses" != "xno"; then
|
||||
AC_CHECK_HEADER([curses.h],
|
||||
[AC_DEFINE([HAVE_CURSES_H], [1],
|
||||
[Define to 1 if you have <curses.h>.])])
|
||||
if test "x$PKG_CONFIG" != "x"; then
|
||||
PKG_CHECK_MODULES([NCURSES], [ncurses], HAVE_NCURSES=yes, HAVE_NCURSES=no)
|
||||
else
|
||||
AC_CHECK_HEADER([curses.h], [],
|
||||
[AC_CHECK_HEADER([ncurses/curses.h],
|
||||
[NCURSES_CFLAGS=-I${prefix}/include/ncurses])])
|
||||
AC_CHECK_LIB(ncurses, initscr,
|
||||
CURSES_LIBS=-lncurses,
|
||||
NCURSES_LIBS=-lncurses,
|
||||
AC_CHECK_LIB(pdcurses, initscr,
|
||||
CURSES_LIBS=-lpdcurses,
|
||||
NCURSES_LIBS=-lpdcurses,
|
||||
AC_CHECK_LIB(curses, initscr,
|
||||
CURSES_LIBS=-lcurses,
|
||||
CURSES_LIBS=
|
||||
NCURSES_LIBS=-lcurses,
|
||||
NCURSES_LIBS=
|
||||
)
|
||||
)
|
||||
)
|
||||
if test "x$CURSES_LIBS" != "x"; then
|
||||
if test "x$NCURSES_LIBS" != "x"; then
|
||||
AC_DEFINE(HAVE_CURSES, 1, [Define if you have the ncurses library])
|
||||
HAVE_CURSES=yes
|
||||
else
|
||||
HAVE_CURSES=no
|
||||
fi
|
||||
fi
|
||||
else
|
||||
HAVE_CURSES=no
|
||||
CURSES_LIBS=
|
||||
NCURSES_LIBS=
|
||||
fi
|
||||
AC_SUBST(CURSES_LIBS)
|
||||
AC_SUBST(NCURSES_LIBS)
|
||||
|
||||
if test "x$HAVE_CURSES" == "xyes"; then
|
||||
AC_CHECK_HEADER(panel.h,
|
||||
[AC_CHECK_LIB(panel, new_panel,
|
||||
[AC_DEFINE(HAVE_PANEL, 1,
|
||||
[Define if you have the ncurses panel library])
|
||||
PANEL_LIBS=-lpanel
|
||||
HAVE_PANEL=yes],
|
||||
if test "x$HAVE_NCURSES" == "xyes"; then
|
||||
if test "x$PKG_CONFIG" != "x"; then
|
||||
PKG_CHECK_MODULES([PANEL], [panel], HAVE_PANEL=yes, HAVE_PANEL=no)
|
||||
else
|
||||
AC_CHECK_HEADER(panel.h,
|
||||
[AC_CHECK_LIB(panel, new_panel,
|
||||
[AC_DEFINE(HAVE_PANEL, 1,
|
||||
[Define if you have the ncurses panel library])
|
||||
PANEL_LIBS=-lpanel
|
||||
HAVE_PANEL=yes],
|
||||
[HAVE_PANEL=no],
|
||||
$NCURSES_LIBS
|
||||
)],
|
||||
[HAVE_PANEL=no],
|
||||
$CURSES_LIBS
|
||||
)],
|
||||
HAVE_PANEL=no,
|
||||
[]
|
||||
)
|
||||
[$NCURSES_CFLAGS]
|
||||
)
|
||||
fi
|
||||
else
|
||||
PANEL_LIBS=
|
||||
fi
|
||||
|
|
|
@ -50,6 +50,15 @@ AC_TRY_COMPILE(
|
|||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(for strndup in string.h)
|
||||
AC_TRY_COMPILE(
|
||||
[#include "string.h"],
|
||||
[int (*foo)() = strndup;],
|
||||
AC_DEFINE(HAVE_STRNDUP_PROTO, 1, [Define this if strndup is prototyped in string.h])
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(for strcasestr in string.h)
|
||||
AC_TRY_COMPILE(
|
||||
[#include "string.h"],
|
||||
|
|
|
@ -10,9 +10,10 @@ AC_FUNC_VPRINTF
|
|||
AC_CHECK_FUNCS(
|
||||
access _access connect dlopen execvp fcntl ftime _ftime getaddrinfo \
|
||||
gethostbyname gethostname getnameinfo getpagesize gettimeofday getuid \
|
||||
getwd ioctl mkdir _mkdir mprotect putenv select snprintf _snprintf \
|
||||
socket stat strcasestr strerror strnlen strsep strstr vsnprintf \
|
||||
_vsnprintf wait
|
||||
getwd ioctl mkdir _mkdir mprotect putenv qsort_r select sigaction \
|
||||
snprintf _snprintf socket stat strcasestr strerror strerror_r strndup \
|
||||
strnlen \
|
||||
strsep strstr vsnprintf _vsnprintf wait
|
||||
)
|
||||
|
||||
AC_FUNC_VA_COPY
|
||||
|
|
|
@ -19,3 +19,4 @@ AC_SUBST(VULKAN_LIBS)
|
|||
AC_SUBST(GLSLANGVALIDATOR, [$glslangvalidator])
|
||||
|
||||
AM_CONDITIONAL(X11_VULKAN, test "x$HAVE_VULKAN" = "xyes")
|
||||
AM_CONDITIONAL(WIN_VULKAN, test "x$HAVE_VULKAN" = "xyes")
|
||||
|
|
|
@ -74,9 +74,10 @@ dnl Checks for system type
|
|||
dnl ==================================================================
|
||||
|
||||
dnl Checks for which system driver to use
|
||||
echo ${host}
|
||||
AC_MSG_CHECKING(for system driver)
|
||||
case "${host}" in
|
||||
i?86-*-mingw32*|x86_64-w64-mingw32)
|
||||
i?86-*-mingw32*|x86_64-w64-mingw32*)
|
||||
SYSTYPE=WIN32
|
||||
AC_MSG_RESULT([Win32 driver])
|
||||
WIN32_LIBS=' $(NET_LIBS)'
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
if (dfunc->vkSetDebugUtilsObjectNameEXT) { \
|
||||
VkDebugUtilsObjectNameInfoEXT nameInfo = { \
|
||||
VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, 0, \
|
||||
type, (uint64_t) handle, name \
|
||||
type, (VkObjectType) handle, name \
|
||||
}; \
|
||||
dfunc->vkSetDebugUtilsObjectNameEXT (device->dev, &nameInfo); \
|
||||
} \
|
||||
|
|
76
include/context_win.h
Normal file
76
include/context_win.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
context_win.h
|
||||
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
Please see the file "AUTHORS" for a list of contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __context_win_h
|
||||
#define __context_win_h
|
||||
|
||||
#include "QF/qtypes.h"
|
||||
#include "winquake.h"
|
||||
|
||||
extern HWND win_mainwindow;
|
||||
extern HDC win_maindc;
|
||||
extern HDC win_dib_section;
|
||||
extern int win_using_ddraw;
|
||||
extern int win_palettized;
|
||||
extern int win_canalttab;
|
||||
extern DEVMODE win_gdevmode;
|
||||
extern LPDIRECTDRAWSURFACE win_dd_frontbuffer;
|
||||
extern LPDIRECTDRAWSURFACE win_dd_backbuffer;
|
||||
extern RECT win_src_rect;
|
||||
extern RECT win_dst_rect;
|
||||
extern RECT win_window_rect;
|
||||
extern HDC win_gdi;
|
||||
extern struct sw_ctx_s *win_sw_context;
|
||||
|
||||
void Win_UnloadAllDrivers (void);
|
||||
void Win_CreateDriver (void);
|
||||
void Win_OpenDisplay (void);
|
||||
void Win_CloseDisplay (void);
|
||||
void Win_SetVidMode (int width, int height, const byte *palette);
|
||||
void Win_Init_Cvars (void);
|
||||
void Win_UpdateWindowStatus (int x, int y);
|
||||
void Win_SetCaption (const char *text);
|
||||
qboolean Win_SetGamma (double gamma);
|
||||
|
||||
struct gl_ctx_s *Win_GL_Context (void);
|
||||
void Win_GL_Init_Cvars (void);
|
||||
|
||||
struct sw_ctx_s *Win_SW_Context (void);
|
||||
void Win_SW_Init_Cvars (void);
|
||||
|
||||
struct vulkan_ctx_s *Win_Vulkan_Context (void);
|
||||
void Win_Vulkan_Init_Cvars (void);
|
||||
|
||||
void IN_UpdateClipCursor (void);
|
||||
void IN_ShowMouse (void);
|
||||
void IN_HideMouse (void);
|
||||
void IN_ActivateMouse (void);
|
||||
void IN_DeactivateMouse (void);
|
||||
|
||||
#endif // __context_win_h
|
|
@ -54,7 +54,7 @@ const char *WINS_AddrToString (netadr_t *addr);
|
|||
int WINS_GetSocketAddr (int socket, netadr_t *addr);
|
||||
int WINS_GetNameFromAddr (netadr_t *addr, char *name);
|
||||
int WINS_GetAddrFromName (const char *name, netadr_t *addr);
|
||||
int WINS_AddrCompare (netadr_t *addr1, netadr_t *addr2);
|
||||
int WINS_AddrCompare (netadr_t *addr1, netadr_t *addr2) __attribute__((pure));
|
||||
int WINS_GetSocketPort (netadr_t *addr);
|
||||
int WINS_SetSocketPort (netadr_t *addr, int port);
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef __vid_gl_h
|
||||
#define __vid_gl_h
|
||||
|
||||
// GLXContext is a pointer to opaque data
|
||||
typedef struct __GLXcontextRec *GLXContext;
|
||||
// GL_context is a pointer to opaque data
|
||||
typedef struct GL_context *GL_context;
|
||||
|
||||
typedef struct gl_ctx_s {
|
||||
GLXContext context;
|
||||
GL_context context;
|
||||
void (*load_gl) (void);
|
||||
void (*choose_visual) (struct gl_ctx_s *ctx);
|
||||
void (*create_context) (struct gl_ctx_s *ctx);
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#ifndef __vid_sw_h
|
||||
#define __vid_sw_h
|
||||
|
||||
// GLXContext is a pointer to opaque data
|
||||
typedef struct __GLXcontextRec *GLXContext;
|
||||
struct vrect_s;
|
||||
typedef struct sw_ctx_s {
|
||||
GLXContext context;
|
||||
void (*choose_visual) (struct sw_ctx_s *ctx);
|
||||
void (*create_context) (struct sw_ctx_s *ctx);
|
||||
void (*set_palette) (const byte *palette);
|
||||
|
|
|
@ -61,7 +61,7 @@ extern "C" {
|
|||
/* Match STRING against the filename pattern PATTERN,
|
||||
returning zero if it matches, FNM_NOMATCH if not. */
|
||||
extern int fnmatch __P ((const char *__pattern, const char *__string,
|
||||
int __flags));
|
||||
int __flags)) __attribute__((pure));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
/* stub for compilers not supporting stdint.h */
|
||||
#include "pstdint.h"
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <memoryapi.h>
|
||||
|
||||
#ifndef __GNUC__
|
||||
# pragma warning( disable : 4229 ) /* mgraph gets this */
|
||||
#endif
|
||||
|
@ -76,20 +78,14 @@ extern LPDIRECTDRAWSURFACE lpBackBuffer;
|
|||
extern LPDIRECTDRAWPALETTE lpDDPal;
|
||||
#endif
|
||||
|
||||
void VID_LockBuffer (void);
|
||||
void VID_UnlockBuffer (void);
|
||||
void VID_UpdateWindowStatus (int window_x, int window_y);
|
||||
|
||||
typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t;
|
||||
|
||||
extern modestate_t modestate;
|
||||
|
||||
extern HWND mainwindow;
|
||||
extern qboolean ActiveApp, Minimized;
|
||||
|
||||
extern qboolean WinNT;
|
||||
|
||||
void VID_ForceLockState (int lk);
|
||||
extern qboolean winsock_lib_initialized;
|
||||
|
||||
extern int window_center_x, window_center_y;
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "winquake.h"
|
||||
|
||||
#include "QF/cdaudio.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/cvar.h"
|
||||
|
@ -41,6 +39,7 @@
|
|||
#include "QF/plugin/cd.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "context_win.h"
|
||||
|
||||
static plugin_t plugin_info;
|
||||
static plugin_data_t plugin_info_data;
|
||||
|
@ -181,7 +180,7 @@ I_CDAudio_Pause (void)
|
|||
if (!playing)
|
||||
return;
|
||||
|
||||
mciGenericParms.dwCallback = (DWORD_PTR) mainwindow;
|
||||
mciGenericParms.dwCallback = (DWORD_PTR) win_mainwindow;
|
||||
dwReturn =
|
||||
mciSendCommand (wDeviceID, MCI_PAUSE, 0,
|
||||
(DWORD_PTR) (LPVOID) & mciGenericParms);
|
||||
|
@ -254,7 +253,7 @@ I_CDAudio_Play (int track, qboolean looping)
|
|||
|
||||
mciPlayParms.dwFrom = MCI_MAKE_TMSF (track, 0, 0, 0);
|
||||
mciPlayParms.dwTo = (mciStatusParms.dwReturn << 8) | track;
|
||||
mciPlayParms.dwCallback = (DWORD_PTR) mainwindow;
|
||||
mciPlayParms.dwCallback = (DWORD_PTR) win_mainwindow;
|
||||
dwReturn =
|
||||
mciSendCommand (wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO,
|
||||
(DWORD_PTR) (LPVOID) & mciPlayParms);
|
||||
|
@ -286,7 +285,7 @@ I_CDAudio_Resume (void)
|
|||
|
||||
mciPlayParms.dwFrom = MCI_MAKE_TMSF (playTrack, 0, 0, 0);
|
||||
mciPlayParms.dwTo = MCI_MAKE_TMSF (playTrack + 1, 0, 0, 0);
|
||||
mciPlayParms.dwCallback = (DWORD_PTR) mainwindow;
|
||||
mciPlayParms.dwCallback = (DWORD_PTR) win_mainwindow;
|
||||
dwReturn =
|
||||
mciSendCommand (wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY,
|
||||
(DWORD_PTR) (LPVOID) & mciPlayParms);
|
||||
|
|
|
@ -30,12 +30,12 @@
|
|||
|
||||
#define CINTERFACE
|
||||
|
||||
#include "winquake.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_internal.h"
|
||||
#include "context_win.h"
|
||||
|
||||
#define iDirectSoundCreate(a,b,c) pDirectSoundCreate(a,b,c)
|
||||
|
||||
|
@ -131,7 +131,7 @@ FreeSound (void)
|
|||
}
|
||||
|
||||
if (pDS) {
|
||||
IDirectSound_SetCooperativeLevel (pDS, mainwindow, DSSCL_NORMAL);
|
||||
IDirectSound_SetCooperativeLevel (pDS, win_mainwindow, DSSCL_NORMAL);
|
||||
IDirectSound_Release (pDS);
|
||||
}
|
||||
pDS = NULL;
|
||||
|
@ -219,7 +219,8 @@ SNDDMA_InitDirect (void)
|
|||
}
|
||||
|
||||
if (DS_OK !=
|
||||
IDirectSound_SetCooperativeLevel (pDS, mainwindow, DSSCL_EXCLUSIVE)) {
|
||||
IDirectSound_SetCooperativeLevel (pDS, win_mainwindow,
|
||||
DSSCL_EXCLUSIVE)) {
|
||||
Sys_Printf ("Set coop level failed\n");
|
||||
FreeSound ();
|
||||
return SIS_FAILURE;
|
||||
|
@ -276,7 +277,7 @@ SNDDMA_InitDirect (void)
|
|||
}
|
||||
} else {
|
||||
if (DS_OK !=
|
||||
IDirectSound_SetCooperativeLevel (pDS, mainwindow,
|
||||
IDirectSound_SetCooperativeLevel (pDS, win_mainwindow,
|
||||
DSSCL_WRITEPRIMARY)) {
|
||||
Sys_Printf ("Set coop level failed\n");
|
||||
FreeSound ();
|
||||
|
|
|
@ -28,6 +28,6 @@ libs_console_console_client_la_DEPENDENCIES= $(client_deps)
|
|||
libs_console_console_client_la_SOURCES= $(client_sources)
|
||||
|
||||
libs_console_console_server_la_LDFLAGS= $(plugin_ldflags)
|
||||
libs_console_console_server_la_LIBADD= $(server_deps) $(CURSES_LIBS) $(plugin_libadd)
|
||||
libs_console_console_server_la_LIBADD= $(server_deps) $(NCURSES_LIBS) $(plugin_libadd)
|
||||
libs_console_console_server_la_DEPENDENCIES= $(server_deps)
|
||||
libs_console_console_server_la_SOURCES= $(server_sources)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURSES_H
|
||||
#ifdef HAVE_CURSES
|
||||
# include <curses.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
|
@ -84,7 +84,7 @@ static cvar_t *sv_conmode;
|
|||
|
||||
static void C_KeyEvent (knum_t key, short unicode, qboolean down);
|
||||
|
||||
#ifdef HAVE_CURSES_H
|
||||
#ifdef HAVE_CURSES
|
||||
|
||||
enum {
|
||||
sv_resize_x = 1,
|
||||
|
@ -682,7 +682,7 @@ sv_conmode_f (cvar_t *var)
|
|||
static void
|
||||
C_Init (void)
|
||||
{
|
||||
#ifdef HAVE_CURSES_H
|
||||
#ifdef HAVE_CURSES
|
||||
cvar_t *curses = Cvar_Get ("sv_use_curses", "0", CVAR_ROM, NULL,
|
||||
"Set to 1 to enable curses server console.");
|
||||
use_curses = curses->int_val;
|
||||
|
@ -705,7 +705,7 @@ C_shutdown (void)
|
|||
Qclose (log_file);
|
||||
log_file = 0;
|
||||
}
|
||||
#ifdef HAVE_CURSES_H
|
||||
#ifdef HAVE_CURSES
|
||||
if (use_curses)
|
||||
endwin ();
|
||||
#endif
|
||||
|
@ -725,7 +725,7 @@ C_Print (const char *fmt, va_list args)
|
|||
Qputs (log_file, buffer->str);
|
||||
Qflush (log_file);
|
||||
}
|
||||
#ifdef HAVE_CURSES_H
|
||||
#ifdef HAVE_CURSES
|
||||
if (use_curses) {
|
||||
print (buffer->str);
|
||||
} else
|
||||
|
@ -741,7 +741,7 @@ C_Print (const char *fmt, va_list args)
|
|||
static void
|
||||
C_ProcessInput (void)
|
||||
{
|
||||
#ifdef HAVE_CURSES_H
|
||||
#ifdef HAVE_CURSES
|
||||
if (use_curses) {
|
||||
process_input ();
|
||||
} else
|
||||
|
@ -757,7 +757,7 @@ C_ProcessInput (void)
|
|||
static void
|
||||
C_KeyEvent (knum_t key, short unicode, qboolean down)
|
||||
{
|
||||
#ifdef HAVE_CURSES_H
|
||||
#ifdef HAVE_CURSES
|
||||
key_event (key, unicode, down);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ NET_Ban_f (void)
|
|||
|
||||
switch (Cmd_Argc ()) {
|
||||
case 1:
|
||||
if (((struct in_addr *) &banAddr)->s_addr) {
|
||||
if (banAddr) {
|
||||
struct in_addr t;
|
||||
t.s_addr = banAddr;
|
||||
strcpy (addrStr, inet_ntoa (t));
|
||||
|
|
|
@ -437,10 +437,11 @@ PartialIPAddress (const char *in, netadr_t *hostaddr)
|
|||
return 0;
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
static int WINS_Connect_called;
|
||||
int
|
||||
WINS_Connect (int socket, netadr_t *addr)
|
||||
{
|
||||
WINS_Connect_called++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -543,6 +544,10 @@ WINS_AddrToString (netadr_t *addr)
|
|||
{
|
||||
static dstring_t *buffer;
|
||||
|
||||
if (!buffer) {
|
||||
buffer = dstring_new ();
|
||||
}
|
||||
|
||||
dsprintf (buffer, "%d.%d.%d.%d:%d", addr->ip[0],
|
||||
addr->ip[1], addr->ip[2], addr->ip[3],
|
||||
ntohs (addr->port));
|
||||
|
|
|
@ -25,10 +25,20 @@
|
|||
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "QF/alloc.h"
|
||||
#include "QF/cmem.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define aligned_alloc(align, size) _aligned_malloc(size, align)
|
||||
#define _SC_PAGESIZE 1
|
||||
static size_t sysconf (int key)
|
||||
{
|
||||
return 1024;
|
||||
}
|
||||
#endif
|
||||
|
||||
static size_t __attribute__((const))
|
||||
ilog2 (size_t x)
|
||||
{
|
||||
|
|
|
@ -103,19 +103,6 @@ int sys_checksum;
|
|||
static sys_printf_t sys_std_printf_function = Sys_StdPrintf;
|
||||
static sys_printf_t sys_err_printf_function = Sys_ErrPrintf;
|
||||
|
||||
#ifndef _WIN32
|
||||
static struct sigaction save_hup;
|
||||
static struct sigaction save_quit;
|
||||
static struct sigaction save_trap;
|
||||
static struct sigaction save_iot;
|
||||
static struct sigaction save_bus;
|
||||
#endif
|
||||
static struct sigaction save_int;
|
||||
static struct sigaction save_ill;
|
||||
static struct sigaction save_segv;
|
||||
static struct sigaction save_term;
|
||||
static struct sigaction save_fpe;
|
||||
|
||||
typedef struct shutdown_list_s {
|
||||
struct shutdown_list_s *next;
|
||||
void (*func) (void *);
|
||||
|
@ -635,11 +622,18 @@ Sys_PageIn (void *ptr, size_t size)
|
|||
VISIBLE void *
|
||||
Sys_Alloc (size_t size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
size_t page_size = 4096;
|
||||
size_t page_mask = page_size - 1;
|
||||
size = (size + page_mask) & ~page_mask;
|
||||
return VirtualAlloc (0, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
#else
|
||||
size_t page_size = sysconf (_SC_PAGESIZE);
|
||||
size_t page_mask = page_size - 1;
|
||||
size = (size + page_mask) & ~page_mask;
|
||||
return mmap (0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
|
||||
-1, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
|
@ -831,9 +825,69 @@ static void __attribute__((noreturn))
|
|||
aiee (int sig)
|
||||
{
|
||||
printf ("AIEE, signal %d in shutdown code, giving up\n", sig);
|
||||
#ifdef _WIN32
|
||||
longjmp (aiee_abort, 1);
|
||||
#else
|
||||
siglongjmp (aiee_abort, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
static void
|
||||
signal_handler (int sig)
|
||||
{
|
||||
int volatile recover = 0; // volatile for longjump
|
||||
static volatile int in_signal_handler = 0;
|
||||
|
||||
if (in_signal_handler) {
|
||||
aiee (sig);
|
||||
}
|
||||
printf ("Received signal %d, exiting...\n", sig);
|
||||
|
||||
switch (sig) {
|
||||
case SIGINT:
|
||||
case SIGTERM:
|
||||
signal (SIGINT, SIG_DFL);
|
||||
signal (SIGTERM, SIG_DFL);
|
||||
Sys_Quit ();
|
||||
default:
|
||||
if (!setjmp (aiee_abort)) {
|
||||
if (signal_hook)
|
||||
recover = signal_hook (sig, signal_hook_data);
|
||||
Sys_Shutdown ();
|
||||
}
|
||||
|
||||
if (!recover) {
|
||||
signal (SIGILL, SIG_DFL);
|
||||
signal (SIGSEGV, SIG_DFL);
|
||||
signal (SIGFPE, SIG_DFL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
hook_signlas (void)
|
||||
{
|
||||
// catch signals
|
||||
signal (SIGINT, signal_handler);
|
||||
signal (SIGILL, signal_handler);
|
||||
signal (SIGSEGV, signal_handler);
|
||||
signal (SIGTERM, signal_handler);
|
||||
signal (SIGFPE, signal_handler);
|
||||
}
|
||||
#else
|
||||
|
||||
static struct sigaction save_hup;
|
||||
static struct sigaction save_quit;
|
||||
static struct sigaction save_trap;
|
||||
static struct sigaction save_iot;
|
||||
static struct sigaction save_bus;
|
||||
static struct sigaction save_int;
|
||||
static struct sigaction save_ill;
|
||||
static struct sigaction save_segv;
|
||||
static struct sigaction save_term;
|
||||
static struct sigaction save_fpe;
|
||||
|
||||
static void
|
||||
signal_handler (int sig, siginfo_t *info, void *ucontext)
|
||||
{
|
||||
|
@ -848,10 +902,8 @@ signal_handler (int sig, siginfo_t *info, void *ucontext)
|
|||
switch (sig) {
|
||||
case SIGINT:
|
||||
case SIGTERM:
|
||||
#ifndef _WIN32
|
||||
case SIGHUP:
|
||||
sigaction (SIGHUP, &save_hup, 0);
|
||||
#endif
|
||||
sigaction (SIGINT, &save_int, 0);
|
||||
sigaction (SIGTERM, &save_term, 0);
|
||||
Sys_Quit ();
|
||||
|
@ -863,12 +915,10 @@ signal_handler (int sig, siginfo_t *info, void *ucontext)
|
|||
}
|
||||
|
||||
if (!recover) {
|
||||
#ifndef _WIN32
|
||||
sigaction (SIGQUIT, &save_quit, 0);
|
||||
sigaction (SIGTRAP, &save_trap, 0);
|
||||
sigaction (SIGIOT, &save_iot, 0);
|
||||
sigaction (SIGBUS, &save_bus, 0);
|
||||
#endif
|
||||
sigaction (SIGILL, &save_ill, 0);
|
||||
sigaction (SIGSEGV, &save_segv, 0);
|
||||
sigaction (SIGFPE, &save_fpe, 0);
|
||||
|
@ -876,8 +926,8 @@ signal_handler (int sig, siginfo_t *info, void *ucontext)
|
|||
}
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
Sys_Init (void)
|
||||
static void
|
||||
hook_signlas (void)
|
||||
{
|
||||
// catch signals
|
||||
struct sigaction action = {};
|
||||
|
@ -895,6 +945,13 @@ Sys_Init (void)
|
|||
sigaction (SIGSEGV, &action, &save_segv);
|
||||
sigaction (SIGTERM, &action, &save_term);
|
||||
sigaction (SIGFPE, &action, &save_fpe);
|
||||
}
|
||||
#endif
|
||||
|
||||
VISIBLE void
|
||||
Sys_Init (void)
|
||||
{
|
||||
hook_signlas ();
|
||||
|
||||
Cvar_Init_Hash ();
|
||||
Cmd_Init_Hash ();
|
||||
|
|
|
@ -395,7 +395,7 @@ V_VKGEN_0 = @echo " VKGEN " $@;
|
|||
V_VKGEN_1 =
|
||||
|
||||
$(vkparse_cinc): $(vkgen) $(qwaq_curses) $(vkparse_plist)
|
||||
$(V_VKGEN)$(qwaq_curses) $(vkgen) -- $(vkparse_plist) $(vkparse_cinc).t $(vkparse_hinc).t &&\
|
||||
$(V_VKGEN)$(QWAQ_CURSES) $(vkgen) -- $(vkparse_plist) $(vkparse_cinc).t $(vkparse_hinc).t &&\
|
||||
$(am__mv) $(vkparse_cinc).t $(vkparse_cinc) &&\
|
||||
$(am__mv) $(vkparse_hinc).t $(vkparse_hinc)
|
||||
|
||||
|
|
|
@ -8,10 +8,11 @@ EXTRA_LTLIBRARIES += \
|
|||
libs/video/targets/libQFsvga.la \
|
||||
libs/video/targets/libQFx11.la \
|
||||
libs/video/targets/libQFsdl.la \
|
||||
libs/video/targets/libQFwgl.la \
|
||||
libs/video/targets/libQFwin.la \
|
||||
libs/video/targets/libvid_common.la \
|
||||
libs/video/targets/libvid_sdl.la \
|
||||
libs/video/targets/libvid_svga.la \
|
||||
libs/video/targets/libvid_win.la \
|
||||
libs/video/targets/libvid_x11.la
|
||||
|
||||
joy_linux_src= libs/video/targets/joy_linux.c
|
||||
|
@ -27,6 +28,15 @@ joy_src= $(joy_null_src)
|
|||
endif
|
||||
endif
|
||||
|
||||
win_gl_src = libs/video/targets/vid_win_gl.c
|
||||
win_sw_src = libs/video/targets/vid_win_sw.c
|
||||
win_vulkan_src = libs/video/targets/vid_win_vulkan.c
|
||||
if WIN_VULKAN
|
||||
win_src = $(win_gl_src) $(win_sw_src) $(win_vulkan_src)
|
||||
else
|
||||
win_src = $(win_gl_src) $(win_sw_src)
|
||||
endif
|
||||
|
||||
x11_gl_src = libs/video/targets/vid_x11_gl.c
|
||||
x11_sw_src = libs/video/targets/vid_x11_sw.c
|
||||
x11_vulkan_src = libs/video/targets/vid_x11_vulkan.c
|
||||
|
@ -64,6 +74,14 @@ libs_video_targets_libvid_x11_la_CFLAGS= @PREFER_NON_PIC@ $(X_CFLAGS)
|
|||
libs_video_targets_libvid_x11_la_LDFLAGS= @STATIC@
|
||||
EXTRA_libs_video_targets_libvid_x11_la_SOURCES= $(x11_vulkan_src)
|
||||
|
||||
libs_video_targets_libvid_win_la_SOURCES = \
|
||||
libs/video/targets/in_win.c \
|
||||
libs/video/targets/context_win.c \
|
||||
$(win_src)
|
||||
libs_video_targets_libvid_win_la_CFLAGS= @PREFER_NON_PIC@ $(X_CFLAGS)
|
||||
libs_video_targets_libvid_win_la_LDFLAGS= @STATIC@
|
||||
EXTRA_libs_video_targets_libvid_win_la_SOURCES= $(win_vulkan_src)
|
||||
|
||||
libs_video_targets_libvid_svga_la_SOURCES= libs/video/targets/in_svgalib.c
|
||||
libs_video_targets_libvid_svga_la_CFLAGS= @PREFER_NON_PIC@ $(SVGA_CFLAGS)
|
||||
libs_video_targets_libvid_svga_la_LDFLAGS= @STATIC@
|
||||
|
@ -117,16 +135,14 @@ libs_video_targets_libQFsvga_la_LIBADD= $(svga_libs)
|
|||
libs_video_targets_libQFsvga_la_DEPENDENCIES= $(svga_libs)
|
||||
|
||||
#
|
||||
# OpenGL in Win32
|
||||
# MS Windows
|
||||
#
|
||||
wgl_libs=libs/video/targets/libvid_common.la libs/video/targets/libvid_gl.la
|
||||
libs_video_targets_libQFwgl_la_CFLAGS= @PREFER_NON_PIC@ $(WGL_CFLAGS)
|
||||
libs_video_targets_libQFwgl_la_SOURCES = \
|
||||
libs/video/targets/in_win.c \
|
||||
libs/video/targets/vid_wgl.c
|
||||
libs_video_targets_libQFwgl_la_LDFLAGS= @STATIC@
|
||||
libs_video_targets_libQFwgl_la_LIBADD= $(wgl_libs)
|
||||
libs_video_targets_libQFwgl_la_DEPENDENCIES= $(wgl_libs)
|
||||
win_libs=libs/video/targets/libvid_common.la libs/video/targets/libvid_win.la
|
||||
libs_video_targets_libQFwin_la_CFLAGS= @PREFER_NON_PIC@ $(WGL_CFLAGS)
|
||||
libs_video_targets_libQFwin_la_SOURCES= libs/video/targets/vid_win.c
|
||||
libs_video_targets_libQFwin_la_LDFLAGS= @STATIC@
|
||||
libs_video_targets_libQFwin_la_LIBADD= $(win_libs)
|
||||
libs_video_targets_libQFwin_la_DEPENDENCIES= $(win_libs)
|
||||
|
||||
#
|
||||
# X11 software rendering
|
||||
|
|
1403
libs/video/targets/context_win.c
Normal file
1403
libs/video/targets/context_win.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -46,6 +46,7 @@
|
|||
#include "QF/sys.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "context_win.h"
|
||||
#include "in_win.h"
|
||||
|
||||
#define DINPUT_BUFFERSIZE 16
|
||||
|
@ -55,9 +56,6 @@ HRESULT (WINAPI * pDirectInputCreate) (HINSTANCE hinst, DWORD dwVersion,
|
|||
LPDIRECTINPUT * lplpDirectInput,
|
||||
LPUNKNOWN punkOuter);
|
||||
|
||||
extern qboolean win_canalttab;
|
||||
extern DEVMODE win_gdevmode;
|
||||
|
||||
// mouse local variables
|
||||
static unsigned uiWheelMessage;
|
||||
static unsigned mouse_buttons;
|
||||
|
@ -119,8 +117,6 @@ static DIDATAFORMAT df = {
|
|||
rgodf, // and here they are
|
||||
};
|
||||
|
||||
// forward-referenced functions, joy
|
||||
|
||||
void
|
||||
IN_UpdateClipCursor (void)
|
||||
{
|
||||
|
@ -168,7 +164,7 @@ IN_ActivateMouse (void)
|
|||
SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);
|
||||
|
||||
SetCursorPos (window_center_x, window_center_y);
|
||||
SetCapture (mainwindow);
|
||||
SetCapture (win_mainwindow);
|
||||
ClipCursor (&window_rect);
|
||||
}
|
||||
|
||||
|
@ -255,7 +251,7 @@ IN_InitDInput (void)
|
|||
return false;
|
||||
}
|
||||
// set the cooperativity level.
|
||||
hr = IDirectInputDevice_SetCooperativeLevel (g_pMouse, mainwindow,
|
||||
hr = IDirectInputDevice_SetCooperativeLevel (g_pMouse, win_mainwindow,
|
||||
DISCL_EXCLUSIVE |
|
||||
DISCL_FOREGROUND);
|
||||
|
||||
|
@ -741,10 +737,10 @@ AppActivate (BOOL fActive, BOOL minimize)
|
|||
"(try upgrading your video drivers)\n (%lx)",
|
||||
GetLastError());
|
||||
}
|
||||
ShowWindow (mainwindow, SW_SHOWNORMAL);
|
||||
ShowWindow (win_mainwindow, SW_SHOWNORMAL);
|
||||
|
||||
// Fix for alt-tab bug in NVidia drivers
|
||||
MoveWindow(mainwindow, 0, 0, win_gdevmode.dmPelsWidth,
|
||||
MoveWindow(win_mainwindow, 0, 0, win_gdevmode.dmPelsWidth,
|
||||
win_gdevmode.dmPelsHeight, false);
|
||||
}
|
||||
}
|
||||
|
@ -782,13 +778,13 @@ MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
switch (uMsg) {
|
||||
case WM_KILLFOCUS:
|
||||
if (modestate == MS_FULLDIB)
|
||||
ShowWindow (mainwindow, SW_SHOWMINNOACTIVE);
|
||||
ShowWindow (win_mainwindow, SW_SHOWMINNOACTIVE);
|
||||
break;
|
||||
case WM_CREATE:
|
||||
break;
|
||||
|
||||
case WM_MOVE:
|
||||
VID_UpdateWindowStatus ((int) LOWORD (lParam),
|
||||
Win_UpdateWindowStatus ((int) LOWORD (lParam),
|
||||
(int) HIWORD (lParam));
|
||||
break;
|
||||
|
||||
|
@ -848,7 +844,8 @@ MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
case WM_CLOSE:
|
||||
if (MessageBox
|
||||
(mainwindow, "Are you sure you want to quit?", "Confirm Exit",
|
||||
(win_mainwindow,
|
||||
"Are you sure you want to quit?", "Confirm Exit",
|
||||
MB_YESNO | MB_SETFOREGROUND | MB_ICONQUESTION) == IDYES) {
|
||||
Sys_Quit ();
|
||||
}
|
||||
|
@ -864,8 +861,8 @@ MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
if (mainwindow)
|
||||
DestroyWindow (mainwindow);
|
||||
if (win_mainwindow)
|
||||
DestroyWindow (win_mainwindow);
|
||||
PostQuitMessage (0);
|
||||
break;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#ifdef _WIN32 // FIXME: evil hack to get full DirectSound support with SDL
|
||||
#include <windows.h>
|
||||
#include <SDL_syswm.h>
|
||||
HWND mainwindow;
|
||||
HWND win_mainwindow;
|
||||
#endif
|
||||
|
||||
SDL_Surface *sdl_screen = NULL;
|
||||
|
@ -116,7 +116,7 @@ VID_Init (byte *palette, byte *colormap)
|
|||
|
||||
// SDL_GetWMInfo(&info);
|
||||
// mainwindow=info.window;
|
||||
mainwindow=GetActiveWindow();
|
||||
win_mainwindow=GetActiveWindow();
|
||||
#endif
|
||||
|
||||
viddef.recalc_refdef = 1; // force a surface cache flush
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#ifdef _WIN32 // FIXME: evil hack to get full DirectSound support with SDL
|
||||
#include <windows.h>
|
||||
#include <SDL_syswm.h>
|
||||
HWND mainwindow;
|
||||
#endif
|
||||
|
||||
// The original defaults
|
||||
|
@ -95,7 +94,7 @@ sdl_update_palette (const byte *palette)
|
|||
}
|
||||
|
||||
static void
|
||||
VID_SetPalette (const byte *palette)
|
||||
sdl_set_palette (const byte *palette)
|
||||
{
|
||||
if (memcmp (cached_palette, palette, sizeof (cached_palette))) {
|
||||
memcpy (cached_palette, palette, sizeof (cached_palette));
|
||||
|
@ -171,7 +170,7 @@ sw_ctx_t *
|
|||
SDL_SW_Context (void)
|
||||
{
|
||||
sw_ctx_t *ctx = calloc (1, sizeof (sw_ctx_t));
|
||||
ctx->set_palette = VID_SetPalette;
|
||||
ctx->set_palette = sdl_set_palette;
|
||||
ctx->create_context = sdl_set_vid_mode;
|
||||
ctx->update = sdl_sw_update;
|
||||
return ctx;
|
||||
|
|
File diff suppressed because it is too large
Load diff
185
libs/video/targets/vid_win_gl.c
Normal file
185
libs/video/targets/vid_win_gl.c
Normal file
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
vid_win_gl.c
|
||||
|
||||
Win32 GL vid component
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "winquake.h"
|
||||
#include <ddraw.h>
|
||||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/vid.h"
|
||||
|
||||
#include "context_win.h"
|
||||
#include "r_internal.h"
|
||||
#include "vid_internal.h"
|
||||
#include "vid_gl.h"
|
||||
|
||||
// Define GLAPIENTRY to a useful value
|
||||
#ifndef GLAPIENTRY
|
||||
# define GLAPIENTRY WINAPI
|
||||
#endif
|
||||
static void *libgl_handle;
|
||||
static HGLRC (GLAPIENTRY * qfwglCreateContext) (HDC);
|
||||
static BOOL (GLAPIENTRY * qfwglDeleteContext) (HGLRC);
|
||||
static HGLRC (GLAPIENTRY * qfwglGetCurrentContext) (void);
|
||||
static HDC (GLAPIENTRY * qfwglGetCurrentDC) (void);
|
||||
static BOOL (GLAPIENTRY * qfwglMakeCurrent) (HDC, HGLRC);
|
||||
static void (GLAPIENTRY *qfglFinish) (void);
|
||||
static void *(WINAPI * glGetProcAddress) (const char *symbol) = NULL;
|
||||
static int use_gl_proceaddress = 0;
|
||||
|
||||
static cvar_t *gl_driver;
|
||||
static HGLRC baseRC;//FIXME should be in gl_ctx_t, but that's GLXContext...
|
||||
static void *
|
||||
QFGL_GetProcAddress (void *handle, const char *name)
|
||||
{
|
||||
void *glfunc = NULL;
|
||||
|
||||
if (use_gl_proceaddress && glGetProcAddress)
|
||||
glfunc = glGetProcAddress (name);
|
||||
if (!glfunc)
|
||||
glfunc = GetProcAddress (handle, name);
|
||||
return glfunc;
|
||||
}
|
||||
|
||||
static void *
|
||||
QFGL_ProcAddress (const char *name, qboolean crit)
|
||||
{
|
||||
void *glfunc = NULL;
|
||||
|
||||
Sys_MaskPrintf (SYS_VID, "DEBUG: Finding symbol %s ... ", name);
|
||||
|
||||
glfunc = QFGL_GetProcAddress (libgl_handle, name);
|
||||
if (glfunc) {
|
||||
Sys_MaskPrintf (SYS_VID, "found [%p]\n", glfunc);
|
||||
return glfunc;
|
||||
}
|
||||
Sys_MaskPrintf (SYS_VID, "not found\n");
|
||||
|
||||
if (crit) {
|
||||
Sys_Error ("Couldn't load critical OpenGL function %s, exiting...",
|
||||
name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
wgl_choose_visual (gl_ctx_t *ctx)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
wgl_create_context (gl_ctx_t *ctx)
|
||||
{
|
||||
DWORD lasterror;
|
||||
|
||||
Sys_Printf ("maindc: %p\n", win_maindc);
|
||||
baseRC = qfwglCreateContext (win_maindc);
|
||||
if (!baseRC) {
|
||||
lasterror=GetLastError();
|
||||
if (win_maindc && win_mainwindow)
|
||||
ReleaseDC (win_mainwindow, win_maindc);
|
||||
Sys_Error ("Could not initialize GL (wglCreateContext failed).\n\n"
|
||||
"Make sure you are in 65535 color mode, and try running "
|
||||
"with -window.\n"
|
||||
"Error code: (%lx)", lasterror);
|
||||
}
|
||||
|
||||
if (!qfwglMakeCurrent (win_maindc, baseRC)) {
|
||||
lasterror = GetLastError ();
|
||||
if (baseRC)
|
||||
qfwglDeleteContext (baseRC);
|
||||
if (win_maindc && win_mainwindow)
|
||||
ReleaseDC (win_mainwindow, win_maindc);
|
||||
Sys_Error ("wglMakeCurrent failed (%lx)", lasterror);
|
||||
}
|
||||
|
||||
ctx->init_gl ();
|
||||
}
|
||||
|
||||
static void
|
||||
wgl_end_rendering (void)
|
||||
{
|
||||
if (!scr_skipupdate) {
|
||||
qfglFinish ();
|
||||
SwapBuffers (win_maindc);
|
||||
}
|
||||
// handle the mouse state when windowed if that's changed
|
||||
if (!vid_fullscreen->int_val) {
|
||||
//FIXME if (!in_grab->int_val) {
|
||||
//FIXME if (windowed_mouse) {
|
||||
//FIXME IN_DeactivateMouse ();
|
||||
//FIXME IN_ShowMouse ();
|
||||
//FIXME windowed_mouse = false;
|
||||
//FIXME }
|
||||
//FIXME } else {
|
||||
//FIXME windowed_mouse = true;
|
||||
//FIXME }
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
wgl_load_gl (void)
|
||||
{
|
||||
libgl_handle = LoadLibrary (gl_driver->string);
|
||||
if (!libgl_handle) {
|
||||
Sys_Error ("Couldn't load OpenGL library %s!", gl_driver->string);
|
||||
}
|
||||
glGetProcAddress =
|
||||
(void *) GetProcAddress (libgl_handle, "wglGetProcAddress");
|
||||
|
||||
qfwglCreateContext = QFGL_ProcAddress ("wglCreateContext", true);
|
||||
qfwglDeleteContext = QFGL_ProcAddress ("wglDeleteContext", true);
|
||||
qfwglGetCurrentContext = QFGL_ProcAddress ("wglGetCurrentContext", true);
|
||||
qfwglGetCurrentDC = QFGL_ProcAddress ("wglGetCurrentDC", true);
|
||||
qfwglMakeCurrent = QFGL_ProcAddress ("wglMakeCurrent", true);
|
||||
|
||||
use_gl_proceaddress = 1;
|
||||
|
||||
qfglFinish = QFGL_ProcAddress ("glFinish", true);
|
||||
}
|
||||
|
||||
gl_ctx_t *
|
||||
Win_GL_Context (void)
|
||||
{
|
||||
gl_ctx_t *ctx = calloc (1, sizeof (gl_ctx_t));
|
||||
ctx->load_gl = wgl_load_gl;
|
||||
ctx->choose_visual = wgl_choose_visual;
|
||||
ctx->create_context = wgl_create_context;
|
||||
ctx->get_proc_address = QFGL_ProcAddress;
|
||||
ctx->end_rendering = wgl_end_rendering;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
void
|
||||
Win_GL_Init_Cvars (void)
|
||||
{
|
||||
gl_driver = Cvar_Get ("gl_driver", GL_DRIVER, CVAR_ROM, NULL,
|
||||
"The OpenGL library to use. (path optional)");
|
||||
}
|
234
libs/video/targets/vid_win_sw.c
Normal file
234
libs/video/targets/vid_win_sw.c
Normal file
|
@ -0,0 +1,234 @@
|
|||
/*
|
||||
vid_win.c
|
||||
|
||||
Win32 SW vid component
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "winquake.h"
|
||||
#include <ddraw.h>
|
||||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/vid.h"
|
||||
|
||||
#include "context_win.h"
|
||||
#include "r_internal.h"
|
||||
#include "vid_internal.h"
|
||||
#include "vid_sw.h"
|
||||
|
||||
typedef union {
|
||||
byte bgra[4];
|
||||
uint32_t value;
|
||||
} win_palette_t;
|
||||
|
||||
static win_palette_t st2d_8to32table[256];
|
||||
static byte current_palette[768];
|
||||
static int palette_changed;
|
||||
|
||||
static void
|
||||
win_init_bufers (void)
|
||||
{
|
||||
// set the rest of the buffers we need (why not just use one single buffer
|
||||
// instead of all this crap? oh well, it's Quake...)
|
||||
viddef.direct = viddef.buffer;
|
||||
viddef.conbuffer = viddef.buffer;
|
||||
|
||||
// more crap for the console
|
||||
viddef.conrowbytes = viddef.rowbytes;
|
||||
}
|
||||
|
||||
static void
|
||||
win_set_palette (const byte *palette)
|
||||
{
|
||||
palette_changed = 1;
|
||||
if (palette != current_palette) {
|
||||
memcpy (current_palette, palette, sizeof (current_palette));
|
||||
}
|
||||
for (int i = 0; i < 256; i++) {
|
||||
const byte *pal = palette + 3 * i;
|
||||
st2d_8to32table[i].bgra[0] = viddef.gammatable[pal[2]];
|
||||
st2d_8to32table[i].bgra[1] = viddef.gammatable[pal[1]];
|
||||
st2d_8to32table[i].bgra[2] = viddef.gammatable[pal[0]];
|
||||
st2d_8to32table[i].bgra[3] = 255;
|
||||
}
|
||||
if (!Minimized && !win_using_ddraw && win_dib_section) {
|
||||
RGBQUAD colors[256];
|
||||
memcpy (colors, st2d_8to32table, sizeof (colors));
|
||||
for (int i = 0; i < 256; i++) {
|
||||
colors[i].rgbReserved = 0;
|
||||
}
|
||||
colors[0].rgbRed = 0;
|
||||
colors[0].rgbGreen = 0;
|
||||
colors[0].rgbBlue = 0;
|
||||
colors[255].rgbRed = 0xff;
|
||||
colors[255].rgbGreen = 0xff;
|
||||
colors[255].rgbBlue = 0xff;
|
||||
|
||||
if (SetDIBColorTable (win_dib_section, 0, 256, colors) == 0) {
|
||||
Sys_Printf ("win_set_palette() - SetDIBColorTable failed\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dd_blit_rect (vrect_t *rect)
|
||||
{
|
||||
RECT TheRect;
|
||||
RECT sRect, dRect;
|
||||
DDSURFACEDESC ddsd;
|
||||
|
||||
memset (&ddsd, 0, sizeof (ddsd));
|
||||
ddsd.dwSize = sizeof (DDSURFACEDESC);
|
||||
|
||||
// lock the correct subrect
|
||||
TheRect.left = rect->x;
|
||||
TheRect.right = rect->x + rect->width;
|
||||
TheRect.top = rect->y;
|
||||
TheRect.bottom = rect->y + rect->height;
|
||||
|
||||
if (IDirectDrawSurface_Lock (win_dd_backbuffer, &TheRect, &ddsd,
|
||||
DDLOCK_WRITEONLY | DDLOCK_SURFACEMEMORYPTR,
|
||||
NULL) == DDERR_WASSTILLDRAWING) {
|
||||
return;
|
||||
}
|
||||
|
||||
// convert pitch to 32-bit addressable
|
||||
ddsd.lPitch >>= 2;
|
||||
|
||||
byte *src = viddef.buffer + rect->y * viddef.rowbytes + rect->x;
|
||||
unsigned *dst = ddsd.lpSurface;
|
||||
for (int y = rect->height; y-- > 0; ) {
|
||||
for (int x = rect->width; x-- > 0; ) {
|
||||
*dst++ = st2d_8to32table[*src++].value;
|
||||
}
|
||||
src += viddef.rowbytes - rect->width;
|
||||
dst += ddsd.lPitch - rect->width;
|
||||
}
|
||||
|
||||
IDirectDrawSurface_Unlock (win_dd_backbuffer, NULL);
|
||||
|
||||
// correctly offset source
|
||||
sRect.left = win_src_rect.left + rect->x;
|
||||
sRect.right = win_src_rect.left + rect->x + rect->width;
|
||||
sRect.top = win_src_rect.top + rect->y;
|
||||
sRect.bottom = win_src_rect.top + rect->y + rect->height;
|
||||
|
||||
// correctly offset dest
|
||||
dRect.left = win_dst_rect.left + rect->x;
|
||||
dRect.right = win_dst_rect.left + rect->x + rect->width;
|
||||
dRect.top = win_dst_rect.top + rect->y;
|
||||
dRect.bottom = win_dst_rect.top + rect->y + rect->height;
|
||||
|
||||
// copy to front buffer
|
||||
IDirectDrawSurface_Blt (win_dd_frontbuffer, &dRect, win_dd_backbuffer,
|
||||
&sRect, 0, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
win_sw_update (vrect_t *rects)
|
||||
{
|
||||
vrect_t full_rect;
|
||||
if (!win_palettized && palette_changed) {
|
||||
palette_changed = false;
|
||||
full_rect.x = 0;
|
||||
full_rect.y = 0;
|
||||
full_rect.width = viddef.width;
|
||||
full_rect.height = viddef.height;
|
||||
full_rect.next = 0;
|
||||
rects = &full_rect;
|
||||
}
|
||||
|
||||
if (win_using_ddraw) {
|
||||
while (rects) {
|
||||
dd_blit_rect (rects);
|
||||
rects = rects->next;
|
||||
}
|
||||
} else if (win_dib_section) {
|
||||
while (rects) {
|
||||
BitBlt (win_gdi, rects->x, rects->y,
|
||||
rects->x + rects->width, rects->y + rects->height,
|
||||
win_dib_section, rects->x, rects->y, SRCCOPY);
|
||||
rects = rects->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
win_choose_visual (sw_ctx_t *ctx)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
win_set_background (void)
|
||||
{
|
||||
// because we have set the background brush for the window to NULL (to
|
||||
// avoid flickering when re-sizing the window on the desktop), we clear
|
||||
// the window to black when created, otherwise it will be empty while
|
||||
// Quake starts up. This also prevents a screen flash to white when
|
||||
// switching drivers. it still flashes, but at least it's black now
|
||||
HDC hdc = GetDC (win_mainwindow);
|
||||
PatBlt (hdc, 0, 0, win_window_rect.right, win_window_rect.bottom,
|
||||
BLACKNESS);
|
||||
ReleaseDC (win_mainwindow, hdc);
|
||||
}
|
||||
|
||||
static void
|
||||
win_create_context (sw_ctx_t *ctx)
|
||||
{
|
||||
// shutdown any old driver that was active
|
||||
Win_UnloadAllDrivers ();
|
||||
|
||||
win_sw_context = ctx;
|
||||
|
||||
win_set_background ();
|
||||
|
||||
// create the new driver
|
||||
win_using_ddraw = false;
|
||||
|
||||
Win_CreateDriver ();
|
||||
|
||||
viddef.vid_internal->do_screen_buffer = win_init_bufers;
|
||||
VID_InitBuffers ();
|
||||
}
|
||||
|
||||
sw_ctx_t *
|
||||
Win_SW_Context (void)
|
||||
{
|
||||
sw_ctx_t *ctx = calloc (1, sizeof (sw_ctx_t));
|
||||
ctx->set_palette = win_set_palette;
|
||||
ctx->choose_visual = win_choose_visual;
|
||||
ctx->create_context = win_create_context;
|
||||
ctx->update = win_sw_update;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
void
|
||||
Win_SW_Init_Cvars (void)
|
||||
{
|
||||
}
|
145
libs/video/targets/vid_win_vulkan.c
Normal file
145
libs/video/targets/vid_win_vulkan.c
Normal file
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
vid_win.c
|
||||
|
||||
Win32 vid component
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "winquake.h"
|
||||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/set.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "QF/Vulkan/instance.h"
|
||||
|
||||
#include "context_win.h"
|
||||
#include "vid_internal.h"
|
||||
#include "vid_vulkan.h"
|
||||
|
||||
static cvar_t *vulkan_library_name;
|
||||
|
||||
typedef struct vulkan_presentation_s {
|
||||
#define PRESENTATION_VULKAN_FUNCTION_FROM_EXTENSION(name,ext) PFN_##name name;
|
||||
#include "QF/Vulkan/funclist.h"
|
||||
|
||||
set_t *usable_visuals;
|
||||
} vulkan_presentation_t;
|
||||
|
||||
static const char *required_extensions[] = {
|
||||
0
|
||||
};
|
||||
|
||||
static HMODULE vulkan_library;
|
||||
|
||||
static void
|
||||
load_vulkan_library (vulkan_ctx_t *ctx)
|
||||
{
|
||||
vulkan_library = LoadLibrary (vulkan_library_name->string);
|
||||
if (!vulkan_library) {
|
||||
DWORD errcode = GetLastError ();
|
||||
Sys_Error ("Couldn't load vulkan library %s: %ld",
|
||||
vulkan_library_name->string, errcode);
|
||||
}
|
||||
|
||||
#define EXPORTED_VULKAN_FUNCTION(name) \
|
||||
ctx->name = (PFN_##name) GetProcAddress (vulkan_library, #name); \
|
||||
if (!ctx->name) { \
|
||||
Sys_Error ("Couldn't find exported vulkan function %s", #name); \
|
||||
}
|
||||
|
||||
#define GLOBAL_LEVEL_VULKAN_FUNCTION(name) \
|
||||
ctx->name = (PFN_##name) ctx->vkGetInstanceProcAddr (0, #name); \
|
||||
if (!ctx->name) { \
|
||||
Sys_Error ("Couldn't find global-level function %s", #name); \
|
||||
}
|
||||
|
||||
#include "QF/Vulkan/funclist.h"
|
||||
}
|
||||
|
||||
static void
|
||||
unload_vulkan_library (vulkan_ctx_t *ctx)
|
||||
{
|
||||
FreeLibrary (vulkan_library);
|
||||
vulkan_library = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
win_vulkan_init_presentation (vulkan_ctx_t *ctx)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
win_vulkan_get_presentation_support (vulkan_ctx_t *ctx,
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex)
|
||||
{
|
||||
if (!ctx->presentation) {
|
||||
win_vulkan_init_presentation (ctx);
|
||||
}
|
||||
vulkan_presentation_t *pres = ctx->presentation;
|
||||
return !set_is_empty (pres->usable_visuals);
|
||||
}
|
||||
|
||||
static void
|
||||
win_vulkan_choose_visual (vulkan_ctx_t *ctx)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
win_vulkan_create_window (vulkan_ctx_t *ctx)
|
||||
{
|
||||
}
|
||||
|
||||
static VkSurfaceKHR
|
||||
win_vulkan_create_surface (vulkan_ctx_t *ctx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
vulkan_ctx_t *
|
||||
Win_Vulkan_Context (void)
|
||||
{
|
||||
vulkan_ctx_t *ctx = calloc (1, sizeof (vulkan_ctx_t));
|
||||
ctx->load_vulkan = load_vulkan_library;
|
||||
ctx->unload_vulkan = unload_vulkan_library;
|
||||
ctx->get_presentation_support = win_vulkan_get_presentation_support;
|
||||
ctx->choose_visual = win_vulkan_choose_visual;
|
||||
ctx->create_window = win_vulkan_create_window;
|
||||
ctx->create_surface = win_vulkan_create_surface;
|
||||
ctx->required_extensions = required_extensions;
|
||||
ctx->va_ctx = va_create_context (4);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
void
|
||||
Win_Vulkan_Init_Cvars (void)
|
||||
{
|
||||
vulkan_library_name = Cvar_Get ("vulkan_library", "vulkan-1.dll",
|
||||
CVAR_ROM, 0,
|
||||
"the name of the vulkan shared library");
|
||||
}
|
|
@ -65,19 +65,17 @@
|
|||
|
||||
typedef XID GLXDrawable;
|
||||
|
||||
// GLXContext is a pointer to opaque data
|
||||
typedef struct __GLXcontextRec *GLXContext;
|
||||
|
||||
|
||||
// Define GLAPIENTRY to a useful value
|
||||
#ifndef GLAPIENTRY
|
||||
# ifdef _WIN32
|
||||
# include <windows.h>
|
||||
# define GLAPIENTRY WINAPI
|
||||
# undef LoadImage
|
||||
# else
|
||||
# ifdef APIENTRY
|
||||
# define GLAPIENTRY APIENTRY
|
||||
# else
|
||||
# define GLAPIENTRY
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
static void *libgl_handle;
|
||||
static void (*qfglXSwapBuffers) (Display *dpy, GLXDrawable drawable);
|
||||
|
@ -155,8 +153,9 @@ static void
|
|||
glx_create_context (gl_ctx_t *ctx)
|
||||
{
|
||||
XSync (x_disp, 0);
|
||||
ctx->context = qfglXCreateContext (x_disp, x_visinfo, NULL, True);
|
||||
qfglXMakeCurrent (x_disp, x_win, ctx->context);
|
||||
ctx->context = (GL_context) qfglXCreateContext (x_disp, x_visinfo, NULL,
|
||||
True);
|
||||
qfglXMakeCurrent (x_disp, x_win, (GLXContext) ctx->context);
|
||||
ctx->init_gl ();
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ xlib_rgb24 (int r, int g, int b)
|
|||
}
|
||||
|
||||
static void
|
||||
VID_SetPalette (const byte *palette)
|
||||
x11_set_palette (const byte *palette)
|
||||
{
|
||||
int i;
|
||||
XColor colors[256];
|
||||
|
@ -529,7 +529,7 @@ sw_ctx_t *
|
|||
X11_SW_Context (void)
|
||||
{
|
||||
sw_ctx_t *ctx = calloc (1, sizeof (sw_ctx_t));
|
||||
ctx->set_palette = VID_SetPalette;
|
||||
ctx->set_palette = x11_set_palette;
|
||||
ctx->choose_visual = x11_choose_visual;
|
||||
ctx->create_context = x11_create_context;
|
||||
ctx->update = x11_sw_update;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#
|
||||
bin_PROGRAMS += @NQ_TARGETS@
|
||||
|
||||
EXTRA_PROGRAMS += nq-fbdev nq-sdl nq-svga nq-wgl nq-x11 nq-server
|
||||
EXTRA_PROGRAMS += nq-fbdev nq-sdl nq-svga nq-win nq-x11 nq-server
|
||||
|
||||
noinst_LIBRARIES += @nq_libs@
|
||||
EXTRA_LIBRARIES += nq/source/libnq_client.a nq/source/libnq_common.a nq/source/libnq_sdl.a nq/source/libnq_server.a
|
||||
|
@ -140,16 +140,17 @@ nq_x11_DEPENDENCIES= $(nq_x11_libs)
|
|||
# OpenGL-using targets
|
||||
|
||||
# ... SGI/Microsoft WGL (Windows OpenGL)
|
||||
nq_wgl_libs= \
|
||||
nq_win_libs= \
|
||||
$(nq_client_libs) \
|
||||
$(nq_cl_plugin_LIBS) \
|
||||
$(opengl_QFLIBS) \
|
||||
libs/video/targets/libQFwgl.la \
|
||||
libs/video/renderer/libQFrenderer.la \
|
||||
libs/models/libQFmodels.la \
|
||||
libs/video/targets/libQFwin.la \
|
||||
$(nq_client_LIBS)
|
||||
nq_wgl_SOURCES= nq/source/sys_win.c
|
||||
nq_wgl_LDADD= $(nq_wgl_libs) -lgdi32 -lcomctl32 -lwinmm $(NET_LIBS)
|
||||
nq_wgl_LDFLAGS= $(common_ldflags)
|
||||
nq_wgl_DEPENDENCIES= $(nq_wgl_libs)
|
||||
nq_win_SOURCES= nq/source/sys_win.c
|
||||
nq_win_LDADD= $(nq_win_libs) -lgdi32 -lcomctl32 -lwinmm $(NET_LIBS)
|
||||
nq_win_LDFLAGS= $(common_ldflags)
|
||||
nq_win_DEPENDENCIES= $(nq_win_libs)
|
||||
|
||||
# Dedicated Server
|
||||
if SYSTYPE_WIN32
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "nq/include/host.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# include "nq/include/winquake.h"
|
||||
# include "winquake.h"
|
||||
#endif
|
||||
|
||||
int qf_sdl_link;
|
||||
|
@ -123,6 +123,11 @@ SDL_main (int argc, char *argv[])
|
|||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NONBLOCK);
|
||||
Sys_Printf ("Quake -- Version %s\n", NQ_VERSION);
|
||||
}
|
||||
#else
|
||||
// hack to prevent gcc suggesting noreturn
|
||||
if (!sys_nostdout) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
oldtime = Sys_DoubleTime () - 0.1;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
bin_PROGRAMS += @QW_TARGETS@
|
||||
|
||||
EXTRA_PROGRAMS += \
|
||||
qw-client-fbdev qw-client-sdl qw-client-svga qw-client-wgl qw-client-x11 \
|
||||
qw-client-fbdev qw-client-sdl qw-client-svga qw-client-win qw-client-x11 \
|
||||
qw-server qw-master
|
||||
|
||||
noinst_LIBRARIES += @qw_libs@
|
||||
|
@ -164,13 +164,14 @@ qw_client_x11_LDFLAGS= $(common_ldflags)
|
|||
qw_client_x11_DEPENDENCIES= $(qw_client_x11_libs)
|
||||
|
||||
# ... SGI/Microsoft WGL (Windows OpenGL)
|
||||
qw_client_wgl_libs= \
|
||||
qw_client_win_libs= \
|
||||
$(qw_client_libs) \
|
||||
$(qw_cl_plugin_LIBS) \
|
||||
$(opengl_LIBS) \
|
||||
libs/video/targets/libQFwgl.la \
|
||||
libs/video/renderer/libQFrenderer.la \
|
||||
libs/models/libQFmodels.la \
|
||||
libs/video/targets/libQFwin.la \
|
||||
$(qw_client_LIBS)
|
||||
qw_client_wgl_SOURCES= qw/source/cl_sys_win.c
|
||||
qw_client_wgl_LDADD= $(qw_client_wgl_libs) -lgdi32 -lwinmm $(NET_LIBS) $(LIBCURL_LIBS)
|
||||
qw_client_wgl_LDFLAGS= $(common_ldflags)
|
||||
qw_client_wgl_DEPENDENCIES= $(qw_client_wgl_libs)
|
||||
qw_client_win_SOURCES= qw/source/cl_sys_win.c
|
||||
qw_client_win_LDADD= $(qw_client_win_libs) -lgdi32 -lwinmm $(NET_LIBS) $(LIBCURL_LIBS)
|
||||
qw_client_win_LDFLAGS= $(common_ldflags)
|
||||
qw_client_win_DEPENDENCIES= $(qw_client_win_libs)
|
||||
|
|
|
@ -118,6 +118,11 @@ SDL_main (int argc, char *argv[])
|
|||
#ifndef _WIN32
|
||||
if (!COM_CheckParm ("-noconinput"))
|
||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NONBLOCK);
|
||||
#else
|
||||
// hack to prevent gcc suggesting noreturn
|
||||
if (!sys_nostdout) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
Sys_RegisterShutdown (Host_Shutdown, 0);
|
||||
Sys_RegisterShutdown (Net_LogStop, 0);
|
||||
|
|
|
@ -41,7 +41,7 @@ ruamoko/cl_menu/menu.dat$(EXEEXT): $(ruamoko_menu_obj) $(QFCC_DEP) ruamoko/lib/l
|
|||
include $(ruamoko_menu_dep) # am--include-marker
|
||||
r_depfiles_remade += $(ruamoko_menu_dep)
|
||||
|
||||
ruamoko/cl_menu/menu.sym: ruamoko/cl_menu/menu.dat
|
||||
ruamoko/cl_menu/menu.sym: ruamoko/cl_menu/menu.dat$(EXEEXT)
|
||||
|
||||
EXTRA_DIST += \
|
||||
ruamoko/cl_menu/CrosshairCvar.h \
|
||||
|
|
|
@ -57,7 +57,7 @@ ruamoko_qwaq_qwaq_curses_SOURCES= \
|
|||
$e
|
||||
|
||||
ruamoko_qwaq_qwaq_curses_LDADD= $(qwaq_curses_libs) $(QWAQ_LIBS) \
|
||||
$(PANEL_LIBS) $(CURSES_LIBS) $(PTHREAD_LDFLAGS) $(DL_LIBS)
|
||||
$(PANEL_LIBS) $(NCURSES_LIBS) $(PTHREAD_LDFLAGS) $(DL_LIBS)
|
||||
ruamoko_qwaq_qwaq_curses_LDFLAGS=
|
||||
ruamoko_qwaq_qwaq_curses_DEPENDENCIES= $(qwaq_curses_libs) $(QWAQ_DEPS)
|
||||
|
||||
|
|
|
@ -659,7 +659,7 @@ dump_command (qwaq_resources_t *res, int len)
|
|||
}
|
||||
|
||||
void
|
||||
qwaq_init_timeout (struct timespec *timeout, long time)
|
||||
qwaq_init_timeout (struct timespec *timeout, int64_t time)
|
||||
{
|
||||
#define SEC 1000000000L
|
||||
struct timeval now;
|
||||
|
|
|
@ -31,14 +31,12 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "QF/dstring.h"
|
||||
|
|
|
@ -31,16 +31,19 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_SIGACTION // no sigaction, no window resize
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
#endif
|
||||
|
||||
#include "QF/dstring.h"
|
||||
#include "QF/hash.h"
|
||||
#include "QF/keys.h"
|
||||
|
@ -164,6 +167,7 @@ static qwaq_key_t default_keys[] = {
|
|||
{ "\033[1;6D", QFK_LEFT, 5 },
|
||||
};
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
static struct sigaction save_winch;
|
||||
static sigset_t winch_mask;
|
||||
static volatile sig_atomic_t winch_arrived;
|
||||
|
@ -173,6 +177,7 @@ handle_winch (int sig)
|
|||
{
|
||||
winch_arrived = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
qwaq_add_event (qwaq_resources_t *res, qwaq_event_t *event)
|
||||
|
@ -196,7 +201,7 @@ qwaq_add_event (qwaq_resources_t *res, qwaq_event_t *event)
|
|||
}
|
||||
|
||||
pthread_mutex_lock (&res->event_cond.mut);
|
||||
qwaq_init_timeout (&timeout, 5000 * 1000000L);
|
||||
qwaq_init_timeout (&timeout, 5000 * (int64_t) 1000000);
|
||||
while (RB_SPACE_AVAILABLE (res->event_queue) < 1 && ret == 0) {
|
||||
ret = pthread_cond_timedwait (&res->event_cond.wcond,
|
||||
&res->event_cond.mut, &timeout);
|
||||
|
@ -207,6 +212,7 @@ qwaq_add_event (qwaq_resources_t *res, qwaq_event_t *event)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
static void
|
||||
resize_event (qwaq_resources_t *res)
|
||||
{
|
||||
|
@ -220,6 +226,7 @@ resize_event (qwaq_resources_t *res)
|
|||
event.resize.height = size.ws_row;
|
||||
qwaq_add_event (res, &event);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
key_event (qwaq_resources_t *res, int key, unsigned shift)
|
||||
|
@ -428,11 +435,13 @@ void qwaq_input_init (qwaq_resources_t *res)
|
|||
Hash_Add (res->key_sequences, &default_keys[i]);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
sigemptyset (&winch_mask);
|
||||
sigaddset (&winch_mask, SIGWINCH);
|
||||
struct sigaction action = {};
|
||||
action.sa_handler = handle_winch;
|
||||
sigaction (SIGWINCH, &action, &save_winch);
|
||||
#endif
|
||||
|
||||
// ncurses takes care of input mode for us, so need only tell xterm
|
||||
// what we need
|
||||
|
@ -447,13 +456,16 @@ void qwaq_input_shutdown (qwaq_resources_t *res)
|
|||
write(1, SGR_OFF, sizeof (SGR_OFF) - 1);
|
||||
write(1, MOUSE_MOVES_OFF, sizeof (MOUSE_MOVES_OFF) - 1);
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
sigaction (SIGWINCH, &save_winch, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void qwaq_process_input (qwaq_resources_t *res)
|
||||
{
|
||||
char buf[256];
|
||||
int len;
|
||||
#ifdef HAVE_SIGACTION
|
||||
sigset_t save_set;
|
||||
int saw_winch;
|
||||
|
||||
|
@ -464,6 +476,7 @@ void qwaq_process_input (qwaq_resources_t *res)
|
|||
if (saw_winch) {
|
||||
resize_event (res);
|
||||
}
|
||||
#endif
|
||||
while (Sys_CheckInput (1, -1)) {
|
||||
len = read(0, buf, sizeof (buf));
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
#include "QF/va.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#include "ruamoko/qwaq/qwaq.h"
|
||||
#include "ruamoko/qwaq/debugger/debug.h"
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef __qwaq_h
|
||||
#define __qwaq_h
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "QF/darray.h"
|
||||
#include "QF/progs.h"
|
||||
#include "QF/sys.h"
|
||||
|
|
|
@ -201,7 +201,7 @@ typedef struct qwaq_resources_s {
|
|||
void qwaq_input_init (qwaq_resources_t *res);
|
||||
void qwaq_input_shutdown (qwaq_resources_t *res);
|
||||
void qwaq_process_input (qwaq_resources_t *res);
|
||||
void qwaq_init_timeout (struct timespec *timeout, long time);
|
||||
void qwaq_init_timeout (struct timespec *timeout, int64_t time);
|
||||
int qwaq_add_event (qwaq_resources_t *res, qwaq_event_t *event);
|
||||
void qwaq_init_cond (rwcond_t *cond);
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
#!/bin/sh -x
|
||||
set -e
|
||||
mkdir -p native i686-w64-mingw32.static
|
||||
mkdir -p native x86_64-w64-mingw32.static
|
||||
cd native
|
||||
../../configure \
|
||||
--enable-silent-rules \
|
||||
--disable-shared \
|
||||
--without-clients \
|
||||
--without-servers \
|
||||
--with-tools=qfcc,pak
|
||||
cd ../i686-w64-mingw32.static
|
||||
--with-tools=qfcc,pak,qwaq
|
||||
cd ../x86_64-w64-mingw32.static
|
||||
export MINGW=/opt/mxe
|
||||
export MINGW_USR=$MINGW/usr/i686-w64-mingw32.static
|
||||
export MINGW_USR=$MINGW/usr/x86_64-w64-mingw32.static
|
||||
export PKG_CONFIG_LIBDIR=$MINGW_USR/lib/pkgconfig
|
||||
export PKG_CONFIG_PATH=$MINGW_USR/local/lib/pkgconfig
|
||||
export PATH=$MINGW/usr/bin:$PATH
|
||||
../../configure \
|
||||
--host=i686-w64-mingw32.static \
|
||||
--host=x86_64-w64-mingw32.static \
|
||||
--disable-shared \
|
||||
$*
|
||||
|
|
|
@ -3,14 +3,15 @@ set -e
|
|||
if test -d native; then
|
||||
cd native
|
||||
make $*
|
||||
cd ../x86_64-w64-mingw32
|
||||
ln -fs ../native/tools/qfcc/source/qfcc .
|
||||
ln -fs ../native/tools/pak/pak .
|
||||
cd ../x86_64-w64-mingw32.static
|
||||
ln -fs ../native/qfcc .
|
||||
ln -fs ../native/pak .
|
||||
ln -fs ../native/ruamoko/qwaq/qwaq-curses .
|
||||
fi
|
||||
export MINGW=/opt/mxe
|
||||
export MINGW_USR=$MINGW/usr/x86_64-w64-mingw32
|
||||
export MINGW_USR=$MINGW/usr/x86_64-w64-mingw32.static
|
||||
export PKG_CONFIG_LIBDIR=$MINGW_USR/lib/pkgconfig
|
||||
export PKG_CONFIG_PATH=$MINGW_USR/local/lib/pkgconfig
|
||||
export PATH=$MINGW/usr/bin:$PATH
|
||||
|
||||
make PAK='$(top_builddir)/pak' QFCC='$(top_builddir)/qfcc' $*
|
||||
make PAK='$(top_builddir)/pak' QFCC='$(top_builddir)/qfcc' QWAQ_CURSES='$(top_builddir)/qwaq-curses' $*
|
||||
|
|
|
@ -2,7 +2,7 @@ QFCC_LIBS=@QFCC_LIBS@
|
|||
QFCC_DEPS=@QFCC_DEPS@
|
||||
QFCC_INCS=@QFCC_INCS@
|
||||
|
||||
EXTRA_PROGRAMS += qfcc qfprogs
|
||||
EXTRA_PROGRAMS += qfcc$(EXEEXT) qfprogs$(EXEEXT)
|
||||
bin_PROGRAMS += @QFCC_TARGETS@
|
||||
bin_SCRIPTS += tools/qfcc/source/qfpreqcc
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ preprocess_file (const char *filename, const char *ext)
|
|||
puts("");
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64) || defined(_WIN32)
|
||||
status = spawnvp (_P_WAIT, cpp_argv[0], (char **) cpp_argv);
|
||||
#else
|
||||
status = spawnvp (_P_WAIT, cpp_argv[0], cpp_argv);
|
||||
|
|
|
@ -168,7 +168,8 @@ qfo_lines (qfo_t *qfo)
|
|||
pr_lineno_t *lineno;
|
||||
qfo_func_t *func = 0;
|
||||
|
||||
for (func = qfo->funcs; func - qfo->funcs < qfo->num_funcs; func++) {
|
||||
for (func = qfo->funcs;
|
||||
(size_t) (func - qfo->funcs) < qfo->num_funcs; func++) {
|
||||
if (!func->line_info) {
|
||||
// builtin
|
||||
continue;
|
||||
|
@ -182,7 +183,7 @@ qfo_lines (qfo_t *qfo)
|
|||
qfo_set_func_data(qfo, func, &func_data);
|
||||
start_lineno = qfo->lines + func->line_info;
|
||||
for (lineno = start_lineno + 1;
|
||||
lineno - qfo->lines < qfo->num_lines && lineno->line;
|
||||
(size_t) (lineno - qfo->lines) < qfo->num_lines && lineno->line;
|
||||
lineno++)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -40,18 +40,18 @@
|
|||
#include "tools/qfcc/include/qfprogs.h"
|
||||
|
||||
static void
|
||||
dump_string_block (const char *strblock, unsigned size)
|
||||
dump_string_block (const char *strblock, size_t size)
|
||||
{
|
||||
const char *s = strblock;
|
||||
|
||||
printf ("%x \"", 0);
|
||||
while (s - strblock < size) {
|
||||
while ((size_t) (s - strblock) < size) {
|
||||
char c = *s++;
|
||||
switch (c) {
|
||||
case 0:
|
||||
fputs ("\"\n", stdout);
|
||||
if (s - strblock < size)
|
||||
printf ("%lx \"", s - strblock);
|
||||
if ((size_t) (s - strblock) < size)
|
||||
printf ("%zx \"", s - strblock);
|
||||
break;
|
||||
case 9:
|
||||
fputs ("\\t", stdout);
|
||||
|
|
|
@ -1191,7 +1191,7 @@ undefined_def (qfo_def_t *def)
|
|||
pr_uint_t best_dist;
|
||||
pr_lineno_t *line;
|
||||
|
||||
while (func - work->funcs < work->num_funcs) {
|
||||
while (func - work->funcs < (ptrdiff_t) work->num_funcs) {
|
||||
if (func->code >= 0
|
||||
&& (pr_uint_t) func->code <= reloc->offset) {
|
||||
if (!best || reloc->offset - func->code < best_dist) {
|
||||
|
@ -1206,7 +1206,7 @@ undefined_def (qfo_def_t *def)
|
|||
line_def.line = best->line;
|
||||
if (!line->line
|
||||
&& line->fa.func == (pr_uint_t) (best - work->funcs)) {
|
||||
while (line - work->lines < work->num_lines - 1
|
||||
while (line - work->lines < (ptrdiff_t) work->num_lines - 1
|
||||
&& line[1].line
|
||||
&& line[1].fa.addr <= (pr_uint_t) reloc->offset)
|
||||
line++;
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "QF/quakeio.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#include "tools/qfcc/include/codespace.h"
|
||||
#include "tools/qfcc/include/debug.h"
|
||||
#include "tools/qfcc/include/def.h"
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
// Result is stored in /raid/quake/id1/sprites/<scriptname>.spr.
|
||||
//
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
|
Loading…
Reference in a new issue