[PR #615] [MERGED] memory: Fixes for direct memory allocation. #1668

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

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/615
Author: @squidbus
Created: 8/27/2024
Status: Merged
Merged: 8/28/2024
Merged by: @raphaelthegreat

Base: mainHead: memory


📝 Commits (3)

  • ca9360a memory: Size direct memory based on requested flexible memory.
  • f48b92e memory: Guard against OrbisProcParam without an OrbisKernelMemParam.
  • 66114c9 memory: Account for alignment in direct memory suitability checks and add more debugging.

📊 Changes

5 files changed (+60 additions, -22 deletions)

View changed files

📝 src/core/libraries/kernel/memory_management.cpp (+5 -4)
📝 src/core/libraries/kernel/memory_management.h (+1 -1)
📝 src/core/linker.cpp (+13 -5)
📝 src/core/memory.cpp (+35 -9)
📝 src/core/memory.h (+6 -3)

📄 Description

Sizes the direct memory area based on the flexible memory size requested by the game.

SCE_KERNEL_MAIN_DMEM_SIZE is set to the total of direct memory and flexible memory, and the flexible memory is removed from that total to arrive at the direct memory size. sceKernelGetDirectMemorySize() replaces most uses of the constant to make sure the proper calculated size is used.

This PR also fixes some areas where requested alignment was not taken into account for the size of an available direct memory region.

This fixes some games hitting Unable to find free direct memory area in https://github.com/shadps4-emu/shadPS4/issues/601


🔄 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/615 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 8/27/2024 **Status:** ✅ Merged **Merged:** 8/28/2024 **Merged by:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Base:** `main` ← **Head:** `memory` --- ### 📝 Commits (3) - [`ca9360a`](https://github.com/shadps4-emu/shadPS4/commit/ca9360a865fb4d28578b25da244b66d5d4483133) memory: Size direct memory based on requested flexible memory. - [`f48b92e`](https://github.com/shadps4-emu/shadPS4/commit/f48b92eefd6bb41d5b86cb930661d062fb34efc8) memory: Guard against OrbisProcParam without an OrbisKernelMemParam. - [`66114c9`](https://github.com/shadps4-emu/shadPS4/commit/66114c927286271c328c1ec3994dd87a491fa5f1) memory: Account for alignment in direct memory suitability checks and add more debugging. ### 📊 Changes **5 files changed** (+60 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `src/core/libraries/kernel/memory_management.cpp` (+5 -4) 📝 `src/core/libraries/kernel/memory_management.h` (+1 -1) 📝 `src/core/linker.cpp` (+13 -5) 📝 `src/core/memory.cpp` (+35 -9) 📝 `src/core/memory.h` (+6 -3) </details> ### 📄 Description Sizes the direct memory area based on the flexible memory size requested by the game. `SCE_KERNEL_MAIN_DMEM_SIZE` is set to the total of direct memory and flexible memory, and the flexible memory is removed from that total to arrive at the direct memory size. `sceKernelGetDirectMemorySize()` replaces most uses of the constant to make sure the proper calculated size is used. This PR also fixes some areas where requested alignment was not taken into account for the size of an available direct memory region. This fixes some games hitting `Unable to find free direct memory area` in https://github.com/shadps4-emu/shadPS4/issues/601 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:13:30 +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#1668
No description provided.