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

@@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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<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) {
@@ -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<HidMitmService>(MitmServiceName));