MCPcopy Create free account
hub / github.com/XorTroll/Goldleaf / EditUserIcon

Function EditUserIcon

Goldleaf/source/acc/acc_UserSelection.cpp:113–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111 }
112
113 Result EditUserIcon(const u8 *jpg, const size_t size) {
114 AccountProfile prof;
115 auto rc = accountGetProfile(&prof, g_SelectedUser);
116 if(R_SUCCEEDED(rc)) {
117 AccountProfileBase prof_base = {};
118 AccountUserData user_data = {};
119 rc = accountProfileGet(&prof, &user_data, &prof_base);
120 if(R_SUCCEEDED(rc)) {
121 AccountExtProfileEditor editor;
122 rc = accountextGetProfileEditor(g_SelectedUser, &editor);
123 if(R_SUCCEEDED(rc)) {
124 rc = accountextProfileEditorStoreWithImage(&editor, &prof_base, &user_data, jpg, size);
125 if(R_SUCCEEDED(rc)) {
126 const auto icon_path = GetExportedUserIcon();
127 auto sd_exp = fs::GetSdCardExplorer();
128 sd_exp->DeleteFile(icon_path);
129 sd_exp->WriteFile(icon_path, jpg, size);
130 }
131 accountextProfileEditorClose(&editor);
132 }
133 }
134 accountProfileClose(&prof);
135 }
136 return rc;
137 }
138
139 void ExportSelectedUserIcon() {
140 AccountProfile prof;

Callers 1

OnFileSelectedMethod · 0.85

Calls 4

GetExportedUserIconFunction · 0.85
GetSdCardExplorerFunction · 0.85
DeleteFileMethod · 0.45
WriteFileMethod · 0.45

Tested by

no test coverage detected