Address more reviews

This commit is contained in:
fearlessTobi 2019-02-26 23:36:58 +01:00
parent 781d4b787a
commit 1517d2fef7
3 changed files with 9 additions and 5 deletions

View File

@ -26,8 +26,9 @@ QtMiiSelectorDialog::QtMiiSelectorDialog(QWidget* parent, QtMiiSelector* mii_sel
buttons->addButton(tr(MII_BUTTON_CANCEL), QDialogButtonBox::ButtonRole::RejectRole); buttons->addButton(tr(MII_BUTTON_CANCEL), QDialogButtonBox::ButtonRole::RejectRole);
} }
setWindowTitle(config.title.empty() ? tr("Mii Selector") setWindowTitle(config.title.empty() || config.title.at(0) == '\x0000'
: QString::fromStdU16String(config.title)); ? tr("Mii Selector")
: QString::fromStdU16String(config.title));
miis.push_back(HLE::Applets::MiiSelector::GetStandardMiiResult().selected_mii_data); miis.push_back(HLE::Applets::MiiSelector::GetStandardMiiResult().selected_mii_data);
combobox->addItem(tr("Standard Mii")); combobox->addItem(tr("Standard Mii"));
@ -35,7 +36,7 @@ QtMiiSelectorDialog::QtMiiSelectorDialog(QWidget* parent, QtMiiSelector* mii_sel
std::string nand_directory{FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)}; std::string nand_directory{FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)};
FileSys::ArchiveFactory_ExtSaveData extdata_archive_factory(nand_directory, true); FileSys::ArchiveFactory_ExtSaveData extdata_archive_factory(nand_directory, true);
auto archive_result = extdata_archive_factory.Open(Service::PTM::ptm_shared_extdata_id); auto archive_result = extdata_archive_factory.Open(Service::PTM::ptm_shared_extdata_id, 0);
if (archive_result.Succeeded()) { if (archive_result.Succeeded()) {
auto archive = std::move(archive_result).Unwrap(); auto archive = std::move(archive_result).Unwrap();

View File

@ -142,7 +142,10 @@ MiiResult MiiSelector::GetStandardMiiResult() {
Frontend::MiiSelectorConfig MiiSelector::ToFrontendConfig(const MiiConfig& config) const { Frontend::MiiSelectorConfig MiiSelector::ToFrontendConfig(const MiiConfig& config) const {
Frontend::MiiSelectorConfig frontend_config; Frontend::MiiSelectorConfig frontend_config;
frontend_config.enable_cancel_button = config.enable_cancel_button == 1; frontend_config.enable_cancel_button = config.enable_cancel_button == 1;
frontend_config.title = reinterpret_cast<const char16_t*>(config.title.data()); std::transform(config.title.begin(), config.title.end(),
std::back_inserter(frontend_config.title), [](u16_le character) -> char16_t {
return static_cast<char16_t>(static_cast<u16>(character));
});
frontend_config.initially_selected_mii_index = config.initially_selected_mii_index; frontend_config.initially_selected_mii_index = config.initially_selected_mii_index;
return frontend_config; return frontend_config;
} }

View File

@ -24,7 +24,7 @@ struct MiiConfig {
u8 enable_guest_mii; u8 enable_guest_mii;
u8 show_on_top_screen; u8 show_on_top_screen;
INSERT_PADDING_BYTES(5); INSERT_PADDING_BYTES(5);
std::array<u16, 0x40> title; std::array<u16_le, 0x40> title;
INSERT_PADDING_BYTES(4); INSERT_PADDING_BYTES(4);
u8 show_guest_miis; u8 show_guest_miis;
INSERT_PADDING_BYTES(3); INSERT_PADDING_BYTES(3);