A tool for deriving PKG packet encryption keys for ps4 written in c++
| 1 | // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include <memory> |
| 7 | |
| 8 | namespace Common { |
| 9 | |
| 10 | template <class T> |
| 11 | class Singleton { |
| 12 | public: |
| 13 | static T* Instance() { |
| 14 | if (!m_instance) { |
| 15 | m_instance = std::make_unique<T>(); |
| 16 | } |
| 17 | return m_instance.get(); |
| 18 | } |
| 19 | |
| 20 | protected: |
| 21 | Singleton(); |
| 22 | ~Singleton(); |
| 23 | |
| 24 | private: |
| 25 | static inline std::unique_ptr<T> m_instance{}; |
| 26 | }; |
| 27 | |
| 28 | } // namespace Common |
| 29 |