[PR #4058] Calculate flex memory size #3905

Open
opened 2026-02-27 22:05:24 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/4058
Author: @par274
Created: 2/20/2026
Status: 🔄 Open

Base: mainHead: calculate-flex-memory-size


📝 Commits (10+)

  • 6df7bea rework flexible memory usage tracking
  • e14ae0c exclude trampoline from code mapping
  • 2ca77d0 need sleep
  • 52e462b clang-format
  • 89171d8 map and register host trampoline for x86_64 patching
  • c5e401d clang-format (I always forget this)
  • 7e2af62 avoid std::prev(begin())
  • da725d9 System modules should not consume the game's flexible memory
  • f459e8b Merge remote-tracking branch 'upstream' into calculate-flex-memory-size
  • cdec57a optimize: unnecessary overhead

📊 Changes

3 files changed (+252 additions, -13 deletions)

View changed files

📝 src/core/memory.cpp (+183 -5)
📝 src/core/memory.h (+58 -5)
📝 src/core/module.cpp (+11 -3)

📄 Description

Based on: https://github.com/shadps4-emu/shadPS4/pull/4055#issuecomment-3930957339

I'm calculating flexible memory accounting based on VMM; module code is counted towards the flexible quota; host-side trampoline region is not counted.

This can solve some startup problems in games like Uncharted 4 and TLOU2.

I'm still learning process, ttrampoline will probably cause problems in other games.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/4058 **Author:** [@par274](https://github.com/par274) **Created:** 2/20/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `calculate-flex-memory-size` --- ### 📝 Commits (10+) - [`6df7bea`](https://github.com/shadps4-emu/shadPS4/commit/6df7bea0143b796cb45674def49e971905a34182) rework flexible memory usage tracking - [`e14ae0c`](https://github.com/shadps4-emu/shadPS4/commit/e14ae0c3d9cc471000533624b47d43a500cc0979) exclude trampoline from code mapping - [`2ca77d0`](https://github.com/shadps4-emu/shadPS4/commit/2ca77d0895ab737287ac8583babdd91c3a31eb10) need sleep - [`52e462b`](https://github.com/shadps4-emu/shadPS4/commit/52e462b4ef343f69722fb0754ff9808e29f62569) clang-format - [`89171d8`](https://github.com/shadps4-emu/shadPS4/commit/89171d89bf6694f8dbb4dd9bce5fec7479187c92) map and register host trampoline for x86_64 patching - [`c5e401d`](https://github.com/shadps4-emu/shadPS4/commit/c5e401d2155873ffd614244a32b56ed1c778ddc7) clang-format (I always forget this) - [`7e2af62`](https://github.com/shadps4-emu/shadPS4/commit/7e2af62e566abea33ab0afe7984e8e5b03b0138c) avoid std::prev(begin()) - [`da725d9`](https://github.com/shadps4-emu/shadPS4/commit/da725d9312cec3e35e9c48de4e9022a571b1e728) System modules should not consume the game's flexible memory - [`f459e8b`](https://github.com/shadps4-emu/shadPS4/commit/f459e8ba76a4ff7d9ecc9d78d2450573a1d39114) Merge remote-tracking branch 'upstream' into calculate-flex-memory-size - [`cdec57a`](https://github.com/shadps4-emu/shadPS4/commit/cdec57acb8aa410821eb78084f3c59bed917b899) optimize: unnecessary overhead ### 📊 Changes **3 files changed** (+252 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `src/core/memory.cpp` (+183 -5) 📝 `src/core/memory.h` (+58 -5) 📝 `src/core/module.cpp` (+11 -3) </details> ### 📄 Description Based on: https://github.com/shadps4-emu/shadPS4/pull/4055#issuecomment-3930957339 I'm calculating flexible memory accounting based on VMM; module code is counted towards the flexible quota; host-side trampoline region is not counted. This can solve some startup problems in games like Uncharted 4 and TLOU2. I'm still learning process, ttrampoline will probably cause problems in other games. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#3905
No description provided.