mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-21 22:53:04 +00:00
Add HOST_TICK and BUILD_PLATFORM to svcGetSystemInfo CITRA_INFORMATION type (#8)
* Add HOST_TICK to svcGetSystemInfo CITRA_INFORMATION type * Add BUILD_PLATFORM
This commit is contained in:
parent
c710c0009f
commit
bf0127d0ae
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <fmt/format.h>
|
||||
#include "common/archives.h"
|
||||
#include "common/logging/log.h"
|
||||
|
@ -268,8 +269,10 @@ enum class SystemInfoMemUsageRegion {
|
|||
*/
|
||||
enum class SystemInfoCitraInformation {
|
||||
IS_CITRA = 0, // Always set the output to 1, signaling the app is running on Citra.
|
||||
HOST_TICK = 1, // Tick reference from the host in ns, unaffected by lag or cpu speed.
|
||||
BUILD_NAME = 10, // (ie: Nightly, Canary).
|
||||
BUILD_VERSION = 11, // Build version.
|
||||
BUILD_PLATFORM = 12, // Build platform, see SystemInfoCitraPlatform.
|
||||
BUILD_DATE_PART1 = 20, // Build date first 7 characters.
|
||||
BUILD_DATE_PART2 = 21, // Build date next 7 characters.
|
||||
BUILD_DATE_PART3 = 22, // Build date next 7 characters.
|
||||
|
@ -280,6 +283,17 @@ enum class SystemInfoCitraInformation {
|
|||
BUILD_GIT_DESCRIPTION_PART2 = 41, // Git description (commit) last 7 characters.
|
||||
};
|
||||
|
||||
/**
|
||||
* Current officially supported platforms.
|
||||
*/
|
||||
enum class SystemInfoCitraPlatform {
|
||||
PLATFORM_UNKNOWN = 0,
|
||||
PLATFORM_WINDOWS = 1,
|
||||
PLATFORM_LINUX = 2,
|
||||
PLATFORM_APPLE = 3,
|
||||
PLATFORM_ANDROID = 4,
|
||||
};
|
||||
|
||||
/**
|
||||
* Accepted by the custom svcControlProcess.
|
||||
*/
|
||||
|
@ -1740,12 +1754,31 @@ Result SVC::GetSystemInfo(s64* out, u32 type, s32 param) {
|
|||
case SystemInfoCitraInformation::IS_CITRA:
|
||||
*out = 1;
|
||||
break;
|
||||
case SystemInfoCitraInformation::HOST_TICK:
|
||||
*out = static_cast<s64>(std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::steady_clock::now().time_since_epoch())
|
||||
.count());
|
||||
break;
|
||||
case SystemInfoCitraInformation::BUILD_NAME:
|
||||
CopyStringPart(reinterpret_cast<char*>(out), Common::g_build_name, 0, sizeof(s64));
|
||||
break;
|
||||
case SystemInfoCitraInformation::BUILD_VERSION:
|
||||
CopyStringPart(reinterpret_cast<char*>(out), Common::g_build_version, 0, sizeof(s64));
|
||||
break;
|
||||
case SystemInfoCitraInformation::BUILD_PLATFORM: {
|
||||
#if defined(_WIN32)
|
||||
*out = static_cast<s64>(SystemInfoCitraPlatform::PLATFORM_WINDOWS);
|
||||
#elif defined(ANDROID)
|
||||
*out = static_cast<s64>(SystemInfoCitraPlatform::PLATFORM_ANDROID);
|
||||
#elif defined(__linux__)
|
||||
*out = static_cast<s64>(SystemInfoCitraPlatform::PLATFORM_LINUX);
|
||||
#elif defined(__APPLE__)
|
||||
*out = static_cast<s64>(SystemInfoCitraPlatform::PLATFORM_APPLE);
|
||||
#else
|
||||
*out = static_cast<s64>(SystemInfoCitraPlatform::PLATFORM_UNKNOWN);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case SystemInfoCitraInformation::BUILD_DATE_PART1:
|
||||
CopyStringPart(reinterpret_cast<char*>(out), Common::g_build_date,
|
||||
(sizeof(s64) - 1) * 0, sizeof(s64));
|
||||
|
|
Loading…
Reference in a new issue