stop overriding user config on update

This commit is contained in:
Michael Scire 2019-11-27 13:44:09 -08:00 committed by SciresM
parent 8d9c51f204
commit e1391d4162
6 changed files with 49 additions and 37 deletions

View file

@ -57,6 +57,7 @@ dist: all
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000036 mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000036
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000037 mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000037
mkdir -p atmosphere-$(AMSVER)/atmosphere/fatal_errors mkdir -p atmosphere-$(AMSVER)/atmosphere/fatal_errors
mkdir -p atmosphere-$(AMSVER)/atmosphere/config_templates
cp fusee/fusee-primary/fusee-primary.bin atmosphere-$(AMSVER)/atmosphere/reboot_payload.bin cp fusee/fusee-primary/fusee-primary.bin atmosphere-$(AMSVER)/atmosphere/reboot_payload.bin
cp fusee/fusee-mtc/fusee-mtc.bin atmosphere-$(AMSVER)/atmosphere/fusee-mtc.bin cp fusee/fusee-mtc/fusee-mtc.bin atmosphere-$(AMSVER)/atmosphere/fusee-mtc.bin
cp fusee/fusee-secondary/fusee-secondary.bin atmosphere-$(AMSVER)/atmosphere/fusee-secondary.bin cp fusee/fusee-secondary/fusee-secondary.bin atmosphere-$(AMSVER)/atmosphere/fusee-secondary.bin
@ -66,8 +67,8 @@ dist: all
cp sept/sept-secondary/sept-secondary_00.enc atmosphere-$(AMSVER)/sept/sept-secondary_00.enc cp sept/sept-secondary/sept-secondary_00.enc atmosphere-$(AMSVER)/sept/sept-secondary_00.enc
cp sept/sept-secondary/sept-secondary_01.enc atmosphere-$(AMSVER)/sept/sept-secondary_01.enc cp sept/sept-secondary/sept-secondary_01.enc atmosphere-$(AMSVER)/sept/sept-secondary_01.enc
cp common/defaults/BCT.ini atmosphere-$(AMSVER)/atmosphere/BCT.ini cp common/defaults/BCT.ini atmosphere-$(AMSVER)/atmosphere/BCT.ini
cp common/defaults/loader.ini atmosphere-$(AMSVER)/atmosphere/loader.ini cp common/defaults/override_config.ini atmosphere-$(AMSVER)/atmosphere/config_templates/override_config.ini
cp common/defaults/system_settings.ini atmosphere-$(AMSVER)/atmosphere/system_settings.ini cp common/defaults/system_settings.ini atmosphere-$(AMSVER)/atmosphere/config_templates/system_settings.ini
cp -r common/defaults/kip_patches atmosphere-$(AMSVER)/atmosphere/kip_patches cp -r common/defaults/kip_patches atmosphere-$(AMSVER)/atmosphere/kip_patches
cp -r common/defaults/hbl_html atmosphere-$(AMSVER)/atmosphere/hbl_html cp -r common/defaults/hbl_html atmosphere-$(AMSVER)/atmosphere/hbl_html
cp stratosphere/boot2/boot2.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000008/exefs.nsp cp stratosphere/boot2/boot2.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000008/exefs.nsp

View file

@ -1,10 +0,0 @@
[hbl_config]
title_id=010000000000100D
override_any_app=true
path=atmosphere/hbl.nsp
override_key=!R
override_any_app_key=R
[default_config]
override_key=!L
cheat_enable_key=!L

View file

@ -0,0 +1,10 @@
[hbl_config]
; title_id=010000000000100D
; override_any_app=true
; path=atmosphere/hbl.nsp
; override_key=!R
; override_any_app_key=R
[default_config]
; override_key=!L
; cheat_enable_key=!L

View file

