Merge pull request #10803 from obrakmann/player-census

Add ability to collect system information from users' systems
This commit is contained in:
abcdefg30
2016-03-04 16:27:32 +01:00
10 changed files with 81 additions and 18 deletions

View File

@@ -78,6 +78,8 @@ namespace OpenRA
IHardwareCursor CreateHardwareCursor(string name, Size size, byte[] data, int2 hotspot);
void SetHardwareCursor(IHardwareCursor cursor);
string GLVersion { get; }
}
public interface IVertexBuffer<T> : IDisposable

View File

@@ -273,5 +273,10 @@ namespace OpenRA
{
return Device.SetClipboardText(text);
}
public string GLVersion
{
get { return Device.GLVersion; }
}
}
}

View File

@@ -92,6 +92,8 @@ namespace OpenRA
public bool SanityCheckUnsyncedCode = false;
public int Samples = 25;
public bool IgnoreVersionMismatch = false;
public bool SendSystemInformation = true;
public string UUID = System.Guid.NewGuid().ToString();
}
public class GraphicSettings
@@ -179,7 +181,7 @@ namespace OpenRA
public Modifiers ZoomModifier = Modifiers.Ctrl;
public bool FetchNews = true;
public string NewsUrl = "http://www.openra.net/gamenews";
public string NewsUrl = "http://master.openra.net/gamenews";
}
public class KeySettings

View File

@@ -220,7 +220,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (newsButton != null)
{
if (!fetchedNews)
new Download(Game.Settings.Game.NewsUrl, cacheFile, e => { },
new Download(Game.Settings.Game.NewsUrl + SysInfoQuery(), cacheFile, e => { },
(e, c) => NewsDownloadComplete(e, cacheFile, currentNews,
() => newsButton.AttachPanel(newsPanel)));
@@ -252,6 +252,23 @@ namespace OpenRA.Mods.Common.Widgets.Logic
() => { Game.CloseServer(); SwitchMenu(MenuType.MapEditor); });
}
string SysInfoQuery()
{
if (!Game.Settings.Debug.SendSystemInformation)
return null;
return "?id={0}&platform={1}&os={2}&runtime={3}&gl={4}&lang={5}&version={6}&mod={7}&modversion={8}".F(
Uri.EscapeUriString(Game.Settings.Debug.UUID),
Uri.EscapeUriString(Platform.CurrentPlatform.ToString()),
Uri.EscapeUriString(Environment.OSVersion.ToString()),
Uri.EscapeUriString(Platform.RuntimeVersion),
Uri.EscapeUriString(Game.Renderer.GLVersion),
Uri.EscapeUriString(System.Globalization.CultureInfo.InstalledUICulture.TwoLetterISOLanguageName),
Uri.EscapeUriString(ModMetadata.AllMods["modchooser"].Version),
Uri.EscapeUriString(Game.ModData.Manifest.Mod.Id),
Uri.EscapeUriString(Game.ModData.Manifest.Mod.Version));
}
void SetNewsStatus(string message)
{
message = WidgetUtils.WrapText(message, newsStatus.Bounds.Width, Game.Renderer.Fonts[newsStatus.Font]);

View File

@@ -604,6 +604,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
BindCheckboxPref(panel, "BOTDEBUG_CHECKBOX", ds, "BotDebug");
BindCheckboxPref(panel, "FETCH_NEWS_CHECKBOX", gs, "FetchNews");
BindCheckboxPref(panel, "LUADEBUG_CHECKBOX", ds, "LuaDebug");
BindCheckboxPref(panel, "SENDSYSINFO_CHECKBOX", ds, "SendSystemInformation");
return () => { };
}

View File

@@ -33,6 +33,8 @@ namespace OpenRA.Platforms.Default
public static GLFeatures Features { get; private set; }
public static string Version { get; private set; }
public const int GL_FALSE = 0;
// ClearBufferMask
@@ -452,8 +454,8 @@ namespace OpenRA.Platforms.Default
{
try
{
var versionString = glGetString(GL_VERSION);
var version = versionString.Contains(" ") ? versionString.Split(' ')[0].Split('.') : versionString.Split('.');
Version = glGetString(GL_VERSION);
var version = Version.Contains(" ") ? Version.Split(' ')[0].Split('.') : Version.Split('.');
var major = 0;
if (version.Length > 0)

View File

@@ -395,5 +395,7 @@ namespace OpenRA.Platforms.Default
VerifyThreadAffinity();
return new Shader(name);
}
public string GLVersion { get { return OpenGL.Version; } }
}
}

