mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 12:21:18 +00:00
bpc.mitm: Make reboot type configurable
This commit is contained in:
parent
e2a7f23214
commit
67c7ef69f4
5 changed files with 42 additions and 8 deletions
|
@ -3,4 +3,9 @@
|
|||
upload_enabled = u8!0x0
|
||||
; Enable USB 3.0 superspeed for homebrew
|
||||
[usb]
|
||||
usb30_force_enabled = u8!0x1
|
||||
usb30_force_enabled = u8!0x1
|
||||
; Atmosphere custom settings
|
||||
[atmosphere]
|
||||
; Make the power menu's "reboot" button reboot to payload.
|
||||
; Set to "normal" for normal reboot, "rcm" for rcm reboot.
|
||||
power_menu_reboot_function = str!payload
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include "bpcmitm_reboot_manager.hpp"
|
||||
#include "../utils.hpp"
|
||||
|
||||
|
@ -43,7 +43,20 @@ void BpcRebootManager::Initialize() {
|
|||
|
||||
g_payload_loaded = true;
|
||||
|
||||
/* TODO: Figure out what kind of reboot we're gonna be doing. */
|
||||
/* Figure out what kind of reboot we're gonna be doing. */
|
||||
{
|
||||
char reboot_type[0x40] = {0};
|
||||
u64 reboot_type_size = 0;
|
||||
if (R_SUCCEEDED(Utils::GetSettingsItemValue("atmosphere", "power_menu_reboot_function", reboot_type, sizeof(reboot_type)-1, &reboot_type_size))) {
|
||||
if (strcasecmp(reboot_type, "stock") == 0 || strcasecmp(reboot_type, "normal") == 0 || strcasecmp(reboot_type, "standard") == 0) {
|
||||
g_reboot_type = BpcRebootType::Standard;
|
||||
} else if (strcasecmp(reboot_type, "rcm") == 0) {
|
||||
g_reboot_type = BpcRebootType::ToRcm;
|
||||
} else if (strcasecmp(reboot_type, "payload") == 0) {
|
||||
g_reboot_type = BpcRebootType::ToPayload;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ClearIram() {
|
||||
|
|
|
@ -40,10 +40,7 @@ using SetMitmManager = WaitableManager<SetSysManagerOptions>;
|
|||
void SetMitmMain(void *arg) {
|
||||
/* Wait for SD to initialize. */
|
||||
Utils::WaitSdInitialized();
|
||||
|
||||
/* Load settings */
|
||||
SettingsItemManager::LoadConfiguration();
|
||||
|
||||
|
||||
/* Create server manager */
|
||||
auto server_manager = new SetMitmManager(3);
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "ini.h"
|
||||
#include "sha256.h"
|
||||
|
||||
#include "set_mitm/setsys_settings_items.hpp"
|
||||
|
||||
static FsFileSystem g_sd_filesystem = {0};
|
||||
static HosSignal g_sd_signal;
|
||||
|
||||
|
@ -187,6 +189,11 @@ void Utils::InitializeThreadFunc(void *args) {
|
|||
|
||||
/* Signal SD is initialized. */
|
||||
g_has_initialized = true;
|
||||
|
||||
/* Load custom settings configuration. */
|
||||
SettingsItemManager::LoadConfiguration();
|
||||
|
||||
/* Signal to waiters that we are ready. */
|
||||
g_sd_signal.Signal();
|
||||
|
||||
/* Initialize HID. */
|
||||
|
@ -541,4 +548,12 @@ void Utils::RefreshConfiguration() {
|
|||
fsFileClose(&config_file);
|
||||
|
||||
ini_parse_string(g_config_ini_data, FsMitMIniHandler, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Result Utils::GetSettingsItemValueSize(const char *name, const char *key, u64 *out_size) {
|
||||
return SettingsItemManager::GetValueSize(name, key, out_size);
|
||||
}
|
||||
|
||||
Result Utils::GetSettingsItemValue(const char *name, const char *key, void *out, size_t max_size, u64 *out_size) {
|
||||
return SettingsItemManager::GetValue(name, key, out, max_size, out_size);
|
||||
}
|
||||
|
|
|
@ -73,6 +73,10 @@ class Utils {
|
|||
static bool IsHidAvailable();
|
||||
static Result GetKeysDown(u64 *keys);
|
||||
static bool HasOverrideButton(u64 tid);
|
||||
|
||||
/* Settings! */
|
||||
static Result GetSettingsItemValueSize(const char *name, const char *key, u64 *out_size);
|
||||
static Result GetSettingsItemValue(const char *name, const char *key, void *out, size_t max_size, u64 *out_size);
|
||||
private:
|
||||
static void RefreshConfiguration();
|
||||
};
|
Loading…
Reference in a new issue