mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-29 09:58:05 +00:00
54cd5fb8eb
- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- - Dynamic shader cache reloading capability for qlaunch - Multi-process improvements (thanks to @frank1734), instead of just using the main application we now respect caller process (also did it for HID devices while I was at it) - Layer stack masks & shared buffer screenshot for video core, added different masks (screenshot, recording, etc.) this was discovered as an issue due to how in qlaunch the transition was not right between applications. May not be perfect but also fixes screenshots while using qlaunch - Reworked overlay display management (input and visibility) - instead of random numbers as I've previously did, I decided to add an AppletZIndex enum for better readability. Also split capability of input by touch and gamepad. - etc. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4238 Reviewed-by: Samuel <lizzie@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
83 lines
3.1 KiB
C++
83 lines
3.1 KiB
C++
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator
|
|
// Project// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "core/core.h"
|
|
#include "core/hle/service/am/applet.h"
|
|
#include "core/hle/service/am/applet_manager.h"
|
|
|
|
namespace Service::AM {
|
|
|
|
Applet::Applet(Core::System& system, std::unique_ptr<Process> process_, bool is_application)
|
|
: context(system, "Applet"), lifecycle_manager(system, context, is_application),
|
|
process(std::move(process_)), hid_registration(system, *process), overlay_event(context),
|
|
gpu_error_detected_event(context), friend_invitation_storage_channel_event(context),
|
|
notification_storage_channel_event(context), health_warning_disappeared_system_event(context),
|
|
unknown_event(context), acquired_sleep_lock_event(context), pop_from_general_channel_event(context),
|
|
library_applet_launchable_event(context), accumulated_suspended_tick_changed_event(context),
|
|
sleep_lock_event(context), state_changed_event(context) {
|
|
|
|
aruid.pid = process->GetProcessId();
|
|
program_id = process->GetProgramId();
|
|
}
|
|
|
|
Applet::~Applet() = default;
|
|
|
|
void Applet::UpdateSuspensionStateLocked(bool force_message) {
|
|
// Remove any forced resumption.
|
|
lifecycle_manager.RemoveForceResumeIfPossible();
|
|
|
|
const bool update_requested_focus_state = lifecycle_manager.UpdateRequestedFocusState();
|
|
const bool curr_activity_runnable = lifecycle_manager.IsRunnable();
|
|
const bool prev_activity_runnable = is_activity_runnable;
|
|
const bool was_changed = curr_activity_runnable != prev_activity_runnable;
|
|
|
|
if (was_changed) {
|
|
if (curr_activity_runnable) {
|
|
process->Suspend(false);
|
|
} else {
|
|
process->Suspend(true);
|
|
lifecycle_manager.RequestResumeNotification();
|
|
}
|
|
|
|
is_activity_runnable = curr_activity_runnable;
|
|
}
|
|
|
|
if (lifecycle_manager.GetForcedSuspend()) {
|
|
// TODO: why is this allowed?
|
|
return;
|
|
}
|
|
|
|
// Signal if the focus state was changed or the process state was changed.
|
|
if (update_requested_focus_state || was_changed || force_message) {
|
|
lifecycle_manager.SignalSystemEventIfNeeded(context.kernel);
|
|
}
|
|
}
|
|
|
|
void Applet::SetInteractibleLocked(bool pad_interactible, bool touch_interactible) {
|
|
if (is_pad_interactible == pad_interactible && is_touch_interactible == touch_interactible) {
|
|
return;
|
|
}
|
|
|
|
is_pad_interactible = pad_interactible;
|
|
is_touch_interactible = touch_interactible;
|
|
|
|
const bool exit_requested = lifecycle_manager.GetExitRequested();
|
|
const bool pad_enabled = pad_interactible && !exit_requested;
|
|
const bool touch_enabled = touch_interactible && !exit_requested;
|
|
|
|
LOG_DEBUG(Service_AM, "applet={} pad={} touch={} exit_requested={}",
|
|
static_cast<u32>(applet_id), pad_enabled, touch_enabled, exit_requested);
|
|
|
|
hid_registration.EnableAppletToGetInput(pad_enabled, touch_enabled);
|
|
}
|
|
|
|
void Applet::OnProcessTerminatedLocked() {
|
|
is_completed = true;
|
|
state_changed_event.Signal(context.kernel);
|
|
}
|
|
|
|
} // namespace Service::AM
|