31 changed files with 424 additions and 508 deletions
-
2src/core/CMakeLists.txt
-
2src/core/hle/service/am/am_types.h
-
40src/core/hle/service/am/applet.cpp
-
36src/core/hle/service/am/applet.h
-
67src/core/hle/service/am/applet_data_broker.cpp
-
80src/core/hle/service/am/applet_data_broker.h
-
27src/core/hle/service/am/applet_manager.cpp
-
23src/core/hle/service/am/frontend/applet_cabinet.cpp
-
5src/core/hle/service/am/frontend/applet_cabinet.h
-
22src/core/hle/service/am/frontend/applet_controller.cpp
-
5src/core/hle/service/am/frontend/applet_controller.h
-
14src/core/hle/service/am/frontend/applet_error.cpp
-
6src/core/hle/service/am/frontend/applet_error.h
-
75src/core/hle/service/am/frontend/applet_general.cpp
-
15src/core/hle/service/am/frontend/applet_general.h
-
20src/core/hle/service/am/frontend/applet_mii_edit.cpp
-
5src/core/hle/service/am/frontend/applet_mii_edit.h
-
19src/core/hle/service/am/frontend/applet_profile_select.cpp
-
5src/core/hle/service/am/frontend/applet_profile_select.h
-
59src/core/hle/service/am/frontend/applet_software_keyboard.cpp
-
5src/core/hle/service/am/frontend/applet_software_keyboard.h
-
15src/core/hle/service/am/frontend/applet_web_browser.cpp
-
7src/core/hle/service/am/frontend/applet_web_browser.h
-
165src/core/hle/service/am/frontend/applets.cpp
-
89src/core/hle/service/am/frontend/applets.h
-
44src/core/hle/service/am/library_applet_accessor.cpp
-
10src/core/hle/service/am/library_applet_accessor.h
-
42src/core/hle/service/am/library_applet_creator.cpp
-
22src/core/hle/service/am/library_applet_self_accessor.cpp
-
4src/core/hle/service/am/library_applet_self_accessor.h
-
2src/core/hle/service/am/process_winding_controller.cpp
@ -0,0 +1,67 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|||
|
|||
#include "common/scope_exit.h"
|
|||
|
|||
#include "core/core.h"
|
|||
#include "core/hle/service/am/am_results.h"
|
|||
#include "core/hle/service/am/applet_data_broker.h"
|
|||
#include "core/hle/service/am/applet_manager.h"
|
|||
|
|||
namespace Service::AM { |
|||
|
|||
AppletStorageChannel::AppletStorageChannel(KernelHelpers::ServiceContext& context) |
|||
: m_event(context) {} |
|||
AppletStorageChannel::~AppletStorageChannel() = default; |
|||
|
|||
void AppletStorageChannel::Push(std::shared_ptr<IStorage> storage) { |
|||
std::scoped_lock lk{m_lock}; |
|||
|
|||
m_data.emplace_back(std::move(storage)); |
|||
m_event.Signal(); |
|||
} |
|||
|
|||
Result AppletStorageChannel::Pop(std::shared_ptr<IStorage>* out_storage) { |
|||
std::scoped_lock lk{m_lock}; |
|||
|
|||
SCOPE_EXIT({ |
|||
if (m_data.empty()) { |
|||
m_event.Clear(); |
|||
} |
|||
}); |
|||
|
|||
R_UNLESS(!m_data.empty(), AM::ResultNoDataInChannel); |
|||
|
|||
*out_storage = std::move(m_data.front()); |
|||
m_data.pop_front(); |
|||
|
|||
R_SUCCEED(); |
|||
} |
|||
|
|||
Kernel::KReadableEvent* AppletStorageChannel::GetEvent() { |
|||
return m_event.GetHandle(); |
|||
} |
|||
|
|||
AppletDataBroker::AppletDataBroker(Core::System& system_) |
|||
: system(system_), context(system_, "AppletDataBroker"), in_data(context), |
|||
interactive_in_data(context), out_data(context), interactive_out_data(context), |
|||
state_changed_event(context), is_completed(false) {} |
|||
|
|||
AppletDataBroker::~AppletDataBroker() = default; |
|||
|
|||
void AppletDataBroker::SignalCompletion() { |
|||
{ |
|||
std::scoped_lock lk{lock}; |
|||
|
|||
if (is_completed) { |
|||
return; |
|||
} |
|||
|
|||
is_completed = true; |
|||
state_changed_event.Signal(); |
|||
} |
|||
|
|||
system.GetAppletManager().FocusStateChanged(); |
|||
} |
|||
|
|||
} // namespace Service::AM
|
|||
@ -0,0 +1,80 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
#pragma once |
|||
|
|||
#include <deque> |
|||
#include <memory> |
|||
#include <mutex> |
|||
|
|||
#include "core/hle/service/event.h" |
|||
#include "core/hle/service/kernel_helpers.h" |
|||
|
|||
union Result; |
|||
|
|||
namespace Service::AM { |
|||
|
|||
struct Applet; |
|||
class IStorage; |
|||
|
|||
class AppletStorageChannel { |
|||
public: |
|||
explicit AppletStorageChannel(KernelHelpers::ServiceContext& ctx); |
|||
~AppletStorageChannel(); |
|||
|
|||
void Push(std::shared_ptr<IStorage> storage); |
|||
Result Pop(std::shared_ptr<IStorage>* out_storage); |
|||
Kernel::KReadableEvent* GetEvent(); |
|||
|
|||
private: |
|||
std::mutex m_lock{}; |
|||
std::deque<std::shared_ptr<IStorage>> m_data{}; |
|||
Event m_event; |
|||
}; |
|||
|
|||
class AppletDataBroker { |
|||
public: |
|||
explicit AppletDataBroker(Core::System& system_); |
|||
~AppletDataBroker(); |
|||
|
|||
AppletStorageChannel& GetInData() { |
|||
return in_data; |
|||
} |
|||
|
|||
AppletStorageChannel& GetInteractiveInData() { |
|||
return interactive_in_data; |
|||
} |
|||
|
|||
AppletStorageChannel& GetOutData() { |
|||
return out_data; |
|||
} |
|||
|
|||
AppletStorageChannel& GetInteractiveOutData() { |
|||
return interactive_out_data; |
|||
} |
|||
|
|||
Event& GetStateChangedEvent() { |
|||
return state_changed_event; |
|||
} |
|||
|
|||
bool IsCompleted() const { |
|||
return is_completed; |
|||
} |
|||
|
|||
void SignalCompletion(); |
|||
|
|||
private: |
|||
Core::System& system; |
|||
KernelHelpers::ServiceContext context; |
|||
|
|||
AppletStorageChannel in_data; |
|||
AppletStorageChannel interactive_in_data; |
|||
AppletStorageChannel out_data; |
|||
AppletStorageChannel interactive_out_data; |
|||
Event state_changed_event; |
|||
|
|||
std::mutex lock; |
|||
bool is_completed; |
|||
}; |
|||
|
|||
} // namespace Service::AM |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue