Example #1
0
File: mumble.c Project: jite/jquake
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");
}
void Config_TroubleShoot_f(void)
{
	unsigned problems = 0;
	extern cvar_t r_novis, r_swapInterval;
	extern cvar_t m_filter, sys_yieldcpu, cl_maxfps, hud_planmode;
	extern cvar_t in_raw;

	if (r_novis.value) {
		Config_TroubleShoot_Tip("r_novis is enabled",
			"r_novis causes a major performance hit, it's only useful if you need transparent liquids "
			"on non-vised maps",
			"set r_novis to 0", 1);
		problems++;
	}

	if (m_filter.value) {
		Config_TroubleShoot_Tip("m_filter is enabled",
			"m_filter causes a serious delay in processing of the mouse input data",
			"set m_filter to 0", 1);
		problems++;
	}

	if (cl_maxfps.integer == 0 && sys_yieldcpu.value == 0 && r_swapInterval.value == 0) {
		Config_TroubleShoot_Tip("cl_maxfps, sys_yieldcpu, and vid_vsync are all 0",
			"unlimited FPS with CPU yielding disabled typically leads to interruptions "
			"in reading input devices (keyboard, mouse)",
			"either set sys_yieldcpu 1, vid_vsync 1, or or limit your FPS with cl_maxfps", 1);
		problems++;
	}

	if (cl_maxfps.integer == 0 && sys_yieldcpu.value == 0) {
		Config_TroubleShoot_Tip("cl_maxfps and sys_yieldcpu are 0",
			"unlimited FPS with CPU yielding disabled typically leads to interruptions "
			"in reading input devices (keyboard, mouse)",
			"either set sys_yieldcpu 1 or or limit your FPS with cl_maxfps", 1);
		problems++;
	}

	if (in_raw.integer != 1) {
		Config_TroubleShoot_Tip("in_raw is not set to 1",
			"in_raw 3 enables Raw Input, the smoothest mouse input method. "
			"It is the recommended setting for mouse input",
			"set in_raw to 1", 0);
		problems++;
	}

	if (hud_planmode.value) {
		Config_TroubleShoot_Tip("hud_planmode is enabled",
			"hud_planmode turns on the display of all possible head up display elements "
			"so that you can fine-tune your head up display settings",
			"set hud_planmode to 0", 1);
	}
	if (!problems) {
		Com_Printf("No problems detected. For more help, please visit the forum in %s\n\n", CharsToBrownStatic("www.QuakeWorld.nu"));
	}
}