mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 09:39:33 +01:00
Merge pull request #23051 from hrydgard/reporting-played-seconds
Reporting: Send time played in seconds, firmware version, OS, device model and disc format
This commit is contained in:
3 files changed
+69
-3
No files matched your search
+2
-2
@@ -382,8 +382,8 @@ static constexpr ConfigSetting generalSettings[] = {
|
||||
ConfigSetting("RemoteScrollPosition", SETTING(g_Config, fRemoteScrollPosition), 0.0f, CfgFlag::DEFAULT),
|
||||
ConfigSetting("DebugOverlay", SETTING(g_Config, iDebugOverlay), 0, CfgFlag::DONT_SAVE),
|
||||
ConfigSetting("DefaultTab", SETTING(g_Config, iDefaultTab), 0, CfgFlag::DEFAULT),
|
||||
ConfigSetting("DisableHLEFlags", SETTING(g_Config, iDisableHLE), 0, CfgFlag::PER_GAME),
|
||||
ConfigSetting("ForceEnableHLEFlags", SETTING(g_Config, iForceEnableHLE), 0, CfgFlag::PER_GAME),
|
||||
ConfigSetting("DisableHLEFlags", SETTING(g_Config, iDisableHLE), 0, CfgFlag::PER_GAME | CfgFlag::REPORT),
|
||||
ConfigSetting("ForceEnableHLEFlags", SETTING(g_Config, iForceEnableHLE), 0, CfgFlag::PER_GAME | CfgFlag::REPORT),
|
||||
|
||||
ConfigSetting("ScreenshotMode", SETTING(g_Config, iScreenshotMode), 0, CfgFlag::DEFAULT)
|
||||
.Label(I18NCat::SYSTEM, "Screenshot mode").Choices(screenshotModeNames),
|
||||
|
||||
+55
-1
@@ -25,6 +25,8 @@
|
||||
#include <set>
|
||||
#include <cstdlib>
|
||||
#include <cstdarg>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
// for crc32
|
||||
extern "C" {
|
||||
@@ -38,6 +40,7 @@ extern "C" {
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/System/OSD.h"
|
||||
#include "Common/System/System.h"
|
||||
#include "Common/Data/Text/I18n.h"
|
||||
#include "Common/Net/HTTPClient.h"
|
||||
#include "Common/Net/Resolve.h"
|
||||
@@ -58,6 +61,7 @@ extern "C" {
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "Core/HLE/scePower.h"
|
||||
#include "Core/HW/Display.h"
|
||||
#include "Core/Util/PSARUnpack.h"
|
||||
#include "GPU/GPUCommon.h"
|
||||
#include "GPU/GPUState.h"
|
||||
|
||||
@@ -423,9 +427,42 @@ namespace Reporting
|
||||
return disc_id + "_" + disc_version;
|
||||
}
|
||||
|
||||
// The container the game image is in, from its header: "cso", "chd", "pbp" or "iso". Empty for
|
||||
// a directory. Cached, since it only changes with the game.
|
||||
static std::string DiscContainer(const Path &path) {
|
||||
static std::mutex cacheLock;
|
||||
static Path cachedPath;
|
||||
static std::string cachedContainer;
|
||||
|
||||
std::lock_guard<std::mutex> guard(cacheLock);
|
||||
if (path == cachedPath) {
|
||||
return cachedContainer;
|
||||
}
|
||||
cachedPath = path;
|
||||
cachedContainer.clear();
|
||||
|
||||
std::unique_ptr<FileLoader> loader(ConstructFileLoader(path));
|
||||
char header[8]{};
|
||||
if (!loader || !loader->Exists() || loader->IsDirectory() || loader->ReadAt(0, 1, 8, header) != 8) {
|
||||
return cachedContainer;
|
||||
}
|
||||
if (!memcmp(header, "CISO", 4)) {
|
||||
cachedContainer = "cso";
|
||||
} else if (!memcmp(header, "MComprHD", 8)) {
|
||||
cachedContainer = "chd";
|
||||
} else if (!memcmp(header, "\0PBP", 4)) {
|
||||
cachedContainer = "pbp";
|
||||
} else {
|
||||
cachedContainer = "iso";
|
||||
}
|
||||
return cachedContainer;
|
||||
}
|
||||
|
||||
void AddGameInfo(UrlEncoder &postdata)
|
||||
{
|
||||
postdata.Add("game", CurrentGameID());
|
||||
postdata.Add("file_type", IdentifiedFileTypeToString(PSP_CoreParameter().fileType));
|
||||
postdata.Add("disc_container", DiscContainer(PSP_CoreParameter().fileToStart));
|
||||
postdata.Add("game_title", StripTrailingNull(g_paramSFO.GetValueString("TITLE")));
|
||||
postdata.Add("sdkver", sceKernelGetCompiledSdkVersion());
|
||||
postdata.Add("module_name", lastModuleName);
|
||||
@@ -444,6 +481,20 @@ namespace Reporting
|
||||
postdata.Add("gpu_full", gpuFull);
|
||||
postdata.Add("cpu", cpu_info.Summarize());
|
||||
postdata.Add("platform", GetPlatformIdentifer());
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
// On Android, SYSPROP_NAME is the device: "MANUFACTURER:MODEL".
|
||||
postdata.Add("os", StringFromFormat("Android API %d", (int)System_GetPropertyInt(SYSPROP_SYSTEMVERSION)));
|
||||
postdata.Add("device_model", System_GetProperty(SYSPROP_NAME));
|
||||
#else
|
||||
postdata.Add("os", System_GetProperty(SYSPROP_NAME));
|
||||
postdata.Add("device_model", System_GetProperty(SYSPROP_DEVICE_MODEL));
|
||||
#endif
|
||||
postdata.Add("os_build", System_GetProperty(SYSPROP_SYSTEMBUILD));
|
||||
|
||||
// Empty when there's no full firmware install (nothing, or just fonts pulled off a disc).
|
||||
InstalledFirmwareInfo firmware;
|
||||
ReadInstalledFirmwareInfo(g_Config.nandRootDirectory, &firmware, false);
|
||||
postdata.Add("firmware", firmware.version);
|
||||
}
|
||||
|
||||
void AddConfigInfo(UrlEncoder &postdata)
|
||||
@@ -457,8 +508,11 @@ namespace Reporting
|
||||
void AddGameplayInfo(UrlEncoder &postdata)
|
||||
{
|
||||
// Just to get an idea of how long they played.
|
||||
if (PSP_GetBootState() == BootState::Complete)
|
||||
if (PSP_GetBootState() == BootState::Complete) {
|
||||
postdata.Add("ticks", (const uint64_t)CoreTiming::GetTicks(currentMIPS));
|
||||
// Emulated seconds. Ticks alone don't say this, since games change the CPU clock.
|
||||
postdata.Add("seconds_played", (double)CoreTiming::PeekGlobalTimeUs() / 1000000.0);
|
||||
}
|
||||
|
||||
float vps, fps;
|
||||
__DisplayGetAveragedFPS(&vps, &fps);
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
#include <cstdlib>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
#include <SDL3/SDL.h>
|
||||
@@ -1121,6 +1124,15 @@ std::string System_GetProperty(SystemProperty prop) {
|
||||
#if PPSSPP_PLATFORM(MAC)
|
||||
case SYSPROP_DEVICE_MODEL:
|
||||
return "Mac";
|
||||
#endif
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
case SYSPROP_SYSTEMBUILD: {
|
||||
struct utsname name;
|
||||
if (uname(&name) != 0) {
|
||||
return "";
|
||||
}
|
||||
return std::string(name.sysname) + " " + name.release;
|
||||
}
|
||||
#endif
|
||||
case SYSPROP_NAME:
|
||||
#ifdef _WIN32
|
||||
|
||||
Reference in new issue
Block a user