Exemplo n.º 1
0
 // todo(jonahr): Eventually could add support for all conditions/operating
 // systems, but these are the ones in use for now
 void validateConfigBase(const GPUTestConfig &config)
 {
     EXPECT_EQ(IsWindows(), config.getConditions()[GPUTestConfig::kConditionWin]);
     EXPECT_EQ(IsOSX(), config.getConditions()[GPUTestConfig::kConditionMac]);
     EXPECT_EQ(IsLinux(), config.getConditions()[GPUTestConfig::kConditionLinux]);
     EXPECT_EQ(IsAndroid(), config.getConditions()[GPUTestConfig::kConditionAndroid]);
     EXPECT_EQ(IsNexus5X(), config.getConditions()[GPUTestConfig::kConditionNexus5X]);
     EXPECT_EQ(IsPixel2(), config.getConditions()[GPUTestConfig::kConditionPixel2]);
     EXPECT_EQ(IsIntel(), config.getConditions()[GPUTestConfig::kConditionIntel]);
     EXPECT_EQ(IsAMD(), config.getConditions()[GPUTestConfig::kConditionAMD]);
     EXPECT_EQ(IsNVIDIA(), config.getConditions()[GPUTestConfig::kConditionNVIDIA]);
     EXPECT_EQ(IsDebug(), config.getConditions()[GPUTestConfig::kConditionDebug]);
     EXPECT_EQ(IsRelease(), config.getConditions()[GPUTestConfig::kConditionRelease]);
 }
