diff options
| author | 2016-05-25 16:40:36 -0400 | |
|---|---|---|
| committer | 2016-05-25 16:40:36 -0400 | |
| commit | f50a32bfce099eeff510e5e314b91dcf65d317ac (patch) | |
| tree | 5bc0347199d722861ba09897e6c6e9015cf026bc /src/core/loader/loader.h | |
| parent | New3DS: Minor style cleanup to #1520. (diff) | |
| parent | Loader: Split SMDH into its own header and import helpers from QGameList (diff) | |
| download | yuzu-f50a32bfce099eeff510e5e314b91dcf65d317ac.tar.gz yuzu-f50a32bfce099eeff510e5e314b91dcf65d317ac.tar.xz yuzu-f50a32bfce099eeff510e5e314b91dcf65d317ac.zip | |
Merge pull request #1817 from linkmauve/smdh-stuff
Improve SMDH support in loaders and frontends
Diffstat (limited to 'src/core/loader/loader.h')
| -rw-r--r-- | src/core/loader/loader.h | 69 |
1 files changed, 9 insertions, 60 deletions
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 9d3e9ed3b..77d87afe1 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -10,10 +10,8 @@ | |||
| 10 | #include <string> | 10 | #include <string> |
| 11 | #include <vector> | 11 | #include <vector> |
| 12 | 12 | ||
| 13 | #include "common/common_funcs.h" | ||
| 14 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 15 | #include "common/file_util.h" | 14 | #include "common/file_util.h" |
| 16 | #include "common/swap.h" | ||
| 17 | 15 | ||
| 18 | namespace Kernel { | 16 | namespace Kernel { |
| 19 | struct AddressMapping; | 17 | struct AddressMapping; |
| @@ -80,51 +78,6 @@ constexpr u32 MakeMagic(char a, char b, char c, char d) { | |||
| 80 | return a | b << 8 | c << 16 | d << 24; | 78 | return a | b << 8 | c << 16 | d << 24; |
| 81 | } | 79 | } |
| 82 | 80 | ||
| 83 | /// SMDH data structure that contains titles, icons etc. See https://www.3dbrew.org/wiki/SMDH | ||
| 84 | struct SMDH { | ||
| 85 | u32_le magic; | ||
| 86 | u16_le version; | ||
| 87 | INSERT_PADDING_BYTES(2); | ||
| 88 | |||
| 89 | struct Title { | ||
| 90 | std::array<u16, 0x40> short_title; | ||
| 91 | std::array<u16, 0x80> long_title; | ||
| 92 | std::array<u16, 0x40> publisher; | ||
| 93 | }; | ||
| 94 | std::array<Title, 16> titles; | ||
| 95 | |||
| 96 | std::array<u8, 16> ratings; | ||
| 97 | u32_le region_lockout; | ||
| 98 | u32_le match_maker_id; | ||
| 99 | u64_le match_maker_bit_id; | ||
| 100 | u32_le flags; | ||
| 101 | u16_le eula_version; | ||
| 102 | INSERT_PADDING_BYTES(2); | ||
| 103 | float_le banner_animation_frame; | ||
| 104 | u32_le cec_id; | ||
| 105 | INSERT_PADDING_BYTES(8); | ||
| 106 | |||
| 107 | std::array<u8, 0x480> small_icon; | ||
| 108 | std::array<u8, 0x1200> large_icon; | ||
| 109 | |||
| 110 | /// indicates the language used for each title entry | ||
| 111 | enum class TitleLanguage { | ||
| 112 | Japanese = 0, | ||
| 113 | English = 1, | ||
| 114 | French = 2, | ||
| 115 | German = 3, | ||
| 116 | Italian = 4, | ||
| 117 | Spanish = 5, | ||
| 118 | SimplifiedChinese = 6, | ||
| 119 | Korean= 7, | ||
| 120 | Dutch = 8, | ||
| 121 | Portuguese = 9, | ||
| 122 | Russian = 10, | ||
| 123 | TraditionalChinese = 11 | ||
| 124 | }; | ||
| 125 | }; | ||
| 126 | static_assert(sizeof(SMDH) == 0x36C0, "SMDH structure size is wrong"); | ||
| 127 | |||
| 128 | /// Interface for loading an application | 81 | /// Interface for loading an application |
| 129 | class AppLoader : NonCopyable { | 82 | class AppLoader : NonCopyable { |
| 130 | public: | 83 | public: |
| @@ -132,6 +85,12 @@ public: | |||
| 132 | virtual ~AppLoader() { } | 85 | virtual ~AppLoader() { } |
| 133 | 86 | ||
| 134 | /** | 87 | /** |
| 88 | * Returns the type of this file | ||
| 89 | * @return FileType corresponding to the loaded file | ||
| 90 | */ | ||
| 91 | virtual FileType GetFileType() = 0; | ||
| 92 | |||
| 93 | /** | ||
| 135 | * Load the application | 94 | * Load the application |
| 136 | * @return ResultStatus result of function | 95 | * @return ResultStatus result of function |
| 137 | */ | 96 | */ |
| @@ -197,20 +156,10 @@ protected: | |||
| 197 | extern const std::initializer_list<Kernel::AddressMapping> default_address_mappings; | 156 | extern const std::initializer_list<Kernel::AddressMapping> default_address_mappings; |
| 198 | 157 | ||
| 199 | /** | 158 | /** |
| 200 | * Get a loader for a file with a specific type | 159 | * Identifies a bootable file and return a suitable loader |
| 201 | * @param file The file to load | ||
| 202 | * @param type The type of the file | ||
| 203 | * @param filename the file name (without path) | ||
| 204 | * @param filepath the file full path (with name) | ||
| 205 | * @return std::unique_ptr<AppLoader> a pointer to a loader object; nullptr for unsupported type | ||
| 206 | */ | ||
| 207 | std::unique_ptr<AppLoader> GetLoader(FileUtil::IOFile&& file, FileType type, const std::string& filename, const std::string& filepath); | ||
| 208 | |||
| 209 | /** | ||
| 210 | * Identifies and loads a bootable file | ||
| 211 | * @param filename String filename of bootable file | 160 | * @param filename String filename of bootable file |
| 212 | * @return ResultStatus result of function | 161 | * @return best loader for this file |
| 213 | */ | 162 | */ |
| 214 | ResultStatus LoadFile(const std::string& filename); | 163 | std::unique_ptr<AppLoader> GetLoader(const std::string& filename); |
| 215 | 164 | ||
| 216 | } // namespace | 165 | } // namespace |