set.mitm: add setting for controlling DebugModeFlag for am

This commit is contained in:
Michael Scire 2020-12-14 15:56:04 -08:00
parent 4ff026224e
commit 1ca373cd71
4 changed files with 24 additions and 1 deletions

View file

@ -38,6 +38,10 @@
; Please note this setting may be removed in a ; Please note this setting may be removed in a
; future release of Atmosphere. ; future release of Atmosphere.
; enable_deprecated_hid_mitm = u8!0x0 ; enable_deprecated_hid_mitm = u8!0x0
; Controls whether am sees system settings "DebugModeFlag" as
; enabled or disabled.
; 0 = Disabled (not debug mode), 1 = Enabled (debug mode)
; enable_am_debug_mode = 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

@ -122,4 +122,16 @@ namespace ams::mitm::settings {
return ResultSuccess(); return ResultSuccess();
} }
Result SetSysMitmService::GetDebugModeFlag(sf::Out<bool> out) {
/* If we're not processing for am, just return the real flag value. */
R_UNLESS(this->client_info.program_id == ncm::SystemProgramId::Am, sm::mitm::ResultShouldForwardToSession());
/* Retrieve the user configuration. */
u8 en = 0;
settings::fwdbg::GetSettingsItemValue(std::addressof(en), sizeof(en), "atmosphere", "enable_am_debug_mode");
out.SetValue(en != 0);
return ResultSuccess();
}
} }

View file

@ -24,7 +24,8 @@ namespace ams::mitm::settings {
AMS_SF_METHOD_INFO(C, H, 3, Result, GetFirmwareVersion, (sf::Out<ams::settings::FirmwareVersion> out)) \ AMS_SF_METHOD_INFO(C, H, 3, Result, GetFirmwareVersion, (sf::Out<ams::settings::FirmwareVersion> out)) \
AMS_SF_METHOD_INFO(C, H, 4, Result, GetFirmwareVersion2, (sf::Out<ams::settings::FirmwareVersion> out)) \ AMS_SF_METHOD_INFO(C, H, 4, Result, GetFirmwareVersion2, (sf::Out<ams::settings::FirmwareVersion> out)) \
AMS_SF_METHOD_INFO(C, H, 37, Result, GetSettingsItemValueSize, (sf::Out<u64> out_size, const ams::settings::fwdbg::SettingsName &name, const ams::settings::fwdbg::SettingsItemKey &key)) \ AMS_SF_METHOD_INFO(C, H, 37, Result, GetSettingsItemValueSize, (sf::Out<u64> out_size, const ams::settings::fwdbg::SettingsName &name, const ams::settings::fwdbg::SettingsItemKey &key)) \
AMS_SF_METHOD_INFO(C, H, 38, Result, GetSettingsItemValue, (sf::Out<u64> out_size, const sf::OutBuffer &out, const ams::settings::fwdbg::SettingsName &name, const ams::settings::fwdbg::SettingsItemKey &key)) AMS_SF_METHOD_INFO(C, H, 38, Result, GetSettingsItemValue, (sf::Out<u64> out_size, const sf::OutBuffer &out, const ams::settings::fwdbg::SettingsName &name, const ams::settings::fwdbg::SettingsItemKey &key)) \
AMS_SF_METHOD_INFO(C, H, 62, Result, GetDebugModeFlag, (sf::Out<bool> out))
AMS_SF_DEFINE_MITM_INTERFACE(ISetSysMitmInterface, AMS_SETTINGS_SYSTEM_MITM_INTERFACE_INFO) AMS_SF_DEFINE_MITM_INTERFACE(ISetSysMitmInterface, AMS_SETTINGS_SYSTEM_MITM_INTERFACE_INFO)
@ -45,6 +46,7 @@ namespace ams::mitm::settings {
Result GetFirmwareVersion2(sf::Out<ams::settings::FirmwareVersion> out); Result GetFirmwareVersion2(sf::Out<ams::settings::FirmwareVersion> out);
Result GetSettingsItemValueSize(sf::Out<u64> out_size, const ams::settings::fwdbg::SettingsName &name, const ams::settings::fwdbg::SettingsItemKey &key); Result GetSettingsItemValueSize(sf::Out<u64> out_size, const ams::settings::fwdbg::SettingsName &name, const ams::settings::fwdbg::SettingsItemKey &key);
Result GetSettingsItemValue(sf::Out<u64> out_size, const sf::OutBuffer &out, const ams::settings::fwdbg::SettingsName &name, const ams::settings::fwdbg::SettingsItemKey &key); Result GetSettingsItemValue(sf::Out<u64> out_size, const sf::OutBuffer &out, const ams::settings::fwdbg::SettingsName &name, const ams::settings::fwdbg::SettingsItemKey &key);
Result GetDebugModeFlag(sf::Out<bool> out);
}; };
static_assert(IsISetSysMitmInterface<SetSysMitmService>); static_assert(IsISetSysMitmInterface<SetSysMitmService>);

View file

@ -351,6 +351,11 @@ namespace ams::settings::fwdbg {
/* Please note this setting may be removed in a future release of Atmosphere. */ /* Please note this setting may be removed in a future release of Atmosphere. */
R_ABORT_UNLESS(ParseSettingsItemValue("atmosphere", "enable_deprecated_hid_mitm", "u8!0x0")); R_ABORT_UNLESS(ParseSettingsItemValue("atmosphere", "enable_deprecated_hid_mitm", "u8!0x0"));
/* Controls whether am sees system settings "DebugModeFlag" as */
/* enabled or disabled. */
/* 0 = Disabled (not debug mode), 1 = Enabled (debug mode) */
R_ABORT_UNLESS(ParseSettingsItemValue("atmosphere", "enable_am_debug_mode", "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. */