2006-04-23 06:44:19 +00:00
|
|
|
#include "compat.h"
|
|
|
|
#include "osd.h"
|
|
|
|
#include "build.h"
|
|
|
|
#include "baselayer.h"
|
|
|
|
|
2012-11-25 04:26:37 +00:00
|
|
|
#include "renderlayer.h"
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2012-12-14 19:28:17 +00:00
|
|
|
#include "a.h"
|
2009-08-09 05:32:17 +00:00
|
|
|
#include "polymost.h"
|
2018-04-05 04:39:30 +00:00
|
|
|
#include "cache1d.h"
|
2019-10-28 00:12:31 +00:00
|
|
|
#include "inputstate.h"
|
2019-11-03 21:46:01 +00:00
|
|
|
#include "d_event.h"
|
2019-10-04 19:13:04 +00:00
|
|
|
#include "../../glbackend/glbackend.h"
|
2009-08-09 05:32:17 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
// video
|
2018-04-12 21:02:18 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 0x00000001;
|
|
|
|
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
|
|
|
}
|
|
|
|
#endif // _WIN32
|
|
|
|
|
2019-08-29 19:00:52 +00:00
|
|
|
int32_t g_borderless=2;
|
2019-11-05 19:16:53 +00:00
|
|
|
bool GUICapture = false;
|
2014-12-27 18:36:43 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
// input
|
|
|
|
char inputdevices = 0;
|
2010-05-25 10:56:00 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
|
|
|
|
bool g_mouseEnabled;
|
|
|
|
bool g_mouseGrabbed;
|
|
|
|
bool g_mouseInsideWindow = 1;
|
|
|
|
bool g_mouseLockedToWindow = 1;
|
|
|
|
|
|
|
|
int32_t mouseReadAbs(vec2_t * const pResult, vec2_t const * const pInput)
|
2012-05-01 12:38:14 +00:00
|
|
|
{
|
2019-11-05 19:16:53 +00:00
|
|
|
if (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || GUICapture)
|
2014-11-17 07:39:12 +00:00
|
|
|
return 0;
|
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
int32_t const xwidth = max(scale(240<<16, xdim, ydim), 320<<16);
|
2014-11-17 07:39:12 +00:00
|
|
|
|
2018-07-14 21:36:44 +00:00
|
|
|
pResult->x = scale(pInput->x, xwidth, xres) - ((xwidth>>1) - (320<<15));
|
|
|
|
pResult->y = scale(pInput->y, 200<<16, yres);
|
2014-11-17 07:39:12 +00:00
|
|
|
|
2019-01-30 00:19:56 +00:00
|
|
|
pResult->y = divscale16(pResult->y - (200<<15), rotatesprite_yxaspect) + (200<<15) - rotatesprite_y_offset;
|
|
|
|
|
2014-11-17 07:39:12 +00:00
|
|
|
return 1;
|
2012-05-01 12:38:14 +00:00
|
|
|
}
|
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
controllerinput_t joystick;
|
|
|
|
|
|
|
|
void joySetCallback(void (*callback)(int32_t, int32_t)) { joystick.pCallback = callback; }
|
|
|
|
void joyReadButtons(int32_t *pResult) { *pResult = appactive ? joystick.bits : 0; }
|
2012-06-03 16:11:22 +00:00
|
|
|
|
2012-12-14 19:28:17 +00:00
|
|
|
// Calculate ylookup[] and call setvlinebpl()
|
|
|
|
void calc_ylookup(int32_t bpl, int32_t lastyidx)
|
|
|
|
{
|
|
|
|
int32_t i, j=0;
|
2014-11-06 23:43:47 +00:00
|
|
|
static int32_t ylookupsiz;
|
2014-11-02 05:36:28 +00:00
|
|
|
|
2012-12-14 19:28:17 +00:00
|
|
|
Bassert(lastyidx <= MAXYDIM);
|
|
|
|
|
2014-11-06 23:43:47 +00:00
|
|
|
lastyidx++;
|
|
|
|
|
2014-10-29 17:04:28 +00:00
|
|
|
if (lastyidx > ylookupsiz)
|
|
|
|
{
|
2019-06-25 11:29:08 +00:00
|
|
|
Xaligned_free(ylookup);
|
2014-10-29 17:04:28 +00:00
|
|
|
|
|
|
|
ylookup = (intptr_t *)Xaligned_alloc(16, lastyidx * sizeof(intptr_t));
|
|
|
|
ylookupsiz = lastyidx;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<=lastyidx-4; i+=4)
|
|
|
|
{
|
|
|
|
ylookup[i] = j;
|
|
|
|
ylookup[i + 1] = j + bpl;
|
|
|
|
ylookup[i + 2] = j + (bpl << 1);
|
|
|
|
ylookup[i + 3] = j + (bpl * 3);
|
|
|
|
j += (bpl << 2);
|
|
|
|
}
|
|
|
|
|
2014-11-06 23:43:47 +00:00
|
|
|
for (; i<lastyidx; i++)
|
2012-12-14 19:28:17 +00:00
|
|
|
{
|
|
|
|
ylookup[i] = j;
|
|
|
|
j += bpl;
|
|
|
|
}
|
|
|
|
|
|
|
|
setvlinebpl(bpl);
|
|
|
|
}
|
|
|
|
|
2014-11-02 05:36:28 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
int32_t g_logFlushWindow = 1;
|
2016-11-15 21:55:30 +00:00
|
|
|
|