mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-07-16 02:01:02 +00:00
GR2-win-crash-fix (#4033)
* 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. * Refactor ExecuteGuest to simplify stack clearing logic This enough for GR2 * Recover thread initialization in ExecuteGuest function * Enhance null check for thread control block * Fix condition to check tcb before clearing stack
This commit is contained in:
@@ -61,7 +61,10 @@ 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>();
|
||||
auto* tcb = GetTcbBase();
|
||||
if (tcb != nullptr && tcb->tcb_fiber == nullptr) {
|
||||
ClearStack<12_KB>();
|
||||
}
|
||||
return func(std::forward<CallArgs>(args)...);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user