[PR #250] [MERGED] Misc implementations and fixes. #1423

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

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/250
Author: @polybiusproxy
Created: 7/6/2024
Status: Merged
Merged: 7/11/2024
Merged by: @raphaelthegreat

Base: mainHead: filesystem


📝 Commits (10+)

  • ddeff9b Implement sceKernelFtruncate and sceKernelUnlink.
  • 45cf1bc Remove unused variable.
  • ec48aa8 Merge branch 'shadps4-emu:main' into filesystem
  • 27b87eb Implement sceKernelReserveVirtualRange, misc fixes
  • ff4584c Merge branch 'shadps4-emu:main' into filesystem
  • 7a83b74 Fix sceKernelReserveVirtualRange.
  • e531c77 Add TODO on reserve
  • c0f2f25 Replace comment with assert.
  • 9f8c674 Add missing copyright header
  • bc8e95d Add UNREACHABLE for IOFile::Unlink.

📊 Changes

15 files changed (+331 additions, -19 deletions)

View changed files

📝 CMakeLists.txt (+2 -0)
📝 src/common/io_file.cpp (+35 -2)
📝 src/common/io_file.h (+2 -0)
src/common/ntapi.cpp (+20 -0)
src/common/ntapi.h (+124 -0)
📝 src/core/address_space.cpp (+17 -2)
📝 src/core/address_space.h (+1 -1)
📝 src/core/libraries/kernel/file_system.cpp (+46 -1)
📝 src/core/libraries/kernel/libkernel.cpp (+1 -0)
📝 src/core/libraries/kernel/memory_management.cpp (+27 -0)
📝 src/core/libraries/kernel/memory_management.h (+1 -0)
📝 src/core/libraries/kernel/time_management.cpp (+2 -4)
📝 src/core/memory.cpp (+46 -9)
📝 src/core/memory.h (+3 -0)
📝 src/emulator.cpp (+4 -0)

📄 Description

This PR implements both the sceKernelFtruncate and sceKernelUnlink functions from libkernel.sprx.
As seen on games using PSPHD (Sony's PSP in-house emulator) - tested with CUSA05289.

PSPHD won't boot due to its start-up routine; at launch, it will try to create a temporary file, resize it - then delete it, and reserve (with sceKernelReserveVirtualRange) and map a ~4GB block of memory for that file.
This PR should improve PSPHD games by implementing the resize and delete methods.

Improves (shadps4-game-compatibility#124)


🔄 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/250 **Author:** [@polybiusproxy](https://github.com/polybiusproxy) **Created:** 7/6/2024 **Status:** ✅ Merged **Merged:** 7/11/2024 **Merged by:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Base:** `main` ← **Head:** `filesystem` --- ### 📝 Commits (10+) - [`ddeff9b`](https://github.com/shadps4-emu/shadPS4/commit/ddeff9bc01bd7af7906ba7ebad83ccc53c87bd99) Implement `sceKernelFtruncate` and `sceKernelUnlink`. - [`45cf1bc`](https://github.com/shadps4-emu/shadPS4/commit/45cf1bc98d03906a8051fded18d882ef826044f4) Remove unused variable. - [`ec48aa8`](https://github.com/shadps4-emu/shadPS4/commit/ec48aa8cd69140f22816024de1eac4ceb5b6a146) Merge branch 'shadps4-emu:main' into filesystem - [`27b87eb`](https://github.com/shadps4-emu/shadPS4/commit/27b87ebc35b2fca009ff478d6a7c070a0cc61f89) Implement `sceKernelReserveVirtualRange`, misc fixes - [`ff4584c`](https://github.com/shadps4-emu/shadPS4/commit/ff4584c14d1882171cce6e2b9f70912028df6e41) Merge branch 'shadps4-emu:main' into filesystem - [`7a83b74`](https://github.com/shadps4-emu/shadPS4/commit/7a83b74d3e372b3062025002c651707af1d404d4) Fix `sceKernelReserveVirtualRange`. - [`e531c77`](https://github.com/shadps4-emu/shadPS4/commit/e531c77fe04926e8707e4c62773bc477a0506ed1) Add TODO on reserve - [`c0f2f25`](https://github.com/shadps4-emu/shadPS4/commit/c0f2f2555592b1c4a93fbe8220791ca6dd2f0869) Replace comment with assert. - [`9f8c674`](https://github.com/shadps4-emu/shadPS4/commit/9f8c674ccea7b7af4050bb25e7c5d020f8893ca2) Add missing copyright header - [`bc8e95d`](https://github.com/shadps4-emu/shadPS4/commit/bc8e95dd6d01bc37fc4cc29ddaab472dd4592431) Add `UNREACHABLE` for `IOFile::Unlink`. ### 📊 Changes **15 files changed** (+331 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+2 -0) 📝 `src/common/io_file.cpp` (+35 -2) 📝 `src/common/io_file.h` (+2 -0) ➕ `src/common/ntapi.cpp` (+20 -0) ➕ `src/common/ntapi.h` (+124 -0) 📝 `src/core/address_space.cpp` (+17 -2) 📝 `src/core/address_space.h` (+1 -1) 📝 `src/core/libraries/kernel/file_system.cpp` (+46 -1) 📝 `src/core/libraries/kernel/libkernel.cpp` (+1 -0) 📝 `src/core/libraries/kernel/memory_management.cpp` (+27 -0) 📝 `src/core/libraries/kernel/memory_management.h` (+1 -0) 📝 `src/core/libraries/kernel/time_management.cpp` (+2 -4) 📝 `src/core/memory.cpp` (+46 -9) 📝 `src/core/memory.h` (+3 -0) 📝 `src/emulator.cpp` (+4 -0) </details> ### 📄 Description This PR implements both the `sceKernelFtruncate` and `sceKernelUnlink` functions from `libkernel.sprx`. As seen on games using PSPHD (Sony's PSP in-house emulator) - tested with CUSA05289. PSPHD won't boot due to its start-up routine; at launch, it will try to create a temporary file, resize it - then delete it, and reserve (with `sceKernelReserveVirtualRange`) and map a ~4GB block of memory for that file. This PR should improve PSPHD games by implementing the resize and delete methods. Improves [(shadps4-game-compatibility#124)](https://github.com/shadps4-emu/shadps4-game-compatibility/issues/124) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:12:29 +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#1423
No description provided.