From 9e563d590b024019221816cd2879fa8d268836a3 Mon Sep 17 00:00:00 2001
From: Michael Scire <SciresM@gmail.com>
Date: Wed, 14 Apr 2021 00:41:31 -0700
Subject: [PATCH] pm: account for 12.0.0 resource limit changes

---
 stratosphere/pm/source/impl/pm_resource_manager.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/stratosphere/pm/source/impl/pm_resource_manager.cpp b/stratosphere/pm/source/impl/pm_resource_manager.cpp
index 9a726ced4..2a9e7e697 100644
--- a/stratosphere/pm/source/impl/pm_resource_manager.cpp
+++ b/stratosphere/pm/source/impl/pm_resource_manager.cpp
@@ -36,6 +36,8 @@ namespace ams::pm::resource {
         constexpr size_t ExtraSystemSessionCount600  = 100;
         constexpr size_t ReservedMemorySize600       = 5_MB;
         constexpr size_t ExtraSystemSessionCount920  = 33;
+        constexpr size_t ExtraSystemEventCount1200   = 200;
+        constexpr size_t ExtraSystemSessionCount1200 = 200;
 
         /* Atmosphere always allocates extra memory for system usage. */
         constexpr size_t ExtraSystemMemorySizeAtmosphere    = 24_MB;
@@ -221,6 +223,11 @@ namespace ams::pm::resource {
             /* 9.2.0 increased the system session limit. */
             g_resource_limits[ResourceLimitGroup_System][svc::LimitableResource_SessionCountMax] += ExtraSystemSessionCount920;
         }
+        if (hos_version >= hos::Version_12_0_0) {
+            /* 12.0.0 increased the system event and session limits. */
+            g_resource_limits[ResourceLimitGroup_System][svc::LimitableResource_EventCountMax]   += ExtraSystemEventCount1200;
+            g_resource_limits[ResourceLimitGroup_System][svc::LimitableResource_SessionCountMax] += ExtraSystemSessionCount1200;
+        }
 
         /* 7.0.0+: Calculate the number of extra application threads available. */
         if (hos::GetVersion() >= hos::Version_7_0_0) {