forked from etc/pineapple-src
early-access version 3027
This commit is contained in:
parent
b7ceb92a69
commit
0ccd766efb
36 changed files with 153 additions and 160 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 3024.
|
This is the source code for early-access 3027.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ System::~System() {
|
||||||
void System::Finalize() {
|
void System::Finalize() {
|
||||||
Stop();
|
Stop();
|
||||||
session->Finalize();
|
session->Finalize();
|
||||||
buffer_event->GetWritableEvent().Signal();
|
buffer_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::StartSession() {
|
void System::StartSession() {
|
||||||
|
@ -142,7 +142,7 @@ void System::ReleaseBuffers() {
|
||||||
|
|
||||||
if (signal) {
|
if (signal) {
|
||||||
// Signal if any buffer was released, or if none are registered, we need more.
|
// Signal if any buffer was released, or if none are registered, we need more.
|
||||||
buffer_event->GetWritableEvent().Signal();
|
buffer_event->Signal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ bool System::FlushAudioInBuffers() {
|
||||||
buffers.FlushBuffers(buffers_released);
|
buffers.FlushBuffers(buffers_released);
|
||||||
|
|
||||||
if (buffers_released > 0) {
|
if (buffers_released > 0) {
|
||||||
buffer_event->GetWritableEvent().Signal();
|
buffer_event->Signal();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ System::~System() {
|
||||||
void System::Finalize() {
|
void System::Finalize() {
|
||||||
Stop();
|
Stop();
|
||||||
session->Finalize();
|
session->Finalize();
|
||||||
buffer_event->GetWritableEvent().Signal();
|
buffer_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view System::GetDefaultOutputDeviceName() const {
|
std::string_view System::GetDefaultOutputDeviceName() const {
|
||||||
|
@ -141,7 +141,7 @@ void System::ReleaseBuffers() {
|
||||||
bool signal{buffers.ReleaseBuffers(system.CoreTiming(), *session)};
|
bool signal{buffers.ReleaseBuffers(system.CoreTiming(), *session)};
|
||||||
if (signal) {
|
if (signal) {
|
||||||
// Signal if any buffer was released, or if none are registered, we need more.
|
// Signal if any buffer was released, or if none are registered, we need more.
|
||||||
buffer_event->GetWritableEvent().Signal();
|
buffer_event->Signal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ bool System::FlushAudioOutBuffers() {
|
||||||
buffers.FlushBuffers(buffers_released);
|
buffers.FlushBuffers(buffers_released);
|
||||||
|
|
||||||
if (buffers_released > 0) {
|
if (buffers_released > 0) {
|
||||||
buffer_event->GetWritableEvent().Signal();
|
buffer_event->Signal();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,7 +534,7 @@ Result System::Update(std::span<const u8> input, std::span<u8> performance, std:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
adsp_rendered_event->GetWritableEvent().Clear();
|
adsp_rendered_event->Clear();
|
||||||
num_times_updated++;
|
num_times_updated++;
|
||||||
|
|
||||||
const auto end_time{core.CoreTiming().GetClockTicks()};
|
const auto end_time{core.CoreTiming().GetClockTicks()};
|
||||||
|
@ -625,7 +625,7 @@ void System::SendCommandToDsp() {
|
||||||
reset_command_buffers = false;
|
reset_command_buffers = false;
|
||||||
command_buffer_size = command_size;
|
command_buffer_size = command_size;
|
||||||
if (remaining_command_count == 0) {
|
if (remaining_command_count == 0) {
|
||||||
adsp_rendered_event->GetWritableEvent().Signal();
|
adsp_rendered_event->Signal();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
adsp.ClearRemainCount(session_id);
|
adsp.ClearRemainCount(session_id);
|
||||||
|
|
|
@ -261,8 +261,6 @@ add_library(core STATIC
|
||||||
hle/kernel/k_worker_task.h
|
hle/kernel/k_worker_task.h
|
||||||
hle/kernel/k_worker_task_manager.cpp
|
hle/kernel/k_worker_task_manager.cpp
|
||||||
hle/kernel/k_worker_task_manager.h
|
hle/kernel/k_worker_task_manager.h
|
||||||
hle/kernel/k_writable_event.cpp
|
|
||||||
hle/kernel/k_writable_event.h
|
|
||||||
hle/kernel/kernel.cpp
|
hle/kernel/kernel.cpp
|
||||||
hle/kernel/kernel.h
|
hle/kernel/kernel.h
|
||||||
hle/kernel/memory_types.h
|
hle/kernel/memory_types.h
|
||||||
|
|
|
@ -43,13 +43,13 @@ class Domain;
|
||||||
class HLERequestContext;
|
class HLERequestContext;
|
||||||
class KAutoObject;
|
class KAutoObject;
|
||||||
class KernelCore;
|
class KernelCore;
|
||||||
|
class KEvent;
|
||||||
class KHandleTable;
|
class KHandleTable;
|
||||||
class KProcess;
|
class KProcess;
|
||||||
class KServerSession;
|
class KServerSession;
|
||||||
class KThread;
|
class KThread;
|
||||||
class KReadableEvent;
|
class KReadableEvent;
|
||||||
class KSession;
|
class KSession;
|
||||||
class KWritableEvent;
|
|
||||||
class ServiceThread;
|
class ServiceThread;
|
||||||
|
|
||||||
enum class ThreadWakeupReason;
|
enum class ThreadWakeupReason;
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "core/hle/kernel/k_synchronization_object.h"
|
#include "core/hle/kernel/k_synchronization_object.h"
|
||||||
#include "core/hle/kernel/k_thread.h"
|
#include "core/hle/kernel/k_thread.h"
|
||||||
#include "core/hle/kernel/k_transfer_memory.h"
|
#include "core/hle/kernel/k_transfer_memory.h"
|
||||||
#include "core/hle/kernel/k_writable_event.h"
|
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
@ -42,13 +41,12 @@ static_assert(ClassToken<KPort> == 0b10000101'00000000);
|
||||||
static_assert(ClassToken<KSession> == 0b00011001'00000000);
|
static_assert(ClassToken<KSession> == 0b00011001'00000000);
|
||||||
static_assert(ClassToken<KSharedMemory> == 0b00101001'00000000);
|
static_assert(ClassToken<KSharedMemory> == 0b00101001'00000000);
|
||||||
static_assert(ClassToken<KEvent> == 0b01001001'00000000);
|
static_assert(ClassToken<KEvent> == 0b01001001'00000000);
|
||||||
static_assert(ClassToken<KWritableEvent> == 0b10001001'00000000);
|
|
||||||
// static_assert(ClassToken<KLightClientSession> == 0b00110001'00000000);
|
// static_assert(ClassToken<KLightClientSession> == 0b00110001'00000000);
|
||||||
// static_assert(ClassToken<KLightServerSession> == 0b01010001'00000000);
|
// static_assert(ClassToken<KLightServerSession> == 0b01010001'00000000);
|
||||||
static_assert(ClassToken<KTransferMemory> == 0b10010001'00000000);
|
static_assert(ClassToken<KTransferMemory> == 0b01010001'00000000);
|
||||||
// static_assert(ClassToken<KDeviceAddressSpace> == 0b01100001'00000000);
|
// static_assert(ClassToken<KDeviceAddressSpace> == 0b01100001'00000000);
|
||||||
// static_assert(ClassToken<KSessionRequest> == 0b10100001'00000000);
|
// static_assert(ClassToken<KSessionRequest> == 0b10100001'00000000);
|
||||||
static_assert(ClassToken<KCodeMemory> == 0b11000001'00000000);
|
static_assert(ClassToken<KCodeMemory> == 0b10100001'00000000);
|
||||||
|
|
||||||
// Ensure that the token hierarchy is correct.
|
// Ensure that the token hierarchy is correct.
|
||||||
|
|
||||||
|
@ -73,13 +71,12 @@ static_assert(ClassToken<KPort> == ((0b10000101 << 8) | ClassToken<KAutoObject>)
|
||||||
static_assert(ClassToken<KSession> == ((0b00011001 << 8) | ClassToken<KAutoObject>));
|
static_assert(ClassToken<KSession> == ((0b00011001 << 8) | ClassToken<KAutoObject>));
|
||||||
static_assert(ClassToken<KSharedMemory> == ((0b00101001 << 8) | ClassToken<KAutoObject>));
|
static_assert(ClassToken<KSharedMemory> == ((0b00101001 << 8) | ClassToken<KAutoObject>));
|
||||||
static_assert(ClassToken<KEvent> == ((0b01001001 << 8) | ClassToken<KAutoObject>));
|
static_assert(ClassToken<KEvent> == ((0b01001001 << 8) | ClassToken<KAutoObject>));
|
||||||
static_assert(ClassToken<KWritableEvent> == ((0b10001001 << 8) | ClassToken<KAutoObject>));
|
|
||||||
// static_assert(ClassToken<KLightClientSession> == ((0b00110001 << 8) | ClassToken<KAutoObject>));
|
// static_assert(ClassToken<KLightClientSession> == ((0b00110001 << 8) | ClassToken<KAutoObject>));
|
||||||
// static_assert(ClassToken<KLightServerSession> == ((0b01010001 << 8) | ClassToken<KAutoObject>));
|
// static_assert(ClassToken<KLightServerSession> == ((0b01010001 << 8) | ClassToken<KAutoObject>));
|
||||||
static_assert(ClassToken<KTransferMemory> == ((0b10010001 << 8) | ClassToken<KAutoObject>));
|
static_assert(ClassToken<KTransferMemory> == ((0b01010001 << 8) | ClassToken<KAutoObject>));
|
||||||
// static_assert(ClassToken<KDeviceAddressSpace> == ((0b01100001 << 8) | ClassToken<KAutoObject>));
|
// static_assert(ClassToken<KDeviceAddressSpace> == ((0b01100001 << 8) | ClassToken<KAutoObject>));
|
||||||
// static_assert(ClassToken<KSessionRequest> == ((0b10100001 << 8) | ClassToken<KAutoObject>));
|
// static_assert(ClassToken<KSessionRequest> == ((0b10100001 << 8) | ClassToken<KAutoObject>));
|
||||||
static_assert(ClassToken<KCodeMemory> == ((0b11000001 << 8) | ClassToken<KAutoObject>));
|
static_assert(ClassToken<KCodeMemory> == ((0b10100001 << 8) | ClassToken<KAutoObject>));
|
||||||
|
|
||||||
// Ensure that the token hierarchy reflects the class hierarchy.
|
// Ensure that the token hierarchy reflects the class hierarchy.
|
||||||
|
|
||||||
|
@ -110,7 +107,6 @@ static_assert(std::is_final_v<KPort> && std::is_base_of_v<KAutoObject, KPort>);
|
||||||
static_assert(std::is_final_v<KSession> && std::is_base_of_v<KAutoObject, KSession>);
|
static_assert(std::is_final_v<KSession> && std::is_base_of_v<KAutoObject, KSession>);
|
||||||
static_assert(std::is_final_v<KSharedMemory> && std::is_base_of_v<KAutoObject, KSharedMemory>);
|
static_assert(std::is_final_v<KSharedMemory> && std::is_base_of_v<KAutoObject, KSharedMemory>);
|
||||||
static_assert(std::is_final_v<KEvent> && std::is_base_of_v<KAutoObject, KEvent>);
|
static_assert(std::is_final_v<KEvent> && std::is_base_of_v<KAutoObject, KEvent>);
|
||||||
static_assert(std::is_final_v<KWritableEvent> && std::is_base_of_v<KAutoObject, KWritableEvent>);
|
|
||||||
// static_assert(std::is_final_v<KLightClientSession> &&
|
// static_assert(std::is_final_v<KLightClientSession> &&
|
||||||
// std::is_base_of_v<KAutoObject, KLightClientSession>);
|
// std::is_base_of_v<KAutoObject, KLightClientSession>);
|
||||||
// static_assert(std::is_final_v<KLightServerSession> &&
|
// static_assert(std::is_final_v<KLightServerSession> &&
|
||||||
|
|
|
@ -101,7 +101,6 @@ public:
|
||||||
KSession,
|
KSession,
|
||||||
KSharedMemory,
|
KSharedMemory,
|
||||||
KEvent,
|
KEvent,
|
||||||
KWritableEvent,
|
|
||||||
KLightClientSession,
|
KLightClientSession,
|
||||||
KLightServerSession,
|
KLightServerSession,
|
||||||
KTransferMemory,
|
KTransferMemory,
|
||||||
|
|
|
@ -8,39 +8,45 @@
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
KEvent::KEvent(KernelCore& kernel_)
|
KEvent::KEvent(KernelCore& kernel_)
|
||||||
: KAutoObjectWithSlabHeapAndContainer{kernel_}, readable_event{kernel_}, writable_event{
|
: KAutoObjectWithSlabHeapAndContainer{kernel_}, m_readable_event{kernel_} {}
|
||||||
kernel_} {}
|
|
||||||
|
|
||||||
KEvent::~KEvent() = default;
|
KEvent::~KEvent() = default;
|
||||||
|
|
||||||
void KEvent::Initialize(std::string&& name_, KProcess* owner_) {
|
void KEvent::Initialize(KProcess* owner) {
|
||||||
// Increment reference count.
|
// Create our readable event.
|
||||||
// Because reference count is one on creation, this will result
|
KAutoObject::Create(std::addressof(m_readable_event));
|
||||||
// in a reference count of two. Thus, when both readable and
|
|
||||||
// writable events are closed this object will be destroyed.
|
|
||||||
Open();
|
|
||||||
|
|
||||||
// Create our sub events.
|
// Initialize our readable event.
|
||||||
KAutoObject::Create(std::addressof(readable_event));
|
m_readable_event.Initialize(this);
|
||||||
KAutoObject::Create(std::addressof(writable_event));
|
|
||||||
|
|
||||||
// Initialize our sub sessions.
|
|
||||||
readable_event.Initialize(this, name_ + ":Readable");
|
|
||||||
writable_event.Initialize(this, name_ + ":Writable");
|
|
||||||
|
|
||||||
// Set our owner process.
|
// Set our owner process.
|
||||||
owner = owner_;
|
m_owner = owner;
|
||||||
owner->Open();
|
m_owner->Open();
|
||||||
|
|
||||||
// Mark initialized.
|
// Mark initialized.
|
||||||
name = std::move(name_);
|
m_initialized = true;
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KEvent::Finalize() {
|
void KEvent::Finalize() {
|
||||||
KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObjectWithList>::Finalize();
|
KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObjectWithList>::Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result KEvent::Signal() {
|
||||||
|
KScopedSchedulerLock sl{kernel};
|
||||||
|
|
||||||
|
R_SUCCEED_IF(m_readable_event_destroyed);
|
||||||
|
|
||||||
|
return m_readable_event.Signal();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result KEvent::Clear() {
|
||||||
|
KScopedSchedulerLock sl{kernel};
|
||||||
|
|
||||||
|
R_SUCCEED_IF(m_readable_event_destroyed);
|
||||||
|
|
||||||
|
return m_readable_event.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
void KEvent::PostDestroy(uintptr_t arg) {
|
void KEvent::PostDestroy(uintptr_t arg) {
|
||||||
// Release the event count resource the owner process holds.
|
// Release the event count resource the owner process holds.
|
||||||
KProcess* owner = reinterpret_cast<KProcess*>(arg);
|
KProcess* owner = reinterpret_cast<KProcess*>(arg);
|
||||||
|
|
|
@ -4,14 +4,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/hle/kernel/k_readable_event.h"
|
#include "core/hle/kernel/k_readable_event.h"
|
||||||
#include "core/hle/kernel/k_writable_event.h"
|
|
||||||
#include "core/hle/kernel/slab_helpers.h"
|
#include "core/hle/kernel/slab_helpers.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
class KernelCore;
|
class KernelCore;
|
||||||
class KReadableEvent;
|
class KReadableEvent;
|
||||||
class KWritableEvent;
|
|
||||||
class KProcess;
|
class KProcess;
|
||||||
|
|
||||||
class KEvent final : public KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObjectWithList> {
|
class KEvent final : public KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObjectWithList> {
|
||||||
|
@ -21,37 +19,40 @@ public:
|
||||||
explicit KEvent(KernelCore& kernel_);
|
explicit KEvent(KernelCore& kernel_);
|
||||||
~KEvent() override;
|
~KEvent() override;
|
||||||
|
|
||||||
void Initialize(std::string&& name, KProcess* owner_);
|
void Initialize(KProcess* owner);
|
||||||
|
|
||||||
void Finalize() override;
|
void Finalize() override;
|
||||||
|
|
||||||
bool IsInitialized() const override {
|
bool IsInitialized() const override {
|
||||||
return initialized;
|
return m_initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t GetPostDestroyArgument() const override {
|
uintptr_t GetPostDestroyArgument() const override {
|
||||||
return reinterpret_cast<uintptr_t>(owner);
|
return reinterpret_cast<uintptr_t>(m_owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
KProcess* GetOwner() const override {
|
KProcess* GetOwner() const override {
|
||||||
return owner;
|
return m_owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
KReadableEvent& GetReadableEvent() {
|
KReadableEvent& GetReadableEvent() {
|
||||||
return readable_event;
|
return m_readable_event;
|
||||||
}
|
|
||||||
|
|
||||||
KWritableEvent& GetWritableEvent() {
|
|
||||||
return writable_event;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PostDestroy(uintptr_t arg);
|
static void PostDestroy(uintptr_t arg);
|
||||||
|
|
||||||
|
Result Signal();
|
||||||
|
Result Clear();
|
||||||
|
|
||||||
|
void OnReadableEventDestroyed() {
|
||||||
|
m_readable_event_destroyed = true;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KReadableEvent readable_event;
|
KReadableEvent m_readable_event;
|
||||||
KWritableEvent writable_event;
|
KProcess* m_owner{};
|
||||||
KProcess* owner{};
|
bool m_initialized{};
|
||||||
bool initialized{};
|
bool m_readable_event_destroyed{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
|
@ -15,31 +15,44 @@ KReadableEvent::KReadableEvent(KernelCore& kernel_) : KSynchronizationObject{ker
|
||||||
|
|
||||||
KReadableEvent::~KReadableEvent() = default;
|
KReadableEvent::~KReadableEvent() = default;
|
||||||
|
|
||||||
bool KReadableEvent::IsSignaled() const {
|
void KReadableEvent::Initialize(KEvent* parent) {
|
||||||
ASSERT(kernel.GlobalSchedulerContext().IsLocked());
|
m_is_signaled = false;
|
||||||
|
m_parent = parent;
|
||||||
|
|
||||||
return is_signaled;
|
if (m_parent != nullptr) {
|
||||||
|
m_parent->Open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KReadableEvent::IsSignaled() const {
|
||||||
|
ASSERT(KScheduler::IsSchedulerLockedByCurrentThread(kernel));
|
||||||
|
|
||||||
|
return m_is_signaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KReadableEvent::Destroy() {
|
void KReadableEvent::Destroy() {
|
||||||
if (parent) {
|
if (m_parent) {
|
||||||
parent->Close();
|
{
|
||||||
|
KScopedSchedulerLock sl{kernel};
|
||||||
|
m_parent->OnReadableEventDestroyed();
|
||||||
|
}
|
||||||
|
m_parent->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Result KReadableEvent::Signal() {
|
Result KReadableEvent::Signal() {
|
||||||
KScopedSchedulerLock lk{kernel};
|
KScopedSchedulerLock lk{kernel};
|
||||||
|
|
||||||
if (!is_signaled) {
|
if (!m_is_signaled) {
|
||||||
is_signaled = true;
|
m_is_signaled = true;
|
||||||
NotifyAvailable();
|
this->NotifyAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result KReadableEvent::Clear() {
|
Result KReadableEvent::Clear() {
|
||||||
Reset();
|
this->Reset();
|
||||||
|
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
@ -47,11 +60,11 @@ Result KReadableEvent::Clear() {
|
||||||
Result KReadableEvent::Reset() {
|
Result KReadableEvent::Reset() {
|
||||||
KScopedSchedulerLock lk{kernel};
|
KScopedSchedulerLock lk{kernel};
|
||||||
|
|
||||||
if (!is_signaled) {
|
if (!m_is_signaled) {
|
||||||
return ResultInvalidState;
|
return ResultInvalidState;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_signaled = false;
|
m_is_signaled = false;
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,26 +20,23 @@ public:
|
||||||
explicit KReadableEvent(KernelCore& kernel_);
|
explicit KReadableEvent(KernelCore& kernel_);
|
||||||
~KReadableEvent() override;
|
~KReadableEvent() override;
|
||||||
|
|
||||||
void Initialize(KEvent* parent_event_, std::string&& name_) {
|
void Initialize(KEvent* parent);
|
||||||
is_signaled = false;
|
|
||||||
parent = parent_event_;
|
|
||||||
name = std::move(name_);
|
|
||||||
}
|
|
||||||
|
|
||||||
KEvent* GetParent() const {
|
KEvent* GetParent() const {
|
||||||
return parent;
|
return m_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result Signal();
|
||||||
|
Result Clear();
|
||||||
|
|
||||||
bool IsSignaled() const override;
|
bool IsSignaled() const override;
|
||||||
void Destroy() override;
|
void Destroy() override;
|
||||||
|
|
||||||
Result Signal();
|
|
||||||
Result Clear();
|
|
||||||
Result Reset();
|
Result Reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is_signaled{};
|
bool m_is_signaled{};
|
||||||
KEvent* parent{};
|
KEvent* m_parent{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
|
@ -52,7 +52,6 @@ class KThread;
|
||||||
class KThreadLocalPage;
|
class KThreadLocalPage;
|
||||||
class KTransferMemory;
|
class KTransferMemory;
|
||||||
class KWorkerTaskManager;
|
class KWorkerTaskManager;
|
||||||
class KWritableEvent;
|
|
||||||
class KCodeMemory;
|
class KCodeMemory;
|
||||||
class PhysicalCore;
|
class PhysicalCore;
|
||||||
class ServiceThread;
|
class ServiceThread;
|
||||||
|
@ -345,8 +344,6 @@ public:
|
||||||
return slab_heap_container->thread;
|
return slab_heap_container->thread;
|
||||||
} else if constexpr (std::is_same_v<T, KTransferMemory>) {
|
} else if constexpr (std::is_same_v<T, KTransferMemory>) {
|
||||||
return slab_heap_container->transfer_memory;
|
return slab_heap_container->transfer_memory;
|
||||||
} else if constexpr (std::is_same_v<T, KWritableEvent>) {
|
|
||||||
return slab_heap_container->writeable_event;
|
|
||||||
} else if constexpr (std::is_same_v<T, KCodeMemory>) {
|
} else if constexpr (std::is_same_v<T, KCodeMemory>) {
|
||||||
return slab_heap_container->code_memory;
|
return slab_heap_container->code_memory;
|
||||||
} else if constexpr (std::is_same_v<T, KPageBuffer>) {
|
} else if constexpr (std::is_same_v<T, KPageBuffer>) {
|
||||||
|
@ -412,7 +409,6 @@ private:
|
||||||
KSlabHeap<KSharedMemoryInfo> shared_memory_info;
|
KSlabHeap<KSharedMemoryInfo> shared_memory_info;
|
||||||
KSlabHeap<KThread> thread;
|
KSlabHeap<KThread> thread;
|
||||||
KSlabHeap<KTransferMemory> transfer_memory;
|
KSlabHeap<KTransferMemory> transfer_memory;
|
||||||
KSlabHeap<KWritableEvent> writeable_event;
|
|
||||||
KSlabHeap<KCodeMemory> code_memory;
|
KSlabHeap<KCodeMemory> code_memory;
|
||||||
KSlabHeap<KPageBuffer> page_buffer;
|
KSlabHeap<KPageBuffer> page_buffer;
|
||||||
KSlabHeap<KThreadLocalPage> thread_local_page;
|
KSlabHeap<KThreadLocalPage> thread_local_page;
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "core/hle/kernel/k_thread.h"
|
#include "core/hle/kernel/k_thread.h"
|
||||||
#include "core/hle/kernel/k_thread_queue.h"
|
#include "core/hle/kernel/k_thread_queue.h"
|
||||||
#include "core/hle/kernel/k_transfer_memory.h"
|
#include "core/hle/kernel/k_transfer_memory.h"
|
||||||
#include "core/hle/kernel/k_writable_event.h"
|
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/kernel/physical_core.h"
|
#include "core/hle/kernel/physical_core.h"
|
||||||
#include "core/hle/kernel/svc.h"
|
#include "core/hle/kernel/svc.h"
|
||||||
|
@ -2445,11 +2444,11 @@ static Result SignalEvent(Core::System& system, Handle event_handle) {
|
||||||
// Get the current handle table.
|
// Get the current handle table.
|
||||||
const KHandleTable& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
|
const KHandleTable& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
|
||||||
|
|
||||||
// Get the writable event.
|
// Get the event.
|
||||||
KScopedAutoObject writable_event = handle_table.GetObject<KWritableEvent>(event_handle);
|
KScopedAutoObject event = handle_table.GetObject<KEvent>(event_handle);
|
||||||
R_UNLESS(writable_event.IsNotNull(), ResultInvalidHandle);
|
R_UNLESS(event.IsNotNull(), ResultInvalidHandle);
|
||||||
|
|
||||||
return writable_event->Signal();
|
return event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result SignalEvent32(Core::System& system, Handle event_handle) {
|
static Result SignalEvent32(Core::System& system, Handle event_handle) {
|
||||||
|
@ -2464,9 +2463,9 @@ static Result ClearEvent(Core::System& system, Handle event_handle) {
|
||||||
|
|
||||||
// Try to clear the writable event.
|
// Try to clear the writable event.
|
||||||
{
|
{
|
||||||
KScopedAutoObject writable_event = handle_table.GetObject<KWritableEvent>(event_handle);
|
KScopedAutoObject event = handle_table.GetObject<KEvent>(event_handle);
|
||||||
if (writable_event.IsNotNull()) {
|
if (event.IsNotNull()) {
|
||||||
return writable_event->Clear();
|
return event->Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2504,24 +2503,24 @@ static Result CreateEvent(Core::System& system, Handle* out_write, Handle* out_r
|
||||||
R_UNLESS(event != nullptr, ResultOutOfResource);
|
R_UNLESS(event != nullptr, ResultOutOfResource);
|
||||||
|
|
||||||
// Initialize the event.
|
// Initialize the event.
|
||||||
event->Initialize("CreateEvent", kernel.CurrentProcess());
|
event->Initialize(kernel.CurrentProcess());
|
||||||
|
|
||||||
// Commit the thread reservation.
|
// Commit the thread reservation.
|
||||||
event_reservation.Commit();
|
event_reservation.Commit();
|
||||||
|
|
||||||
// Ensure that we clean up the event (and its only references are handle table) on function end.
|
// Ensure that we clean up the event (and its only references are handle table) on function end.
|
||||||
SCOPE_EXIT({
|
SCOPE_EXIT({
|
||||||
event->GetWritableEvent().Close();
|
|
||||||
event->GetReadableEvent().Close();
|
event->GetReadableEvent().Close();
|
||||||
|
event->Close();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Register the event.
|
// Register the event.
|
||||||
KEvent::Register(kernel, event);
|
KEvent::Register(kernel, event);
|
||||||
|
|
||||||
// Add the writable event to the handle table.
|
// Add the event to the handle table.
|
||||||
R_TRY(handle_table.Add(out_write, std::addressof(event->GetWritableEvent())));
|
R_TRY(handle_table.Add(out_write, event));
|
||||||
|
|
||||||
// Add the writable event to the handle table.
|
// Ensure that we maintaing a clean handle state on exit.
|
||||||
auto handle_guard = SCOPE_GUARD({ handle_table.Remove(*out_write); });
|
auto handle_guard = SCOPE_GUARD({ handle_table.Remove(*out_write); });
|
||||||
|
|
||||||
// Add the readable event to the handle table.
|
// Add the readable event to the handle table.
|
||||||
|
|
|
@ -64,7 +64,7 @@ void IAsyncContext::GetResult(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
void IAsyncContext::MarkComplete() {
|
void IAsyncContext::MarkComplete() {
|
||||||
is_complete.store(true);
|
is_complete.store(true);
|
||||||
completion_event->GetWritableEvent().Signal();
|
completion_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Account
|
} // namespace Service::Account
|
||||||
|
|
|
@ -316,7 +316,7 @@ ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nv
|
||||||
|
|
||||||
accumulated_suspended_tick_changed_event =
|
accumulated_suspended_tick_changed_event =
|
||||||
service_context.CreateEvent("ISelfController:AccumulatedSuspendedTickChangedEvent");
|
service_context.CreateEvent("ISelfController:AccumulatedSuspendedTickChangedEvent");
|
||||||
accumulated_suspended_tick_changed_event->GetWritableEvent().Signal();
|
accumulated_suspended_tick_changed_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
ISelfController::~ISelfController() {
|
ISelfController::~ISelfController() {
|
||||||
|
@ -378,7 +378,7 @@ void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) {
|
||||||
void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) {
|
void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
LOG_WARNING(Service_AM, "(STUBBED) called");
|
||||||
|
|
||||||
launchable_event->GetWritableEvent().Signal();
|
launchable_event->Signal();
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
|
@ -618,18 +618,18 @@ Kernel::KReadableEvent& AppletMessageQueue::GetOperationModeChangedEvent() {
|
||||||
|
|
||||||
void AppletMessageQueue::PushMessage(AppletMessage msg) {
|
void AppletMessageQueue::PushMessage(AppletMessage msg) {
|
||||||
messages.push(msg);
|
messages.push(msg);
|
||||||
on_new_message->GetWritableEvent().Signal();
|
on_new_message->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
AppletMessageQueue::AppletMessage AppletMessageQueue::PopMessage() {
|
AppletMessageQueue::AppletMessage AppletMessageQueue::PopMessage() {
|
||||||
if (messages.empty()) {
|
if (messages.empty()) {
|
||||||
on_new_message->GetWritableEvent().Clear();
|
on_new_message->Clear();
|
||||||
return AppletMessage::None;
|
return AppletMessage::None;
|
||||||
}
|
}
|
||||||
auto msg = messages.front();
|
auto msg = messages.front();
|
||||||
messages.pop();
|
messages.pop();
|
||||||
if (messages.empty()) {
|
if (messages.empty()) {
|
||||||
on_new_message->GetWritableEvent().Clear();
|
on_new_message->Clear();
|
||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
@ -653,7 +653,7 @@ void AppletMessageQueue::FocusStateChanged() {
|
||||||
void AppletMessageQueue::OperationModeChanged() {
|
void AppletMessageQueue::OperationModeChanged() {
|
||||||
PushMessage(AppletMessage::OperationModeChanged);
|
PushMessage(AppletMessage::OperationModeChanged);
|
||||||
PushMessage(AppletMessage::PerformanceModeChanged);
|
PushMessage(AppletMessage::PerformanceModeChanged);
|
||||||
on_operation_mode_changed->GetWritableEvent().Signal();
|
on_operation_mode_changed->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
ICommonStateGetter::ICommonStateGetter(Core::System& system_,
|
ICommonStateGetter::ICommonStateGetter(Core::System& system_,
|
||||||
|
|
|
@ -65,7 +65,7 @@ std::shared_ptr<IStorage> AppletDataBroker::PopNormalDataToGame() {
|
||||||
|
|
||||||
auto out = std::move(out_channel.front());
|
auto out = std::move(out_channel.front());
|
||||||
out_channel.pop_front();
|
out_channel.pop_front();
|
||||||
pop_out_data_event->GetWritableEvent().Clear();
|
pop_out_data_event->Clear();
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ std::shared_ptr<IStorage> AppletDataBroker::PopInteractiveDataToGame() {
|
||||||
|
|
||||||
auto out = std::move(out_interactive_channel.front());
|
auto out = std::move(out_interactive_channel.front());
|
||||||
out_interactive_channel.pop_front();
|
out_interactive_channel.pop_front();
|
||||||
pop_interactive_out_data_event->GetWritableEvent().Clear();
|
pop_interactive_out_data_event->Clear();
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ void AppletDataBroker::PushNormalDataFromGame(std::shared_ptr<IStorage>&& storag
|
||||||
|
|
||||||
void AppletDataBroker::PushNormalDataFromApplet(std::shared_ptr<IStorage>&& storage) {
|
void AppletDataBroker::PushNormalDataFromApplet(std::shared_ptr<IStorage>&& storage) {
|
||||||
out_channel.emplace_back(std::move(storage));
|
out_channel.emplace_back(std::move(storage));
|
||||||
pop_out_data_event->GetWritableEvent().Signal();
|
pop_out_data_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletDataBroker::PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& storage) {
|
void AppletDataBroker::PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& storage) {
|
||||||
|
@ -112,11 +112,11 @@ void AppletDataBroker::PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& s
|
||||||
|
|
||||||
void AppletDataBroker::PushInteractiveDataFromApplet(std::shared_ptr<IStorage>&& storage) {
|
void AppletDataBroker::PushInteractiveDataFromApplet(std::shared_ptr<IStorage>&& storage) {
|
||||||
out_interactive_channel.emplace_back(std::move(storage));
|
out_interactive_channel.emplace_back(std::move(storage));
|
||||||
pop_interactive_out_data_event->GetWritableEvent().Signal();
|
pop_interactive_out_data_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletDataBroker::SignalStateChanged() {
|
void AppletDataBroker::SignalStateChanged() {
|
||||||
state_changed_event->GetWritableEvent().Signal();
|
state_changed_event->Signal();
|
||||||
|
|
||||||
switch (applet_mode) {
|
switch (applet_mode) {
|
||||||
case LibraryAppletMode::AllForeground:
|
case LibraryAppletMode::AllForeground:
|
||||||
|
|
|
@ -239,7 +239,7 @@ public:
|
||||||
};
|
};
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
|
|
||||||
event->GetWritableEvent().Signal();
|
event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
~IAudioDevice() override {
|
~IAudioDevice() override {
|
||||||
|
@ -325,7 +325,7 @@ private:
|
||||||
void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) {
|
void QueryAudioDeviceSystemEvent(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_Audio, "(STUBBED) called");
|
LOG_DEBUG(Service_Audio, "(STUBBED) called");
|
||||||
|
|
||||||
event->GetWritableEvent().Signal();
|
event->Signal();
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
|
|
|
@ -82,7 +82,7 @@ void ProgressServiceBackend::FinishDownload(Result result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgressServiceBackend::SignalUpdate() {
|
void ProgressServiceBackend::SignalUpdate() {
|
||||||
update_event->GetWritableEvent().Signal();
|
update_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
Backend::Backend(DirectoryGetter getter) : dir_getter(std::move(getter)) {}
|
Backend::Backend(DirectoryGetter getter) : dir_getter(std::move(getter)) {}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "core/hid/hid_core.h"
|
#include "core/hid/hid_core.h"
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/kernel/k_readable_event.h"
|
#include "core/hle/kernel/k_readable_event.h"
|
||||||
#include "core/hle/kernel/k_writable_event.h"
|
|
||||||
#include "core/hle/service/hid/controllers/npad.h"
|
#include "core/hle/service/hid/controllers/npad.h"
|
||||||
#include "core/hle/service/hid/errors.h"
|
#include "core/hle/service/hid/errors.h"
|
||||||
#include "core/hle/service/kernel_helpers.h"
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
|
@ -167,7 +166,7 @@ void Controller_NPad::InitNewlyAddedController(Core::HID::NpadIdType npad_id) {
|
||||||
const auto& battery_level = controller.device->GetBattery();
|
const auto& battery_level = controller.device->GetBattery();
|
||||||
auto* shared_memory = controller.shared_memory;
|
auto* shared_memory = controller.shared_memory;
|
||||||
if (controller_type == Core::HID::NpadStyleIndex::None) {
|
if (controller_type == Core::HID::NpadStyleIndex::None) {
|
||||||
controller.styleset_changed_event->GetWritableEvent().Signal();
|
controller.styleset_changed_event->Signal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1033,7 +1032,7 @@ Kernel::KReadableEvent& Controller_NPad::GetStyleSetChangedEvent(Core::HID::Npad
|
||||||
|
|
||||||
void Controller_NPad::SignalStyleSetChangedEvent(Core::HID::NpadIdType npad_id) const {
|
void Controller_NPad::SignalStyleSetChangedEvent(Core::HID::NpadIdType npad_id) const {
|
||||||
const auto& controller = GetControllerFromNpadIdType(npad_id);
|
const auto& controller = GetControllerFromNpadIdType(npad_id);
|
||||||
controller.styleset_changed_event->GetWritableEvent().Signal();
|
controller.styleset_changed_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller_NPad::AddNewControllerAt(Core::HID::NpadStyleIndex controller,
|
void Controller_NPad::AddNewControllerAt(Core::HID::NpadStyleIndex controller,
|
||||||
|
|
|
@ -73,7 +73,7 @@ Result Controller_Palma::PlayPalmaActivity(const PalmaConnectionHandle& handle,
|
||||||
operation.operation = PalmaOperationType::PlayActivity;
|
operation.operation = PalmaOperationType::PlayActivity;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->GetWritableEvent().Signal();
|
operation_complete_event->Signal();
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ Result Controller_Palma::ReadPalmaStep(const PalmaConnectionHandle& handle) {
|
||||||
operation.operation = PalmaOperationType::ReadStep;
|
operation.operation = PalmaOperationType::ReadStep;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->GetWritableEvent().Signal();
|
operation_complete_event->Signal();
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ Result Controller_Palma::ReadPalmaUniqueCode(const PalmaConnectionHandle& handle
|
||||||
operation.operation = PalmaOperationType::ReadUniqueCode;
|
operation.operation = PalmaOperationType::ReadUniqueCode;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->GetWritableEvent().Signal();
|
operation_complete_event->Signal();
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ Result Controller_Palma::SetPalmaUniqueCodeInvalid(const PalmaConnectionHandle&
|
||||||
operation.operation = PalmaOperationType::SetUniqueCodeInvalid;
|
operation.operation = PalmaOperationType::SetUniqueCodeInvalid;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->GetWritableEvent().Signal();
|
operation_complete_event->Signal();
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ Result Controller_Palma::WritePalmaRgbLedPatternEntry(const PalmaConnectionHandl
|
||||||
operation.operation = PalmaOperationType::WriteRgbLedPatternEntry;
|
operation.operation = PalmaOperationType::WriteRgbLedPatternEntry;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->GetWritableEvent().Signal();
|
operation_complete_event->Signal();
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ Result Controller_Palma::WritePalmaWaveEntry(const PalmaConnectionHandle& handle
|
||||||
operation.operation = PalmaOperationType::WriteWaveEntry;
|
operation.operation = PalmaOperationType::WriteWaveEntry;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation_complete_event->GetWritableEvent().Signal();
|
operation_complete_event->Signal();
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ Result Controller_Palma::SetPalmaDataBaseIdentificationVersion(const PalmaConnec
|
||||||
operation.operation = PalmaOperationType::ReadDataBaseIdentificationVersion;
|
operation.operation = PalmaOperationType::ReadDataBaseIdentificationVersion;
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data[0] = {};
|
operation.data[0] = {};
|
||||||
operation_complete_event->GetWritableEvent().Signal();
|
operation_complete_event->Signal();
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ Result Controller_Palma::GetPalmaDataBaseIdentificationVersion(
|
||||||
operation.result = PalmaResultSuccess;
|
operation.result = PalmaResultSuccess;
|
||||||
operation.data = {};
|
operation.data = {};
|
||||||
operation.data[0] = static_cast<u8>(database_id_version);
|
operation.data[0] = static_cast<u8>(database_id_version);
|
||||||
operation_complete_event->GetWritableEvent().Signal();
|
operation_complete_event->Signal();
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,12 +131,12 @@ bool RingController::SetCommand(const std::vector<u8>& data) {
|
||||||
case RingConCommands::ReadRepCount:
|
case RingConCommands::ReadRepCount:
|
||||||
case RingConCommands::ReadTotalPushCount:
|
case RingConCommands::ReadTotalPushCount:
|
||||||
ASSERT_MSG(data.size() == 0x4, "data.size is not 0x4 bytes");
|
ASSERT_MSG(data.size() == 0x4, "data.size is not 0x4 bytes");
|
||||||
send_command_async_event->GetWritableEvent().Signal();
|
send_command_async_event->Signal();
|
||||||
return true;
|
return true;
|
||||||
case RingConCommands::ResetRepCount:
|
case RingConCommands::ResetRepCount:
|
||||||
ASSERT_MSG(data.size() == 0x4, "data.size is not 0x4 bytes");
|
ASSERT_MSG(data.size() == 0x4, "data.size is not 0x4 bytes");
|
||||||
total_rep_count = 0;
|
total_rep_count = 0;
|
||||||
send_command_async_event->GetWritableEvent().Signal();
|
send_command_async_event->Signal();
|
||||||
return true;
|
return true;
|
||||||
case RingConCommands::SaveCalData: {
|
case RingConCommands::SaveCalData: {
|
||||||
ASSERT_MSG(data.size() == 0x14, "data.size is not 0x14 bytes");
|
ASSERT_MSG(data.size() == 0x14, "data.size is not 0x14 bytes");
|
||||||
|
@ -144,14 +144,14 @@ bool RingController::SetCommand(const std::vector<u8>& data) {
|
||||||
SaveCalData save_info{};
|
SaveCalData save_info{};
|
||||||
std::memcpy(&save_info, data.data(), sizeof(SaveCalData));
|
std::memcpy(&save_info, data.data(), sizeof(SaveCalData));
|
||||||
user_calibration = save_info.calibration;
|
user_calibration = save_info.calibration;
|
||||||
send_command_async_event->GetWritableEvent().Signal();
|
send_command_async_event->Signal();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Service_HID, "Command not implemented {}", command);
|
LOG_ERROR(Service_HID, "Command not implemented {}", command);
|
||||||
command = RingConCommands::Error;
|
command = RingConCommands::Error;
|
||||||
// Signal a reply to avoid softlocking the game
|
// Signal a reply to avoid softlocking the game
|
||||||
send_command_async_event->GetWritableEvent().Signal();
|
send_command_async_event->Signal();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "core/hle/kernel/k_readable_event.h"
|
#include "core/hle/kernel/k_readable_event.h"
|
||||||
#include "core/hle/kernel/k_resource_limit.h"
|
#include "core/hle/kernel/k_resource_limit.h"
|
||||||
#include "core/hle/kernel/k_scoped_resource_reservation.h"
|
#include "core/hle/kernel/k_scoped_resource_reservation.h"
|
||||||
#include "core/hle/kernel/k_writable_event.h"
|
|
||||||
#include "core/hle/service/kernel_helpers.h"
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
|
|
||||||
namespace Service::KernelHelpers {
|
namespace Service::KernelHelpers {
|
||||||
|
@ -46,7 +45,7 @@ Kernel::KEvent* ServiceContext::CreateEvent(std::string&& name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the event.
|
// Initialize the event.
|
||||||
event->Initialize(std::move(name), process);
|
event->Initialize(process);
|
||||||
|
|
||||||
// Commit the thread reservation.
|
// Commit the thread reservation.
|
||||||
event_reservation.Commit();
|
event_reservation.Commit();
|
||||||
|
@ -59,7 +58,7 @@ Kernel::KEvent* ServiceContext::CreateEvent(std::string&& name) {
|
||||||
|
|
||||||
void ServiceContext::CloseEvent(Kernel::KEvent* event) {
|
void ServiceContext::CloseEvent(Kernel::KEvent* event) {
|
||||||
event->GetReadableEvent().Close();
|
event->GetReadableEvent().Close();
|
||||||
event->GetWritableEvent().Close();
|
event->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::KernelHelpers
|
} // namespace Service::KernelHelpers
|
||||||
|
|
|
@ -165,7 +165,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnEventFired() {
|
void OnEventFired() {
|
||||||
state_change_event->GetWritableEvent().Signal();
|
state_change_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetState(Kernel::HLERequestContext& ctx) {
|
void GetState(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ NfpDevice::~NfpDevice() {
|
||||||
void NfpDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
|
void NfpDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
|
||||||
if (type == Core::HID::ControllerTriggerType::Connected ||
|
if (type == Core::HID::ControllerTriggerType::Connected ||
|
||||||
type == Core::HID::ControllerTriggerType::Disconnected) {
|
type == Core::HID::ControllerTriggerType::Disconnected) {
|
||||||
availability_change_event->GetWritableEvent().Signal();
|
availability_change_event->Signal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ bool NfpDevice::LoadAmiibo(std::span<const u8> data) {
|
||||||
|
|
||||||
device_state = DeviceState::TagFound;
|
device_state = DeviceState::TagFound;
|
||||||
deactivate_event->GetReadableEvent().Clear();
|
deactivate_event->GetReadableEvent().Clear();
|
||||||
activate_event->GetWritableEvent().Signal();
|
activate_event->Signal();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ void NfpDevice::CloseAmiibo() {
|
||||||
encrypted_tag_data = {};
|
encrypted_tag_data = {};
|
||||||
tag_data = {};
|
tag_data = {};
|
||||||
activate_event->GetReadableEvent().Clear();
|
activate_event->GetReadableEvent().Clear();
|
||||||
deactivate_event->GetWritableEvent().Signal();
|
deactivate_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
Kernel::KReadableEvent& NfpDevice::GetActivateEvent() const {
|
Kernel::KReadableEvent& NfpDevice::GetActivateEvent() const {
|
||||||
|
|
|
@ -328,7 +328,7 @@ private:
|
||||||
void StartTask(Kernel::HLERequestContext& ctx) {
|
void StartTask(Kernel::HLERequestContext& ctx) {
|
||||||
// No need to connect to the internet, just finish the task straight away.
|
// No need to connect to the internet, just finish the task straight away.
|
||||||
LOG_DEBUG(Service_NIM, "called");
|
LOG_DEBUG(Service_NIM, "called");
|
||||||
finished_event->GetWritableEvent().Signal();
|
finished_event->Signal();
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ private:
|
||||||
|
|
||||||
void Cancel(Kernel::HLERequestContext& ctx) {
|
void Cancel(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service_NIM, "called");
|
LOG_DEBUG(Service_NIM, "called");
|
||||||
finished_event->GetWritableEvent().Clear();
|
finished_event->Clear();
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/kernel/k_writable_event.h"
|
|
||||||
#include "core/hle/service/nvdrv/core/container.h"
|
#include "core/hle/service/nvdrv/core/container.h"
|
||||||
#include "core/hle/service/nvdrv/core/syncpoint_manager.h"
|
#include "core/hle/service/nvdrv/core/syncpoint_manager.h"
|
||||||
#include "core/hle/service/nvdrv/devices/nvhost_ctrl.h"
|
#include "core/hle/service/nvdrv/devices/nvhost_ctrl.h"
|
||||||
|
@ -206,7 +205,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
|
||||||
auto& event_ = events[slot];
|
auto& event_ = events[slot];
|
||||||
if (event_.status.exchange(EventState::Signalling, std::memory_order_acq_rel) ==
|
if (event_.status.exchange(EventState::Signalling, std::memory_order_acq_rel) ==
|
||||||
EventState::Waiting) {
|
EventState::Waiting) {
|
||||||
event_.kevent->GetWritableEvent().Signal();
|
event_.kevent->Signal();
|
||||||
}
|
}
|
||||||
event_.status.store(EventState::Signalled, std::memory_order_release);
|
event_.status.store(EventState::Signalled, std::memory_order_release);
|
||||||
});
|
});
|
||||||
|
@ -306,7 +305,7 @@ NvResult nvhost_ctrl::IocCtrlClearEventWait(const std::vector<u8>& input, std::v
|
||||||
}
|
}
|
||||||
event.fails++;
|
event.fails++;
|
||||||
event.status.store(EventState::Cancelled, std::memory_order_release);
|
event.status.store(EventState::Cancelled, std::memory_order_release);
|
||||||
event.kevent->GetWritableEvent().Clear();
|
event.kevent->Clear();
|
||||||
|
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/kernel/k_writable_event.h"
|
|
||||||
#include "core/hle/service/nvdrv/core/container.h"
|
#include "core/hle/service/nvdrv/core/container.h"
|
||||||
#include "core/hle/service/nvdrv/devices/nvdevice.h"
|
#include "core/hle/service/nvdrv/devices/nvdevice.h"
|
||||||
#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
|
#include "core/hle/service/nvdrv/devices/nvdisp_disp0.h"
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
#include "core/hle/service/nvdrv/nvdrv.h"
|
#include "core/hle/service/nvdrv/nvdrv.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Kernel {
|
|
||||||
class KWritableEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Service::Nvidia {
|
namespace Service::Nvidia {
|
||||||
|
|
||||||
class NVDRV final : public ServiceFramework<NVDRV> {
|
class NVDRV final : public ServiceFramework<NVDRV> {
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "core/hle/kernel/hle_ipc.h"
|
#include "core/hle/kernel/hle_ipc.h"
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/kernel/k_readable_event.h"
|
#include "core/hle/kernel/k_readable_event.h"
|
||||||
#include "core/hle/kernel/k_writable_event.h"
|
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/service/kernel_helpers.h"
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
#include "core/hle/service/nvdrv/core/nvmap.h"
|
#include "core/hle/service/nvdrv/core/nvmap.h"
|
||||||
|
@ -110,7 +109,7 @@ Status BufferQueueProducer::SetBufferCount(s32 buffer_count) {
|
||||||
|
|
||||||
core->override_max_buffer_count = buffer_count;
|
core->override_max_buffer_count = buffer_count;
|
||||||
core->SignalDequeueCondition();
|
core->SignalDequeueCondition();
|
||||||
buffer_wait_event->GetWritableEvent().Signal();
|
buffer_wait_event->Signal();
|
||||||
listener = core->consumer_listener;
|
listener = core->consumer_listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,7 +622,7 @@ void BufferQueueProducer::CancelBuffer(s32 slot, const Fence& fence) {
|
||||||
slots[slot].fence = fence;
|
slots[slot].fence = fence;
|
||||||
|
|
||||||
core->SignalDequeueCondition();
|
core->SignalDequeueCondition();
|
||||||
buffer_wait_event->GetWritableEvent().Signal();
|
buffer_wait_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
Status BufferQueueProducer::Query(NativeWindow what, s32* out_value) {
|
Status BufferQueueProducer::Query(NativeWindow what, s32* out_value) {
|
||||||
|
@ -753,7 +752,7 @@ Status BufferQueueProducer::Disconnect(NativeWindowApi api) {
|
||||||
core->connected_producer_listener = nullptr;
|
core->connected_producer_listener = nullptr;
|
||||||
core->connected_api = NativeWindowApi::NoConnectedApi;
|
core->connected_api = NativeWindowApi::NoConnectedApi;
|
||||||
core->SignalDequeueCondition();
|
core->SignalDequeueCondition();
|
||||||
buffer_wait_event->GetWritableEvent().Signal();
|
buffer_wait_event->Signal();
|
||||||
listener = core->consumer_listener;
|
listener = core->consumer_listener;
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Service_NVFlinger, "still connected to another api (cur = {} req = {})",
|
LOG_ERROR(Service_NVFlinger, "still connected to another api (cur = {} req = {})",
|
||||||
|
@ -802,7 +801,7 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
|
||||||
}
|
}
|
||||||
|
|
||||||
core->SignalDequeueCondition();
|
core->SignalDequeueCondition();
|
||||||
buffer_wait_event->GetWritableEvent().Signal();
|
buffer_wait_event->Signal();
|
||||||
|
|
||||||
return Status::NoError;
|
return Status::NoError;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ namespace Kernel {
|
||||||
class KernelCore;
|
class KernelCore;
|
||||||
class KEvent;
|
class KEvent;
|
||||||
class KReadableEvent;
|
class KReadableEvent;
|
||||||
class KWritableEvent;
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
||||||
namespace Service::KernelHelpers {
|
namespace Service::KernelHelpers {
|
||||||
|
|
|
@ -25,7 +25,6 @@ struct EventType;
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
class KReadableEvent;
|
class KReadableEvent;
|
||||||
class KWritableEvent;
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
||||||
namespace Service::Nvidia {
|
namespace Service::Nvidia {
|
||||||
|
|
|
@ -37,19 +37,19 @@ public:
|
||||||
|
|
||||||
void SignalChargerTypeChanged() {
|
void SignalChargerTypeChanged() {
|
||||||
if (should_signal && should_signal_charger_type) {
|
if (should_signal && should_signal_charger_type) {
|
||||||
state_change_event->GetWritableEvent().Signal();
|
state_change_event->Signal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalPowerSupplyChanged() {
|
void SignalPowerSupplyChanged() {
|
||||||
if (should_signal && should_signal_power_supply) {
|
if (should_signal && should_signal_power_supply) {
|
||||||
state_change_event->GetWritableEvent().Signal();
|
state_change_event->Signal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SignalBatteryVoltageStateChanged() {
|
void SignalBatteryVoltageStateChanged() {
|
||||||
if (should_signal && should_signal_battery_voltage) {
|
if (should_signal && should_signal_battery_voltage) {
|
||||||
state_change_event->GetWritableEvent().Signal();
|
state_change_event->Signal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/hle/kernel/k_writable_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/service/time/errors.h"
|
#include "core/hle/service/time/errors.h"
|
||||||
#include "core/hle/service/time/system_clock_context_update_callback.h"
|
#include "core/hle/service/time/system_clock_context_update_callback.h"
|
||||||
|
|
||||||
|
@ -20,13 +20,13 @@ bool SystemClockContextUpdateCallback::NeedUpdate(const SystemClockContext& valu
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemClockContextUpdateCallback::RegisterOperationEvent(
|
void SystemClockContextUpdateCallback::RegisterOperationEvent(
|
||||||
std::shared_ptr<Kernel::KWritableEvent>&& writable_event) {
|
std::shared_ptr<Kernel::KEvent>&& event) {
|
||||||
operation_event_list.emplace_back(std::move(writable_event));
|
operation_event_list.emplace_back(std::move(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemClockContextUpdateCallback::BroadcastOperationEvent() {
|
void SystemClockContextUpdateCallback::BroadcastOperationEvent() {
|
||||||
for (const auto& writable_event : operation_event_list) {
|
for (const auto& event : operation_event_list) {
|
||||||
writable_event->Signal();
|
event->Signal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "core/hle/service/time/clock_types.h"
|
#include "core/hle/service/time/clock_types.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
class KWritableEvent;
|
class KEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Service::Time::Clock {
|
namespace Service::Time::Clock {
|
||||||
|
@ -24,7 +24,7 @@ public:
|
||||||
|
|
||||||
bool NeedUpdate(const SystemClockContext& value) const;
|
bool NeedUpdate(const SystemClockContext& value) const;
|
||||||
|
|
||||||
void RegisterOperationEvent(std::shared_ptr<Kernel::KWritableEvent>&& writable_event);
|
void RegisterOperationEvent(std::shared_ptr<Kernel::KEvent>&& event);
|
||||||
|
|
||||||
void BroadcastOperationEvent();
|
void BroadcastOperationEvent();
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool has_context{};
|
bool has_context{};
|
||||||
std::vector<std::shared_ptr<Kernel::KWritableEvent>> operation_event_list;
|
std::vector<std::shared_ptr<Kernel::KEvent>> operation_event_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::Time::Clock
|
} // namespace Service::Time::Clock
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/kernel/k_readable_event.h"
|
#include "core/hle/kernel/k_readable_event.h"
|
||||||
#include "core/hle/kernel/k_writable_event.h"
|
|
||||||
#include "core/hle/service/kernel_helpers.h"
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
#include "core/hle/service/nvdrv/core/container.h"
|
#include "core/hle/service/nvdrv/core/container.h"
|
||||||
#include "core/hle/service/nvflinger/buffer_item_consumer.h"
|
#include "core/hle/service/nvflinger/buffer_item_consumer.h"
|
||||||
|
@ -74,7 +73,7 @@ Kernel::KReadableEvent* Display::GetVSyncEventUnchecked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::SignalVSyncEvent() {
|
void Display::SignalVSyncEvent() {
|
||||||
vsync_event->GetWritableEvent().Signal();
|
vsync_event->Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Display::CreateLayer(u64 layer_id, u32 binder_id,
|
void Display::CreateLayer(u64 layer_id, u32 binder_id,
|
||||||
|
|
Loading…
Reference in a new issue