mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
ams:bpc: allow programatically setting reboot payload
This commit is contained in:
parent
3e6031b8f4
commit
85cd2c97a0
7 changed files with 16 additions and 15 deletions
|
@ -51,7 +51,7 @@ Result amsBpcRebootToFatalError(void *ctx) {
|
|||
}
|
||||
|
||||
|
||||
Result amsBpcSetInitialPayload(const void *src, size_t src_size) {
|
||||
Result amsBpcSetRebootPayload(const void *src, size_t src_size) {
|
||||
return serviceDispatch(&g_amsBpcSrv, 65001,
|
||||
.buffer_attrs = { SfBufferAttr_In | SfBufferAttr_HipcMapAlias },
|
||||
.buffers = { { src, src_size } },
|
||||
|
|
|
@ -28,7 +28,7 @@ void amsBpcExit(void);
|
|||
Service *amsBpcGetServiceSession(void);
|
||||
|
||||
Result amsBpcRebootToFatalError(void *ctx);
|
||||
Result amsBpcSetInitialPayload(const void *src, size_t src_size);
|
||||
Result amsBpcSetRebootPayload(const void *src, size_t src_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace ams {
|
|||
}
|
||||
|
||||
void SetInitialRebootPayload(const void *src, size_t src_size) {
|
||||
R_ABORT_UNLESS(amsBpcSetInitialPayload(src, src_size));
|
||||
R_ABORT_UNLESS(amsBpcSetRebootPayload(src, src_size));
|
||||
}
|
||||
|
||||
void WEAK_SYMBOL ExceptionHandler(FatalErrorContext *ctx) {
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace ams::mitm::bpc {
|
|||
DoRebootToPayload(ctx);
|
||||
}
|
||||
|
||||
void SetInitialRebootPayload(const void *payload, size_t payload_size) {
|
||||
void SetRebootPayload(const void *payload, size_t payload_size) {
|
||||
/* Clear payload buffer */
|
||||
std::memset(g_reboot_payload, 0xCC, sizeof(g_reboot_payload));
|
||||
|
||||
|
@ -107,9 +107,8 @@ namespace ams::mitm::bpc {
|
|||
/* Copy in payload. */
|
||||
std::memcpy(g_reboot_payload, payload, payload_size);
|
||||
|
||||
/* NOTE: Preferred reboot type will be parsed from settings later on. */
|
||||
/* NOTE: Preferred reboot type may be overrwritten when parsed from settings during boot. */
|
||||
g_reboot_type = RebootType::ToPayload;
|
||||
|
||||
}
|
||||
|
||||
Result LoadRebootPayload() {
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace ams::mitm::bpc {
|
|||
void ShutdownSystem();
|
||||
|
||||
/* Atmosphere power utilities. */
|
||||
void SetInitialRebootPayload(const void *payload, size_t payload_size);
|
||||
void SetRebootPayload(const void *payload, size_t payload_size);
|
||||
Result LoadRebootPayload();
|
||||
Result DetectPreferredRebootFunctionality();
|
||||
void RebootForFatalError(const ams::FatalErrorContext *ctx);
|
||||
|
|
|
@ -29,13 +29,15 @@ namespace ams::mitm::bpc {
|
|||
bpc::RebootForFatalError(&ctx);
|
||||
}
|
||||
|
||||
void AtmosphereService::SetInitialRebootPayload(const ams::sf::InBuffer &payload) {
|
||||
void AtmosphereService::SetRebootPayload(const ams::sf::InBuffer &payload) {
|
||||
/* Set the reboot payload. */
|
||||
bpc::SetRebootPayload(payload.GetPointer(), payload.GetSize());
|
||||
|
||||
/* If this is being called for the first time (by boot sysmodule), */
|
||||
/* Then we should kick off the rest of init. */
|
||||
if (!g_set_initial_payload) {
|
||||
g_set_initial_payload = true;
|
||||
|
||||
/* Set the initial reboot payload. */
|
||||
bpc::SetInitialRebootPayload(payload.GetPointer(), payload.GetSize());
|
||||
|
||||
/* Start the initialization process. */
|
||||
::ams::mitm::StartInitialize();
|
||||
}
|
||||
|
|
|
@ -22,16 +22,16 @@ namespace ams::mitm::bpc {
|
|||
class AtmosphereService final : public sf::IServiceObject {
|
||||
private:
|
||||
enum class CommandId {
|
||||
RebootToFatalError = 65000,
|
||||
SetInitialRebootPayload = 65001,
|
||||
RebootToFatalError = 65000,
|
||||
SetRebootPayload = 65001,
|
||||
};
|
||||
private:
|
||||
void RebootToFatalError(const ams::FatalErrorContext &ctx);
|
||||
void SetInitialRebootPayload(const ams::sf::InBuffer &payload);
|
||||
void SetRebootPayload(const ams::sf::InBuffer &payload);
|
||||
public:
|
||||
DEFINE_SERVICE_DISPATCH_TABLE {
|
||||
MAKE_SERVICE_COMMAND_META(RebootToFatalError),
|
||||
MAKE_SERVICE_COMMAND_META(SetInitialRebootPayload),
|
||||
MAKE_SERVICE_COMMAND_META(SetRebootPayload),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue