summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/cfg
diff options
context:
space:
mode:
authorpurpasmart96 <kanzoconfigz@hotmail.com>2015-02-01 00:11:51 +0100
committerpurpasmart96 <kanzoconfigz@hotmail.com>2015-02-08 02:34:59 +0100
commit60ce36f721415a1be26eab838ed4196efd3e475f (patch)
treea59e99e485ee5ede0823fc358f49d0085c477bee /src/core/hle/service/cfg
parentMerge pull request #516 from lioncash/cleanup (diff)
downloadyuzu-60ce36f721415a1be26eab838ed4196efd3e475f.tar
yuzu-60ce36f721415a1be26eab838ed4196efd3e475f.tar.gz
yuzu-60ce36f721415a1be26eab838ed4196efd3e475f.tar.bz2
yuzu-60ce36f721415a1be26eab838ed4196efd3e475f.tar.lz
yuzu-60ce36f721415a1be26eab838ed4196efd3e475f.tar.xz
yuzu-60ce36f721415a1be26eab838ed4196efd3e475f.tar.zst
yuzu-60ce36f721415a1be26eab838ed4196efd3e475f.zip
Diffstat (limited to 'src/core/hle/service/cfg')
-rw-r--r--src/core/hle/service/cfg/cfg_u.cpp66
1 files changed, 63 insertions, 3 deletions
diff --git a/src/core/hle/service/cfg/cfg_u.cpp b/src/core/hle/service/cfg/cfg_u.cpp
index 835620909..5d212a9a2 100644
--- a/src/core/hle/service/cfg/cfg_u.cpp
+++ b/src/core/hle/service/cfg/cfg_u.cpp
@@ -5,6 +5,7 @@
#include "common/file_util.h"
#include "common/log.h"
#include "common/string_util.h"
+#include "core/settings.h"
#include "core/file_sys/archive_systemsavedata.h"
#include "core/hle/hle.h"
#include "core/hle/service/cfg/cfg.h"
@@ -129,6 +130,65 @@ static void GetConfigInfoBlk2(Service::Interface* self) {
}
/**
+ * CFG_User::SecureInfoGetRegion service function
+ * Inputs:
+ * 1 : None
+ * Outputs:
+ * 0 : Result Header code
+ * 1 : Result of function, 0 on success, otherwise error code
+ * 2 : Region value loaded from SecureInfo offset 0x100
+ */
+static void SecureInfoGetRegion(Service::Interface* self) {
+ u32* cmd_buffer = Kernel::GetCommandBuffer();
+
+ cmd_buffer[1] = RESULT_SUCCESS.raw; // No Error
+ cmd_buffer[2] = Settings::values.region_value;
+}
+
+/**
+ * CFG_User::GenHashConsoleUnique service function
+ * Inputs:
+ * 1 : 20 bit application ID salt
+ * Outputs:
+ * 0 : Result Header code
+ * 1 : Result of function, 0 on success, otherwise error code
+ * 2 : Hash/"ID" lower word
+ * 3 : Hash/"ID" upper word
+ */
+static void GenHashConsoleUnique(Service::Interface* self) {
+ u32* cmd_buffer = Kernel::GetCommandBuffer();
+ u32 app_id_salt = cmd_buffer[1];
+
+ cmd_buffer[1] = RESULT_SUCCESS.raw; // No Error
+ cmd_buffer[2] = 0x33646D6F ^ (app_id_salt & 0xFFFFF); // 3dmoo hash
+ cmd_buffer[3] = 0x6F534841 ^ (app_id_salt & 0xFFFFF);
+
+ LOG_WARNING(Service_CFG, "(STUBBED) called app_id_salt=0x%08X", app_id_salt);
+}
+
+/**
+ * CFG_User::GetRegionCanadaUSA service function
+ * Inputs:
+ * 1 : None
+ * Outputs:
+ * 0 : Result Header code
+ * 1 : Result of function, 0 on success, otherwise error code
+ * 2 : Output value
+ */
+static void GetRegionCanadaUSA(Service::Interface* self) {
+ u32* cmd_buffer = Kernel::GetCommandBuffer();
+
+ cmd_buffer[1] = RESULT_SUCCESS.raw; // No Error
+
+ u8 canada_or_usa = 1;
+ if (canada_or_usa == Settings::values.region_value) {
+ cmd_buffer[2] = 1;
+ } else {
+ cmd_buffer[2] = 0;
+ }
+}
+
+/**
* CFG_User::GetSystemModel service function
* Inputs:
* 0 : 0x00050000
@@ -171,9 +231,9 @@ static void GetModelNintendo2DS(Service::Interface* self) {
const Interface::FunctionInfo FunctionTable[] = {
{0x00010082, GetConfigInfoBlk2, "GetConfigInfoBlk2"},
- {0x00020000, nullptr, "SecureInfoGetRegion"},
- {0x00030040, nullptr, "GenHashConsoleUnique"},
- {0x00040000, nullptr, "GetRegionCanadaUSA"},
+ {0x00020000, SecureInfoGetRegion, "SecureInfoGetRegion"},
+ {0x00030040, GenHashConsoleUnique, "GenHashConsoleUnique"},
+ {0x00040000, GetRegionCanadaUSA, "GetRegionCanadaUSA"},
{0x00050000, GetSystemModel, "GetSystemModel"},
{0x00060000, GetModelNintendo2DS, "GetModelNintendo2DS"},
{0x00070040, nullptr, "WriteToFirstByteCfgSavegame"},