diff options
| -rw-r--r-- | src/core/hle/service/acc/acc.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index d17d784cf..c6437a671 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -32,6 +32,19 @@ struct UserData { | |||
| 32 | }; | 32 | }; |
| 33 | static_assert(sizeof(UserData) == 0x80, "UserData structure has incorrect size"); | 33 | static_assert(sizeof(UserData) == 0x80, "UserData structure has incorrect size"); |
| 34 | 34 | ||
| 35 | // Smallest JPEG https://github.com/mathiasbynens/small/blob/master/jpeg.jpg | ||
| 36 | // used as a backup should the one on disk not exist | ||
| 37 | constexpr u32 backup_jpeg_size = 107; | ||
| 38 | constexpr std::array<u8, backup_jpeg_size> backup_jpeg{{ | ||
| 39 | 0xff, 0xd8, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, | ||
| 40 | 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x06, 0x06, 0x05, | ||
| 41 | 0x06, 0x09, 0x08, 0x0a, 0x0a, 0x09, 0x08, 0x09, 0x09, 0x0a, 0x0c, 0x0f, 0x0c, 0x0a, 0x0b, 0x0e, | ||
| 42 | 0x0b, 0x09, 0x09, 0x0d, 0x11, 0x0d, 0x0e, 0x0f, 0x10, 0x10, 0x11, 0x10, 0x0a, 0x0c, 0x12, 0x13, | ||
| 43 | 0x12, 0x10, 0x13, 0x0f, 0x10, 0x10, 0x10, 0xff, 0xc9, 0x00, 0x0b, 0x08, 0x00, 0x01, 0x00, 0x01, | ||
| 44 | 0x01, 0x01, 0x11, 0x00, 0xff, 0xcc, 0x00, 0x06, 0x00, 0x10, 0x10, 0x05, 0xff, 0xda, 0x00, 0x08, | ||
| 45 | 0x01, 0x01, 0x00, 0x00, 0x3f, 0x00, 0xd2, 0xcf, 0x20, 0xff, 0xd9, | ||
| 46 | }}; | ||
| 47 | |||
| 35 | static std::string GetImagePath(UUID uuid) { | 48 | static std::string GetImagePath(UUID uuid) { |
| 36 | return FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + | 49 | return FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + |
| 37 | "/system/save/8000000000000010/su/avators/" + uuid.FormatSwitch() + ".jpg"; | 50 | "/system/save/8000000000000010/su/avators/" + uuid.FormatSwitch() + ".jpg"; |
| @@ -89,19 +102,6 @@ private: | |||
| 89 | 102 | ||
| 90 | void LoadImage(Kernel::HLERequestContext& ctx) { | 103 | void LoadImage(Kernel::HLERequestContext& ctx) { |
| 91 | LOG_DEBUG(Service_ACC, "called"); | 104 | LOG_DEBUG(Service_ACC, "called"); |
| 92 | // smallest jpeg https://github.com/mathiasbynens/small/blob/master/jpeg.jpg | ||
| 93 | // used as a backup should the one on disk not exist | ||
| 94 | constexpr u32 backup_jpeg_size = 107; | ||
| 95 | static constexpr std::array<u8, backup_jpeg_size> backup_jpeg{ | ||
| 96 | 0xff, 0xd8, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, | ||
| 97 | 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, | ||
| 98 | 0x08, 0x06, 0x06, 0x05, 0x06, 0x09, 0x08, 0x0a, 0x0a, 0x09, 0x08, 0x09, 0x09, 0x0a, | ||
| 99 | 0x0c, 0x0f, 0x0c, 0x0a, 0x0b, 0x0e, 0x0b, 0x09, 0x09, 0x0d, 0x11, 0x0d, 0x0e, 0x0f, | ||
| 100 | 0x10, 0x10, 0x11, 0x10, 0x0a, 0x0c, 0x12, 0x13, 0x12, 0x10, 0x13, 0x0f, 0x10, 0x10, | ||
| 101 | 0x10, 0xff, 0xc9, 0x00, 0x0b, 0x08, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x11, 0x00, | ||
| 102 | 0xff, 0xcc, 0x00, 0x06, 0x00, 0x10, 0x10, 0x05, 0xff, 0xda, 0x00, 0x08, 0x01, 0x01, | ||
| 103 | 0x00, 0x00, 0x3f, 0x00, 0xd2, 0xcf, 0x20, 0xff, 0xd9, | ||
| 104 | }; | ||
| 105 | 105 | ||
| 106 | IPC::ResponseBuilder rb{ctx, 3}; | 106 | IPC::ResponseBuilder rb{ctx, 3}; |
| 107 | rb.Push(RESULT_SUCCESS); | 107 | rb.Push(RESULT_SUCCESS); |
| @@ -125,7 +125,6 @@ private: | |||
| 125 | 125 | ||
| 126 | void GetImageSize(Kernel::HLERequestContext& ctx) { | 126 | void GetImageSize(Kernel::HLERequestContext& ctx) { |
| 127 | LOG_DEBUG(Service_ACC, "called"); | 127 | LOG_DEBUG(Service_ACC, "called"); |
| 128 | constexpr u32 backup_jpeg_size = 107; | ||
| 129 | IPC::ResponseBuilder rb{ctx, 3}; | 128 | IPC::ResponseBuilder rb{ctx, 3}; |
| 130 | rb.Push(RESULT_SUCCESS); | 129 | rb.Push(RESULT_SUCCESS); |
| 131 | 130 | ||