Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
812fb308
There was an error fetching the commit references. Please try again later.
Commit
812fb308
authored
5 years ago
by
Zach Hilman
Browse files
Options
Downloads
Patches
Plain Diff
acc: Implement IProfileEditor-specific commands 'Store' and 'StoreWithImage'
Verified with IDA
parent
02560d64
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/hle/service/acc/acc.cpp
+73
-1
73 additions, 1 deletion
src/core/hle/service/acc/acc.cpp
with
73 additions
and
1 deletion
src/core/hle/service/acc/acc.cpp
+
73
−
1
View file @
812fb308
...
@@ -26,6 +26,9 @@
...
@@ -26,6 +26,9 @@
namespace
Service
::
Account
{
namespace
Service
::
Account
{
constexpr
ResultCode
ERR_INVALID_BUFFER_SIZE
{
ErrorModule
::
Account
,
30
};
constexpr
ResultCode
ERR_FAILED_SAVE_DATA
{
ErrorModule
::
Account
,
100
};
static
std
::
string
GetImagePath
(
Common
::
UUID
uuid
)
{
static
std
::
string
GetImagePath
(
Common
::
UUID
uuid
)
{
return
FileUtil
::
GetUserPath
(
FileUtil
::
UserPath
::
NANDDir
)
+
return
FileUtil
::
GetUserPath
(
FileUtil
::
UserPath
::
NANDDir
)
+
"/system/save/8000000000000010/su/avators/"
+
uuid
.
FormatSwitch
()
+
".jpg"
;
"/system/save/8000000000000010/su/avators/"
+
uuid
.
FormatSwitch
()
+
".jpg"
;
...
@@ -133,7 +136,76 @@ protected:
...
@@ -133,7 +136,76 @@ protected:
}
}
}
}
const
ProfileManager
&
profile_manager
;
void
Store
(
Kernel
::
HLERequestContext
&
ctx
)
{
IPC
::
RequestParser
rp
{
ctx
};
const
auto
base
=
rp
.
PopRaw
<
ProfileBase
>
();
const
auto
user_data
=
ctx
.
ReadBuffer
();
LOG_DEBUG
(
Service_ACC
,
"called, username='{}', timestamp={:016X}, uuid={}"
,
Common
::
StringFromFixedZeroTerminatedBuffer
(
reinterpret_cast
<
const
char
*>
(
base
.
username
.
data
()),
base
.
username
.
size
()),
base
.
timestamp
,
base
.
user_uuid
.
Format
());
if
(
user_data
.
size
()
<
sizeof
(
ProfileData
))
{
LOG_ERROR
(
Service_ACC
,
"ProfileData buffer too small!"
);
IPC
::
ResponseBuilder
rb
{
ctx
,
2
};
rb
.
Push
(
ERR_INVALID_BUFFER_SIZE
);
return
;
}
ProfileData
data
;
std
::
memcpy
(
&
data
,
user_data
.
data
(),
sizeof
(
ProfileData
));
if
(
!
profile_manager
.
SetProfileBaseAndData
(
user_id
,
base
,
data
))
{
LOG_ERROR
(
Service_ACC
,
"Failed to update profile data and base!"
);
IPC
::
ResponseBuilder
rb
{
ctx
,
2
};
rb
.
Push
(
ERR_FAILED_SAVE_DATA
);
return
;
}
IPC
::
ResponseBuilder
rb
{
ctx
,
2
};
rb
.
Push
(
RESULT_SUCCESS
);
}
void
StoreWithImage
(
Kernel
::
HLERequestContext
&
ctx
)
{
IPC
::
RequestParser
rp
{
ctx
};
const
auto
base
=
rp
.
PopRaw
<
ProfileBase
>
();
const
auto
user_data
=
ctx
.
ReadBuffer
();
const
auto
image_data
=
ctx
.
ReadBuffer
(
1
);
LOG_DEBUG
(
Service_ACC
,
"called, username='{}', timestamp={:016X}, uuid={}"
,
Common
::
StringFromFixedZeroTerminatedBuffer
(
reinterpret_cast
<
const
char
*>
(
base
.
username
.
data
()),
base
.
username
.
size
()),
base
.
timestamp
,
base
.
user_uuid
.
Format
());
if
(
user_data
.
size
()
<
sizeof
(
ProfileData
))
{
LOG_ERROR
(
Service_ACC
,
"ProfileData buffer too small!"
);
IPC
::
ResponseBuilder
rb
{
ctx
,
2
};
rb
.
Push
(
ERR_INVALID_BUFFER_SIZE
);
return
;
}
ProfileData
data
;
std
::
memcpy
(
&
data
,
user_data
.
data
(),
sizeof
(
ProfileData
));
FileUtil
::
IOFile
image
(
GetImagePath
(
user_id
),
"wb"
);
if
(
!
image
.
IsOpen
()
||
!
image
.
Resize
(
image_data
.
size
())
||
image
.
WriteBytes
(
image_data
.
data
(),
image_data
.
size
())
!=
image_data
.
size
()
||
!
profile_manager
.
SetProfileBaseAndData
(
user_id
,
base
,
data
))
{
LOG_ERROR
(
Service_ACC
,
"Failed to update profile data, base, and image!"
);
IPC
::
ResponseBuilder
rb
{
ctx
,
2
};
rb
.
Push
(
ERR_FAILED_SAVE_DATA
);
return
;
}
IPC
::
ResponseBuilder
rb
{
ctx
,
2
};
rb
.
Push
(
RESULT_SUCCESS
);
}
ProfileManager
&
profile_manager
;
Common
::
UUID
user_id
;
///< The user id this profile refers to.
Common
::
UUID
user_id
;
///< The user id this profile refers to.
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment