mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-19 17:02:14 +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
|
upload_enabled = u8!0x0
|
||||||
; Enable USB 3.0 superspeed for homebrew
|
; Enable USB 3.0 superspeed for homebrew
|
||||||
[usb]
|
[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 <switch.h>
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
#include <string.h>
|
#include <strings.h>
|
||||||
#include "bpcmitm_reboot_manager.hpp"
|
#include "bpcmitm_reboot_manager.hpp"
|
||||||
#include "../utils.hpp"
|
#include "../utils.hpp"
|
||||||
|
|
||||||
|
@ -43,7 +43,20 @@ void BpcRebootManager::Initialize() {
|
||||||
|
|
||||||
g_payload_loaded = true;
|
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() {
|
static void ClearIram() {
|
||||||
|
|
|
@ -40,10 +40,7 @@ using SetMitmManager = WaitableManager<SetSysManagerOptions>;
|
||||||
void SetMitmMain(void *arg) {
|
void SetMitmMain(void *arg) {
|
||||||
/* Wait for SD to initialize. */
|
/* Wait for SD to initialize. */
|
||||||
Utils::WaitSdInitialized();
|
Utils::WaitSdInitialized();
|
||||||
|
|
||||||
/* Load settings */
|
|
||||||
SettingsItemManager::LoadConfiguration();
|
|
||||||
|
|
||||||
/* Create server manager */
|
/* Create server manager */
|
||||||
auto server_manager = new SetMitmManager(3);
|
auto server_manager = new SetMitmManager(3);
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include "ini.h"
|
#include "ini.h"
|
||||||
#include "sha256.h"
|
#include "sha256.h"
|
||||||
|
|
||||||
|
#include "set_mitm/setsys_settings_items.hpp"
|
||||||
|
|
||||||
static FsFileSystem g_sd_filesystem = {0};
|
static FsFileSystem g_sd_filesystem = {0};
|
||||||
static HosSignal g_sd_signal;
|
static HosSignal g_sd_signal;
|
||||||
|
|
||||||
|
@ -187,6 +189,11 @@ void Utils::InitializeThreadFunc(void *args) {
|
||||||
|
|
||||||
/* Signal SD is initialized. */
|
/* Signal SD is initialized. */
|
||||||
g_has_initialized = true;
|
g_has_initialized = true;
|
||||||
|
|
||||||
|
/* Load custom settings configuration. */
|
||||||
|
SettingsItemManager::LoadConfiguration();
|
||||||
|
|
||||||
|
/* Signal to waiters that we are ready. */
|
||||||
g_sd_signal.Signal();
|
g_sd_signal.Signal();
|
||||||
|
|
||||||
/* Initialize HID. */
|
/* Initialize HID. */
|
||||||
|
@ -541,4 +548,12 @@ void Utils::RefreshConfiguration() {
|
||||||
fsFileClose(&config_file);
|
fsFileClose(&config_file);
|
||||||
|
|
||||||
ini_parse_string(g_config_ini_data, FsMitMIniHandler, NULL);
|
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 bool IsHidAvailable();
|
||||||
static Result GetKeysDown(u64 *keys);
|
static Result GetKeysDown(u64 *keys);
|
||||||
static bool HasOverrideButton(u64 tid);
|
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:
|
private:
|
||||||
static void RefreshConfiguration();
|
static void RefreshConfiguration();
|
||||||
};
|
};
|
Loading…
Reference in a new issue