summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/acc/acc.cpp61
-rw-r--r--src/core/hle/service/acc/acc.h5
-rw-r--r--src/core/hle/service/acc/acc_su.cpp2
-rw-r--r--src/core/hle/service/acc/acc_u0.cpp2
-rw-r--r--src/core/hle/service/acc/acc_u1.cpp2
5 files changed, 66 insertions, 6 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index bb07f6ccc..3ec0e1eca 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -32,9 +32,15 @@
32 32
33namespace Service::Account { 33namespace Service::Account {
34 34
35constexpr ResultCode ERR_INVALID_BUFFER_SIZE{ErrorModule::Account, 30}; 35constexpr ResultCode ERR_INVALID_USER_ID{ErrorModule::Account, 20};
36constexpr ResultCode ERR_INVALID_APPLICATION_ID{ErrorModule::Account, 22};
37constexpr ResultCode ERR_INVALID_BUFFER{ErrorModule::Account, 30};
38constexpr ResultCode ERR_INVALID_BUFFER_SIZE{ErrorModule::Account, 31};
36constexpr ResultCode ERR_FAILED_SAVE_DATA{ErrorModule::Account, 100}; 39constexpr ResultCode ERR_FAILED_SAVE_DATA{ErrorModule::Account, 100};
37 40
41// Thumbnails are hard coded to be at least this size
42constexpr std::size_t THUMBNAIL_SIZE = 0x24000;
43
38static std::string GetImagePath(Common::UUID uuid) { 44static std::string GetImagePath(Common::UUID uuid) {
39 return Common::FS::GetUserPath(Common::FS::UserPath::NANDDir) + 45 return Common::FS::GetUserPath(Common::FS::UserPath::NANDDir) +
40 "/system/save/8000000000000010/su/avators/" + uuid.FormatSwitch() + ".jpg"; 46 "/system/save/8000000000000010/su/avators/" + uuid.FormatSwitch() + ".jpg";
@@ -369,7 +375,7 @@ protected:
369 if (user_data.size() < sizeof(ProfileData)) { 375 if (user_data.size() < sizeof(ProfileData)) {
370 LOG_ERROR(Service_ACC, "ProfileData buffer too small!"); 376 LOG_ERROR(Service_ACC, "ProfileData buffer too small!");
371 IPC::ResponseBuilder rb{ctx, 2}; 377 IPC::ResponseBuilder rb{ctx, 2};
372 rb.Push(ERR_INVALID_BUFFER_SIZE); 378 rb.Push(ERR_INVALID_BUFFER);
373 return; 379 return;
374 } 380 }
375 381
@@ -402,7 +408,7 @@ protected:
402 if (user_data.size() < sizeof(ProfileData)) { 408 if (user_data.size() < sizeof(ProfileData)) {
403 LOG_ERROR(Service_ACC, "ProfileData buffer too small!"); 409 LOG_ERROR(Service_ACC, "ProfileData buffer too small!");
404 IPC::ResponseBuilder rb{ctx, 2}; 410 IPC::ResponseBuilder rb{ctx, 2};
405 rb.Push(ERR_INVALID_BUFFER_SIZE); 411 rb.Push(ERR_INVALID_BUFFER);
406 return; 412 return;
407 } 413 }
408 414
@@ -811,6 +817,55 @@ void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ct
811 rb.Push(RESULT_SUCCESS); 817 rb.Push(RESULT_SUCCESS);
812} 818}
813 819
820void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestContext& ctx) {
821 IPC::RequestParser rp{ctx};
822 const auto uuid = rp.PopRaw<Common::UUID>();
823
824 LOG_WARNING(Service_ACC, "(STUBBED) called, uuid={}", uuid.Format());
825
826 // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable
827 // way of confirming things like the TID, we're going to assume a non zero value for the time
828 // being.
829 constexpr u64 tid{1};
830 StoreSaveDataThumbnail(ctx, uuid, tid);
831}
832
833void Module::Interface::StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& ctx) {
834 IPC::RequestParser rp{ctx};
835 const auto uuid = rp.PopRaw<Common::UUID>();
836 const auto tid = rp.Pop<u64_le>();
837
838 LOG_WARNING(Service_ACC, "(STUBBED) called, uuid={}, tid={:016X}", uuid.Format(), tid);
839 StoreSaveDataThumbnail(ctx, uuid, tid);
840}
841
842void Module::Interface::StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx,
843 const Common::UUID& uuid, const u64 tid) {
844 IPC::ResponseBuilder rb{ctx, 2};
845
846 if (tid == 0) {
847 LOG_ERROR(Service_ACC, "TitleID is not valid!");
848 rb.Push(ERR_INVALID_APPLICATION_ID);
849 return;
850 }
851
852 if (!uuid) {
853 LOG_ERROR(Service_ACC, "User ID is not valid!");
854 rb.Push(ERR_INVALID_USER_ID);
855 return;
856 }
857 const auto thumbnail_size = ctx.GetReadBufferSize();
858 if (thumbnail_size != THUMBNAIL_SIZE) {
859 LOG_ERROR(Service_ACC, "Buffer size is empty! size={:X} expecting {:X}", thumbnail_size,
860 THUMBNAIL_SIZE);
861 rb.Push(ERR_INVALID_BUFFER_SIZE);
862 return;
863 }
864
865 // TODO(ogniK): Construct save data thumbnail
866 rb.Push(RESULT_SUCCESS);
867}
868
814void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) { 869void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx) {
815 LOG_DEBUG(Service_ACC, "called"); 870 LOG_DEBUG(Service_ACC, "called");
816 // A u8 is passed into this function which we can safely ignore. It's to determine if we have 871 // A u8 is passed into this function which we can safely ignore. It's to determine if we have
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h
index ab8edc049..0e3ad8ec6 100644
--- a/src/core/hle/service/acc/acc.h
+++ b/src/core/hle/service/acc/acc.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "common/uuid.h"
7#include "core/hle/service/glue/manager.h" 8#include "core/hle/service/glue/manager.h"
8#include "core/hle/service/service.h" 9#include "core/hle/service/service.h"
9 10
@@ -36,9 +37,13 @@ public:
36 void ListQualifiedUsers(Kernel::HLERequestContext& ctx); 37 void ListQualifiedUsers(Kernel::HLERequestContext& ctx);
37 void LoadOpenContext(Kernel::HLERequestContext& ctx); 38 void LoadOpenContext(Kernel::HLERequestContext& ctx);
38 void ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx); 39 void ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx);
40 void StoreSaveDataThumbnailApplication(Kernel::HLERequestContext& ctx);
41 void StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& ctx);
39 42
40 private: 43 private:
41 ResultCode InitializeApplicationInfoBase(); 44 ResultCode InitializeApplicationInfoBase();
45 void StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, const Common::UUID& uuid,
46 const u64 tid);
42 47
43 enum class ApplicationType : u32_le { 48 enum class ApplicationType : u32_le {
44 GameCard = 0, 49 GameCard = 0,
diff --git a/src/core/hle/service/acc/acc_su.cpp b/src/core/hle/service/acc/acc_su.cpp
index d2bb8c2c8..49b22583e 100644
--- a/src/core/hle/service/acc/acc_su.cpp
+++ b/src/core/hle/service/acc/acc_su.cpp
@@ -29,7 +29,7 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
29 {104, nullptr, "GetProfileUpdateNotifier"}, 29 {104, nullptr, "GetProfileUpdateNotifier"},
30 {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+ 30 {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+
31 {106, nullptr, "GetProfileSyncNotifier"}, // 9.0.0+ 31 {106, nullptr, "GetProfileSyncNotifier"}, // 9.0.0+
32 {110, nullptr, "StoreSaveDataThumbnail"}, 32 {110, &ACC_SU::StoreSaveDataThumbnailSystem, "StoreSaveDataThumbnail"},
33 {111, nullptr, "ClearSaveDataThumbnail"}, 33 {111, nullptr, "ClearSaveDataThumbnail"},
34 {112, nullptr, "LoadSaveDataThumbnail"}, 34 {112, nullptr, "LoadSaveDataThumbnail"},
35 {113, nullptr, "GetSaveDataThumbnailExistence"}, // 5.0.0+ 35 {113, nullptr, "GetSaveDataThumbnailExistence"}, // 5.0.0+
diff --git a/src/core/hle/service/acc/acc_u0.cpp b/src/core/hle/service/acc/acc_u0.cpp
index 75a24f8f5..8d66d180d 100644
--- a/src/core/hle/service/acc/acc_u0.cpp
+++ b/src/core/hle/service/acc/acc_u0.cpp
@@ -26,7 +26,7 @@ ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
26 {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"}, 26 {101, &ACC_U0::GetBaasAccountManagerForApplication, "GetBaasAccountManagerForApplication"},
27 {102, nullptr, "AuthenticateApplicationAsync"}, 27 {102, nullptr, "AuthenticateApplicationAsync"},
28 {103, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+ 28 {103, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+
29 {110, nullptr, "StoreSaveDataThumbnail"}, 29 {110, &ACC_U0::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"},
30 {111, nullptr, "ClearSaveDataThumbnail"}, 30 {111, nullptr, "ClearSaveDataThumbnail"},
31 {120, nullptr, "CreateGuestLoginRequest"}, 31 {120, nullptr, "CreateGuestLoginRequest"},
32 {130, &ACC_U0::LoadOpenContext, "LoadOpenContext"}, // 5.0.0+ 32 {130, &ACC_U0::LoadOpenContext, "LoadOpenContext"}, // 5.0.0+
diff --git a/src/core/hle/service/acc/acc_u1.cpp b/src/core/hle/service/acc/acc_u1.cpp
index a4aa5316a..951081cd0 100644
--- a/src/core/hle/service/acc/acc_u1.cpp
+++ b/src/core/hle/service/acc/acc_u1.cpp
@@ -29,7 +29,7 @@ ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
29 {104, nullptr, "GetProfileUpdateNotifier"}, 29 {104, nullptr, "GetProfileUpdateNotifier"},
30 {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+ 30 {105, nullptr, "CheckNetworkServiceAvailabilityAsync"}, // 4.0.0+
31 {106, nullptr, "GetProfileSyncNotifier"}, // 9.0.0+ 31 {106, nullptr, "GetProfileSyncNotifier"}, // 9.0.0+
32 {110, nullptr, "StoreSaveDataThumbnail"}, 32 {110, &ACC_U1::StoreSaveDataThumbnailApplication, "StoreSaveDataThumbnail"},
33 {111, nullptr, "ClearSaveDataThumbnail"}, 33 {111, nullptr, "ClearSaveDataThumbnail"},
34 {112, nullptr, "LoadSaveDataThumbnail"}, 34 {112, nullptr, "LoadSaveDataThumbnail"},
35 {113, nullptr, "GetSaveDataThumbnailExistence"}, // 5.0.0+ 35 {113, nullptr, "GetSaveDataThumbnailExistence"}, // 5.0.0+