[PR #2938] [MERGED] Proper error handling for MapMemory errors #3096

Closed
opened 2026-02-27 22:02:25 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/2938
Author: @StevenMiller123
Created: 5/15/2025
Status: Merged
Merged: 5/16/2025
Merged by: @georgemoralis

Base: mainHead: mapmemory-assert-remove


📝 Commits (9)

  • e250119 Properly handle ENOMEM error return in MapMemory
  • 582766f Merge branch 'shadps4-emu:main' into mapmemory-assert-remove
  • aff59c3 Merge branch 'shadps4-emu:main' into mapmemory-assert-remove
  • 88b1e0d Merge branch 'shadps4-emu:main' into mapmemory-assert-remove
  • 1d319ee Change error message
  • dc25dd6 Clang
  • fbab952 Attempt to handle MemoryMapFlags::NoOverwrite
  • 8258a4b Fix flag description
  • 1296c1f Move overwrite check to while condition

📊 Changes

1 file changed (+8 additions, -5 deletions)

View changed files

📝 src/core/memory.cpp (+8 -5)

📄 Description

On real hardware, most functions we've attached to MapMemory will return ENOMEM if they've got flag MAP_FIXED and try mapping to already mapped addresses.

Handling this error case properly is necessary for Assassin's Creed® Unity (CUSA00663) and Need for Speed™ Heat (CUSA15081) to progress further.

Once this is merged, I'll probably start an aggregate issue for tracking known memory issues, as this will make it harder to identify them.


🔄 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/2938 **Author:** [@StevenMiller123](https://github.com/StevenMiller123) **Created:** 5/15/2025 **Status:** ✅ Merged **Merged:** 5/16/2025 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `mapmemory-assert-remove` --- ### 📝 Commits (9) - [`e250119`](https://github.com/shadps4-emu/shadPS4/commit/e25011937f68269d9d42df954123444b25038daf) Properly handle ENOMEM error return in MapMemory - [`582766f`](https://github.com/shadps4-emu/shadPS4/commit/582766f78efa555de6c0c2362d6c9c195fa14517) Merge branch 'shadps4-emu:main' into mapmemory-assert-remove - [`aff59c3`](https://github.com/shadps4-emu/shadPS4/commit/aff59c3519807d09fded10fa3e0582bdbccfca61) Merge branch 'shadps4-emu:main' into mapmemory-assert-remove - [`88b1e0d`](https://github.com/shadps4-emu/shadPS4/commit/88b1e0da8aeffa8bc2b653bc138e40d7a24c7b06) Merge branch 'shadps4-emu:main' into mapmemory-assert-remove - [`1d319ee`](https://github.com/shadps4-emu/shadPS4/commit/1d319ee51ff0f9a0b64b8c5880184c871e84c9f8) Change error message - [`dc25dd6`](https://github.com/shadps4-emu/shadPS4/commit/dc25dd683583818ca2524e444a8ca29172034c4e) Clang - [`fbab952`](https://github.com/shadps4-emu/shadPS4/commit/fbab9524726f378be6e194007f528f7347d48249) Attempt to handle MemoryMapFlags::NoOverwrite - [`8258a4b`](https://github.com/shadps4-emu/shadPS4/commit/8258a4b66ff55a736417bc9131af80825b62d84f) Fix flag description - [`1296c1f`](https://github.com/shadps4-emu/shadPS4/commit/1296c1fe8082f45d64fba31092f2bfae303e6f3b) Move overwrite check to while condition ### 📊 Changes **1 file changed** (+8 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/core/memory.cpp` (+8 -5) </details> ### 📄 Description On real hardware, most functions we've attached to MapMemory will return ENOMEM if they've got flag `MAP_FIXED` and try mapping to already mapped addresses. Handling this error case properly is necessary for Assassin's Creed® Unity (CUSA00663) and Need for Speed™ Heat (CUSA15081) to progress further. Once this is merged, I'll probably start an aggregate issue for tracking known memory issues, as this will make it harder to identify them. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:02:25 +03:00
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#3096
No description provided.