summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------externals/boost0
-rw-r--r--src/common/x64/cpu_detect.cpp12
-rw-r--r--src/core/hle/service/cfg/cfg.cpp31
3 files changed, 31 insertions, 12 deletions
diff --git a/externals/boost b/externals/boost
Subproject f005c955f8147a29667aa0b65257abc3dd520b0 Subproject 351972396392c97a659b9a02f34ce9269293d21
diff --git a/src/common/x64/cpu_detect.cpp b/src/common/x64/cpu_detect.cpp
index 370ae2c80..2cb3ab9cc 100644
--- a/src/common/x64/cpu_detect.cpp
+++ b/src/common/x64/cpu_detect.cpp
@@ -8,9 +8,9 @@
8#include "common/common_types.h" 8#include "common/common_types.h"
9#include "cpu_detect.h" 9#include "cpu_detect.h"
10 10
11namespace Common { 11#ifdef _MSC_VER
12 12#include <intrin.h>
13#ifndef _MSC_VER 13#else
14 14
15#if defined(__DragonFly__) || defined(__FreeBSD__) 15#if defined(__DragonFly__) || defined(__FreeBSD__)
16// clang-format off 16// clang-format off
@@ -37,13 +37,15 @@ static inline void __cpuid(int info[4], int function_id) {
37} 37}
38 38
39#define _XCR_XFEATURE_ENABLED_MASK 0 39#define _XCR_XFEATURE_ENABLED_MASK 0
40static u64 _xgetbv(u32 index) { 40static inline u64 _xgetbv(u32 index) {
41 u32 eax, edx; 41 u32 eax, edx;
42 __asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index)); 42 __asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
43 return ((u64)edx << 32) | eax; 43 return ((u64)edx << 32) | eax;
44} 44}
45 45
46#endif // ifndef _MSC_VER 46#endif // _MSC_VER
47
48namespace Common {
47 49
48// Detects the various CPU features 50// Detects the various CPU features
49static CPUCaps Detect() { 51static CPUCaps Detect() {
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index 6f13cde27..4ddb1bc90 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -3,6 +3,8 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <algorithm> 5#include <algorithm>
6#include <array>
7#include <cryptopp/sha.h>
6#include "common/file_util.h" 8#include "common/file_util.h"
7#include "common/logging/log.h" 9#include "common/logging/log.h"
8#include "common/string_util.h" 10#include "common/string_util.h"
@@ -176,14 +178,29 @@ void SecureInfoGetRegion(Service::Interface* self) {
176} 178}
177 179
178void GenHashConsoleUnique(Service::Interface* self) { 180void GenHashConsoleUnique(Service::Interface* self) {
179 u32* cmd_buff = Kernel::GetCommandBuffer(); 181 IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x03, 1, 0);
180 u32 app_id_salt = cmd_buff[1]; 182 const u32 app_id_salt = rp.Pop<u32>() & 0x000FFFFF;
181 183
182 cmd_buff[1] = RESULT_SUCCESS.raw; 184 IPC::RequestBuilder rb = rp.MakeBuilder(3, 0);
183 cmd_buff[2] = 0x33646D6F ^ (app_id_salt & 0xFFFFF); // 3dmoo hash 185
184 cmd_buff[3] = 0x6F534841 ^ (app_id_salt & 0xFFFFF); 186 std::array<u8, 12> buffer;
187 const ResultCode result = GetConfigInfoBlock(ConsoleUniqueID2BlockID, 8, 2, buffer.data());
188 rb.Push(result);
189 if (result.IsSuccess()) {
190 std::memcpy(&buffer[8], &app_id_salt, sizeof(u32));
191 std::array<u8, CryptoPP::SHA256::DIGESTSIZE> hash;
192 CryptoPP::SHA256().CalculateDigest(hash.data(), buffer.data(), sizeof(buffer));
193 u32 low, high;
194 memcpy(&low, &hash[hash.size() - 8], sizeof(u32));
195 memcpy(&high, &hash[hash.size() - 4], sizeof(u32));
196 rb.Push(low);
197 rb.Push(high);
198 } else {
199 rb.Push<u32>(0);
200 rb.Push<u32>(0);
201 }
185 202
186 LOG_WARNING(Service_CFG, "(STUBBED) called app_id_salt=0x%X", app_id_salt); 203 LOG_DEBUG(Service_CFG, "called app_id_salt=0x%X", app_id_salt);
187} 204}
188 205
189void GetRegionCanadaUSA(Service::Interface* self) { 206void GetRegionCanadaUSA(Service::Interface* self) {