early-access version 1673
This commit is contained in:
parent
24d9812c76
commit
544152130d
@ -1,7 +1,7 @@
|
|||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 1671.
|
This is the source code for early-access 1673.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
@ -150,8 +150,8 @@ public:
|
|||||||
if (context->Session()->IsDomain()) {
|
if (context->Session()->IsDomain()) {
|
||||||
context->AddDomainObject(std::move(iface));
|
context->AddDomainObject(std::move(iface));
|
||||||
} else {
|
} else {
|
||||||
kernel.CurrentProcess()->GetResourceLimit()->Reserve(
|
// kernel.CurrentProcess()->GetResourceLimit()->Reserve(
|
||||||
Kernel::LimitableResource::Sessions, 1);
|
// Kernel::LimitableResource::Sessions, 1);
|
||||||
|
|
||||||
auto* session = Kernel::KSession::Create(kernel);
|
auto* session = Kernel::KSession::Create(kernel);
|
||||||
session->Initialize(nullptr, iface->GetServiceName());
|
session->Initialize(nullptr, iface->GetServiceName());
|
||||||
|
@ -57,7 +57,7 @@ constexpr size_t SlabCountKSharedMemory = 80;
|
|||||||
constexpr size_t SlabCountKTransferMemory = 200;
|
constexpr size_t SlabCountKTransferMemory = 200;
|
||||||
constexpr size_t SlabCountKCodeMemory = 10;
|
constexpr size_t SlabCountKCodeMemory = 10;
|
||||||
constexpr size_t SlabCountKDeviceAddressSpace = 300;
|
constexpr size_t SlabCountKDeviceAddressSpace = 300;
|
||||||
constexpr size_t SlabCountKSession = /*933*/ 40000;
|
constexpr size_t SlabCountKSession = 933;
|
||||||
constexpr size_t SlabCountKLightSession = 100;
|
constexpr size_t SlabCountKLightSession = 100;
|
||||||
constexpr size_t SlabCountKObjectName = 7;
|
constexpr size_t SlabCountKObjectName = 7;
|
||||||
constexpr size_t SlabCountKResourceLimit = 5;
|
constexpr size_t SlabCountKResourceLimit = 5;
|
||||||
|
@ -58,9 +58,9 @@ bool KClientPort::IsSignaled() const {
|
|||||||
|
|
||||||
ResultCode KClientPort::CreateSession(KClientSession** out) {
|
ResultCode KClientPort::CreateSession(KClientSession** out) {
|
||||||
// Reserve a new session from the resource limit.
|
// Reserve a new session from the resource limit.
|
||||||
KScopedResourceReservation session_reservation(kernel.CurrentProcess()->GetResourceLimit(),
|
// KScopedResourceReservation session_reservation(kernel.CurrentProcess()->GetResourceLimit(),
|
||||||
LimitableResource::Sessions);
|
// LimitableResource::Sessions);
|
||||||
R_UNLESS(session_reservation.Succeeded(), ResultLimitReached);
|
// R_UNLESS(session_reservation.Succeeded(), ResultLimitReached);
|
||||||
|
|
||||||
// Update the session counts.
|
// Update the session counts.
|
||||||
{
|
{
|
||||||
@ -104,7 +104,7 @@ ResultCode KClientPort::CreateSession(KClientSession** out) {
|
|||||||
session->Initialize(this, parent->GetName());
|
session->Initialize(this, parent->GetName());
|
||||||
|
|
||||||
// Commit the session reservation.
|
// Commit the session reservation.
|
||||||
session_reservation.Commit();
|
// session_reservation.Commit();
|
||||||
|
|
||||||
// Register the session.
|
// Register the session.
|
||||||
KSession::Register(kernel, session);
|
KSession::Register(kernel, session);
|
||||||
|
@ -78,7 +78,7 @@ void KSession::OnClientClosed() {
|
|||||||
void KSession::PostDestroy(uintptr_t arg) {
|
void KSession::PostDestroy(uintptr_t arg) {
|
||||||
// Release the session count resource the owner process holds.
|
// Release the session count resource the owner process holds.
|
||||||
KProcess* owner = reinterpret_cast<KProcess*>(arg);
|
KProcess* owner = reinterpret_cast<KProcess*>(arg);
|
||||||
owner->GetResourceLimit()->Release(LimitableResource::Sessions, 1);
|
// owner->GetResourceLimit()->Release(LimitableResource::Sessions, 1);
|
||||||
owner->Close();
|
owner->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,11 +67,11 @@ class KAutoObjectWithSlabHeapAndContainer : public Base {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static Derived* Allocate(KernelCore& kernel) {
|
static Derived* Allocate(KernelCore& kernel) {
|
||||||
return kernel.SlabHeap<Derived>().AllocateWithKernel(kernel);
|
return new Derived(kernel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Free(KernelCore& kernel, Derived* obj) {
|
static void Free(KernelCore& kernel, Derived* obj) {
|
||||||
kernel.SlabHeap<Derived>().Free(obj);
|
delete obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -169,10 +169,9 @@ private:
|
|||||||
|
|
||||||
class IAudioDevice final : public ServiceFramework<IAudioDevice> {
|
class IAudioDevice final : public ServiceFramework<IAudioDevice> {
|
||||||
public:
|
public:
|
||||||
explicit IAudioDevice(Core::System& system_, u32_le revision_num)
|
explicit IAudioDevice(Core::System& system_, Kernel::KEvent& buffer_event_, u32_le revision_)
|
||||||
: ServiceFramework{system_, "IAudioDevice"}, revision{revision_num},
|
: ServiceFramework{system_, "IAudioDevice"}, buffer_event{buffer_event_}, revision{
|
||||||
buffer_event{system.Kernel()}, audio_input_device_switch_event{system.Kernel()},
|
revision_} {
|
||||||
audio_output_device_switch_event{system.Kernel()} {
|
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"},
|
{0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"},
|
||||||
{1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"},
|
{1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"},
|
||||||
@ -189,18 +188,6 @@ public:
|
|||||||
{13, nullptr, "GetAudioSystemMasterVolumeSetting"},
|
{13, nullptr, "GetAudioSystemMasterVolumeSetting"},
|
||||||
};
|
};
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
|
|
||||||
Kernel::KAutoObject::Create(std::addressof(buffer_event));
|
|
||||||
buffer_event.Initialize("IAudioOutBufferReleasedEvent");
|
|
||||||
|
|
||||||
// Should be similar to audio_output_device_switch_event
|
|
||||||
Kernel::KAutoObject::Create(std::addressof(audio_input_device_switch_event));
|
|
||||||
audio_input_device_switch_event.Initialize("IAudioDevice:AudioInputDeviceSwitchedEvent");
|
|
||||||
|
|
||||||
// Should only be signalled when an audio output device has been changed, example: speaker
|
|
||||||
// to headset
|
|
||||||
Kernel::KAutoObject::Create(std::addressof(audio_output_device_switch_event));
|
|
||||||
audio_output_device_switch_event.Initialize("IAudioDevice:AudioOutputDeviceSwitchedEvent");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -310,7 +297,7 @@ private:
|
|||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushCopyObjects(audio_input_device_switch_event.GetReadableEvent());
|
rb.PushCopyObjects(buffer_event.GetReadableEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueryAudioDeviceOutputEvent(Kernel::HLERequestContext& ctx) {
|
void QueryAudioDeviceOutputEvent(Kernel::HLERequestContext& ctx) {
|
||||||
@ -318,17 +305,16 @@ private:
|
|||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushCopyObjects(audio_output_device_switch_event.GetReadableEvent());
|
rb.PushCopyObjects(buffer_event.GetReadableEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Kernel::KEvent& buffer_event;
|
||||||
u32_le revision = 0;
|
u32_le revision = 0;
|
||||||
Kernel::KEvent buffer_event;
|
};
|
||||||
Kernel::KEvent audio_input_device_switch_event;
|
|
||||||
Kernel::KEvent audio_output_device_switch_event;
|
|
||||||
|
|
||||||
}; // namespace Audio
|
AudRenU::AudRenU(Core::System& system_)
|
||||||
|
: ServiceFramework{system_, "audren:u"}, buffer_event{system.Kernel()} {
|
||||||
|
|
||||||
AudRenU::AudRenU(Core::System& system_) : ServiceFramework{system_, "audren:u"} {
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"},
|
{0, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"},
|
||||||
@ -340,6 +326,9 @@ AudRenU::AudRenU(Core::System& system_) : ServiceFramework{system_, "audren:u"}
|
|||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
|
|
||||||
|
Kernel::KAutoObject::Create(std::addressof(buffer_event));
|
||||||
|
buffer_event.Initialize("IAudioOutBufferReleasedEvent");
|
||||||
}
|
}
|
||||||
|
|
||||||
AudRenU::~AudRenU() = default;
|
AudRenU::~AudRenU() = default;
|
||||||
@ -662,7 +651,7 @@ void AudRenU::GetAudioDeviceService(Kernel::HLERequestContext& ctx) {
|
|||||||
// always assumes the initial release revision (REV1).
|
// always assumes the initial release revision (REV1).
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<IAudioDevice>(system, Common::MakeMagic('R', 'E', 'V', '1'));
|
rb.PushIpcInterface<IAudioDevice>(system, buffer_event, Common::MakeMagic('R', 'E', 'V', '1'));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudRenU::OpenAudioRendererForManualExecution(Kernel::HLERequestContext& ctx) {
|
void AudRenU::OpenAudioRendererForManualExecution(Kernel::HLERequestContext& ctx) {
|
||||||
@ -684,7 +673,7 @@ void AudRenU::GetAudioDeviceServiceWithRevisionInfo(Kernel::HLERequestContext& c
|
|||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushIpcInterface<IAudioDevice>(system, revision);
|
rb.PushIpcInterface<IAudioDevice>(system, buffer_event, revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudRenU::OpenAudioRendererImpl(Kernel::HLERequestContext& ctx) {
|
void AudRenU::OpenAudioRendererImpl(Kernel::HLERequestContext& ctx) {
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
@ -31,6 +32,7 @@ private:
|
|||||||
void OpenAudioRendererImpl(Kernel::HLERequestContext& ctx);
|
void OpenAudioRendererImpl(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
std::size_t audren_instance_count = 0;
|
std::size_t audren_instance_count = 0;
|
||||||
|
Kernel::KEvent buffer_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Describes a particular audio feature that may be supported in a particular revision.
|
// Describes a particular audio feature that may be supported in a particular revision.
|
||||||
|
@ -22,7 +22,7 @@ void Controller::ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(1); // Converted sessions start with 1 request handler
|
rb.Push<u32>(1); // Converted sessions start with 1 request handler
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) {
|
void Controller::CloneCurrentObject(Kernel::HLERequestContext& ctx) {
|
||||||
// TODO(bunnei): This is just creating a new handle to the same Session. I assume this is wrong
|
// TODO(bunnei): This is just creating a new handle to the same Session. I assume this is wrong
|
||||||
// and that we probably want to actually make an entirely new Session, but we still need to
|
// and that we probably want to actually make an entirely new Session, but we still need to
|
||||||
// verify this on hardware.
|
// verify this on hardware.
|
||||||
@ -41,10 +41,10 @@ void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.PushMoveObjects(session->GetClientSession());
|
rb.PushMoveObjects(session->GetClientSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::DuplicateSessionEx(Kernel::HLERequestContext& ctx) {
|
void Controller::CloneCurrentObjectEx(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_DEBUG(Service, "called");
|
LOG_DEBUG(Service, "called");
|
||||||
|
|
||||||
DuplicateSession(ctx);
|
CloneCurrentObject(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
|
void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
|
||||||
@ -60,9 +60,9 @@ Controller::Controller(Core::System& system_) : ServiceFramework{system_, "IpcCo
|
|||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"},
|
{0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"},
|
||||||
{1, nullptr, "CopyFromCurrentDomain"},
|
{1, nullptr, "CopyFromCurrentDomain"},
|
||||||
{2, &Controller::DuplicateSession, "DuplicateSession"},
|
{2, &Controller::CloneCurrentObject, "CloneCurrentObject"},
|
||||||
{3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"},
|
{3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"},
|
||||||
{4, &Controller::DuplicateSessionEx, "DuplicateSessionEx"},
|
{4, &Controller::CloneCurrentObjectEx, "CloneCurrentObjectEx"},
|
||||||
};
|
};
|
||||||
RegisterHandlers(functions);
|
RegisterHandlers(functions);
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx);
|
void ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx);
|
||||||
void DuplicateSession(Kernel::HLERequestContext& ctx);
|
void CloneCurrentObject(Kernel::HLERequestContext& ctx);
|
||||||
void DuplicateSessionEx(Kernel::HLERequestContext& ctx);
|
void CloneCurrentObjectEx(Kernel::HLERequestContext& ctx);
|
||||||
void QueryPointerBufferSize(Kernel::HLERequestContext& ctx);
|
void QueryPointerBufferSize(Kernel::HLERequestContext& ctx);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -158,15 +158,15 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext&
|
|||||||
|
|
||||||
auto* port = result.Unwrap();
|
auto* port = result.Unwrap();
|
||||||
|
|
||||||
Kernel::KScopedResourceReservation session_reservation(
|
// Kernel::KScopedResourceReservation session_reservation(
|
||||||
kernel.CurrentProcess()->GetResourceLimit(), Kernel::LimitableResource::Sessions);
|
// kernel.CurrentProcess()->GetResourceLimit(), Kernel::LimitableResource::Sessions);
|
||||||
R_UNLESS(session_reservation.Succeeded(), Kernel::ResultLimitReached);
|
// R_UNLESS(session_reservation.Succeeded(), Kernel::ResultLimitReached);
|
||||||
|
|
||||||
auto* session = Kernel::KSession::Create(kernel);
|
auto* session = Kernel::KSession::Create(kernel);
|
||||||
session->Initialize(&port->GetClientPort(), std::move(name));
|
session->Initialize(&port->GetClientPort(), std::move(name));
|
||||||
|
|
||||||
// Commit the session reservation.
|
// Commit the session reservation.
|
||||||
session_reservation.Commit();
|
// session_reservation.Commit();
|
||||||
|
|
||||||
if (port->GetServerPort().GetHLEHandler()) {
|
if (port->GetServerPort().GetHLEHandler()) {
|
||||||
port->GetServerPort().GetHLEHandler()->ClientConnected(&session->GetServerSession());
|
port->GetServerPort().GetHLEHandler()->ClientConnected(&session->GetServerSession());
|
||||||
|
Loading…
Reference in New Issue
Block a user