web: introduce browser memory patching

With 23.0.0 we have even less memory available which is causing the browser (openWeb) and eshop (systemWeb) applets to crash immediately.
While the amount of memory required by the browser applets didn't change this time, just implementing 23.0.0 changes was enough to push it over the limit.
Instead of reducing the memory available to us even further, this convoluted set of patches attempts to reclaim around 9 MB of unused browser memory.
This commit is contained in:
hexkyz
2026-09-27 01:35:29 +01:00
parent 2ae182bd5d
commit 59e7786a45
3 changed files with 80 additions and 1 deletions

View File

@@ -357,7 +357,12 @@ namespace ams::kern::board::nintendo::nx {
/* Return (possibly) adjusted size. */
/* NOTE: On 20.0.0+ (and even more-so 21.0.0+) the browser requires much more memory in the applet pool in order to function. */
/* Thus, we have to reduce our extra system memory size by 26 MB to compensate. */
if (kern::GetTargetFirmware() >= ams::TargetFirmware_21_0_0) {
/* NOTE: On 23.0.0+ we are patching memory allocation for each browser applet since there are only 3 of them now. */
/* Given that the root "Reserved" region is 0x43E000 bytes and the "ReservedTbd" subregion is 0x540000 bytes, we can safely reclaim 9MB.*/
if (kern::GetTargetFirmware() >= ams::TargetFirmware_23_0_0) {
constexpr size_t ExtraSystemMemoryForAtmosphere_23_0_0 = 16_MB;
return base_pool_size - ExtraSystemMemoryForAtmosphere_23_0_0 - KTraceBufferSize;
} else if (kern::GetTargetFirmware() >= ams::TargetFirmware_21_0_0) {
constexpr size_t ExtraSystemMemoryForAtmosphere_21_0_0 = 7_MB;
return base_pool_size - ExtraSystemMemoryForAtmosphere_21_0_0 - KTraceBufferSize;
} else if (kern::GetTargetFirmware() >= ams::TargetFirmware_20_0_0) {