Compare commits
1 Commits
rem-dup-ap
...
mutliplaye
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
795a52c75a |
@@ -170,14 +170,10 @@ struct Values {
|
||||
// multiplayer settings
|
||||
Setting<std::string> multiplayer_nickname{linkage, {}, "nickname", Category::Multiplayer};
|
||||
Setting<std::string> multiplayer_filter_text{linkage, {}, "filter_text", Category::Multiplayer};
|
||||
Setting<bool> multiplayer_filter_games_owned{linkage, false, "filter_games_owned",
|
||||
Category::Multiplayer};
|
||||
Setting<bool> multiplayer_filter_hide_empty{linkage, false, "filter_games_hide_empty",
|
||||
Category::Multiplayer};
|
||||
Setting<bool> multiplayer_filter_hide_full{linkage, false, "filter_games_hide_full",
|
||||
Category::Multiplayer};
|
||||
Setting<bool> multiplayer_filter_games_owned{linkage, true, "filter_games_owned", Category::Multiplayer};
|
||||
Setting<bool> multiplayer_filter_public_rooms{linkage, true, "filter_games_public_room", Category::Multiplayer};
|
||||
Setting<std::string> multiplayer_ip{linkage, {}, "ip", Category::Multiplayer};
|
||||
Setting<u16, true> multiplayer_port{linkage, 24872, 0,
|
||||
Setting<u16, true> multiplayer_port{linkage, 24872, 0,
|
||||
UINT16_MAX, "port", Category::Multiplayer};
|
||||
Setting<std::string> multiplayer_room_nickname{
|
||||
linkage, {}, "room_nickname", Category::Multiplayer};
|
||||
|
||||
@@ -160,20 +160,20 @@
|
||||
<property name="title">
|
||||
<string>Am&iibo</string>
|
||||
</property>
|
||||
<addaction name="action_Launch_Cabinet_Nickname_Owner"/>
|
||||
<addaction name="action_Launch_Cabinet_Eraser"/>
|
||||
<addaction name="action_Launch_Cabinet_Restorer"/>
|
||||
<addaction name="action_Launch_Cabinet_Formatter"/>
|
||||
<addaction name="action_Load_Cabinet_Nickname_Owner"/>
|
||||
<addaction name="action_Load_Cabinet_Eraser"/>
|
||||
<addaction name="action_Load_Cabinet_Restorer"/>
|
||||
<addaction name="action_Load_Cabinet_Formatter"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Applets">
|
||||
<property name="title">
|
||||
<string>Launch &Applet</string>
|
||||
<string>&Applets</string>
|
||||
</property>
|
||||
<addaction name="action_Launch_QLaunch"/>
|
||||
<addaction name="action_Launch_MiiEdit"/>
|
||||
<addaction name="action_Launch_Controller"/>
|
||||
<addaction name="action_Launch_Setup"/>
|
||||
<addaction name="action_Launch_PhotoViewer"/>
|
||||
<addaction name="action_Load_Home_Menu"/>
|
||||
<addaction name="action_Load_Album"/>
|
||||
<addaction name="action_Load_Mii_Edit"/>
|
||||
<addaction name="action_Open_Controller_Menu"/>
|
||||
<addaction name="action_Open_Setup"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuTAS">
|
||||
<property name="title">
|
||||
@@ -420,34 +420,34 @@
|
||||
<string>&Capture Screenshot</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Launch_PhotoViewer">
|
||||
<action name="action_Load_Album">
|
||||
<property name="text">
|
||||
<string>&Album</string>
|
||||
<string>Open &Album</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Launch_Cabinet_Nickname_Owner">
|
||||
<action name="action_Load_Cabinet_Nickname_Owner">
|
||||
<property name="text">
|
||||
<string>&Set Nickname and Owner</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Launch_Cabinet_Eraser">
|
||||
<action name="action_Load_Cabinet_Eraser">
|
||||
<property name="text">
|
||||
<string>&Delete Game Data</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Launch_Cabinet_Restorer">
|
||||
<action name="action_Load_Cabinet_Restorer">
|
||||
<property name="text">
|
||||
<string>&Restore Amiibo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Launch_Cabinet_Formatter">
|
||||
<action name="action_Load_Cabinet_Formatter">
|
||||
<property name="text">
|
||||
<string>&Format Amiibo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Launch_MiiEdit">
|
||||
<action name="action_Load_Mii_Edit">
|
||||
<property name="text">
|
||||
<string>&Mii Editor</string>
|
||||
<string>Open &Mii Editor</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Configure_Tas">
|
||||
@@ -493,7 +493,7 @@
|
||||
<string>R&ecord</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Launch_Controller">
|
||||
<action name="action_Open_Controller_Menu">
|
||||
<property name="text">
|
||||
<string>Open &Controller Menu</string>
|
||||
</property>
|
||||
@@ -503,14 +503,14 @@
|
||||
<string>Install Decryption &Keys</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Launch_QLaunch">
|
||||
<action name="action_Load_Home_Menu">
|
||||
<property name="text">
|
||||
<string>&Home Menu</string>
|
||||
<string>Open &Home Menu</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Launch_Setup">
|
||||
<action name="action_Open_Setup">
|
||||
<property name="text">
|
||||
<string>&Setup</string>
|
||||
<string>Open &Setup</string>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::MenuRole::TextHeuristicRole</enum>
|
||||
|
||||
@@ -705,13 +705,13 @@ MainWindow::MainWindow(bool has_broken_vulkan)
|
||||
}
|
||||
|
||||
if (should_launch_setup) {
|
||||
LaunchFirmwareApplet(Service::AM::AppletProgramId::Starter, std::nullopt);
|
||||
OnInitialSetup();
|
||||
} else {
|
||||
if (!game_path.isEmpty()) {
|
||||
BootGame(game_path, ApplicationAppletParameters());
|
||||
} else {
|
||||
if (should_launch_qlaunch) {
|
||||
LaunchFirmwareApplet(Service::AM::AppletProgramId::QLaunch, std::nullopt);
|
||||
OnHomeMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1661,35 +1661,19 @@ void MainWindow::ConnectMenuEvents() {
|
||||
connect(multiplayer_state, &MultiplayerState::SaveConfig, this, &MainWindow::OnSaveConfig);
|
||||
|
||||
// Tools
|
||||
connect_menu(ui->action_Launch_PhotoViewer, [this]{
|
||||
LaunchFirmwareApplet(Service::AM::AppletProgramId::PhotoViewer, std::nullopt);
|
||||
});
|
||||
connect_menu(ui->action_Launch_MiiEdit, [this]{
|
||||
LaunchFirmwareApplet(Service::AM::AppletProgramId::MiiEdit, std::nullopt);
|
||||
});
|
||||
connect_menu(ui->action_Launch_Controller, [this]{
|
||||
LaunchFirmwareApplet(Service::AM::AppletProgramId::Controller, std::nullopt);
|
||||
});
|
||||
connect_menu(ui->action_Launch_QLaunch, [this]{
|
||||
LaunchFirmwareApplet(Service::AM::AppletProgramId::QLaunch, std::nullopt);
|
||||
});
|
||||
connect_menu(ui->action_Launch_Setup, [this]{
|
||||
LaunchFirmwareApplet(Service::AM::AppletProgramId::Starter, std::nullopt);
|
||||
});
|
||||
// Tools (cabinet)
|
||||
connect_menu(ui->action_Launch_Cabinet_Nickname_Owner, [this]{
|
||||
LaunchFirmwareApplet(Service::AM::AppletProgramId::Cabinet, {Service::NFP::CabinetMode::StartNicknameAndOwnerSettings});
|
||||
});
|
||||
connect_menu(ui->action_Launch_Cabinet_Eraser, [this]{
|
||||
LaunchFirmwareApplet(Service::AM::AppletProgramId::Cabinet, {Service::NFP::CabinetMode::StartGameDataEraser});
|
||||
});
|
||||
connect_menu(ui->action_Launch_Cabinet_Restorer, [this]{
|
||||
LaunchFirmwareApplet(Service::AM::AppletProgramId::Cabinet, {Service::NFP::CabinetMode::StartRestorer});
|
||||
});
|
||||
connect_menu(ui->action_Launch_Cabinet_Formatter, [this]{
|
||||
LaunchFirmwareApplet(Service::AM::AppletProgramId::Cabinet, {Service::NFP::CabinetMode::StartFormatter});
|
||||
});
|
||||
|
||||
connect_menu(ui->action_Load_Album, &MainWindow::OnAlbum);
|
||||
connect_menu(ui->action_Load_Cabinet_Nickname_Owner,
|
||||
[this]() { OnCabinet(Service::NFP::CabinetMode::StartNicknameAndOwnerSettings); });
|
||||
connect_menu(ui->action_Load_Cabinet_Eraser,
|
||||
[this]() { OnCabinet(Service::NFP::CabinetMode::StartGameDataEraser); });
|
||||
connect_menu(ui->action_Load_Cabinet_Restorer,
|
||||
[this]() { OnCabinet(Service::NFP::CabinetMode::StartRestorer); });
|
||||
connect_menu(ui->action_Load_Cabinet_Formatter,
|
||||
[this]() { OnCabinet(Service::NFP::CabinetMode::StartFormatter); });
|
||||
connect_menu(ui->action_Load_Mii_Edit, &MainWindow::OnMiiEdit);
|
||||
connect_menu(ui->action_Open_Controller_Menu, &MainWindow::OnOpenControllerMenu);
|
||||
connect_menu(ui->action_Load_Home_Menu, &MainWindow::OnHomeMenu);
|
||||
connect_menu(ui->action_Open_Setup, &MainWindow::OnInitialSetup);
|
||||
connect_menu(ui->action_Desktop, &MainWindow::OnCreateHomeMenuDesktopShortcut);
|
||||
connect_menu(ui->action_Application_Menu,
|
||||
&MainWindow::OnCreateHomeMenuApplicationMenuShortcut);
|
||||
@@ -1730,16 +1714,14 @@ void MainWindow::UpdateMenuState() {
|
||||
ui->action_Pause,
|
||||
};
|
||||
|
||||
const std::array applet_actions{
|
||||
ui->action_Launch_PhotoViewer,
|
||||
ui->action_Launch_Cabinet_Nickname_Owner,
|
||||
ui->action_Launch_Cabinet_Eraser,
|
||||
ui->action_Launch_Cabinet_Restorer,
|
||||
ui->action_Launch_Cabinet_Formatter,
|
||||
ui->action_Launch_MiiEdit,
|
||||
ui->action_Launch_QLaunch,
|
||||
ui->action_Launch_Controller
|
||||
};
|
||||
const std::array applet_actions{ui->action_Load_Album,
|
||||
ui->action_Load_Cabinet_Nickname_Owner,
|
||||
ui->action_Load_Cabinet_Eraser,
|
||||
ui->action_Load_Cabinet_Restorer,
|
||||
ui->action_Load_Cabinet_Formatter,
|
||||
ui->action_Load_Mii_Edit,
|
||||
ui->action_Load_Home_Menu,
|
||||
ui->action_Open_Controller_Menu};
|
||||
|
||||
for (QAction* action : running_actions) {
|
||||
action->setEnabled(emulation_running);
|
||||
@@ -3978,61 +3960,157 @@ void MainWindow::OnGameListRefresh()
|
||||
SetFirmwareVersion();
|
||||
}
|
||||
|
||||
void MainWindow::OnAlbum() {
|
||||
constexpr u64 AlbumId = static_cast<u64>(Service::AM::AppletProgramId::PhotoViewer);
|
||||
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (!bis_system) {
|
||||
QMessageBox::warning(this, tr("No firmware available"),
|
||||
tr("Please install firmware to use the Album applet."));
|
||||
return;
|
||||
}
|
||||
|
||||
void MainWindow::LaunchFirmwareApplet(Service::AM::AppletProgramId program_id, std::optional<Service::NFP::CabinetMode> cabinet_mode) {
|
||||
auto album_nca = bis_system->GetEntry(AlbumId, FileSys::ContentRecordType::Program);
|
||||
if (!album_nca) {
|
||||
QMessageBox::warning(this, tr("Album Applet"),
|
||||
tr("Album applet is not available. Please reinstall firmware."));
|
||||
return;
|
||||
}
|
||||
|
||||
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::PhotoViewer);
|
||||
|
||||
const auto filename = QString::fromStdString(album_nca->GetFullPath());
|
||||
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
||||
BootGame(filename, LibraryAppletParameters(AlbumId, Service::AM::AppletId::PhotoViewer));
|
||||
}
|
||||
|
||||
void MainWindow::OnCabinet(Service::NFP::CabinetMode mode) {
|
||||
constexpr u64 CabinetId = static_cast<u64>(Service::AM::AppletProgramId::Cabinet);
|
||||
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (!bis_system) {
|
||||
QMessageBox::warning(this, tr("No firmware available"),
|
||||
tr("Please install firmware to use the Cabinet applet."));
|
||||
return;
|
||||
}
|
||||
|
||||
auto cabinet_nca = bis_system->GetEntry(CabinetId, FileSys::ContentRecordType::Program);
|
||||
if (!cabinet_nca) {
|
||||
QMessageBox::warning(this, tr("Cabinet Applet"),
|
||||
tr("Cabinet applet is not available. Please reinstall firmware."));
|
||||
return;
|
||||
}
|
||||
|
||||
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Cabinet);
|
||||
QtCommon::system->GetFrontendAppletHolder().SetCabinetMode(mode);
|
||||
|
||||
const auto filename = QString::fromStdString(cabinet_nca->GetFullPath());
|
||||
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
||||
BootGame(filename, LibraryAppletParameters(CabinetId, Service::AM::AppletId::Cabinet));
|
||||
}
|
||||
|
||||
void MainWindow::OnMiiEdit() {
|
||||
constexpr u64 MiiEditId = static_cast<u64>(Service::AM::AppletProgramId::MiiEdit);
|
||||
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (!bis_system) {
|
||||
QMessageBox::warning(this, tr("No firmware available"),
|
||||
tr("Please install firmware to use the Mii editor."));
|
||||
return;
|
||||
}
|
||||
|
||||
auto mii_applet_nca = bis_system->GetEntry(MiiEditId, FileSys::ContentRecordType::Program);
|
||||
if (!mii_applet_nca) {
|
||||
QMessageBox::warning(this, tr("Mii Edit Applet"),
|
||||
tr("Mii editor is not available. Please reinstall firmware."));
|
||||
return;
|
||||
}
|
||||
|
||||
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::MiiEdit);
|
||||
|
||||
const auto filename = QString::fromStdString((mii_applet_nca->GetFullPath()));
|
||||
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
||||
BootGame(filename, LibraryAppletParameters(MiiEditId, Service::AM::AppletId::MiiEdit));
|
||||
}
|
||||
|
||||
void MainWindow::OnOpenControllerMenu() {
|
||||
constexpr u64 ControllerAppletId = static_cast<u64>(Service::AM::AppletProgramId::Controller);
|
||||
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (!bis_system) {
|
||||
QMessageBox::warning(this, tr("No firmware available"),
|
||||
tr("Please install firmware to use the Controller Menu."));
|
||||
return;
|
||||
}
|
||||
|
||||
auto controller_applet_nca =
|
||||
bis_system->GetEntry(ControllerAppletId, FileSys::ContentRecordType::Program);
|
||||
if (!controller_applet_nca) {
|
||||
QMessageBox::warning(this, tr("Controller Applet"),
|
||||
tr("Controller Menu is not available. Please reinstall firmware."));
|
||||
return;
|
||||
}
|
||||
|
||||
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Controller);
|
||||
|
||||
const auto filename = QString::fromStdString((controller_applet_nca->GetFullPath()));
|
||||
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
||||
BootGame(filename,
|
||||
LibraryAppletParameters(ControllerAppletId, Service::AM::AppletId::Controller));
|
||||
}
|
||||
|
||||
void MainWindow::OnHomeMenu() {
|
||||
auto result = FirmwareManager::VerifyFirmware(*QtCommon::system.get());
|
||||
|
||||
using namespace QtCommon::StringLookup;
|
||||
|
||||
switch (result) {
|
||||
case FirmwareManager::ErrorFirmwareMissing:
|
||||
QMessageBox::warning(this, tr("No firmware available"), Lookup(FwCheckErrorFirmwareMissing));
|
||||
QMessageBox::warning(this, tr("No firmware available"),
|
||||
Lookup(FwCheckErrorFirmwareMissing));
|
||||
return;
|
||||
case FirmwareManager::ErrorFirmwareCorrupted:
|
||||
QMessageBox::warning(this, tr("Firmware Corrupted"), Lookup(FwCheckErrorFirmwareCorrupted));
|
||||
QMessageBox::warning(this, tr("Firmware Corrupted"),
|
||||
Lookup(FwCheckErrorFirmwareCorrupted));
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
constexpr u64 QLaunchId = static_cast<u64>(Service::AM::AppletProgramId::QLaunch);
|
||||
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (auto applet_nca = bis_system->GetEntry(u64(program_id), FileSys::ContentRecordType::Program); applet_nca) {
|
||||
if (auto const applet_id = [program_id] {
|
||||
using namespace Service::AM;
|
||||
switch (program_id) {
|
||||
case AppletProgramId::OverlayDisplay: return AppletId::OverlayDisplay;
|
||||
case AppletProgramId::QLaunch: return AppletId::QLaunch;
|
||||
case AppletProgramId::Starter: return AppletId::Starter;
|
||||
case AppletProgramId::Auth: return AppletId::Auth;
|
||||
case AppletProgramId::Cabinet: return AppletId::Cabinet;
|
||||
case AppletProgramId::Controller: return AppletId::Controller;
|
||||
case AppletProgramId::DataErase: return AppletId::DataErase;
|
||||
case AppletProgramId::Error: return AppletId::Error;
|
||||
case AppletProgramId::NetConnect: return AppletId::NetConnect;
|
||||
case AppletProgramId::ProfileSelect: return AppletId::ProfileSelect;
|
||||
case AppletProgramId::SoftwareKeyboard: return AppletId::SoftwareKeyboard;
|
||||
case AppletProgramId::MiiEdit: return AppletId::MiiEdit;
|
||||
case AppletProgramId::Web: return AppletId::Web;
|
||||
case AppletProgramId::Shop: return AppletId::Shop;
|
||||
case AppletProgramId::PhotoViewer: return AppletId::PhotoViewer;
|
||||
case AppletProgramId::Settings: return AppletId::Settings;
|
||||
case AppletProgramId::OfflineWeb: return AppletId::OfflineWeb;
|
||||
case AppletProgramId::LoginShare: return AppletId::LoginShare;
|
||||
case AppletProgramId::WebAuth: return AppletId::WebAuth;
|
||||
case AppletProgramId::MyPage: return AppletId::MyPage;
|
||||
default: return AppletId::None;
|
||||
|
||||
auto qlaunch_applet_nca = bis_system->GetEntry(QLaunchId, FileSys::ContentRecordType::Program);
|
||||
if (!qlaunch_applet_nca) {
|
||||
QMessageBox::warning(this, tr("Home Menu Applet"),
|
||||
tr("Home Menu is not available. Please reinstall firmware."));
|
||||
return;
|
||||
}
|
||||
}(); applet_id != Service::AM::AppletId::None) {
|
||||
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(applet_id);
|
||||
if (cabinet_mode)
|
||||
QtCommon::system->GetFrontendAppletHolder().SetCabinetMode(*cabinet_mode);
|
||||
// ?
|
||||
auto const filename = QString::fromStdString((applet_nca->GetFullPath()));
|
||||
|
||||
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::QLaunch);
|
||||
|
||||
const auto filename = QString::fromStdString((qlaunch_applet_nca->GetFullPath()));
|
||||
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
||||
BootGame(filename, LibraryAppletParameters(u64(program_id), applet_id));
|
||||
} else {
|
||||
QMessageBox::warning(this, tr("Unknown applet"), tr("Applet doesn't map to a known value."));
|
||||
}
|
||||
} else {
|
||||
QMessageBox::warning(this, tr("Record not found"), tr("Applet not found. Please reinstall firmware."));
|
||||
BootGame(filename, LibraryAppletParameters(QLaunchId, Service::AM::AppletId::QLaunch));
|
||||
}
|
||||
|
||||
void MainWindow::OnInitialSetup() {
|
||||
constexpr u64 Starter = static_cast<u64>(Service::AM::AppletProgramId::Starter);
|
||||
auto bis_system = QtCommon::system->GetFileSystemController().GetSystemNANDContents();
|
||||
if (!bis_system) {
|
||||
QMessageBox::warning(this, tr("No firmware available"),
|
||||
tr("Please install firmware to use Starter."));
|
||||
return;
|
||||
}
|
||||
|
||||
auto qlaunch_nca = bis_system->GetEntry(Starter, FileSys::ContentRecordType::Program);
|
||||
if (!qlaunch_nca) {
|
||||
QMessageBox::warning(this, tr("Starter Applet"),
|
||||
tr("Starter is not available. Please reinstall firmware."));
|
||||
return;
|
||||
}
|
||||
|
||||
QtCommon::system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::Starter);
|
||||
|
||||
const auto filename = QString::fromStdString((qlaunch_nca->GetFullPath()));
|
||||
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
|
||||
BootGame(filename, LibraryAppletParameters(Starter, Service::AM::AppletId::Starter));
|
||||
}
|
||||
|
||||
void MainWindow::OnCreateHomeMenuDesktopShortcut() {
|
||||
|
||||
@@ -101,7 +101,6 @@ class InputSubsystem;
|
||||
namespace Service::AM {
|
||||
struct FrontendAppletParameters;
|
||||
enum class AppletId : u32;
|
||||
enum class AppletProgramId : u64;
|
||||
} // namespace Service::AM
|
||||
|
||||
namespace Service::AM::Frontend {
|
||||
@@ -400,7 +399,12 @@ private slots:
|
||||
void ResetWindowSize720();
|
||||
void ResetWindowSize900();
|
||||
void ResetWindowSize1080();
|
||||
void LaunchFirmwareApplet(Service::AM::AppletProgramId program_id, std::optional<Service::NFP::CabinetMode> mode);
|
||||
void OnAlbum();
|
||||
void OnCabinet(Service::NFP::CabinetMode mode);
|
||||
void OnMiiEdit();
|
||||
void OnOpenControllerMenu();
|
||||
void OnHomeMenu();
|
||||
void OnInitialSetup();
|
||||
void OnCreateHomeMenuDesktopShortcut();
|
||||
void OnCreateHomeMenuApplicationMenuShortcut();
|
||||
void OnCaptureScreenshot();
|
||||
@@ -424,6 +428,7 @@ private:
|
||||
bool SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id,
|
||||
u64* selected_title_id, u8* selected_content_record_type);
|
||||
ContentManager::InstallResult InstallNCA(const QString& filename);
|
||||
void MigrateConfigFiles();
|
||||
void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {},
|
||||
std::string_view gpu_vendor = {});
|
||||
void UpdateDockedButton();
|
||||
|
||||
@@ -62,14 +62,12 @@ Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
|
||||
ui->room_list->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
ui->nickname->setValidator(validation.GetNickname());
|
||||
ui->nickname->setText(
|
||||
QString::fromStdString(UISettings::values.multiplayer_nickname.GetValue()));
|
||||
ui->nickname->setText(QString::fromStdString(UISettings::values.multiplayer_nickname.GetValue()));
|
||||
|
||||
// Try find the best nickname by default
|
||||
if (ui->nickname->text().isEmpty() || ui->nickname->text() == QStringLiteral("Eden")) {
|
||||
if (!Settings::values.eden_username.GetValue().empty()) {
|
||||
ui->nickname->setText(
|
||||
QString::fromStdString(Settings::values.eden_username.GetValue()));
|
||||
if (auto const username = Settings::values.eden_username.GetValue(); !username.empty()) {
|
||||
ui->nickname->setText(QString::fromStdString(username));
|
||||
} else if (!GetProfileUsername().empty()) {
|
||||
ui->nickname->setText(QString::fromStdString(GetProfileUsername()));
|
||||
} else {
|
||||
@@ -81,21 +79,17 @@ Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
|
||||
connect(ui->refresh_list, &QPushButton::clicked, this, &Lobby::RefreshLobby);
|
||||
connect(ui->search, &QLineEdit::textChanged, proxy, &LobbyFilterProxyModel::SetFilterSearch);
|
||||
connect(ui->games_owned, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterOwned);
|
||||
connect(ui->hide_empty, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterEmpty);
|
||||
connect(ui->hide_full, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterFull);
|
||||
connect(ui->public_rooms, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterPublic);
|
||||
connect(ui->room_list, &QTreeView::doubleClicked, this, &Lobby::OnJoinRoom);
|
||||
connect(ui->room_list, &QTreeView::clicked, this, &Lobby::OnExpandRoom);
|
||||
|
||||
// Actions
|
||||
connect(&room_list_watcher, &QFutureWatcher<AnnounceMultiplayerRoom::RoomList>::finished, this,
|
||||
&Lobby::OnRefreshLobby);
|
||||
connect(&room_list_watcher, &QFutureWatcher<AnnounceMultiplayerRoom::RoomList>::finished, this, &Lobby::OnRefreshLobby);
|
||||
|
||||
// Load persistent filters after events are connected to make sure they apply
|
||||
ui->search->setText(
|
||||
QString::fromStdString(UISettings::values.multiplayer_filter_text.GetValue()));
|
||||
ui->search->setText(QString::fromStdString(UISettings::values.multiplayer_filter_text.GetValue()));
|
||||
ui->games_owned->setChecked(UISettings::values.multiplayer_filter_games_owned.GetValue());
|
||||
ui->hide_empty->setChecked(UISettings::values.multiplayer_filter_hide_empty.GetValue());
|
||||
ui->hide_full->setChecked(UISettings::values.multiplayer_filter_hide_full.GetValue());
|
||||
ui->public_rooms->setChecked(UISettings::values.multiplayer_filter_public_rooms.GetValue());
|
||||
}
|
||||
|
||||
Lobby::~Lobby() = default;
|
||||
@@ -215,12 +209,9 @@ void Lobby::OnJoinRoom(const QModelIndex& source) {
|
||||
UISettings::values.multiplayer_nickname = ui->nickname->text().toStdString();
|
||||
UISettings::values.multiplayer_filter_text = ui->search->text().toStdString();
|
||||
UISettings::values.multiplayer_filter_games_owned = ui->games_owned->isChecked();
|
||||
UISettings::values.multiplayer_filter_hide_empty = ui->hide_empty->isChecked();
|
||||
UISettings::values.multiplayer_filter_hide_full = ui->hide_full->isChecked();
|
||||
UISettings::values.multiplayer_ip =
|
||||
proxy->data(connection_index, LobbyItemHost::HostIPRole).value<QString>().toStdString();
|
||||
UISettings::values.multiplayer_port =
|
||||
proxy->data(connection_index, LobbyItemHost::HostPortRole).toInt();
|
||||
UISettings::values.multiplayer_filter_public_rooms = ui->public_rooms->isChecked();
|
||||
UISettings::values.multiplayer_ip = proxy->data(connection_index, LobbyItemHost::HostIPRole).value<QString>().toStdString();
|
||||
UISettings::values.multiplayer_port = proxy->data(connection_index, LobbyItemHost::HostPortRole).toInt();
|
||||
emit SaveConfig();
|
||||
}
|
||||
|
||||
@@ -228,8 +219,8 @@ void Lobby::ResetModel() {
|
||||
model->clear();
|
||||
model->insertColumns(0, Column::TOTAL);
|
||||
model->setHeaderData(Column::MEMBER, Qt::Horizontal, tr("Players"), Qt::DisplayRole);
|
||||
model->setHeaderData(Column::ROOM_NAME, Qt::Horizontal, tr("Room Name"), Qt::DisplayRole);
|
||||
model->setHeaderData(Column::GAME_NAME, Qt::Horizontal, tr("Preferred Game"), Qt::DisplayRole);
|
||||
model->setHeaderData(Column::ROOM_NAME, Qt::Horizontal, tr("Name"), Qt::DisplayRole);
|
||||
model->setHeaderData(Column::GAME_NAME, Qt::Horizontal, tr("Game"), Qt::DisplayRole);
|
||||
model->setHeaderData(Column::HOST, Qt::Horizontal, tr("Host"), Qt::DisplayRole);
|
||||
}
|
||||
|
||||
@@ -345,26 +336,12 @@ bool LobbyFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex& s
|
||||
return true;
|
||||
}
|
||||
|
||||
// filter by empty rooms
|
||||
if (filter_empty) {
|
||||
QModelIndex member_list = sourceModel()->index(sourceRow, Column::MEMBER, sourceParent);
|
||||
int player_count =
|
||||
sourceModel()->data(member_list, LobbyItemMemberList::MemberListRole).toList().size();
|
||||
if (player_count == 0) {
|
||||
// filter by non-password protected
|
||||
if (filter_public) {
|
||||
QModelIndex password_index = sourceModel()->index(sourceRow, Column::ROOM_NAME);
|
||||
bool has_password = sourceModel()->data(password_index, LobbyItemName::PasswordRole).toBool();
|
||||
if (has_password)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// filter by filled rooms
|
||||
if (filter_full) {
|
||||
QModelIndex member_list = sourceModel()->index(sourceRow, Column::MEMBER, sourceParent);
|
||||
int player_count =
|
||||
sourceModel()->data(member_list, LobbyItemMemberList::MemberListRole).toList().size();
|
||||
int max_players =
|
||||
sourceModel()->data(member_list, LobbyItemMemberList::MaxPlayerRole).toInt();
|
||||
if (player_count >= max_players) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// filter by search parameters
|
||||
@@ -372,18 +349,9 @@ bool LobbyFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex& s
|
||||
QModelIndex game_name = sourceModel()->index(sourceRow, Column::GAME_NAME, sourceParent);
|
||||
QModelIndex room_name = sourceModel()->index(sourceRow, Column::ROOM_NAME, sourceParent);
|
||||
QModelIndex host_name = sourceModel()->index(sourceRow, Column::HOST, sourceParent);
|
||||
bool preferred_game_match = sourceModel()
|
||||
->data(game_name, LobbyItemGame::GameNameRole)
|
||||
.toString()
|
||||
.contains(filter_search, filterCaseSensitivity());
|
||||
bool room_name_match = sourceModel()
|
||||
->data(room_name, LobbyItemName::NameRole)
|
||||
.toString()
|
||||
.contains(filter_search, filterCaseSensitivity());
|
||||
bool username_match = sourceModel()
|
||||
->data(host_name, LobbyItemHost::HostUsernameRole)
|
||||
.toString()
|
||||
.contains(filter_search, filterCaseSensitivity());
|
||||
bool preferred_game_match = sourceModel()->data(game_name, LobbyItemGame::GameNameRole).toString().contains(filter_search, filterCaseSensitivity());
|
||||
bool room_name_match = sourceModel()->data(room_name, LobbyItemName::NameRole).toString().contains(filter_search, filterCaseSensitivity());
|
||||
bool username_match = sourceModel()->data(host_name, LobbyItemHost::HostUsernameRole).toString().contains(filter_search, filterCaseSensitivity());
|
||||
if (!preferred_game_match && !room_name_match && !username_match) {
|
||||
return false;
|
||||
}
|
||||
@@ -425,13 +393,8 @@ void LobbyFilterProxyModel::SetFilterOwned(bool filter) {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void LobbyFilterProxyModel::SetFilterEmpty(bool filter) {
|
||||
filter_empty = filter;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void LobbyFilterProxyModel::SetFilterFull(bool filter) {
|
||||
filter_full = filter;
|
||||
void LobbyFilterProxyModel::SetFilterPublic(bool filter) {
|
||||
filter_public = filter;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
||||
@@ -126,14 +126,13 @@ public:
|
||||
|
||||
public slots:
|
||||
void SetFilterOwned(bool);
|
||||
void SetFilterEmpty(bool);
|
||||
void SetFilterFull(bool);
|
||||
void SetFilterPublic(bool);
|
||||
void SetFilterSearch(const QString&);
|
||||
|
||||
private:
|
||||
QStandardItemModel* game_list;
|
||||
bool filter_owned = false;
|
||||
bool filter_empty = false;
|
||||
bool filter_full = false;
|
||||
bool filter_public = false;
|
||||
QString filter_search;
|
||||
};
|
||||
|
||||
@@ -78,16 +78,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hide_empty">
|
||||
<widget class="QCheckBox" name="public_rooms">
|
||||
<property name="text">
|
||||
<string>Hide Empty Rooms</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hide_full">
|
||||
<property name="text">
|
||||
<string>Hide Full Rooms</string>
|
||||
<string>Public Rooms</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user