A tool for deriving PKG packet encryption keys for ps4 written in c++
| 1 | // SPDX-FileCopyrightText: 2013 Dolphin Emulator Project |
| 2 | // SPDX-FileCopyrightText: 2014 Citra Emulator Project |
| 3 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 4 | |
| 5 | #pragma once |
| 6 | |
| 7 | #include <chrono> |
| 8 | #include "common/shadpkg_types.h" |
| 9 | |
| 10 | namespace Common { |
| 11 | |
| 12 | enum class ThreadPriority : u32 { |
| 13 | Low = 0, |
| 14 | Normal = 1, |
| 15 | High = 2, |
| 16 | VeryHigh = 3, |
| 17 | Critical = 4, |
| 18 | }; |
| 19 | |
| 20 | void SetCurrentThreadRealtime(std::chrono::nanoseconds period_ns); |
| 21 | |
| 22 | void SetCurrentThreadPriority(ThreadPriority new_priority); |
| 23 | |
| 24 | void SetCurrentThreadName(const char* name); |
| 25 | |
| 26 | void SetThreadName(void* thread, const char* name); |
| 27 | |
| 28 | class AccurateTimer { |
| 29 | std::chrono::nanoseconds target_interval{}; |
| 30 | std::chrono::nanoseconds total_wait{}; |
| 31 | |
| 32 | std::chrono::high_resolution_clock::time_point start_time; |
| 33 | |
| 34 | public: |
| 35 | explicit AccurateTimer(std::chrono::nanoseconds target_interval); |
| 36 | |
| 37 | void Start(); |
| 38 | |
| 39 | void End(); |
| 40 | |
| 41 | std::chrono::nanoseconds GetTotalWait() const { |
| 42 | return total_wait; |
| 43 | } |
| 44 | }; |
| 45 | |
| 46 | } // namespace Common |
| 47 |