[PR #2037] [MERGED] Improved error handling in sceKernelAllocateDirectMemory #2455

Closed
opened 2026-02-27 21:16:34 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/2037
Author: @StevenMiller123
Created: 1/3/2025
Status: Merged
Merged: 2/5/2025
Merged by: @georgemoralis

Base: mainHead: allocate-fixes


📝 Commits (10+)

  • 0d1394a Handle errors in sceKernelAllocateDirectMemory
  • 32a8724 Improve accuracy of error cases
  • b3b68f5 Improve logging on errors
  • b0cbd2e Clang
  • ae1beca Merge branch 'shadps4-emu:main' into allocate-fixes
  • 6bd4c6b Merge branch 'shadps4-emu:main' into allocate-fixes
  • 0475e26 Merge branch 'shadps4-emu:main' into allocate-fixes
  • 5d3e2d8 Merge branch 'shadps4-emu:main' into allocate-fixes
  • 46e4678 Merge branch 'shadps4-emu:main' into allocate-fixes
  • e3f1e4c Merge branch 'shadps4-emu:main' into allocate-fixes

📊 Changes

2 files changed (+26 additions, -7 deletions)

View changed files

📝 src/core/libraries/kernel/memory.cpp (+22 -6)
📝 src/core/memory.cpp (+4 -1)

📄 Description

Some games, most notably the Call of Duty series of games, intentionally make sceKernelAllocateDirectMemory calls that fail. To match hardware behavior, we should return ORBIS_KERNEL_ERROR_EAGAIN instead of throwing an assert.

This should fix games that still hit Unable to find free direct memory area asserts after https://github.com/shadps4-emu/shadPS4/pull/1896.

Credits to @red-prig and @raphaelthegreat for helping with the error cases.

This needs testing, as it could hide deeper issues in some 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/2037 **Author:** [@StevenMiller123](https://github.com/StevenMiller123) **Created:** 1/3/2025 **Status:** ✅ Merged **Merged:** 2/5/2025 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `allocate-fixes` --- ### 📝 Commits (10+) - [`0d1394a`](https://github.com/shadps4-emu/shadPS4/commit/0d1394ac2b0658876a5d2f492e7b6976b16c3792) Handle errors in sceKernelAllocateDirectMemory - [`32a8724`](https://github.com/shadps4-emu/shadPS4/commit/32a8724635ced2ace83693989d680ac042ce660a) Improve accuracy of error cases - [`b3b68f5`](https://github.com/shadps4-emu/shadPS4/commit/b3b68f5c1fc585ba5c482e330b605aa4bb324a32) Improve logging on errors - [`b0cbd2e`](https://github.com/shadps4-emu/shadPS4/commit/b0cbd2e4ab9578b23b64c070e737293376f357d5) Clang - [`ae1beca`](https://github.com/shadps4-emu/shadPS4/commit/ae1beca725b17f9606586f7186c19816a08dc4e6) Merge branch 'shadps4-emu:main' into allocate-fixes - [`6bd4c6b`](https://github.com/shadps4-emu/shadPS4/commit/6bd4c6b02f3db135794ef0a539c76b07247b8887) Merge branch 'shadps4-emu:main' into allocate-fixes - [`0475e26`](https://github.com/shadps4-emu/shadPS4/commit/0475e263fae047243b89f4bf063c8a10cee43f10) Merge branch 'shadps4-emu:main' into allocate-fixes - [`5d3e2d8`](https://github.com/shadps4-emu/shadPS4/commit/5d3e2d80b635aceea091bd0518386b5131ed3e16) Merge branch 'shadps4-emu:main' into allocate-fixes - [`46e4678`](https://github.com/shadps4-emu/shadPS4/commit/46e467878aec1bfd935d82a788e5b63d4ca570ce) Merge branch 'shadps4-emu:main' into allocate-fixes - [`e3f1e4c`](https://github.com/shadps4-emu/shadPS4/commit/e3f1e4cf1ddd83470b6f67ba2a016877499a69c6) Merge branch 'shadps4-emu:main' into allocate-fixes ### 📊 Changes **2 files changed** (+26 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/core/libraries/kernel/memory.cpp` (+22 -6) 📝 `src/core/memory.cpp` (+4 -1) </details> ### 📄 Description Some games, most notably the Call of Duty series of games, intentionally make `sceKernelAllocateDirectMemory` calls that fail. To match hardware behavior, we should return `ORBIS_KERNEL_ERROR_EAGAIN` instead of throwing an assert. This should fix games that still hit `Unable to find free direct memory area` asserts after https://github.com/shadps4-emu/shadPS4/pull/1896. Credits to @red-prig and @raphaelthegreat for helping with the error cases. This needs testing, as it could hide deeper issues in some games. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:16:34 +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#2455
No description provided.