[win] Fix a handful of small bugs for windows

Only 64-bit windows is tested, and there are still various failures, but
QF is limping along in windows again.

nq-sdl works for sw, and sw32, gl and glsl are mostly black (but not
entirely for gl?),  vulkan is not supported with sdl.

nq-win works for sw and sw32, and sort of for vulkan (very dark and
upside-down?). gl and glsl complain about vid mode,

qw-client-[sdl,win] seem to be the same, but something is wrong with the
console (reading keyboard input).
This commit is contained in:
Bill Currie 2021-03-30 20:09:13 +09:00
parent ae78c81b3a
commit 63e30e6ae0
4 changed files with 17 additions and 21 deletions

View File

@ -12,6 +12,7 @@ case "$host_os" in
CPPFLAGS="$CPPFLAGS $CFLAGS"
;;
esac
SYSTYPE=WIN32
fi
AC_DEFINE(NEED_GNUPRINTF)
endian="little"

View File

@ -166,6 +166,10 @@ setup_debug_callback (qfv_instance_t *instance)
.pfnUserCallback = debug_callback,
.pUserData = instance,
};
if (!instance->funcs->vkCreateDebugUtilsMessengerEXT) {
Sys_Printf ("Cound not set up Vulkan validation debug callback\n");
return;
}
instance->funcs->vkCreateDebugUtilsMessengerEXT(instance->instance,
&createInfo, 0,
&debug_handle);

View File

@ -142,7 +142,9 @@ int aPage; // Current active display page
int vPage; // Current visible display page
int waitVRT = true; // True to wait for retrace on flip
static vmode_t badmode;
static vmode_t badmode = {
.modedesc = "Bad mode",
};
/*
=============================================================================
@ -257,10 +259,6 @@ VID_CreateDDrawDriver (int width, int height, const byte *palette,
// direct draw is working now
win_using_ddraw = true;
// create a palette
VID_InitGamma (palette);
viddef.vid_internal->set_palette (palette);
// create initial rects
DD_UpdateRects (dd_window_width, dd_window_height);
}
@ -738,7 +736,6 @@ Win_SetVidMode (int width, int height, const byte *palette)
VID_SetMode (vid_default, palette);
force_mode_set = false;
vid_realmode = vid_modenum;
strcpy (badmode.modedesc, "Bad mode");
}
static void
@ -1034,14 +1031,13 @@ VID_SetMode (int modenum, const byte *palette)
SetForegroundWindow (win_mainwindow);
hdc = GetDC (NULL);
if (GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE)
if (GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE) {
vid_palettized = true;
else
} else {
vid_palettized = false;
viddef.vid_internal->set_palette (palette);
}
ReleaseDC (NULL, hdc);
vid_modenum = modenum;
Cvar_SetValue (vid_mode, (float) vid_modenum);
@ -1064,8 +1060,6 @@ VID_SetMode (int modenum, const byte *palette)
Sys_Printf ("%s\n", VID_GetModeDescription (vid_modenum));
viddef.vid_internal->set_palette (palette);
in_mode_set = false;
viddef.recalc_refdef = 1;
@ -1151,10 +1145,9 @@ VID_GetModeDescriptionMemCheck (int mode)
// Tacks on "windowed" or "fullscreen"
static char * __attribute__((used))
static const char * __attribute__((used))
VID_GetModeDescription2 (int mode)
{
static char pinfo[40];
vmode_t *pv;
if ((mode < 0) || (mode >= nummodes))
@ -1164,14 +1157,12 @@ VID_GetModeDescription2 (int mode)
pv = VID_GetModePtr (mode);
if (modelist[mode].type == MS_FULLSCREEN) {
sprintf (pinfo, "%s fullscreen", pv->modedesc);
return va (0, "%s fullscreen", pv->modedesc);
} else if (modelist[mode].type == MS_FULLDIB) {
sprintf (pinfo, "%s fullscreen", pv->modedesc);
return va (0, "%s fullscreen", pv->modedesc);
} else {
sprintf (pinfo, "%s windowed", pv->modedesc);
return va (0, "%s windowed", pv->modedesc);
}
return pinfo;
}

View File

@ -120,7 +120,7 @@ SDL_main (int argc, char *argv[])
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NONBLOCK);
#else
// hack to prevent gcc suggesting noreturn
if (!sys_nostdout) {
if (sys_nostdout) {
return 1;
}
#endif