#include "compat.h" #include "osd.h" #include "build.h" #include "baselayer.h" #include "renderlayer.h" #include "a.h" #include "polymost.h" #include "cache1d.h" #include "inputstate.h" #include "d_event.h" #include "../../glbackend/glbackend.h" // video #ifdef _WIN32 extern "C" { __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 0x00000001; __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; } #endif // _WIN32 int32_t g_borderless=2; // input char inputdevices = 0; vec2_t g_mousePos; vec2_t g_mouseAbs; bool g_mouseEnabled; bool g_mouseGrabbed; bool g_mouseInsideWindow = 1; bool g_mouseLockedToWindow = 1; void mouseReadPos(int32_t *x, int32_t *y) { if (!g_mouseEnabled || !g_mouseGrabbed || !appactive) { *x = *y = 0; return; } *x = g_mousePos.x; *y = g_mousePos.y; g_mousePos.x = g_mousePos.y = 0; } int32_t mouseReadAbs(vec2_t * const pResult, vec2_t const * const pInput) { if (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || (osd && osd->flags & OSD_CAPTURE)) return 0; int32_t const xwidth = max(scale(240<<16, xdim, ydim), 320<<16); pResult->x = scale(pInput->x, xwidth, xres) - ((xwidth>>1) - (320<<15)); pResult->y = scale(pInput->y, 200<<16, yres); pResult->y = divscale16(pResult->y - (200<<15), rotatesprite_yxaspect) + (200<<15) - rotatesprite_y_offset; return 1; } controllerinput_t joystick; void joySetCallback(void (*callback)(int32_t, int32_t)) { joystick.pCallback = callback; } void joyReadButtons(int32_t *pResult) { *pResult = appactive ? joystick.bits : 0; } #if defined __linux || defined EDUKE32_BSD || defined __APPLE__ # include #endif // Calculate ylookup[] and call setvlinebpl() void calc_ylookup(int32_t bpl, int32_t lastyidx) { int32_t i, j=0; static int32_t ylookupsiz; Bassert(lastyidx <= MAXYDIM); lastyidx++; if (lastyidx > ylookupsiz) { Xaligned_free(ylookup); 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); } for (; inumparms < 1 || (int32_t)ARRAY_SIZE(parms) < parm->numparms) return OSDCMD_SHOWHELP; size_t i; for (i = 0; (int32_t)i < parm->numparms; ++i) parms[i] = Batol(parm->parms[i]); for (; i < ARRAY_SIZE(parms); ++i) parms[i] = 0; // order is intentional hicsetpalettetint(parms[0],parms[1],parms[2],parms[3],parms[5],parms[6],parms[7],parms[4]); return OSDCMD_OK; } #endif int osdcmd_glinfo(osdcmdptr_t UNUSED(parm)) { UNREFERENCED_CONST_PARAMETER(parm); initprintf("OpenGL information\n %s %s %s\n", GLInterface.glinfo.vendor, GLInterface.glinfo.renderer, GLInterface.glinfo.version); return OSDCMD_OK; } #endif int32_t baselayer_init(void) { #ifdef USE_OPENGL # ifdef DEBUGGINGAIDS OSD_RegisterFunction("hicsetpalettetint","hicsetpalettetint: sets palette tinting values",osdcmd_hicsetpalettetint); # endif OSD_RegisterFunction("glinfo","glinfo: shows OpenGL information about the current OpenGL mode",osdcmd_glinfo); polymost_initosdfuncs(); #endif return 0; }