Exemplo n.º 2
0
//-----------------------------------------------------------------------------
// Purpose: Advanced joystick setup
//-----------------------------------------------------------------------------
void CInput::Joystick_Advanced(void)
{
	// called whenever an update is needed
	int	i;
	DWORD dwTemp;

	if ( IsX360() )
	{
		// Xbox always uses a joystick
		in_joystick.SetValue( 1 );
	}

	// Initialize all the maps
	for ( i = 0; i < MAX_JOYSTICK_AXES; i++ )
	{
		m_rgAxes[i].AxisMap = GAME_AXIS_NONE;
		m_rgAxes[i].ControlMap = JOY_ABSOLUTE_AXIS;
	}

	if ( !joy_advanced.GetBool() )
	{
		// default joystick initialization
		// 2 axes only with joystick control
		m_rgAxes[JOY_AXIS_X].AxisMap = GAME_AXIS_YAW;
		m_rgAxes[JOY_AXIS_Y].AxisMap = GAME_AXIS_FORWARD;
	}
	else
	{
		if ( Q_stricmp( joy_name.GetString(), "joystick") != 0 )
		{
			// notify user of advanced controller
			Msg( "Using joystick '%s' configuration\n", joy_name.GetString() );
		}

		// advanced initialization here
		// data supplied by user via joy_axisn cvars
		dwTemp = ( joy_movement_stick.GetBool() ) ? (DWORD)joy_advaxisu.GetInt() : (DWORD)joy_advaxisx.GetInt();
		m_rgAxes[JOY_AXIS_X].AxisMap = dwTemp & 0x0000000f;
		m_rgAxes[JOY_AXIS_X].ControlMap = dwTemp & JOY_RELATIVE_AXIS;

		DescribeJoystickAxis( "JOY_AXIS_X", &m_rgAxes[JOY_AXIS_X] );

		dwTemp = ( joy_movement_stick.GetBool() ) ? (DWORD)joy_advaxisr.GetInt() : (DWORD)joy_advaxisy.GetInt();
		m_rgAxes[JOY_AXIS_Y].AxisMap = dwTemp & 0x0000000f;
		m_rgAxes[JOY_AXIS_Y].ControlMap = dwTemp & JOY_RELATIVE_AXIS;

		DescribeJoystickAxis( "JOY_AXIS_Y", &m_rgAxes[JOY_AXIS_Y] );

		dwTemp = (DWORD)joy_advaxisz.GetInt();
		m_rgAxes[JOY_AXIS_Z].AxisMap = dwTemp & 0x0000000f;
		m_rgAxes[JOY_AXIS_Z].ControlMap = dwTemp & JOY_RELATIVE_AXIS;

		DescribeJoystickAxis( "JOY_AXIS_Z", &m_rgAxes[JOY_AXIS_Z] );

		dwTemp = ( joy_movement_stick.GetBool() ) ? (DWORD)joy_advaxisy.GetInt() : (DWORD)joy_advaxisr.GetInt();
		m_rgAxes[JOY_AXIS_R].AxisMap = dwTemp & 0x0000000f;
		m_rgAxes[JOY_AXIS_R].ControlMap = dwTemp & JOY_RELATIVE_AXIS;

		DescribeJoystickAxis( "JOY_AXIS_R", &m_rgAxes[JOY_AXIS_R] );

		dwTemp = ( joy_movement_stick.GetBool() ) ? (DWORD)joy_advaxisx.GetInt() : (DWORD)joy_advaxisu.GetInt();
		m_rgAxes[JOY_AXIS_U].AxisMap = dwTemp & 0x0000000f;
		m_rgAxes[JOY_AXIS_U].ControlMap = dwTemp & JOY_RELATIVE_AXIS;

		DescribeJoystickAxis( "JOY_AXIS_U", &m_rgAxes[JOY_AXIS_U] );

		dwTemp = (DWORD)joy_advaxisv.GetInt();
		m_rgAxes[JOY_AXIS_V].AxisMap = dwTemp & 0x0000000f;
		m_rgAxes[JOY_AXIS_V].ControlMap = dwTemp & JOY_RELATIVE_AXIS;

		DescribeJoystickAxis( "JOY_AXIS_V", &m_rgAxes[JOY_AXIS_V] );

		Msg( "Advanced Joystick settings initialized\n" );
	}

	// If we have an xcontroller, load the cfg file if it hasn't been loaded.
	static ConVarRef var( "joy_xcontroller_found" );
	if ( var.IsValid() && var.GetBool() && in_joystick.GetBool() )
	{
		if ( joy_xcontroller_cfg_loaded.GetInt() < 2 )
		{
			engine->ClientCmd_Unrestricted( "exec 360controller.cfg" );
			if ( IsLinux () )
			{
				engine->ClientCmd_Unrestricted( "exec 360controller-linux.cfg" );
			}
			joy_xcontroller_cfg_loaded.SetValue( 2 );
		}
	}
	else if ( joy_xcontroller_cfg_loaded.GetInt() > 0 )
	{
		engine->ClientCmd_Unrestricted( "exec undo360controller.cfg" );
		joy_xcontroller_cfg_loaded.SetValue( 0 );
	}
}
void AppendPlayerInformation(ISteamHTTP *pSteamHttp, HTTPRequestHandle httpRequest, CSteamAPIContext *pSteamAPIContext, CBasePlayer *pPlayer, bool bAnonymous)
{
	// Local DS
	time_t rawtime;
	struct tm* timeinfo;

	time(&rawtime);
	timeinfo = localtime(&rawtime);
	char* local_ds = asctime(timeinfo);

	char* newLine = strstr(local_ds, "\n");
	if (newLine)
	{
		*newLine = 0;
	}

	pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "localdatetime", local_ds);

	// Build DS
	char build_ds[64];
	Q_snprintf(build_ds, sizeof(build_ds), "%s,%s", __DATE__, __TIME__);
	pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "builddatetime", build_ds);

	// DxLevel
	pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "dxlevel", ConVarRef("mat_dxlevel").GetString());

	if (pPlayer)
	{
		// Position
		char player_position[32];
		Vector player_pos = pPlayer->GetLocalOrigin();
		Q_snprintf(player_position, sizeof(player_position), "%.2f,%.2f,%.2f", player_pos.x, player_pos.y, player_pos.z);
		pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "position", player_position);

		// Angles
		char player_angles[32];
		QAngle player_ang = pPlayer->GetLocalAngles();
		Q_snprintf(player_angles, sizeof(player_angles), "%.2f,%.2f,%.2f", player_ang.x, player_ang.y, player_ang.z);
		pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "angles", player_angles);

		// Health
		char player_health[16];
		Q_snprintf(player_health, sizeof(player_health), "%i", pPlayer->GetHealth());
		pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "health", player_health);

		// Weapon
		CBaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
		if (pWeapon)
		{
			pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "weapon", pWeapon->GetClassname());
		}
	}

	// Cheats
	char cheats_enabled[8];
	Q_snprintf(cheats_enabled, sizeof(cheats_enabled), "%i", (ConVarRef("sv_cheats").GetBool() || ConVarRef("developer").GetBool()));
	pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "cheats", cheats_enabled);

	// Map
#ifdef CLIENT_DLL
	char mapname[256];
	V_FileBase(engine->GetLevelName(), mapname, sizeof(mapname));
	pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "level", mapname);
#else
	pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "level", gpGlobals->mapname.ToCStr());
#endif

	if (pSteamAPIContext)
	{
		// Language
		pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "language", pSteamAPIContext->SteamUtils()->GetSteamUILanguage());
	}

	// Platform
	char *			platform = "unknown";
	if (IsPC())		platform = "pc";
	if (IsOSX())	platform = "osx";
	if (IsLinux())	platform = "linux";
	if (IsX360())	platform = "360";
	if (IsPS3())	platform = "ps3";
	pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "platform", platform);

	// Player ID
	if (bAnonymous == false)
	{
		if (ae_uniqueplayerid.GetInt() == 0)
			GenerateUniquePlayerId(pSteamAPIContext);
		pSteamHttp->SetHTTPRequestGetOrPostParameter(httpRequest, "playerid", ae_uniqueplayerid.GetString());
	}
}