mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-24 13:35:20 +00:00
Fix sceNpTrophyRegisterContext
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 gcc (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04-arm clang (push) Waiting to run
Build RPCS3 / RPCS3 Linux ubuntu-24.04 clang (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
This commit is contained in:
parent
a928e8a3db
commit
5ca5b54bf6
1 changed files with 14 additions and 12 deletions
|
@ -716,9 +716,9 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
|
|||
|
||||
lock2.unlock();
|
||||
|
||||
struct register_context_thread : register_context_thread_name
|
||||
lv2_obj::sleep(ppu);
|
||||
{
|
||||
void operator()(s32 progress_cb_count, u32 context, vm::ptr<SceNpTrophyStatusCallback> statusCb, vm::ptr<void> arg) const
|
||||
const s32 progress_cb_count = ::narrow<s32>(tropusr->GetTrophiesCount()) - 1;
|
||||
{
|
||||
// This emulates vsh sending the events and ensures that not 2 events are processed at once
|
||||
const std::pair<SceNpTrophyStatus, s32> statuses[] =
|
||||
|
@ -732,6 +732,13 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
|
|||
// Create a counter which is destroyed after the function ends
|
||||
const auto queued = std::make_shared<atomic_t<u32>>(0);
|
||||
|
||||
u32 total_events = 0;
|
||||
|
||||
for (auto status : statuses)
|
||||
{
|
||||
total_events += status.second + 1;
|
||||
}
|
||||
|
||||
for (auto status : statuses)
|
||||
{
|
||||
for (s32 completed = 0; completed <= status.second; completed++)
|
||||
|
@ -754,8 +761,9 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
|
|||
|
||||
u64 current = get_system_time();
|
||||
|
||||
const u64 until_max = current + 300'000;
|
||||
const u64 until_min = current + 100'000;
|
||||
// Minimum register trophy time 2 seconds globally.
|
||||
const u64 until_min = current + (2'000'000 / total_events);
|
||||
const u64 until_max = until_min + 50'000;
|
||||
|
||||
// If too much time passes just send the rest of the events anyway
|
||||
for (u32 old_value = *queued; current < (old_value ? until_max : until_min);
|
||||
|
@ -772,19 +780,13 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
|
|||
|
||||
if (thread_ctrl::state() == thread_state::aborting)
|
||||
{
|
||||
return;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
lv2_obj::sleep(ppu);
|
||||
|
||||
g_fxo->get<named_thread<register_context_thread>>()(::narrow<s32>(tropusr->GetTrophiesCount()) - 1, context, statusCb, arg);
|
||||
|
||||
thread_ctrl::wait_for(200'000);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue