early-access version 2086

This commit is contained in:
pineappleEA
2021-09-26 23:58:49 +02:00
parent 3292ff67a9
commit 23e9c85afd
8 changed files with 45 additions and 3 deletions

View File

@@ -421,6 +421,7 @@ struct System::Impl {
bool is_async_gpu{};
ExecuteProgramCallback execute_program_callback;
ExitCallback exit_callback;
std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{};
std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_dynarmic{};
@@ -798,6 +799,18 @@ void System::ExecuteProgram(std::size_t program_index) {
}
}
void System::RegisterExitCallback(ExitCallback&& callback) {
impl->exit_callback = std::move(callback);
}
void System::Exit() {
if (impl->exit_callback) {
impl->exit_callback();
} else {
LOG_CRITICAL(Core, "exit_callback must be initialized by the frontend");
}
}
void System::ApplySettings() {
if (IsPoweredOn()) {
Renderer().RefreshBaseSettings();

View File

@@ -387,6 +387,18 @@ public:
*/
void ExecuteProgram(std::size_t program_index);
/// Type used for the frontend to designate a callback for System to exit the application.
using ExitCallback = std::function<void()>;
/**
* Registers a callback from the frontend for System to exit the application.
* @param callback Callback from the frontend to exit the application.
*/
void RegisterExitCallback(ExitCallback&& callback);
/// Instructs the frontend to exit the application.
void Exit();
/// Applies any changes to settings to this core instance.
void ApplySettings();

View File

@@ -329,10 +329,10 @@ ISelfController::~ISelfController() = default;
void ISelfController::Exit(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_AM, "called");
system.Shutdown();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
system.Exit();
}
void ISelfController::LockExit(Kernel::HLERequestContext& ctx) {