mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-25 02:42:41 -06:00
service: mii: Fix broken mii on MK8
This commit is contained in:
parent
69949e7964
commit
57e7eed54c
6 changed files with 118 additions and 7 deletions
|
@ -90,7 +90,7 @@ void MiiEdit::Execute() {
|
||||||
const MiiEditCharInfo char_info{
|
const MiiEditCharInfo char_info{
|
||||||
.mii_info{applet_input_common.applet_mode == MiiEditAppletMode::EditMii
|
.mii_info{applet_input_common.applet_mode == MiiEditAppletMode::EditMii
|
||||||
? applet_input_v4.char_info.mii_info
|
? applet_input_v4.char_info.mii_info
|
||||||
: mii_manager.BuildDefault(0)},
|
: mii_manager.BuildBase(Mii::Gender::Male)},
|
||||||
};
|
};
|
||||||
|
|
||||||
MiiEditOutputForCharInfoEditing(MiiEditResult::Success, char_info);
|
MiiEditOutputForCharInfoEditing(MiiEditResult::Success, char_info);
|
||||||
|
|
|
@ -18,7 +18,6 @@ namespace {
|
||||||
|
|
||||||
constexpr Result ERROR_CANNOT_FIND_ENTRY{ErrorModule::Mii, 4};
|
constexpr Result ERROR_CANNOT_FIND_ENTRY{ErrorModule::Mii, 4};
|
||||||
|
|
||||||
constexpr std::size_t BaseMiiCount{2};
|
|
||||||
constexpr std::size_t DefaultMiiCount{RawData::DefaultMii.size()};
|
constexpr std::size_t DefaultMiiCount{RawData::DefaultMii.size()};
|
||||||
|
|
||||||
constexpr MiiStoreData::Name DefaultMiiName{u'n', u'o', u' ', u'n', u'a', u'm', u'e'};
|
constexpr MiiStoreData::Name DefaultMiiName{u'n', u'o', u' ', u'n', u'a', u'm', u'e'};
|
||||||
|
@ -404,7 +403,7 @@ u32 MiiManager::GetCount(SourceFlag source_flag) const {
|
||||||
count += 0;
|
count += 0;
|
||||||
}
|
}
|
||||||
if ((source_flag & SourceFlag::Default) != SourceFlag::None) {
|
if ((source_flag & SourceFlag::Default) != SourceFlag::None) {
|
||||||
count += (DefaultMiiCount - BaseMiiCount);
|
count += DefaultMiiCount;
|
||||||
}
|
}
|
||||||
return static_cast<u32>(count);
|
return static_cast<u32>(count);
|
||||||
}
|
}
|
||||||
|
@ -422,13 +421,18 @@ CharInfo MiiManager::BuildRandom(Age age, Gender gender, Race race) {
|
||||||
return ConvertStoreDataToInfo(BuildRandomStoreData(age, gender, race, user_id));
|
return ConvertStoreDataToInfo(BuildRandomStoreData(age, gender, race, user_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CharInfo MiiManager::BuildBase(Gender gender) {
|
||||||
|
const std::size_t index = gender == Gender::Female ? 1 : 0;
|
||||||
|
return ConvertStoreDataToInfo(BuildDefaultStoreData(RawData::BaseMii.at(index), user_id));
|
||||||
|
}
|
||||||
|
|
||||||
CharInfo MiiManager::BuildDefault(std::size_t index) {
|
CharInfo MiiManager::BuildDefault(std::size_t index) {
|
||||||
return ConvertStoreDataToInfo(BuildDefaultStoreData(RawData::DefaultMii.at(index), user_id));
|
return ConvertStoreDataToInfo(BuildDefaultStoreData(RawData::DefaultMii.at(index), user_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
CharInfo MiiManager::ConvertV3ToCharInfo(const Ver3StoreData& mii_v3) const {
|
CharInfo MiiManager::ConvertV3ToCharInfo(const Ver3StoreData& mii_v3) const {
|
||||||
Service::Mii::MiiManager manager;
|
Service::Mii::MiiManager manager;
|
||||||
auto mii = manager.BuildDefault(0);
|
auto mii = manager.BuildBase(Mii::Gender::Male);
|
||||||
|
|
||||||
if (!ValidateV3Info(mii_v3)) {
|
if (!ValidateV3Info(mii_v3)) {
|
||||||
return mii;
|
return mii;
|
||||||
|
@ -678,7 +682,7 @@ std::vector<MiiInfoElement> MiiManager::GetDefault(SourceFlag source_flag) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::size_t index = BaseMiiCount; index < DefaultMiiCount; index++) {
|
for (std::size_t index = 0; index < DefaultMiiCount; index++) {
|
||||||
result.emplace_back(BuildDefault(index), Source::Default);
|
result.emplace_back(BuildDefault(index), Source::Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
u32 GetCount(SourceFlag source_flag) const;
|
u32 GetCount(SourceFlag source_flag) const;
|
||||||
Result UpdateLatest(CharInfo* out_info, const CharInfo& info, SourceFlag source_flag);
|
Result UpdateLatest(CharInfo* out_info, const CharInfo& info, SourceFlag source_flag);
|
||||||
CharInfo BuildRandom(Age age, Gender gender, Race race);
|
CharInfo BuildRandom(Age age, Gender gender, Race race);
|
||||||
|
CharInfo BuildBase(Gender gender);
|
||||||
CharInfo BuildDefault(std::size_t index);
|
CharInfo BuildDefault(std::size_t index);
|
||||||
CharInfo ConvertV3ToCharInfo(const Ver3StoreData& mii_v3) const;
|
CharInfo ConvertV3ToCharInfo(const Ver3StoreData& mii_v3) const;
|
||||||
bool ValidateV3Info(const Ver3StoreData& mii_v3) const;
|
bool ValidateV3Info(const Ver3StoreData& mii_v3) const;
|
||||||
|
|
|
@ -5,6 +5,111 @@
|
||||||
|
|
||||||
namespace Service::Mii::RawData {
|
namespace Service::Mii::RawData {
|
||||||
|
|
||||||
|
const std::array<Service::Mii::DefaultMii, 2> BaseMii{
|
||||||
|
Service::Mii::DefaultMii{
|
||||||
|
.face_type = 0,
|
||||||
|
.face_color = 0,
|
||||||
|
.face_wrinkle = 0,
|
||||||
|
.face_makeup = 0,
|
||||||
|
.hair_type = 33,
|
||||||
|
.hair_color = 1,
|
||||||
|
.hair_flip = 0,
|
||||||
|
.eye_type = 2,
|
||||||
|
.eye_color = 0,
|
||||||
|
.eye_scale = 4,
|
||||||
|
.eye_aspect = 3,
|
||||||
|
.eye_rotate = 4,
|
||||||
|
.eye_x = 2,
|
||||||
|
.eye_y = 12,
|
||||||
|
.eyebrow_type = 6,
|
||||||
|
.eyebrow_color = 1,
|
||||||
|
.eyebrow_scale = 4,
|
||||||
|
.eyebrow_aspect = 3,
|
||||||
|
.eyebrow_rotate = 6,
|
||||||
|
.eyebrow_x = 2,
|
||||||
|
.eyebrow_y = 10,
|
||||||
|
.nose_type = 1,
|
||||||
|
.nose_scale = 4,
|
||||||
|
.nose_y = 9,
|
||||||
|
.mouth_type = 23,
|
||||||
|
.mouth_color = 0,
|
||||||
|
.mouth_scale = 4,
|
||||||
|
.mouth_aspect = 3,
|
||||||
|
.mouth_y = 13,
|
||||||
|
.mustache_type = 0,
|
||||||
|
.beard_type = 0,
|
||||||
|
.beard_color = 0,
|
||||||
|
.mustache_scale = 4,
|
||||||
|
.mustache_y = 10,
|
||||||
|
.glasses_type = 0,
|
||||||
|
.glasses_color = 0,
|
||||||
|
.glasses_scale = 4,
|
||||||
|
.glasses_y = 10,
|
||||||
|
.mole_type = 0,
|
||||||
|
.mole_scale = 4,
|
||||||
|
.mole_x = 2,
|
||||||
|
.mole_y = 20,
|
||||||
|
.height = 64,
|
||||||
|
.weight = 64,
|
||||||
|
.gender = Gender::Male,
|
||||||
|
.favorite_color = 0,
|
||||||
|
.region = 0,
|
||||||
|
.font_region = FontRegion::Standard,
|
||||||
|
.type = 0,
|
||||||
|
},
|
||||||
|
Service::Mii::DefaultMii{
|
||||||
|
.face_type = 0,
|
||||||
|
.face_color = 0,
|
||||||
|
.face_wrinkle = 0,
|
||||||
|
.face_makeup = 0,
|
||||||
|
.hair_type = 12,
|
||||||
|
.hair_color = 1,
|
||||||
|
.hair_flip = 0,
|
||||||
|
.eye_type = 4,
|
||||||
|
.eye_color = 0,
|
||||||
|
.eye_scale = 4,
|
||||||
|
.eye_aspect = 3,
|
||||||
|
.eye_rotate = 3,
|
||||||
|
.eye_x = 2,
|
||||||
|
.eye_y = 12,
|
||||||
|
.eyebrow_type = 0,
|
||||||
|
.eyebrow_color = 1,
|
||||||
|
.eyebrow_scale = 4,
|
||||||
|
.eyebrow_aspect = 3,
|
||||||
|
.eyebrow_rotate = 6,
|
||||||
|
.eyebrow_x = 2,
|
||||||
|
.eyebrow_y = 10,
|
||||||
|
.nose_type = 1,
|
||||||
|
.nose_scale = 4,
|
||||||
|
.nose_y = 9,
|
||||||
|
.mouth_type = 23,
|
||||||
|
.mouth_color = 0,
|
||||||
|
.mouth_scale = 4,
|
||||||
|
.mouth_aspect = 3,
|
||||||
|
.mouth_y = 13,
|
||||||
|
.mustache_type = 0,
|
||||||
|
.beard_type = 0,
|
||||||
|
.beard_color = 0,
|
||||||
|
.mustache_scale = 4,
|
||||||
|
.mustache_y = 10,
|
||||||
|
.glasses_type = 0,
|
||||||
|
.glasses_color = 0,
|
||||||
|
.glasses_scale = 4,
|
||||||
|
.glasses_y = 10,
|
||||||
|
.mole_type = 0,
|
||||||
|
.mole_scale = 4,
|
||||||
|
.mole_x = 2,
|
||||||
|
.mole_y = 20,
|
||||||
|
.height = 64,
|
||||||
|
.weight = 64,
|
||||||
|
.gender = Gender::Female,
|
||||||
|
.favorite_color = 0,
|
||||||
|
.region = 0,
|
||||||
|
.font_region = FontRegion::Standard,
|
||||||
|
.type = 0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const std::array<Service::Mii::DefaultMii, 6> DefaultMii{
|
const std::array<Service::Mii::DefaultMii, 6> DefaultMii{
|
||||||
Service::Mii::DefaultMii{
|
Service::Mii::DefaultMii{
|
||||||
.face_type = 0,
|
.face_type = 0,
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
namespace Service::Mii::RawData {
|
namespace Service::Mii::RawData {
|
||||||
|
|
||||||
|
extern const std::array<Service::Mii::DefaultMii, 2> BaseMii;
|
||||||
extern const std::array<Service::Mii::DefaultMii, 6> DefaultMii;
|
extern const std::array<Service::Mii::DefaultMii, 6> DefaultMii;
|
||||||
extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFaceline;
|
extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFaceline;
|
||||||
extern const std::array<Service::Mii::RandomMiiData3, 6> RandomMiiFacelineColor;
|
extern const std::array<Service::Mii::RandomMiiData3, 6> RandomMiiFacelineColor;
|
||||||
|
|
|
@ -826,7 +826,7 @@ Result NfcDevice::SetRegisterInfoPrivate(const NFP::RegisterInfoPrivate& registe
|
||||||
}
|
}
|
||||||
|
|
||||||
Service::Mii::MiiManager manager;
|
Service::Mii::MiiManager manager;
|
||||||
const auto mii = manager.BuildDefault(0);
|
const auto mii = manager.BuildBase(Mii::Gender::Male);
|
||||||
auto& settings = tag_data.settings;
|
auto& settings = tag_data.settings;
|
||||||
|
|
||||||
if (tag_data.settings.settings.amiibo_initialized == 0) {
|
if (tag_data.settings.settings.amiibo_initialized == 0) {
|
||||||
|
@ -1467,7 +1467,7 @@ void NfcDevice::BuildAmiiboWithoutKeys(NFP::NTAG215File& stubbed_tag_data,
|
||||||
SetAmiiboName(settings, {'y', 'u', 'z', 'u', 'A', 'm', 'i', 'i', 'b', 'o'});
|
SetAmiiboName(settings, {'y', 'u', 'z', 'u', 'A', 'm', 'i', 'i', 'b', 'o'});
|
||||||
settings.settings.font_region.Assign(0);
|
settings.settings.font_region.Assign(0);
|
||||||
settings.init_date = GetAmiiboDate(GetCurrentPosixTime());
|
settings.init_date = GetAmiiboDate(GetCurrentPosixTime());
|
||||||
stubbed_tag_data.owner_mii = manager.BuildFromStoreData(manager.BuildDefault(0));
|
stubbed_tag_data.owner_mii = manager.BuildFromStoreData(manager.BuildBase(Mii::Gender::Male));
|
||||||
|
|
||||||
// Admin info
|
// Admin info
|
||||||
settings.settings.amiibo_initialized.Assign(1);
|
settings.settings.amiibo_initialized.Assign(1);
|
||||||
|
|
Loading…
Reference in a new issue