diff --git a/config_templates/system_settings.ini b/config_templates/system_settings.ini
index c82fe9627..32cebc036 100644
--- a/config_templates/system_settings.ini
+++ b/config_templates/system_settings.ini
@@ -32,6 +32,12 @@
; NOTE: EXPERIMENTAL
; If you do not know what you are doing, do not touch this yet.
; fsmitm_redirect_saves_to_sd = u8!0x0
+; Controls whether to enable the deprecated hid mitm
+; to fix compatibility with old homebrew.
+; 0 = Do not enable, 1 = Enable.
+; Please note this setting may be removed in a
+; future release of Atmosphere.
+; enable_deprecated_hid_mitm = u8!0x0
[hbloader]
; Controls the size of the homebrew heap when running as applet.
; If set to zero, all available applet memory is used as heap.
diff --git a/stratosphere/ams_mitm/source/amsmitm_initialization.cpp b/stratosphere/ams_mitm/source/amsmitm_initialization.cpp
index 7b29ce9e2..928559879 100644
--- a/stratosphere/ams_mitm/source/amsmitm_initialization.cpp
+++ b/stratosphere/ams_mitm/source/amsmitm_initialization.cpp
@@ -17,6 +17,7 @@
#include "amsmitm_initialization.hpp"
#include "amsmitm_fs_utils.hpp"
#include "bpc_mitm/bpc_ams_power_utils.hpp"
+#include "set_mitm/settings_sd_kvs.hpp"
namespace ams::mitm {
@@ -228,6 +229,12 @@ namespace ams::mitm {
R_ASSERT(setsysInitialize());
});
+ /* Load settings off the SD card. */
+ settings::fwdbg::InitializeSdCardKeyValueStore();
+
+ /* Ensure that we reboot using the user's preferred method. */
+ R_ASSERT(mitm::bpc::DetectPreferredRebootFunctionality());
+
/* Signal to waiters that we are ready. */
g_init_event.Signal();
}
diff --git a/stratosphere/ams_mitm/source/hid_mitm/hidmitm_module.cpp b/stratosphere/ams_mitm/source/hid_mitm/hidmitm_module.cpp
index a239cdff5..fedcf29ab 100644
--- a/stratosphere/ams_mitm/source/hid_mitm/hidmitm_module.cpp
+++ b/stratosphere/ams_mitm/source/hid_mitm/hidmitm_module.cpp
@@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
+#include "../amsmitm_initialization.hpp"
#include "hidmitm_module.hpp"
#include "hid_mitm_service.hpp"
@@ -31,6 +32,14 @@ namespace ams::mitm::hid {
constexpr size_t MaxServers = 1;
sf::hipc::ServerManager g_server_manager;
+ bool ShouldMitmHidForCompability() {
+ u8 en = 0;
+ if (settings::fwdbg::GetSettingsItemValue(&en, sizeof(en), "atmosphere", "enable_deprecated_hid_mitm") == sizeof(en)) {
+ return (en != 0);
+ }
+ return false;
+ }
+
}
void MitmModule::ThreadFunction(void *arg) {
@@ -39,6 +48,15 @@ namespace ams::mitm::hid {
return;
}
+ /* Wait until initialization is complete. */
+ mitm::WaitInitialized();
+
+ /* hid mitm was a temporary solution for compatibility. */
+ /* Unless we are configured to continue doing so, don't instantiate the mitm. */
+ if (!ShouldMitmHidForCompability()) {
+ return;
+ }
+
/* Create hid mitm. */
R_ASSERT(g_server_manager.RegisterMitmServer(MitmServiceName));
diff --git a/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp b/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp
index b77f1a7c6..21d9da50c 100644
--- a/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp
+++ b/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp
@@ -14,11 +14,9 @@
* along with this program. If not, see .
*/
#include "../amsmitm_initialization.hpp"
-#include "../bpc_mitm/bpc_ams_power_utils.hpp"
#include "setmitm_module.hpp"
#include "set_mitm_service.hpp"
#include "setsys_mitm_service.hpp"
-#include "settings_sd_kvs.hpp"
namespace ams::mitm::settings {
@@ -43,12 +41,6 @@ namespace ams::mitm::settings {
/* Wait until initialization is complete. */
mitm::WaitInitialized();
- /* Load settings off the SD card. */
- ams::settings::fwdbg::InitializeSdCardKeyValueStore();
-
- /* Ensure that we reboot using the user's preferred method. */
- R_ASSERT(ams::mitm::bpc::DetectPreferredRebootFunctionality());
-
/* Create mitm servers. */
R_ASSERT(g_server_manager.RegisterMitmServer(SetMitmServiceName));
R_ASSERT(g_server_manager.RegisterMitmServer(SetSysMitmServiceName));
diff --git a/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp b/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp
index ab08da28d..5537668d7 100644
--- a/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp
+++ b/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp
@@ -346,6 +346,12 @@ namespace ams::settings::fwdbg {
/* If you do not know what you are doing, do not touch this yet. */
R_ASSERT(ParseSettingsItemValue("atmosphere", "fsmitm_redirect_saves_to_sd", "u8!0x0"));
+ /* Controls whether to enable the deprecated hid mitm */
+ /* to fix compatibility with old homebrew. */
+ /* 0 = Do not enable, 1 = Enable. */
+ /* Please note this setting may be removed in a future release of Atmosphere. */
+ R_ASSERT(ParseSettingsItemValue("atmosphere", "enable_deprecated_hid_mitm", "u8!0x0"));
+
/* Hbloader custom settings. */
/* Controls the size of the homebrew heap when running as applet. */