mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 03:35:46 -04:00
Cheevos: Add RAIntergration support
This commit is contained in:
@ -20,6 +20,11 @@
|
||||
#include "scmversion/scmversion.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "settingwidgetbinder.h"
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
#include "core/cheevos.h"
|
||||
#endif
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QFileInfo>
|
||||
@ -101,6 +106,11 @@ void MainWindow::initializeAndShow()
|
||||
switchToGameListView();
|
||||
|
||||
show();
|
||||
|
||||
#ifdef WITH_RAINTEGRATION
|
||||
if (Cheevos::IsUsingRAIntegration())
|
||||
Cheevos::RAIntegration::MainWindowChanged((void*)winId());
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::reportError(const QString& message)
|
||||
@ -991,6 +1001,33 @@ void MainWindow::setupAdditionalUi()
|
||||
connect(action, &QAction::triggered,
|
||||
[scale]() { QtHostInterface::GetInstance()->requestRenderWindowScale(scale); });
|
||||
}
|
||||
|
||||
#ifdef WITH_RAINTEGRATION
|
||||
if (Cheevos::IsUsingRAIntegration())
|
||||
{
|
||||
QMenu* raMenu = new QMenu(QStringLiteral("RAIntegration"), m_ui.menuDebug);
|
||||
connect(raMenu, &QMenu::aboutToShow, this, [this, raMenu]() {
|
||||
raMenu->clear();
|
||||
|
||||
const auto items = Cheevos::RAIntegration::GetMenuItems();
|
||||
for (const auto& [id, title] : items)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
raMenu->addSeparator();
|
||||
continue;
|
||||
}
|
||||
|
||||
QAction* raAction = raMenu->addAction(QString::fromUtf8(title));
|
||||
connect(raAction, &QAction::triggered, this, [id]() {
|
||||
QtHostInterface::GetInstance()->executeOnEmulationThread(
|
||||
[id]() { Cheevos::RAIntegration::ActivateMenuItem(id); });
|
||||
});
|
||||
}
|
||||
});
|
||||
m_ui.menuDebug->insertMenu(m_ui.menuCPUExecutionMode->menuAction(), raMenu);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::updateEmulationActions(bool starting, bool running, bool cheevos_challenge_mode)
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
#include "achievementsettingswidget.h"
|
||||
#include "core/cheevos.h"
|
||||
#endif
|
||||
|
||||
static constexpr char DEFAULT_SETTING_HELP_TEXT[] = "";
|
||||
@ -45,7 +46,8 @@ SettingsDialog::SettingsDialog(QtHostInterface* host_interface, QWidget* parent
|
||||
m_advanced_settings = new AdvancedSettingsWidget(host_interface, m_ui.settingsContainer, this);
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
m_achievement_settings = new AchievementSettingsWidget(host_interface, m_ui.settingsContainer, this);
|
||||
if (!Cheevos::IsUsingRAIntegration())
|
||||
m_achievement_settings = new AchievementSettingsWidget(host_interface, m_ui.settingsContainer, this);
|
||||
#endif
|
||||
|
||||
m_ui.settingsContainer->insertWidget(static_cast<int>(Category::GeneralSettings), m_general_settings);
|
||||
@ -62,7 +64,18 @@ SettingsDialog::SettingsDialog(QtHostInterface* host_interface, QWidget* parent
|
||||
m_ui.settingsContainer->insertWidget(static_cast<int>(Category::AudioSettings), m_audio_settings);
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
m_ui.settingsContainer->insertWidget(static_cast<int>(Category::AchievementSettings), m_achievement_settings);
|
||||
if (Cheevos::IsUsingRAIntegration())
|
||||
{
|
||||
QLabel* placeholder_label =
|
||||
new QLabel(QStringLiteral("RAIntegration is being used, built-in RetroAchievements support is disabled."),
|
||||
m_ui.settingsContainer);
|
||||
placeholder_label->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
m_ui.settingsContainer->insertWidget(static_cast<int>(Category::AchievementSettings), placeholder_label);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui.settingsContainer->insertWidget(static_cast<int>(Category::AchievementSettings), m_achievement_settings);
|
||||
}
|
||||
#else
|
||||
QLabel* placeholder_label =
|
||||
new QLabel(tr("This DuckStation build was not compiled with RetroAchievements support."), m_ui.settingsContainer);
|
||||
|
Reference in New Issue
Block a user