mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-26 05:42:17 +00:00
hbl: support different keys for any-app vs specific
This also makes the default configuration: To override a generic app, hold R. To override album, do not hold R.
This commit is contained in:
parent
421324b498
commit
5484740cab
2 changed files with 21 additions and 3 deletions
|
@ -2,7 +2,8 @@
|
|||
title_id=010000000000100D
|
||||
override_any_app=true
|
||||
path=atmosphere/hbl.nsp
|
||||
override_key=R
|
||||
override_key=!R
|
||||
override_any_app_key=R
|
||||
|
||||
[default_config]
|
||||
override_key=!L
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace ams::cfg {
|
|||
|
||||
struct HblOverrideConfig {
|
||||
OverrideKey override_key;
|
||||
OverrideKey override_any_app_key;
|
||||
ncm::ProgramId program_id;
|
||||
bool override_any_app;
|
||||
};
|
||||
|
@ -50,6 +51,10 @@ namespace ams::cfg {
|
|||
|
||||
HblOverrideConfig g_hbl_override_config = {
|
||||
.override_key = {
|
||||
.key_combination = KEY_R,
|
||||
.override_by_default = true,
|
||||
},
|
||||
.override_any_app_key = {
|
||||
.key_combination = KEY_R,
|
||||
.override_by_default = false,
|
||||
},
|
||||
|
@ -136,6 +141,8 @@ namespace ams::cfg {
|
|||
} else {
|
||||
/* I guess we default to not changing the value? */
|
||||
}
|
||||
} else if (strcasecmp(name, "override_any_app_key") == 0) {
|
||||
g_hbl_override_config.override_any_app_key = ParseOverrideKey(value);
|
||||
}
|
||||
} else if (strcasecmp(section, "default_config") == 0) {
|
||||
if (strcasecmp(name, "override_key") == 0) {
|
||||
|
@ -169,6 +176,14 @@ namespace ams::cfg {
|
|||
return (cfg.override_by_default ^ keys_triggered);
|
||||
}
|
||||
|
||||
inline bool IsApplicationHblProgramId(ncm::ProgramId program_id) {
|
||||
return g_hbl_override_config.override_any_app && ncm::IsApplicationProgramId(program_id);
|
||||
}
|
||||
|
||||
inline bool IsSpecificHblProgramId(ncm::ProgramId program_id) {
|
||||
return program_id == g_hbl_override_config.program_id;
|
||||
}
|
||||
|
||||
void ParseIniFile(util::ini::Handler handler, const char *path, void *user_ctx) {
|
||||
/* Mount the SD card. */
|
||||
FsFileSystem sd_fs = {};
|
||||
|
@ -229,7 +244,9 @@ namespace ams::cfg {
|
|||
}
|
||||
|
||||
/* Detect Hbl. */
|
||||
if (IsHblProgramId(program_id) && IsOverrideMatch(status, g_hbl_override_config.override_key)) {
|
||||
if ((IsApplicationHblProgramId(program_id) && IsOverrideMatch(status, g_hbl_override_config.override_any_app_key)) ||
|
||||
(IsSpecificHblProgramId(program_id) && IsOverrideMatch(status, g_hbl_override_config.override_key)))
|
||||
{
|
||||
status.SetHbl();
|
||||
}
|
||||
|
||||
|
@ -249,7 +266,7 @@ namespace ams::cfg {
|
|||
|
||||
/* HBL Configuration utilities. */
|
||||
bool IsHblProgramId(ncm::ProgramId program_id) {
|
||||
return (g_hbl_override_config.override_any_app && ncm::IsApplicationProgramId(program_id)) || (program_id == g_hbl_override_config.program_id);
|
||||
return IsApplicationHblProgramId(program_id) || IsSpecificHblProgramId(program_id);
|
||||
}
|
||||
|
||||
const char *GetHblPath() {
|
||||
|
|
Loading…
Reference in a new issue