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 <array> |
| 7 | #include <cstdint> |
| 8 | |
| 9 | using s8 = std::int8_t; |
| 10 | using s16 = std::int16_t; |
| 11 | using s32 = std::int32_t; |
| 12 | using s64 = std::int64_t; |
| 13 | |
| 14 | using u8 = std::uint8_t; |
| 15 | using u16 = std::uint16_t; |
| 16 | using u32 = std::uint32_t; |
| 17 | using u64 = std::uint64_t; |
| 18 | |
| 19 | using f32 = float; |
| 20 | using f64 = double; |
| 21 | |
| 22 | using u128 = std::array<std::uint64_t, 2>; |
| 23 | static_assert(sizeof(u128) == 16, "u128 must be 128 bits wide"); |
| 24 | |
| 25 | using VAddr = uintptr_t; |
| 26 | using PAddr = uintptr_t; |
| 27 | |
| 28 | #define PS4_SYSV_ABI __attribute__((sysv_abi)) |
| 29 | |
| 30 | // UDLs for memory size values |
| 31 | constexpr unsigned long long operator""_KB(unsigned long long x) { |
| 32 | return 1024ULL * x; |
| 33 | } |
| 34 | constexpr unsigned long long operator""_MB(unsigned long long x) { |
| 35 | return 1024_KB * x; |
| 36 | } |
| 37 | constexpr unsigned long long operator""_GB(unsigned long long x) { |
| 38 | return 1024_MB * x; |
| 39 | } |
| 40 |