More code style aligning

* Null terminate nickname array and correct character limit in settings perference
This commit is contained in:
Willi Ye 2020-07-20 22:57:52 +02:00 committed by ◱ PixelyIon
parent 93da9f2826
commit 1f282af87e
7 changed files with 16 additions and 16 deletions

View File

@ -41,6 +41,7 @@ namespace skyline {
constexpr u32 NoMessages = 0x680; //!< "No message available"
constexpr u32 ServiceInvName = 0xC15; //!< "Invalid name"
constexpr u32 ServiceNotReg = 0xE15; //!< "Service not registered"
constexpr u32 InvUser = 0xC87C; //!< Invalid user
constexpr u32 InvSize = 0xCA01; //!< "Invalid size"
constexpr u32 InvAddress = 0xCC01; //!< "Invalid address"
constexpr u32 InvState = 0xD401; //!< "Invalid MemoryState"

View File

@ -29,7 +29,7 @@ namespace skyline::service::account {
void IAccountServiceForApplication::GetProfile(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
auto id = request.Pop<UserId>();
if (id != constant::DefaultUserId) {
response.errorCode = constant::InvUser;
response.errorCode = constant::status::InvUser;
return;
}

View File

@ -59,7 +59,5 @@ namespace skyline {
namespace constant {
constexpr service::account::UserId DefaultUserId = {0x0000000000000001, 0x0000000000000000}; //!< The default user ID
constexpr u32 InvUser = 0xC87C; //!< Invalid user
}
}

View File

@ -11,25 +11,28 @@ namespace skyline::service::account {
void IProfile::Get(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
struct AccountUserData {
u32 _unk0_; //!< Unknown.
u32 iconID; //!< Icon ID (0 = Mii, the rest are character icon IDs).
u32 _unk0_;
u32 iconID; //!< Icon ID (0 = Mii, the rest are character icon IDs)
u8 iconBackgroundColorID; //!< Profile icon background color ID
std::array<u8, 0x7> _unk1_; //!< Unknown.
std::array<u8, 0x10> miiID; //!< Some ID related to the Mii? All zeros when a character icon is used.
std::array<u8, 0x60> _unk2_; //!< Unknown.
u8 _unk1_[0x7];
std::array<u8, 0x10> miiID; //!< Some ID related to the Mii? All zeros when a character icon is used
u8 _unk2_[0x60];
};
struct {
UserId uid; //!< The UID of the corresponding account
u64 lastEditTimestamp; //!< A POSIX UTC timestamp denoting the last account edit.
std::array<char, 0x20> nickname; //!< UTF-8 Nickname.
} accountProfileBase = {.uid = userId};
u64 lastEditTimestamp; //!< A POSIX UTC timestamp denoting the last account edit
std::array<char, 0x20> nickname; //!< UTF-8 Nickname
} accountProfileBase = {
.uid = userId
};
std::string username = state.settings->GetString("username_value");
auto username = state.settings->GetString("username_value");
size_t usernameSize = std::min(accountProfileBase.nickname.size(), username.size());
std::memcpy(accountProfileBase.nickname.data(), username.c_str(), usernameSize);
accountProfileBase.nickname[accountProfileBase.nickname.size() - 1] = '\0';
AccountUserData *userData = state.process->GetPointer<AccountUserData>(request.outputBuf.at(0).address);
auto userData = state.process->GetPointer<AccountUserData>(request.outputBuf.at(0).address);
userData->iconBackgroundColorID = 0x1; // Color indexing starts at 0x1
response.Push(accountProfileBase);

View File

@ -16,7 +16,6 @@ namespace skyline::service::account {
IProfile(const DeviceState &state, ServiceManager &manager, const UserId &userId);
private:
UserId userId;
/**

View File

@ -16,7 +16,6 @@ import emu.skyline.R
* This class adapts [EditTextPreference] so that it supports setting the value as the summary automatically. Also added useful attributes.
*/
class CustomEditTextPreference : EditTextPreference {
constructor(context : Context, attrs : AttributeSet?, defStyleAttr : Int, defStyleRes : Int) : super(context, attrs, defStyleAttr, defStyleRes) {
attrs?.let {
val a = context.obtainStyledAttributes(it, R.styleable.CustomEditTextPreference, defStyleAttr, 0)

View File

@ -65,7 +65,7 @@
<emu.skyline.preference.CustomEditTextPreference
android:defaultValue="@string/username_default"
app:key="username_value"
app:limit="32"
app:limit="31"
app:title="@string/username" />
</PreferenceCategory>
<PreferenceCategory