void Mumble_DestroyLink() { #ifdef _WIN32 if (hMapObject != NULL) { CloseHandle(hMapObject); hMapObject = NULL; #else // Linux && Mac if (lm != NULL) { munmap(lm, sizeof(struct LinkedMem)); lm = NULL; close(shmfd); shmfd = -1; #endif ST_Printf(PRINT_INFO,"Mumble link shut down.\n"); return; } else { if (mumble_debug.integer) ST_Printf(PRINT_FAIL,"Mumble link not established, unable to shut down.\n"); } } void OnChange_mumble_enabled(cvar_t *var, char *value, qbool *cancel) { int mumble = Q_atoi (value); if (mumble) Mumble_CreateLink(); else Mumble_DestroyLink(); }
void Mumble_CreateLink() { #ifdef _WIN32 if (hMapObject != NULL) { ST_Printf(PRINT_FAIL,"Mumble link already initialized.\n"); return; } hMapObject = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, L"MumbleLink"); if (hMapObject == NULL) { //Com_Printf("Mumble is not running\n"); return; } lm = (struct LinkedMem *) MapViewOfFile(hMapObject, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(struct LinkedMem)); if (lm == NULL) { CloseHandle(hMapObject); hMapObject = NULL; ST_Printf(PRINT_FAIL,"Mumble link initialization failed.\n"); return; } #else // Linux && Mac char memname[256]; if (lm != NULL) { ST_Printf(PRINT_FAIL,"Mumble link already initialized.\n"); return; } snprintf(memname, 256, "/MumbleLink.%d", getuid()); shmfd = shm_open(memname, O_RDWR, S_IRUSR | S_IWUSR); if(shmfd < 0) { ST_Printf(PRINT_INFO,"Mumble initialization skipped. Mumble not running.\n"); return; } lm = (struct LinkedMem *) (mmap(NULL, sizeof(struct LinkedMem), PROT_READ | PROT_WRITE, MAP_SHARED, shmfd,0)); if (lm == (void *) (-1)) { lm = NULL; close(shmfd); shmfd = -1; ST_Printf(PRINT_FAIL,"Mumble link initialization failed.\n"); return; } #endif mbstowcs(lm->name, "jQuake", sizeof(lm->name)); Com_Printf(CharsToBrownStatic("Mumble link initialized.")); Com_Printf("\n"); }
static void GfxInfo_f(void) { SDL_DisplayMode current; ST_Printf(PRINT_ALL, "\nGL_VENDOR: %s\n", glConfig.vendor_string ); ST_Printf(PRINT_ALL, "GL_RENDERER: %s\n", glConfig.renderer_string ); ST_Printf(PRINT_ALL, "GL_VERSION: %s\n", glConfig.version_string ); if (r_showextensions.value) ST_Printf(PRINT_ALL, "GL_EXTENSIONS: %s\n", glConfig.extensions_string); ST_Printf(PRINT_ALL, "PIXELFORMAT: color(%d-bits) Z(%d-bit)\n stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits); if (SDL_GetCurrentDisplayMode(0, ¤t) != 0) current.refresh_rate = 0; // print 0Hz if we run into problem fetching data ST_Printf(PRINT_ALL, "MODE: %d x %d @ %d Hz ", glConfig.vidWidth, glConfig.vidHeight, current.refresh_rate); if (r_fullscreen.integer) ST_Printf(PRINT_ALL, "[fullscreen]\n"); else ST_Printf(PRINT_ALL, "[windowed]\n"); ST_Printf(PRINT_ALL, "CONRES: %d x %d\n", r_conwidth.integer, r_conheight.integer ); }
/* ** R_ModeList_f */ static void R_ModeList_f( void ) { int i; ST_Printf( PRINT_ALL, "\n" ); for ( i = 0; i < s_numVidModes; i++ ) { ST_Printf( PRINT_ALL, "%s\n", r_vidModes[i].description ); } ST_Printf( PRINT_ALL, "\n" ); }
void updateMumble() { vec3_t right; static qbool mpa_report_active = true; if (!mumble_enabled.integer || !lm ) return; // Only activate Mumble Positional Audio if you are an active player if (cls.demoplayback || cl.spectator) { if (mpa_report_active) { // Setting position to 0 disables Mumble Positional Audio VectorClear(lm->fPosition); mpa_report_active = false; ST_Printf(PRINT_INFO,"Mumble Position Audio reporting disabled\n"); } return ; } // Set player origin for Mumble VectorCopy(cl.simorg , lm->fPosition); // Set distance ratio for Mumble distance calculation, qw units to meters lm->fPosition[0] *= mumble_distance_ratio.value; lm->fPosition[1] *= mumble_distance_ratio.value; // Above + convert from right-handed coordinates to left-handed lm->fPosition[2] *= -1 * mumble_distance_ratio.value; // Convert viewangle to normalized vectors AngleVectors(cl.viewangles,lm->fFront, right, lm->fTop); // Convert from right-handed coordinates to left-handed lm->fFront[2] *= -1; lm->fTop[2] *= -1; if (mumble_debug.integer) Com_Printf("X=%f Y=%f Z=%f\n",lm->fPosition[0],lm->fPosition[1],lm->fPosition[2]); // If a link is lost struct is reset, reinitialize lm->name if(lm->name[0] != 'e') mbstowcs(lm->name, "jQuake", sizeof(lm->name)); // Required by Mumble lm->uiVersion = 1; lm->uiTick = GetTickCount(); if(!mpa_report_active) { ST_Printf(PRINT_INFO,"Mumble Position Audio reporting enabled.\n"); mpa_report_active = true; } }
/* =============== RE_Init =============== */ void RE_Init( void ) { int err; ST_Printf( PRINT_R_VERBOSE, "----- R_Init -----\n" ); R_Register(); InitOpenGL(); err = glGetError(); if ( err != GL_NO_ERROR ) ST_Printf ( PRINT_R_VERBOSE, "glGetError() = 0x%x\n", err ); ST_Printf( PRINT_R_VERBOSE, "----- finished R_Init -----\n" ); }
// // Init shader system, called after GL start up. // void SHD_Init(void) { if (SHD_Initialized()) Sys_Error("multiple SHD_Init()"); SHD_Init_(); if (SHD_Initialized()) ST_Printf(PRINT_OK, "SHADERS: initialized\n"); else ST_Printf(PRINT_FAIL, "SHADERS: failed to initialize\n"); #ifdef GLSLEXAMPLE SHD_EXAMPLE_Init(); // EXAMPLE #endif }
/* =============== RE_Shutdown =============== */ void RE_Shutdown( qbool destroyWindow ) { ST_Printf( PRINT_R_VERBOSE, "R_Shutdown( %i )\n", destroyWindow ); // shut down platform specific OpenGL stuff if ( destroyWindow ) { GLimp_Shutdown(); } }
static void AssertCvarRange( cvar_t *cv, float minVal, float maxVal, qbool shouldBeIntegral ) { if ( shouldBeIntegral ) { if ( ( int ) cv->value != cv->integer ) { ST_Printf( PRINT_WARNING, "WARNING: cvar '%s' must be integral (%f)\n", cv->name, cv->value ); Cvar_SetValue( cv, cv->integer ); } } if ( cv->value < minVal ) { ST_Printf( PRINT_WARNING, "WARNING: cvar '%s' out of range (%f < %f)\n", cv->name, cv->value, minVal ); Cvar_SetValue( cv, minVal ); } else if ( cv->value > maxVal ) { ST_Printf( PRINT_WARNING, "WARNING: cvar '%s' out of range (%f > %f)\n", cv->name, cv->value, maxVal ); Cvar_SetValue( cv, maxVal ); } }
/* ================== GL_CheckErrors ================== */ void GL_CheckErrors( void ) { int err; char s[64]; err = glGetError(); if ( err == GL_NO_ERROR ) { return; } if ( r_ignoreGLErrors.integer ) { return; } switch( err ) { case GL_INVALID_ENUM: strlcpy( s, "GL_INVALID_ENUM", sizeof( s ) ); break; case GL_INVALID_VALUE: strlcpy( s, "GL_INVALID_VALUE", sizeof( s ) ); break; case GL_INVALID_OPERATION: strlcpy( s, "GL_INVALID_OPERATION", sizeof( s ) ); break; case GL_STACK_OVERFLOW: strlcpy( s, "GL_STACK_OVERFLOW", sizeof( s ) ); break; case GL_STACK_UNDERFLOW: strlcpy( s, "GL_STACK_UNDERFLOW", sizeof( s ) ); break; case GL_OUT_OF_MEMORY: strlcpy( s, "GL_OUT_OF_MEMORY", sizeof( s ) ); break; default: snprintf( s, sizeof(s), "%i", err); break; } ST_Printf( PRINT_ERR_FATAL, "GL_CheckErrors: %s", s ); }
/* ================ GfxInfo_f ================ */ void GfxInfo_f( void ) { // cvar_t *sys_cpustring = Cvar_Get( "sys_cpustring", "", 0 ); #if 0 const char *enablestrings[] = { "disabled", "enabled" }; #endif const char *fsstrings[] = { "windowed", "fullscreen" }; ST_Printf( PRINT_ALL, "\nGL_VENDOR: %s\n", glConfig.vendor_string ); ST_Printf( PRINT_ALL, "GL_RENDERER: %s\n", glConfig.renderer_string ); ST_Printf( PRINT_ALL, "GL_VERSION: %s\n", glConfig.version_string ); if ( r_showextensions.value ) ST_Printf( PRINT_ALL, "GL_EXTENSIONS: %s\n", glConfig.extensions_string ); // ST_Printf( PRINT_ALL, "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize ); // ST_Printf( PRINT_ALL, "GL_MAX_ACTIVE_TEXTURES_ARB: %d\n", glConfig.maxActiveTextures ); ST_Printf( PRINT_ALL, "PIXELFORMAT: color(%d-bits) Z(%d-bit)\n stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits ); ST_Printf( PRINT_ALL, "MODE: %d, %d x %d ", r_mode.integer, glConfig.vidWidth, glConfig.vidHeight); if ( glConfig.displayFrequency ) { ST_Printf( PRINT_ALL, "%d", glConfig.displayFrequency ); } else { ST_Printf( PRINT_ALL, "N/A" ); } Com_Printf ("hz %s\n", fsstrings[r_fullscreen.integer == 1]); ST_Printf( PRINT_ALL, "CONRES: %d x %d\n", r_conwidth.integer, r_conheight.integer ); #if 0 if ( glConfig.deviceSupportsGamma ) { ST_Printf( PRINT_ALL, "GAMMA: hardware w/ %d overbright bits\n", tr.overbrightBits ); } else { ST_Printf( PRINT_ALL, "GAMMA: software w/ %d overbright bits\n", tr.overbrightBits ); } ST_Printf( PRINT_ALL, "CPU: %s\n", sys_cpustring.string ); ST_Printf( PRINT_ALL, "texturemode: %s\n", r_textureMode.string ); ST_Printf( PRINT_ALL, "picmip: %d\n", r_picmip.integer ); ST_Printf( PRINT_ALL, "texture bits: %d\n", r_texturebits.integer ); ST_Printf( PRINT_ALL, "multitexture: %s\n", enablestrings[qglActiveTextureARB != 0] ); if ( r_vertexLight.integer || glConfig.hardwareType == GLHW_PERMEDIA2 ) { ST_Printf( PRINT_ALL, "HACK: using vertex lightmap approximation\n" ); } if ( glConfig.hardwareType == GLHW_RAGEPRO ) { ST_Printf( PRINT_ALL, "HACK: ragePro approximations\n" ); } if ( glConfig.hardwareType == GLHW_RIVA128 ) { ST_Printf( PRINT_ALL, "HACK: riva128 approximations\n" ); } if ( r_finish.integer ) { ST_Printf( PRINT_ALL, "Forcing glFinish\n" ); } #endif }