| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <optional> |
| 7 |
#include <span> |
| 8 |
#include <string> |
| 9 |
|
| 10 |
#include "Common/CommonTypes.h" |
| 11 |
#include "DiscIO/Blob.h" |
| 12 |
|
| 13 |
namespace DiscIO |
| 14 |
{ |
| 15 |
class FileInfo; |
| 16 |
struct Partition; |
| 17 |
class Volume; |
| 18 |
|
| 19 |
constexpr u64 MINI_DVD_SIZE = 1459978240; |
| 20 |
constexpr u64 SL_DVD_SIZE = 4699979776; |
| 21 |
constexpr u64 SL_DVD_R_SIZE = 4707319808; |
| 22 |
constexpr u64 DL_DVD_SIZE = 8511160320; |
| 23 |
constexpr u64 DL_DVD_R_SIZE = 8543666176; |
| 24 |
|
| 25 |
constexpr u32 GAMECUBE_DISC_MAGIC = 0xC2339F3D; |
| 26 |
constexpr u32 WII_DISC_MAGIC = 0x5D1C9EA3; |
| 27 |
|
| 28 |
constexpr u32 PARTITION_DATA = 0; |
| 29 |
constexpr u32 PARTITION_UPDATE = 1; |
| 30 |
constexpr u32 PARTITION_CHANNEL = 2; |
| 31 |
constexpr u32 PARTITION_INSTALL = 3; |
| 32 |
|
| 33 |
constexpr u32 DISCHEADER_ADDRESS = 0; |
| 34 |
constexpr u32 DISCHEADER_SIZE = 0x440; |
| 35 |
constexpr u32 BI2_ADDRESS = 0x440; |
| 36 |
constexpr u32 BI2_SIZE = 0x2000; |
| 37 |
constexpr u32 APPLOADER_ADDRESS = 0x2440; |
| 38 |
|
| 39 |
constexpr u32 WII_PARTITION_TICKET_ADDRESS = 0; |
| 40 |
constexpr u32 WII_PARTITION_TICKET_SIZE = 0x2a4; |
| 41 |
constexpr u32 WII_PARTITION_TMD_SIZE_ADDRESS = 0x2a4; |
| 42 |
constexpr u32 WII_PARTITION_TMD_OFFSET_ADDRESS = 0x2a8; |
| 43 |
constexpr u32 WII_PARTITION_CERT_CHAIN_SIZE_ADDRESS = 0x2ac; |
| 44 |
constexpr u32 WII_PARTITION_CERT_CHAIN_OFFSET_ADDRESS = 0x2b0; |
| 45 |
constexpr u32 WII_PARTITION_H3_OFFSET_ADDRESS = 0x2b4; |
| 46 |
constexpr u32 WII_PARTITION_H3_SIZE = 0x18000; |
| 47 |
|
| 48 |
constexpr u32 WII_NONPARTITION_DISCHEADER_ADDRESS = 0; |
| 49 |
constexpr u32 WII_NONPARTITION_DISCHEADER_SIZE = 0x100; |
| 50 |
constexpr u32 WII_REGION_DATA_ADDRESS = 0x4E000; |
| 51 |
constexpr u32 WII_REGION_DATA_SIZE = 0x20; |
| 52 |
|
| 53 |
|
| 54 |
constexpr int GCZ_RVZ_PREFERRED_BLOCK_SIZE = 0x20000; |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
constexpr int PREFERRED_MIN_BLOCK_SIZE = 0x8000; |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
constexpr int PREFERRED_MAX_BLOCK_SIZE = 0x200000; |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
constexpr int GCZ_FALLBACK_BLOCK_SIZE = 0x4000; |
| 68 |
|
| 69 |
|
| 70 |
constexpr int WIA_MIN_BLOCK_SIZE = 0x200000; |
| 71 |
|
| 72 |
|
| 73 |
constexpr int RVZ_MIN_BLOCK_SIZE = 0x8000; |
| 74 |
|
| 75 |
|
| 76 |
constexpr int RVZ_BIG_BLOCK_SIZE_LCM = 0x200000; |
| 77 |
|
| 78 |
std::string NameForPartitionType(u32 partition_type, bool include_prefix); |
| 79 |
|
| 80 |
std::optional<u64> GetApploaderSize(const Volume& volume, const Partition& partition); |
| 81 |
std::optional<u64> GetBootDOLOffset(const Volume& volume, const Partition& partition); |
| 82 |
std::optional<u32> GetBootDOLSize(const Volume& volume, const Partition& partition, u64 dol_offset); |
| 83 |
std::optional<u64> GetFSTOffset(const Volume& volume, const Partition& partition); |
| 84 |
std::optional<u64> GetFSTSize(const Volume& volume, const Partition& partition); |
| 85 |
|
| 86 |
u64 GetBiggestReferencedOffset(const Volume& volume); |
| 87 |
u64 GetBiggestReferencedOffset(const Volume& volume, std::span<const Partition> partitions); |
| 88 |
|
| 89 |
bool IsGCZBlockSizeLegacyCompatible(int block_size, u64 file_size); |
| 90 |
bool IsDiscImageBlockSizeValid(int block_size, BlobType format); |
| 91 |
} |