Refactor ExecuteGuest to simplify stack clearing logic

This enough for GR2
This commit is contained in:
Valdis Bogdāns 2026-02-14 02:57:04 +02:00 committed by GitHub
parent 2f885b6c21
commit 5ae377decf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,9 +59,9 @@ void ClearStack() {
template <class ReturnType, class... FuncArgs, class... CallArgs>
ReturnType ExecuteGuest(PS4_SYSV_ABI ReturnType (*func)(FuncArgs...), CallArgs&&... args) {
// clear stack to avoid trash from EnsureThreadInitialized (skip on fiber stacks)
// clear stack to avoid trash from EnsureThreadInitialized
auto* tcb = GetTcbBase();
if (tcb == nullptr || tcb->tcb_fiber == nullptr) {
if (tcb == nullptr) {
ClearStack<12_KB>();
}
return func(std::forward<CallArgs>(args)...);