mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-26 12:55:14 -06:00
Improve stack clearing logic in ExecuteGuest
Added a check for fiber stacks before clearing the stack in ExecuteGuest. That fixes Gravity Rush 2 crash on Windows.
This commit is contained in:
parent
e0850d5cfc
commit
2f885b6c21
@ -59,9 +59,11 @@ void ClearStack() {
|
||||
|
||||
template <class ReturnType, class... FuncArgs, class... CallArgs>
|
||||
ReturnType ExecuteGuest(PS4_SYSV_ABI ReturnType (*func)(FuncArgs...), CallArgs&&... args) {
|
||||
EnsureThreadInitialized();
|
||||
// clear stack to avoid trash from EnsureThreadInitialized
|
||||
ClearStack<12_KB>();
|
||||
// clear stack to avoid trash from EnsureThreadInitialized (skip on fiber stacks)
|
||||
auto* tcb = GetTcbBase();
|
||||
if (tcb == nullptr || tcb->tcb_fiber == nullptr) {
|
||||
ClearStack<12_KB>();
|
||||
}
|
||||
return func(std::forward<CallArgs>(args)...);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user