more shady stuff

This commit is contained in:
Nayla Hanegan 2024-08-23 15:42:58 -04:00
commit 2bb83b1adb
16 changed files with 93 additions and 86 deletions

View file

@ -89,9 +89,6 @@ void GeckoCodeWidget::CreateWidgets()
m_add_code = new NonDefaultQPushButton(tr("&Add New Code..."));
m_edit_code = new NonDefaultQPushButton(tr("&Edit Code..."));
m_remove_code = new NonDefaultQPushButton(tr("&Remove Code"));
m_download_codes = new NonDefaultQPushButton(tr("Download Codes"));
m_download_codes->setToolTip(tr("Download Codes from the WiiRD Database"));
m_code_list->setEnabled(!m_game_id.empty());
m_name_label->setEnabled(!m_game_id.empty());
@ -102,7 +99,6 @@ void GeckoCodeWidget::CreateWidgets()
m_add_code->setEnabled(!m_game_id.empty());
m_edit_code->setEnabled(false);
m_remove_code->setEnabled(false);
m_download_codes->setEnabled(!m_game_id.empty());
auto* layout = new QVBoxLayout;
@ -135,7 +131,6 @@ void GeckoCodeWidget::CreateWidgets()
btn_layout->addWidget(m_add_code);
btn_layout->addWidget(m_edit_code);
btn_layout->addWidget(m_remove_code);
btn_layout->addWidget(m_download_codes);
layout->addLayout(btn_layout);
@ -155,7 +150,6 @@ void GeckoCodeWidget::ConnectWidgets()
connect(m_add_code, &QPushButton::clicked, this, &GeckoCodeWidget::AddCode);
connect(m_remove_code, &QPushButton::clicked, this, &GeckoCodeWidget::RemoveCode);
connect(m_edit_code, &QPushButton::clicked, this, &GeckoCodeWidget::EditCode);
connect(m_download_codes, &QPushButton::clicked, this, &GeckoCodeWidget::DownloadCodes);
connect(m_warning, &CheatWarningWidget::OpenCheatEnableSettings, this,
&GeckoCodeWidget::OpenGeneralSettings);
#ifdef USE_RETRO_ACHIEVEMENTS
@ -346,43 +340,3 @@ void GeckoCodeWidget::UpdateList()
m_code_list->setDragDropMode(QAbstractItemView::InternalMove);
}
void GeckoCodeWidget::DownloadCodes()
{
bool success;
std::vector<Gecko::GeckoCode> codes = Gecko::DownloadCodes(m_gametdb_id, &success);
if (!success)
{
ModalMessageBox::critical(this, tr("Error"), tr("Failed to download codes."));
return;
}
if (codes.empty())
{
ModalMessageBox::critical(this, tr("Error"), tr("File contained no codes."));
return;
}
size_t added_count = 0;
for (const auto& code : codes)
{
auto it = std::find(m_gecko_codes.begin(), m_gecko_codes.end(), code);
if (it == m_gecko_codes.end())
{
m_gecko_codes.push_back(code);
added_count++;
}
}
UpdateList();
SaveCodes();
ModalMessageBox::information(
this, tr("Download complete"),
tr("Downloaded %1 codes. (added %2)")
.arg(QString::number(codes.size()), QString::number(added_count)));
}

View file

