mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-25 15:56:00 +03:00
[PR #1681] [MERGED] The way to Unity, pt.3 #2243
Labels
No labels
Bloodborne
bug
contributor wanted
documentation
enhancement
frontend
good first issue
help wanted
linux
pull-request
question
release
verification progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/shadPS4#2243
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/shadps4-emu/shadPS4/pull/1681
Author: @polybiusproxy
Created: 12/7/2024
Status: ✅ Merged
Merged: 12/8/2024
Merged by: @georgemoralis
Base:
main← Head:unity-pt3📝 Commits (1)
df19a82The way to Unity, pt.3📊 Changes
17 files changed (+256 additions, -50 deletions)
View changed files
📝
src/common/ntapi.cpp(+2 -0)📝
src/common/ntapi.h(+20 -0)📝
src/core/libraries/ajm/ajm_context.cpp(+2 -0)📝
src/core/libraries/kernel/kernel.cpp(+2 -1)📝
src/core/libraries/kernel/memory.cpp(+1 -2)📝
src/core/libraries/kernel/process.cpp(+11 -4)📝
src/core/libraries/kernel/sync/semaphore.h(+29 -13)📝
src/core/libraries/kernel/threads/event_flag.cpp(+29 -1)📝
src/core/libraries/kernel/threads/exception.cpp(+40 -10)📝
src/core/libraries/kernel/threads/pthread.cpp(+2 -0)📝
src/core/libraries/kernel/threads/semaphore.cpp(+96 -12)📝
src/core/libraries/save_data/save_backup.cpp(+1 -1)📝
src/core/libraries/save_data/save_memory.cpp(+1 -1)📝
src/core/linker.h(+9 -0)📝
src/core/memory.cpp(+5 -3)📝
src/core/memory.h(+2 -2)📝
src/imgui/renderer/texture_manager.cpp(+4 -0)📄 Description
This should be the last of my PR series regarding Unity. The last main thing to implement is exception support.
To emulate POSIX's behavior, we will use special user APCs, which will allow us to 'inject' code on a remote thread, regardless of what the thread was executing—when the APC returns, the thread goes back to what it was executing.
The only caveat is that APCs won't execute if the thread is on a non-alertable wait at the time of the APC raise. This is why we did a rework of sync primitives in part 2, using wrappers that use Win32 sync primitives and WaitForSingleObjectEx.
To make use of APCs, we use
NtQueueApcThreadExand rely on its undocumented behavior to have x86 context on the APC routine as well (thanks to red_prig and Roamic).In addition, this PR does some additional fixes on the linker to improve Unity games further—if
sceKernelLoadStartModuleis called more than once for a module, a handle will be returned instead of loading and calling the module'smodule_startfunction again. This fixes both crashes and race conditions on later Unity games.Event flag cancelling is also implemented as seen on Unity (makes no effect, but it's nice to have).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.