summaryrefslogtreecommitdiff
path: root/src/core/loader/smdh.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/loader/smdh.cpp')
-rw-r--r--src/core/loader/smdh.cpp51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/core/loader/smdh.cpp b/src/core/loader/smdh.cpp
deleted file mode 100644
index ccbeb7961..000000000
--- a/src/core/loader/smdh.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
1// Copyright 2016 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <cstring>
6#include <vector>
7#include "common/common_types.h"
8#include "core/loader/loader.h"
9#include "core/loader/smdh.h"
10#include "video_core/utils.h"
11
12namespace Loader {
13
14bool IsValidSMDH(const std::vector<u8>& smdh_data) {
15 if (smdh_data.size() < sizeof(Loader::SMDH))
16 return false;
17
18 u32 magic;
19 memcpy(&magic, smdh_data.data(), sizeof(u32));
20
21 return Loader::MakeMagic('S', 'M', 'D', 'H') == magic;
22}
23
24std::vector<u16> SMDH::GetIcon(bool large) const {
25 u32 size;
26 const u8* icon_data;
27
28 if (large) {
29 size = 48;
30 icon_data = large_icon.data();
31 } else {
32 size = 24;
33 icon_data = small_icon.data();
34 }
35
36 std::vector<u16> icon(size * size);
37 for (u32 x = 0; x < size; ++x) {
38 for (u32 y = 0; y < size; ++y) {
39 u32 coarse_y = y & ~7;
40 const u8* pixel = icon_data + VideoCore::GetMortonOffset(x, y, 2) + coarse_y * size * 2;
41 icon[x + size * y] = (pixel[1] << 8) + pixel[0];
42 }
43 }
44 return icon;
45}
46
47std::array<u16, 0x40> SMDH::GetShortTitle(Loader::SMDH::TitleLanguage language) const {
48 return titles[static_cast<int>(language)].short_title;
49}
50
51} // namespace