[PR #2803] [MERGED] libkernel: Fix sceKernelAllocateDirectMemory and sceKernelAvailableDirectMemorySize #2990

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

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/2803
Author: @StevenMiller123
Created: 4/18/2025
Status: Merged
Merged: 4/18/2025
Merged by: @georgemoralis

Base: mainHead: dmem-fixes


📝 Commits (8)

📊 Changes

2 files changed (+42 additions, -25 deletions)

View changed files

📝 src/core/libraries/kernel/memory.cpp (+1 -1)
📝 src/core/memory.cpp (+41 -24)

📄 Description

Both sceKernelAllocateDirectMemory and sceKernelAvailableDirectMemorySize handled the search area parameters improperly. This PR adjusts these functions to behave closer to observed hardware behavior.

Real hardware:
image

Main:
image

This PR:
image

I've also reduced the log severity of sceKernelGetDirectMemorySize, since it's behavior appears to be hardware accurate.

So far I've tested a few games and it seems like it doesn't break anything. Wouldn't hurt to have more people test though.


🔄 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/2803 **Author:** [@StevenMiller123](https://github.com/StevenMiller123) **Created:** 4/18/2025 **Status:** ✅ Merged **Merged:** 4/18/2025 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `dmem-fixes` --- ### 📝 Commits (8) - [`8e351de`](https://github.com/shadps4-emu/shadPS4/commit/8e351de4defb5d6ebd1ce51d56115218c6d746e3) AllocateDirectMemory fixes - [`8442408`](https://github.com/shadps4-emu/shadPS4/commit/84424088a43b73c0e80aacf5987f10254333271e) DirectQueryAvailable fixes - [`7ba45e3`](https://github.com/shadps4-emu/shadPS4/commit/7ba45e3a351da7ed4bd6356cd01d3c27d102ed2c) Reduce sceKernelGetDirectMemorySize log severity - [`e92053a`](https://github.com/shadps4-emu/shadPS4/commit/e92053aa63997f41410565bbc43bba0405c73a59) Clang - [`6c277d7`](https://github.com/shadps4-emu/shadPS4/commit/6c277d7c6c5fda2b6cd4b4bd3570ebb8d4c98d28) Fix phys_addr_out - [`d4b7ebc`](https://github.com/shadps4-emu/shadPS4/commit/d4b7ebc484e9fea68e38fb0c65a72a1e3629a72e) Dividing by zero is fun - [`ffefe2d`](https://github.com/shadps4-emu/shadPS4/commit/ffefe2d2d37473ac7cec645ba959cac910b50c2e) Update memory.cpp - [`008b1cd`](https://github.com/shadps4-emu/shadPS4/commit/008b1cd656893fa2d3bf64e92baec18114d0df7c) Clang ### 📊 Changes **2 files changed** (+42 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `src/core/libraries/kernel/memory.cpp` (+1 -1) 📝 `src/core/memory.cpp` (+41 -24) </details> ### 📄 Description Both sceKernelAllocateDirectMemory and sceKernelAvailableDirectMemorySize handled the search area parameters improperly. This PR adjusts these functions to behave closer to observed hardware behavior. Real hardware: ![image](https://github.com/user-attachments/assets/5eed3042-6ec7-4007-bfa5-116c014d560d) Main: ![image](https://github.com/user-attachments/assets/5caf0132-0588-4a2e-901b-9d17cb3c176f) This PR: ![image](https://github.com/user-attachments/assets/15241d55-1027-43df-ba0d-b087b3322da8) I've also reduced the log severity of sceKernelGetDirectMemorySize, since it's behavior appears to be hardware accurate. So far I've tested a few games and it seems like it doesn't break anything. Wouldn't hurt to have more people test though. --- <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:01 +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#2990
No description provided.