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 <filesystem> |
| 7 | #include <string> |
| 8 | #include <vector> |
| 9 | #include "common/shadpkg_types.h" |
| 10 | |
| 11 | class Splash { |
| 12 | public: |
| 13 | struct ImageInfo { |
| 14 | u32 width; |
| 15 | u32 height; |
| 16 | u32 num_channels; |
| 17 | |
| 18 | u32 GetSizeBytes() const { |
| 19 | return width * height * 4; // we always forcing rgba8 for simplicity |
| 20 | } |
| 21 | }; |
| 22 | |
| 23 | Splash() = default; |
| 24 | ~Splash() = default; |
| 25 | |
| 26 | bool Open(const std::filesystem::path& filepath); |
| 27 | [[nodiscard]] bool IsLoaded() const { |
| 28 | return img_data.size(); |
| 29 | } |
| 30 | |
| 31 | const auto& GetImageData() const { |
| 32 | return img_data; |
| 33 | } |
| 34 | |
| 35 | ImageInfo GetImageInfo() const { |
| 36 | return img_info; |
| 37 | } |
| 38 | |
| 39 | private: |
| 40 | ImageInfo img_info{}; |
| 41 | std::vector<u8> img_data{}; |
| 42 | }; |
| 43 |