From 906a450ac397e9457e2722a15c6db1aaa9414a81 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sat, 30 Jan 2021 19:50:49 -0800 Subject: [PATCH] dns.mitm: parse redirections from hosts file --- .../include/stratosphere/ams/ams_emummc_api.hpp | 3 +++ libstratosphere/source/ams/ams_emummc_api.cpp | 14 ++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libstratosphere/include/stratosphere/ams/ams_emummc_api.hpp b/libstratosphere/include/stratosphere/ams/ams_emummc_api.hpp index c919abc1..4597b2ad 100644 --- a/libstratosphere/include/stratosphere/ams/ams_emummc_api.hpp +++ b/libstratosphere/include/stratosphere/ams/ams_emummc_api.hpp @@ -22,6 +22,9 @@ namespace ams::emummc { /* Get whether emummc is active. */ bool IsActive(); + /* Get the active emummc id. */ + u32 GetActiveId(); + /* Get Nintendo redirection path. */ const char *GetNintendoDirPath(); diff --git a/libstratosphere/source/ams/ams_emummc_api.cpp b/libstratosphere/source/ams/ams_emummc_api.cpp index 02dd75f9..2c82a12d 100644 --- a/libstratosphere/source/ams/ams_emummc_api.cpp +++ b/libstratosphere/source/ams/ams_emummc_api.cpp @@ -57,10 +57,10 @@ namespace ams::emummc { }; /* Globals. */ - os::Mutex g_lock(false); - ExosphereConfig g_exo_config; - bool g_is_emummc; - bool g_has_cached; + constinit os::SdkMutex g_lock; + constinit ExosphereConfig g_exo_config; + constinit bool g_is_emummc; + constinit bool g_has_cached; /* Helpers. */ void CacheValues() { @@ -110,6 +110,12 @@ namespace ams::emummc { return g_is_emummc; } + /* Get the active emummc id. */ + u32 GetActiveId() { + CacheValues(); + return g_exo_config.base_cfg.id; + } + /* Get Nintendo redirection path. */ const char *GetNintendoDirPath() { CacheValues();