@ -63,8 +63,8 @@ PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& ga
connect(graphics_mod_list, &GraphicsModListWidget::OpenGraphicsSettings, this,
&PropertiesDialog::OpenGraphicsSettings);
const int padding_width = 120;
const int padding_height = 100;
const int padding_width = 600;
const int padding_height = 1100;
tab_widget->addTab(GetWrappedWidget(game_config, this, padding_width, padding_height),
tr("Game Config"));
tab_widget->addTab(GetWrappedWidget(patches, this, padding_width, padding_height), tr("Patches"));
@ -106,3 +106,50 @@ PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& ga
setLayout(layout);
tab_widget->setCurrentIndex(3);
}
GeckoDialog::GeckoDialog(QWidget* parent) : QDialog(parent)
{
setWindowTitle(QStringLiteral("%1").arg(QString::fromStdString("Modifications")));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QVBoxLayout* layout = new QVBoxLayout();
QTabWidget* tab_widget = new QTabWidget(this);
GeckoCodeWidget* mp4_gecko = new GeckoCodeWidget("GMPE01", "GMPE01", 0);
GeckoCodeWidget* mp5_gecko = new GeckoCodeWidget("GP5E01", "GP5E01", 0);
GeckoCodeWidget* mp6_gecko = new GeckoCodeWidget("GP6E01", "GP6E01", 0);
GeckoCodeWidget* mp7_gecko = new GeckoCodeWidget("GP7E01", "GP7E01", 0);
GeckoCodeWidget* mp8_gecko = new GeckoCodeWidget("RM8E01", "RM8E01", 0);
connect(mp4_gecko, &GeckoCodeWidget::OpenGeneralSettings, this,
&GeckoDialog::OpenGeneralSettings);
connect(mp5_gecko, &GeckoCodeWidget::OpenGeneralSettings, this,
&GeckoDialog::OpenGeneralSettings);
connect(mp6_gecko, &GeckoCodeWidget::OpenGeneralSettings, this,
&GeckoDialog::OpenGeneralSettings);
connect(mp7_gecko, &GeckoCodeWidget::OpenGeneralSettings, this,
&GeckoDialog::OpenGeneralSettings);
connect(mp8_gecko, &GeckoCodeWidget::OpenGeneralSettings, this,
&GeckoDialog::OpenGeneralSettings);
const int padding_width = 600;
const int padding_height = 1100;
tab_widget->addTab(GetWrappedWidget(mp4_gecko, this, padding_width, padding_height),
tr("Mario Party 4"));
tab_widget->addTab(GetWrappedWidget(mp5_gecko, this, padding_width, padding_height),
tr("Mario Party 5"));
tab_widget->addTab(GetWrappedWidget(mp6_gecko, this, padding_width, padding_height),
tr("Mario Party 6"));
tab_widget->addTab(GetWrappedWidget(mp7_gecko, this, padding_width, padding_height),
tr("Mario Party 7"));
tab_widget->addTab(GetWrappedWidget(mp8_gecko, this, padding_width, padding_height),
tr("Mario Party 8"));
layout->addWidget(tab_widget);
QDialogButtonBox* close_box = new QDialogButtonBox(QDialogButtonBox::Close);
connect(close_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
layout->addWidget(close_box);
setLayout(layout);
}

View file

@ -23,3 +23,13 @@ signals:
void OpenAchievementSettings();
#endif // USE_RETRO_ACHIEVEMENTS
};
class GeckoDialog final : public QDialog
{
Q_OBJECT
public:
explicit GeckoDialog(QWidget* parent);
signals:
void OpenGeneralSettings();
};

View file

@ -67,7 +67,7 @@
#include "Core/State.h"
#include "Core/System.h"
#include "Core/WiiUtils.h"
#include "PropertiesDialog.h"
#include "DiscIO/DirectoryBlob.h"
#include "DiscIO/NANDImporter.h"
#include "DiscIO/RiivolutionPatcher.h"
@ -699,7 +699,7 @@ void MainWindow::ConnectToolBar()
connect(m_tool_bar, &ToolBar::GraphicsPressed, this, &MainWindow::ShowGraphicsWindow);
connect(m_tool_bar, &ToolBar::StartNetPlayPressed, this, &MainWindow::ShowNetPlaySetupDialog);
connect(m_tool_bar, &ToolBar::ViewGeckoCodes, this, &MainWindow::ShowGeckoCodes);
connect(m_tool_bar, &ToolBar::StepPressed, m_code_widget, &CodeWidget::Step);
connect(m_tool_bar, &ToolBar::StepOverPressed, m_code_widget, &CodeWidget::StepOver);
connect(m_tool_bar, &ToolBar::StepOutPressed, m_code_widget, &CodeWidget::StepOut);
@ -2192,3 +2192,16 @@ void MainWindow::ShowRiivolutionBootWidget(const UICommon::GameFile& game)
AddRiivolutionPatches(boot_params.get(), std::move(w.GetPatches()));
StartGame(std::move(boot_params));
}
void MainWindow::ShowGeckoCodes()
{
if (!m_gecko_dialog)
{
m_gecko_dialog = new GeckoDialog(this);
InstallHotkeyFilter(m_gecko_dialog);
}
m_gecko_dialog->show();
m_gecko_dialog->raise();
m_gecko_dialog->activateWindow();
}

View file

