early-access version 1673

main
pineappleEA 2021-05-11 20:41:28 +02:00
parent 24d9812c76
commit 544152130d
11 changed files with 38 additions and 47 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access
=============
This is the source code for early-access 1671.
This is the source code for early-access 1673.
## Legal Notice

View File

@ -150,8 +150,8 @@ public:
if (context->Session()->IsDomain()) {
context->AddDomainObject(std::move(iface));
} else {
kernel.CurrentProcess()->GetResourceLimit()->Reserve(
Kernel::LimitableResource::Sessions, 1);
// kernel.CurrentProcess()->GetResourceLimit()->Reserve(
// Kernel::LimitableResource::Sessions, 1);
auto* session = Kernel::KSession::Create(kernel);
session->Initialize(nullptr, iface->GetServiceName());

View File

@ -57,7 +57,7 @@ constexpr size_t SlabCountKSharedMemory = 80;
constexpr size_t SlabCountKTransferMemory = 200;
constexpr size_t SlabCountKCodeMemory = 10;
constexpr size_t SlabCountKDeviceAddressSpace = 300;
constexpr size_t SlabCountKSession = /*933*/ 40000;
constexpr size_t SlabCountKSession = 933;
constexpr size_t SlabCountKLightSession = 100;
constexpr size_t SlabCountKObjectName = 7;
constexpr size_t SlabCountKResourceLimit = 5;

View File

@ -58,9 +58,9 @@ bool KClientPort::IsSignaled() const {
ResultCode KClientPort::CreateSession(KClientSession** out) {
// Reserve a new session from the resource limit.
KScopedResourceReservation session_reservation(kernel.CurrentProcess()->GetResourceLimit(),
LimitableResource::Sessions);
R_UNLESS(session_reservation.Succeeded(), ResultLimitReached);
// KScopedResourceReservation session_reservation(kernel.CurrentProcess()->GetResourceLimit(),
// LimitableResource::Sessions);
// R_UNLESS(session_reservation.Succeeded(), ResultLimitReached);
// Update the session counts.
{
@ -104,7 +104,7 @@ ResultCode KClientPort::CreateSession(KClientSession** out) {
session->Initialize(this, parent->GetName());
// Commit the session reservation.
session_reservation.Commit();
// session_reservation.Commit();
// Register the session.
KSession::Register(kernel, session);

View File

@ -78,7 +78,7 @@ void KSession::OnClientClosed() {
void KSession::PostDestroy(uintptr_t arg) {
// Release the session count resource the owner process holds.
KProcess* owner = reinterpret_cast<KProcess*>(arg);
owner->GetResourceLimit()->Release(LimitableResource::Sessions, 1);
// owner->GetResourceLimit()->Release(LimitableResource::Sessions, 1);
owner->Close();
}

View File

@ -67,11 +67,11 @@ class KAutoObjectWithSlabHeapAndContainer : public Base {
private:
static Derived* Allocate(KernelCore& kernel) {
return kernel.SlabHeap<Derived>().AllocateWithKernel(kernel);
return new Derived(kernel);
}
static void Free(KernelCore& kernel, Derived* obj) {
kernel.SlabHeap<Derived>().Free(obj);
delete obj;
}
public:

View File

@ -169,10 +169,9 @@ private:
class IAudioDevice final : public ServiceFramework<IAudioDevice> {
public:
explicit IAudioDevice(Core::System& system_, u32_le revision_num)
: ServiceFramework{system_, "IAudioDevice"}, revision{revision_num},
buffer_event{system.Kernel()}, audio_input_device_switch_event{system.Kernel()},
audio_output_device_switch_event{system.Kernel()} {
explicit IAudioDevice(Core::System& system_, Kernel::KEvent& buffer_event_, u32_le revision_)
: ServiceFramework{system_, "IAudioDevice"}, buffer_event{buffer_event_}, revision{
revision_} {
static const FunctionInfo functions[] = {
{0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"},
{1, &IAudioDevice::SetAudioDeviceOutputVolume, "SetAudioDeviceOutputVolume"},
@ -189,18 +188,6 @@ public:
{13, nullptr, "GetAudioSystemMasterVolumeSetting"},
};
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:
@ -310,7 +297,7 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(audio_input_device_switch_event.GetReadableEvent());
rb.PushCopyObjects(buffer_event.GetReadableEvent());
}
void QueryAudioDeviceOutputEvent(Kernel::HLERequestContext& ctx) {
@ -318,17 +305,16 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 1};
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;
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
static const FunctionInfo functions[] = {
{0, &AudRenU::OpenAudioRenderer, "OpenAudioRenderer"},
@ -340,6 +326,9 @@ AudRenU::AudRenU(Core::System& system_) : ServiceFramework{system_, "audren:u"}
// clang-format on
RegisterHandlers(functions);
Kernel::KAutoObject::Create(std::addressof(buffer_event));
buffer_event.Initialize("IAudioOutBufferReleasedEvent");
}
AudRenU::~AudRenU() = default;
@ -662,7 +651,7 @@ void AudRenU::GetAudioDeviceService(Kernel::HLERequestContext& ctx) {
// always assumes the initial release revision (REV1).
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
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) {
@ -684,7 +673,7 @@ void AudRenU::GetAudioDeviceServiceWithRevisionInfo(Kernel::HLERequestContext& c
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IAudioDevice>(system, revision);
rb.PushIpcInterface<IAudioDevice>(system, buffer_event, revision);
}
void AudRenU::OpenAudioRendererImpl(Kernel::HLERequestContext& ctx) {

View File

@ -4,6 +4,7 @@
#pragma once
#include "core/hle/kernel/k_event.h"
#include "core/hle/service/service.h"
namespace Core {
@ -31,6 +32,7 @@ private:
void OpenAudioRendererImpl(Kernel::HLERequestContext& ctx);
std::size_t audren_instance_count = 0;
Kernel::KEvent buffer_event;
};
// Describes a particular audio feature that may be supported in a particular revision.

View File

@ -22,7 +22,7 @@ void Controller::ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx) {
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
// and that we probably want to actually make an entirely new Session, but we still need to
// verify this on hardware.
@ -41,10 +41,10 @@ void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) {
rb.PushMoveObjects(session->GetClientSession());
}
void Controller::DuplicateSessionEx(Kernel::HLERequestContext& ctx) {
void Controller::CloneCurrentObjectEx(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service, "called");
DuplicateSession(ctx);
CloneCurrentObject(ctx);
}
void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
@ -60,9 +60,9 @@ Controller::Controller(Core::System& system_) : ServiceFramework{system_, "IpcCo
static const FunctionInfo functions[] = {
{0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"},
{1, nullptr, "CopyFromCurrentDomain"},
{2, &Controller::DuplicateSession, "DuplicateSession"},
{2, &Controller::CloneCurrentObject, "CloneCurrentObject"},
{3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"},
{4, &Controller::DuplicateSessionEx, "DuplicateSessionEx"},
{4, &Controller::CloneCurrentObjectEx, "CloneCurrentObjectEx"},
};
RegisterHandlers(functions);
}

View File

@ -19,8 +19,8 @@ public:
private:
void ConvertCurrentObjectToDomain(Kernel::HLERequestContext& ctx);
void DuplicateSession(Kernel::HLERequestContext& ctx);
void DuplicateSessionEx(Kernel::HLERequestContext& ctx);
void CloneCurrentObject(Kernel::HLERequestContext& ctx);
void CloneCurrentObjectEx(Kernel::HLERequestContext& ctx);
void QueryPointerBufferSize(Kernel::HLERequestContext& ctx);
};

View File

@ -158,15 +158,15 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext&
auto* port = result.Unwrap();
Kernel::KScopedResourceReservation session_reservation(
kernel.CurrentProcess()->GetResourceLimit(), Kernel::LimitableResource::Sessions);
R_UNLESS(session_reservation.Succeeded(), Kernel::ResultLimitReached);
// Kernel::KScopedResourceReservation session_reservation(
// kernel.CurrentProcess()->GetResourceLimit(), Kernel::LimitableResource::Sessions);
// R_UNLESS(session_reservation.Succeeded(), Kernel::ResultLimitReached);
auto* session = Kernel::KSession::Create(kernel);
session->Initialize(&port->GetClientPort(), std::move(name));
// Commit the session reservation.
session_reservation.Commit();
// session_reservation.Commit();
if (port->GetServerPort().GetHLEHandler()) {
port->GetServerPort().GetHLEHandler()->ClientConnected(&session->GetServerSession());