1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-22 11:56:40 +00:00

hid.mitm: disable by default

This commit is contained in:
Michael Scire 2020-01-02 22:40:47 -08:00
parent 3038612774
commit d779eea009
5 changed files with 37 additions and 8 deletions

View file

@ -32,6 +32,12 @@
; NOTE: EXPERIMENTAL ; NOTE: EXPERIMENTAL
; If you do not know what you are doing, do not touch this yet. ; If you do not know what you are doing, do not touch this yet.
; fsmitm_redirect_saves_to_sd = u8!0x0 ; 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] [hbloader]
; Controls the size of the homebrew heap when running as applet. ; Controls the size of the homebrew heap when running as applet.
; If set to zero, all available applet memory is used as heap. ; If set to zero, all available applet memory is used as heap.

View file

@ -17,6 +17,7 @@
#include "amsmitm_initialization.hpp" #include "amsmitm_initialization.hpp"
#include "amsmitm_fs_utils.hpp" #include "amsmitm_fs_utils.hpp"
#include "bpc_mitm/bpc_ams_power_utils.hpp" #include "bpc_mitm/bpc_ams_power_utils.hpp"
#include "set_mitm/settings_sd_kvs.hpp"
namespace ams::mitm { namespace ams::mitm {
@ -228,6 +229,12 @@ namespace ams::mitm {
R_ASSERT(setsysInitialize()); 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. */ /* Signal to waiters that we are ready. */
g_init_event.Signal(); g_init_event.Signal();
} }

View file

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "../amsmitm_initialization.hpp"
#include "hidmitm_module.hpp" #include "hidmitm_module.hpp"
#include "hid_mitm_service.hpp" #include "hid_mitm_service.hpp"
@ -31,6 +32,14 @@ namespace ams::mitm::hid {
constexpr size_t MaxServers = 1; constexpr size_t MaxServers = 1;
sf::hipc::ServerManager<MaxServers, ServerOptions> g_server_manager; sf::hipc::ServerManager<MaxServers, ServerOptions> 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) { void MitmModule::ThreadFunction(void *arg) {
@ -39,6 +48,15 @@ namespace ams::mitm::hid {
return; 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. */ /* Create hid mitm. */
R_ASSERT(g_server_manager.RegisterMitmServer<HidMitmService>(MitmServiceName)); R_ASSERT(g_server_manager.RegisterMitmServer<HidMitmService>(MitmServiceName));

View file

@ -14,11 +14,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "../amsmitm_initialization.hpp" #include "../amsmitm_initialization.hpp"
#include "../bpc_mitm/bpc_ams_power_utils.hpp"
#include "setmitm_module.hpp" #include "setmitm_module.hpp"
#include "set_mitm_service.hpp" #include "set_mitm_service.hpp"
#include "setsys_mitm_service.hpp" #include "setsys_mitm_service.hpp"
#include "settings_sd_kvs.hpp"
namespace ams::mitm::settings { namespace ams::mitm::settings {
@ -43,12 +41,6 @@ namespace ams::mitm::settings {
/* Wait until initialization is complete. */ /* Wait until initialization is complete. */
mitm::WaitInitialized(); 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. */ /* Create mitm servers. */
R_ASSERT(g_server_manager.RegisterMitmServer<SetMitmService>(SetMitmServiceName)); R_ASSERT(g_server_manager.RegisterMitmServer<SetMitmService>(SetMitmServiceName));
R_ASSERT(g_server_manager.RegisterMitmServer<SetSysMitmService>(SetSysMitmServiceName)); R_ASSERT(g_server_manager.RegisterMitmServer<SetSysMitmService>(SetSysMitmServiceName));

View file

@ -346,6 +346,12 @@ namespace ams::settings::fwdbg {
/* If you do not know what you are doing, do not touch this yet. */ /* 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")); 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. */ /* Hbloader custom settings. */
/* Controls the size of the homebrew heap when running as applet. */ /* Controls the size of the homebrew heap when running as applet. */