mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-27 17:11:00 +01:00
stop overriding user config on update
This commit is contained in:
parent
8d9c51f204
commit
e1391d4162
5
Makefile
5
Makefile
@ -57,6 +57,7 @@ dist: all
|
||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000036
|
||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000037
|
||||
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-mtc/fusee-mtc.bin atmosphere-$(AMSVER)/atmosphere/fusee-mtc.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_01.enc atmosphere-$(AMSVER)/sept/sept-secondary_01.enc
|
||||
cp common/defaults/BCT.ini atmosphere-$(AMSVER)/atmosphere/BCT.ini
|
||||
cp common/defaults/loader.ini atmosphere-$(AMSVER)/atmosphere/loader.ini
|
||||
cp common/defaults/system_settings.ini atmosphere-$(AMSVER)/atmosphere/system_settings.ini
|
||||
cp common/defaults/override_config.ini atmosphere-$(AMSVER)/atmosphere/config_templates/override_config.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/hbl_html atmosphere-$(AMSVER)/atmosphere/hbl_html
|
||||
cp stratosphere/boot2/boot2.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000008/exefs.nsp
|
||||
|
@ -7,7 +7,7 @@ stage2_entrypoint = 0xF0000000
|
||||
|
||||
[exosphere]
|
||||
; Note: Disabling debugmode will cause parts of ams.tma to not work, in the future.
|
||||
debugmode = 1
|
||||
debugmode = 1
|
||||
debugmode_user = 0
|
||||
; Note: Disabling usermode exception handlers will cause atmosphere to not fail gracefully under error conditions.
|
||||
; Support will not be provided to users who disable these. If you do not know what you are doing, leave them on.
|
||||
|
@ -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
|
10
common/defaults/override_config.ini
Normal file
10
common/defaults/override_config.ini
Normal 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
|
@ -13,7 +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 "utils.h"
|
||||
#include "exception_handlers.h"
|
||||
#include "panic.h"
|
||||
@ -37,35 +37,40 @@ static char g_bct0_buffer[BCTO_MAX_SIZE];
|
||||
|
||||
#define CONFIG_LOG_LEVEL_KEY "log_level"
|
||||
|
||||
#define DEFAULT_BCT0_FOR_DEBUG \
|
||||
#define DEFAULT_BCT0 \
|
||||
"BCT0\n"\
|
||||
"[stage1]\n"\
|
||||
"stage2_path = atmosphere/fusee-secondary.bin\n"\
|
||||
"stage2_mtc_path = atmosphere/fusee-mtc.bin\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) {
|
||||
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, "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) {
|
||||
fatal_error("Unexpected magic in BCT.ini!\n");
|
||||
}
|
||||
|
||||
|
||||
/* Return pointer to first line of the ini. */
|
||||
const char *bct0 = g_bct0_buffer;
|
||||
while (*bct0 && *bct0 != '\n') {
|
||||
bct0++;
|
||||
}
|
||||
|
||||
|
||||
if (!bct0) {
|
||||
fatal_error("BCT.ini has no newline!\n");
|
||||
}
|
||||
|
||||
|
||||
return bct0;
|
||||
}
|
||||
|
||||
@ -87,7 +92,7 @@ static int config_ini_handler(void *user, const char *section, const char *name,
|
||||
|
||||
static void setup_display(void) {
|
||||
g_framebuffer = (void *)0xC0000000;
|
||||
|
||||
|
||||
/* Zero-fill the framebuffer and register it as printk provider. */
|
||||
video_init(g_framebuffer);
|
||||
|
||||
@ -105,7 +110,7 @@ static void setup_display(void) {
|
||||
static void cleanup_display(void) {
|
||||
/* Turn off the backlight. */
|
||||
display_backlight(false);
|
||||
|
||||
|
||||
/* Terminate the display. */
|
||||
display_end();
|
||||
}
|
||||
@ -116,7 +121,7 @@ static void setup_env(void) {
|
||||
|
||||
/* Set up the exception handlers. */
|
||||
setup_exception_handlers();
|
||||
|
||||
|
||||
/* Mount the SD card. */
|
||||
mount_sd();
|
||||
}
|
||||
@ -137,13 +142,13 @@ int main(void) {
|
||||
stage2_args_t *stage2_args;
|
||||
uint32_t stage2_version = 0;
|
||||
ScreenLogLevel log_level = SCREEN_LOG_LEVEL_NONE;
|
||||
|
||||
|
||||
/* Initialize the boot environment. */
|
||||
setup_env();
|
||||
|
||||
/* Check for panics. */
|
||||
check_and_display_panic();
|
||||
|
||||
|
||||
/* Load the BCT0 configuration ini off of the SD. */
|
||||
bct0 = load_config();
|
||||
|
||||
@ -151,19 +156,19 @@ int main(void) {
|
||||
if (ini_parse_string(bct0, config_ini_handler, &log_level) < 0) {
|
||||
fatal_error("Failed to parse BCT.ini!\n");
|
||||
}
|
||||
|
||||
|
||||
/* Override the global logging level. */
|
||||
log_set_log_level(log_level);
|
||||
|
||||
|
||||
if (log_level != SCREEN_LOG_LEVEL_NONE) {
|
||||
/* Initialize the display for debugging. */
|
||||
setup_display();
|
||||
}
|
||||
|
||||
|
||||
/* Say hello. */
|
||||
print(SCREEN_LOG_LEVEL_DEBUG | SCREEN_LOG_LEVEL_NO_PREFIX, "Welcome to Atmosph\xe8re Fus\xe9" "e!\n");
|
||||
print(SCREEN_LOG_LEVEL_DEBUG, "Using color linear framebuffer at 0x%p!\n", g_framebuffer);
|
||||
|
||||
|
||||
/* Load the loader payload into DRAM. */
|
||||
load_stage2(bct0);
|
||||
|
||||
@ -175,14 +180,14 @@ int main(void) {
|
||||
memcpy(&stage2_args->log_level, &log_level, sizeof(log_level));
|
||||
strcpy(stage2_args->bct0, bct0);
|
||||
g_chainloader_argc = 2;
|
||||
|
||||
|
||||
/* Terminate the boot environment. */
|
||||
cleanup_env();
|
||||
|
||||
|
||||
if (log_level != SCREEN_LOG_LEVEL_NONE) {
|
||||
/* Wait a while for debugging. */
|
||||
mdelay(1000);
|
||||
|
||||
|
||||
/* Terminate the display for debugging. */
|
||||
cleanup_display();
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ namespace ams::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. */
|
||||
if (strcasecmp(section, "hbl_config") == 0) {
|
||||
/* 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);
|
||||
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) {
|
||||
g_hbl_override_config.override_key = ParseOverrideKey(value);
|
||||
} else if (strcasecmp(name, "override_any_app") == 0) {
|
||||
@ -223,8 +229,8 @@ namespace ams::cfg {
|
||||
util::ini::ParseFile(&config_file, user_ctx, handler);
|
||||
}
|
||||
|
||||
void RefreshLoaderConfiguration() {
|
||||
ParseIniFile(LoaderIniHandler, "/atmosphere/loader.ini", nullptr);
|
||||
void RefreshOverrideConfiguration() {
|
||||
ParseIniFile(OverrideConfigIniHandler, "/atmosphere/override_config.ini", nullptr);
|
||||
}
|
||||
|
||||
ContentSpecificOverrideConfig GetContentOverrideConfig(ncm::ProgramId program_id) {
|
||||
@ -257,8 +263,8 @@ namespace ams::cfg {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Unconditionally refresh loader.ini contents. */
|
||||
RefreshLoaderConfiguration();
|
||||
/* Unconditionally refresh override_config.ini contents. */
|
||||
RefreshOverrideConfiguration();
|
||||
|
||||
/* If we can't read the key state, don't override anything. */
|
||||
if (R_FAILED(hid::GetKeysHeld(&status.keys_held))) {
|
||||
|
Loading…
Reference in New Issue
Block a user