View File

@@ -60,6 +60,8 @@ namespace OpenRA.Platforms.Null
public IHardwareCursor CreateHardwareCursor(string name, Size size, byte[] data, int2 hotspot) { return null; }
public void SetHardwareCursor(IHardwareCursor cursor) { }
public string GLVersion { get { return "(null)"; } }
}
public class NullShader : IShader

View File

@@ -523,6 +523,13 @@ Container@SETTINGS_PANEL:
Height: 20
Font: Regular
Text: Show Performance Text
Checkbox@PERFGRAPH_CHECKBOX:
X: 15
Y: 100
Width: 300
Height: 20
Font: Regular
Text: Show Performance Graph
Checkbox@FETCH_NEWS_CHECKBOX:
X: 310
Y: 40
@@ -530,43 +537,51 @@ Container@SETTINGS_PANEL:
Height: 20
Font: Regular
Text: Fetch Community News
Checkbox@PERFGRAPH_CHECKBOX:
Checkbox@SENDSYSINFO_CHECKBOX:
X: 310
Y: 70
Width: 300
Height: 20
Font: Regular
Text: Show Performance Graph
Text: Send System Information
Label@SENDSYSINFO_DESC:
X: 310
Y: 85
Width: 250
Height: 30
Font: Tiny
WordWrap: True
Text: Your Operating System, OpenGL and .NET runtime versions, and language settings will be sent along with an anonymous ID to help priorise future development.
Label@DEBUG_TITLE:
Y: 140
Y: 170
Width: PARENT_RIGHT
Font: Bold
Text: Debug
Align: Center
Checkbox@BOTDEBUG_CHECKBOX:
X: 15
Y: 160
Y: 190
Width: 300
Height: 20
Font: Regular
Text: Show Bot Debug Messages
Checkbox@VERBOSE_NAT_CHECKBOX:
X: 310
Y: 160
Y: 190
Width: 300
Height: 20
Font: Regular
Text: Detailed NAT logging
Checkbox@CHECKUNSYNCED_CHECKBOX:
X: 15
Y: 190
Y: 220
Width: 300
Height: 20
Font: Regular
Text: Check Sync around Unsynced Code
Checkbox@LUADEBUG_CHECKBOX:
X: 310
Y: 190
Y: 220
Width: 300
Height: 20
Font: Regular

View File

@@ -524,6 +524,13 @@ Background@SETTINGS_PANEL:
Height: 20
Font: Regular
Text: Show Performance Text
Checkbox@PERFGRAPH_CHECKBOX:
X: 15
Y: 100
Width: 300
Height: 20
Font: Regular
Text: Show Performance Graph
Checkbox@FETCH_NEWS_CHECKBOX:
X: 310
Y: 40
@@ -531,43 +538,51 @@ Background@SETTINGS_PANEL:
Height: 20
Font: Regular
Text: Fetch Community News
Checkbox@PERFGRAPH_CHECKBOX:
Checkbox@SENDSYSINFO_CHECKBOX:
X: 310
Y: 70
Width: 300
Height: 20
Font: Regular
Text: Show Performance Graph
Text: Send System Information
Label@SENDSYSINFO_DESC:
X: 310
Y: 85
Width: 250
Height: 30
Font: Tiny
WordWrap: True
Text: Your Operating System, OpenGL and .NET runtime versions, and language settings will be sent along with an anonymous ID to help priorise future development.
Label@DEBUG_TITLE:
Y: 140
Y: 170
Width: PARENT_RIGHT
Font: Bold
Text: Debug
Align: Center
Checkbox@BOTDEBUG_CHECKBOX:
X: 15
Y: 160
Y: 190
Width: 300
Height: 20
Font: Regular
Text: Show Bot Debug Messages
Checkbox@VERBOSE_NAT_CHECKBOX:
X: 310
Y: 160
Y: 190
Width: 300
Height: 20
Font: Regular
Text: Detailed NAT logging
Checkbox@CHECKUNSYNCED_CHECKBOX:
X: 15
Y: 190
Y: 220
Width: 300
Height: 20
Font: Regular
Text: Check Sync around Unsynced Code
Checkbox@LUADEBUG_CHECKBOX:
X: 310
Y: 190
Y: 220
Width: 300
Height: 20
Font: Regular