@ -37,19 +37,24 @@ static char g_bct0_buffer[BCTO_MAX_SIZE];
#define CONFIG_LOG_LEVEL_KEY "log_level" #define CONFIG_LOG_LEVEL_KEY "log_level"
#define DEFAULT_BCT0_FOR_DEBUG \ #define DEFAULT_BCT0 \
"BCT0\n"\ "BCT0\n"\
"[stage1]\n"\ "[stage1]\n"\
"stage2_path = atmosphere/fusee-secondary.bin\n"\ "stage2_path = atmosphere/fusee-secondary.bin\n"\
"stage2_mtc_path = atmosphere/fusee-mtc.bin\n"\ "stage2_mtc_path = atmosphere/fusee-mtc.bin\n"\
"stage2_addr = 0xF0000000\n"\ "stage2_addr = 0xF0000000\n"\
"stage2_entrypoint = 0xF0000000\n" "stage2_entrypoint = 0xF0000000\n"\
"[exosphere]\n"\
"debugmode = 1\n"\
"debugmode_user = 0\n"\
"disable_user_exception_handlers = 0\n"\
"[stratosphere]\n"
static const char *load_config(void) { static const char *load_config(void) {
if (!read_from_file(g_bct0_buffer, BCTO_MAX_SIZE, "atmosphere/BCT.ini")) { if (!read_from_file(g_bct0_buffer, BCTO_MAX_SIZE, "atmosphere/BCT.ini")) {
print(SCREEN_LOG_LEVEL_DEBUG, "Failed to read BCT0 from SD!\n"); print(SCREEN_LOG_LEVEL_DEBUG, "Failed to read BCT0 from SD!\n");
print(SCREEN_LOG_LEVEL_DEBUG, "Using default BCT0!\n"); print(SCREEN_LOG_LEVEL_DEBUG, "Using default BCT0!\n");
memcpy(g_bct0_buffer, DEFAULT_BCT0_FOR_DEBUG, sizeof(DEFAULT_BCT0_FOR_DEBUG)); memcpy(g_bct0_buffer, DEFAULT_BCT0, sizeof(DEFAULT_BCT0));
} }
if (memcmp(g_bct0_buffer, "BCT0", 4) != 0) { if (memcmp(g_bct0_buffer, "BCT0", 4) != 0) {

View file

@ -117,7 +117,7 @@ namespace ams::cfg {
return cfg; return cfg;
} }
int LoaderIniHandler(void *user, const char *section, const char *name, const char *value) { int OverrideConfigIniHandler(void *user, const char *section, const char *name, const char *value) {
/* Taken and modified, with love, from Rajkosto's implementation. */ /* Taken and modified, with love, from Rajkosto's implementation. */
if (strcasecmp(section, "hbl_config") == 0) { if (strcasecmp(section, "hbl_config") == 0) {
/* TODO: Consider deprecating "title_id" string in the future." */ /* TODO: Consider deprecating "title_id" string in the future." */
@ -132,6 +132,12 @@ namespace ams::cfg {
} }
std::snprintf(g_hbl_sd_path, sizeof(g_hbl_sd_path) - 1, "/%s", value); std::snprintf(g_hbl_sd_path, sizeof(g_hbl_sd_path) - 1, "/%s", value);
g_hbl_sd_path[sizeof(g_hbl_sd_path) - 1] = '\0'; g_hbl_sd_path[sizeof(g_hbl_sd_path) - 1] = '\0';
for (size_t i = 0; i < sizeof(g_hbl_sd_path); i++) {
if (g_hbl_sd_path[i] == '\\') {
g_hbl_sd_path[i] = '/';
}
}
} else if (strcasecmp(name, "override_key") == 0) { } else if (strcasecmp(name, "override_key") == 0) {
g_hbl_override_config.override_key = ParseOverrideKey(value); g_hbl_override_config.override_key = ParseOverrideKey(value);
} else if (strcasecmp(name, "override_any_app") == 0) { } else if (strcasecmp(name, "override_any_app") == 0) {
@ -223,8 +229,8 @@ namespace ams::cfg {
util::ini::ParseFile(&config_file, user_ctx, handler); util::ini::ParseFile(&config_file, user_ctx, handler);
} }
void RefreshLoaderConfiguration() { void RefreshOverrideConfiguration() {
ParseIniFile(LoaderIniHandler, "/atmosphere/loader.ini", nullptr); ParseIniFile(OverrideConfigIniHandler, "/atmosphere/override_config.ini", nullptr);
} }
ContentSpecificOverrideConfig GetContentOverrideConfig(ncm::ProgramId program_id) { ContentSpecificOverrideConfig GetContentOverrideConfig(ncm::ProgramId program_id) {
@ -257,8 +263,8 @@ namespace ams::cfg {
return status; return status;
} }
/* Unconditionally refresh loader.ini contents. */ /* Unconditionally refresh override_config.ini contents. */
RefreshLoaderConfiguration(); RefreshOverrideConfiguration();
/* If we can't read the key state, don't override anything. */ /* If we can't read the key state, don't override anything. */
if (R_FAILED(hid::GetKeysHeld(&status.keys_held))) { if (R_FAILED(hid::GetKeysHeld(&status.keys_held))) {