From 29215c945d8567e947f115a6d082caf038185969 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 10 Jun 2021 22:22:25 +0200 Subject: [PATCH] early-access version 1776 --- README.md | 2 +- src/common/host_memory.cpp | 11 +++++------ src/core/hle/service/service.h | 5 ++++- src/core/hle/service/sm/sm.cpp | 26 +++++++++----------------- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 4722a24dd..3c507a991 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1775. +This is the source code for early-access 1776. ## Legal Notice diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp index 7a6462737..9ae384f01 100755 --- a/src/common/host_memory.cpp +++ b/src/common/host_memory.cpp @@ -59,12 +59,11 @@ using PFN_VirtualAlloc2 = _Ret_maybenull_ PVOID(WINAPI*)( _Inout_updates_opt_(ParameterCount) MEM_EXTENDED_PARAMETER* ExtendedParameters, _In_ ULONG ParameterCount); -using PFN_MapViewOfFile3 = _Ret_maybenull_ __out_data_source(FILE) - PVOID(WINAPI*)(_In_ HANDLE FileMapping, _In_opt_ HANDLE Process, _In_opt_ PVOID BaseAddress, - _In_ ULONG64 Offset, _In_ SIZE_T ViewSize, _In_ ULONG AllocationType, - _In_ ULONG PageProtection, - _Inout_updates_opt_(ParameterCount) MEM_EXTENDED_PARAMETER* ExtendedParameters, - _In_ ULONG ParameterCount); +using PFN_MapViewOfFile3 = _Ret_maybenull_ PVOID(WINAPI*)( + _In_ HANDLE FileMapping, _In_opt_ HANDLE Process, _In_opt_ PVOID BaseAddress, + _In_ ULONG64 Offset, _In_ SIZE_T ViewSize, _In_ ULONG AllocationType, _In_ ULONG PageProtection, + _Inout_updates_opt_(ParameterCount) MEM_EXTENDED_PARAMETER* ExtendedParameters, + _In_ ULONG ParameterCount); using PFN_UnmapViewOfFile2 = BOOL(WINAPI*)(_In_ HANDLE Process, _In_ PVOID BaseAddress, _In_ ULONG UnmapFlags); diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 6c5bf3a95..e078ac176 100755 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -41,7 +41,10 @@ class ServiceManager; } /// Default number of maximum connections to a server session. -static constexpr u32 ServerSessionCountMax = 0x10000; +static constexpr u32 ServerSessionCountMax = 0x40; +static_assert(ServerSessionCountMax == 0x40, + "ServerSessionCountMax isn't 0x40 somehow, this assert is a reminder that this will " + "break lots of things"); /** * This is an non-templated base of ServiceFramework to reduce code bloat and compilation times, it diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index a1e1a7d76..c7828c3bd 100755 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -151,27 +151,19 @@ ResultVal SM::GetServiceImpl(Kernel::HLERequestContext& std::string name(PopServiceName(rp)); // Find the named port. - auto result = service_manager.GetServicePort(name); - if (result.Failed()) { - LOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, result.Code().raw); - return result.Code(); + auto port_result = service_manager.GetServicePort(name); + if (port_result.Failed()) { + LOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, port_result.Code().raw); + return port_result.Code(); } - auto* port = result.Unwrap(); - - // Reserve a new session from the process resource limit. - Kernel::KScopedResourceReservation session_reservation( - kernel.CurrentProcess()->GetResourceLimit(), Kernel::LimitableResource::Sessions); - R_UNLESS(session_reservation.Succeeded(), Kernel::ResultLimitReached); + auto& port = port_result.Unwrap()->GetClientPort(); // Create a new session. Kernel::KClientSession* session{}; - port->GetClientPort().CreateSession(std::addressof(session)); - - // Commit the session reservation. - session_reservation.Commit(); - - // Enqueue the session with the named port. - port->EnqueueSession(&session->GetParent()->GetServerSession()); + if (const auto result = port.CreateSession(std::addressof(session)); result.IsError()) { + LOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, result.raw); + return result; + } LOG_DEBUG(Service_SM, "called service={} -> session={}", name, session->GetId());