@ -31,6 +31,7 @@ class FreeLookWindow;
class GameList;
class GBATASInputWindow;
class GCTASInputWindow;
class GeckoDialog;
class GraphicsWindow;
class HotkeyScheduler;
class InfinityBaseWindow;
@ -213,6 +214,7 @@ private:
void dragEnterEvent(QDragEnterEvent* event) override;
void dropEvent(QDropEvent* event) override;
QSize sizeHint() const override;
void ShowGeckoCodes();
#ifdef _WIN32
// This gets called for each event from the Windows message queue.
@ -237,7 +239,7 @@ private:
bool m_is_screensaver_inhibited = false;
u32 m_state_slot = 1;
std::unique_ptr<BootParameters> m_pending_boot;
GeckoDialog* m_gecko_dialog = nullptr;
ControllersWindow* m_controllers_window = nullptr;
SettingsWindow* m_settings_window = nullptr;
GraphicsWindow* m_graphics_window = nullptr;
@ -246,7 +248,6 @@ private:
InfinityBaseWindow* m_infinity_window = nullptr;
MappingWindow* m_hotkey_window = nullptr;
FreeLookWindow* m_freelook_window = nullptr;
HotkeyScheduler* m_hotkey_scheduler;
NetPlayDialog* m_netplay_dialog;
DiscordHandler* m_netplay_discord;

View file

@ -105,7 +105,7 @@ void NetPlayBrowser::Refresh()
std::map<std::string, std::string> filters;
if (m_check_hide_incompatible->isChecked())
filters["version"] = Common::GetScmDescStr();
filters["version"] = "MPN";
if (!m_edit_name->text().isEmpty())
filters["name"] = m_edit_name->text().toStdString();

View file

@ -264,7 +264,7 @@ void NetPlayDialog::CreateMainLayout()
m_main_layout->addLayout(options_widget, 2, 0, 1, -1, Qt::AlignRight);
m_main_layout->setRowStretch(1, 1000);
m_buffer_size_box->setFixedSize(100, 20);
setLayout(m_main_layout);
}
@ -1297,4 +1297,4 @@ void NetPlayDialog::OnActiveGeckoCodes(std::string codeStr)
void NetPlayDialog::OnActiveARCodes(std::string codeStr)
{
DisplayMessage(QString::fromStdString(codeStr), "cornflowerblue");
}
}

View file

@ -371,7 +371,7 @@ void NetPlaySetupDialog::show()
m_host_server_name->setText(QString::fromStdString(nickname));
}
m_connection_type->setCurrentIndex(1);
m_tab_widget->setCurrentIndex(2); // start on browser
m_tab_widget->setCurrentIndex(2);
PopulateGameList();
QDialog::show();
@ -444,7 +444,7 @@ void NetPlaySetupDialog::RefreshBrowser()
filters["name"] = m_edit_name->text().toStdString();
if (true)
filters["version"] = Common::GetScmDescStr();
filters["version"] = "MPN";
if (!m_radio_all->isChecked())
filters["password"] = std::to_string(m_radio_private->isChecked());

View file

@ -133,7 +133,7 @@ void ToolBar::MakeActions()
m_config_action = addAction(tr("Config"), this, &ToolBar::SettingsPressed);
m_graphics_action = addAction(tr("Graphics"), this, &ToolBar::GraphicsPressed);
m_controllers_action = addAction(tr("Controllers"), this, &ToolBar::ControllersPressed);
m_view_gecko_codes_action = addAction(tr("Modifications"), this, &ToolBar::ViewGeckoCodes);
// Ensure every button has about the same width
std::vector<QWidget*> items;
for (const auto& action :
@ -196,6 +196,7 @@ void ToolBar::UpdateIcons()
m_screenshot_action->setIcon(Resources::GetThemeIcon("screenshot"));
m_config_action->setIcon(Resources::GetThemeIcon("config"));
m_controllers_action->setIcon(Resources::GetThemeIcon("classic"));
m_view_gecko_codes_action->setIcon(Resources::GetThemeIcon("modifications"));
m_graphics_action->setIcon(Resources::GetThemeIcon("graphics"));
m_start_netplay_action->setIcon(Resources::GetThemeIcon("wifi"));
}

View file

@ -34,7 +34,7 @@ signals:
void GraphicsPressed();
void StartNetPlayPressed();
void ViewGeckoCodes();
void StepPressed();
void StepOverPressed();
void StepOutPressed();
@ -59,9 +59,10 @@ private:
QAction* m_config_action;
QAction* m_controllers_action;
QAction* m_graphics_action;
QAction* m_start_netplay_action;
QAction* m_view_gecko_codes_action;
QAction* m_step_action;
QAction* m_step_over_action;
QAction* m_step_out_action;