mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-09-28 13:22:58 -05:00
Merge branch 'master' into overlay-haptics
This commit is contained in:
@@ -214,10 +214,11 @@ void Mixer::PushSamples(const s16* samples, std::size_t num_samples)
|
||||
{
|
||||
// Big-endian RL-orderered stereo samples.
|
||||
|
||||
while (num_samples--)
|
||||
const s16* ptr = samples;
|
||||
for (std::size_t i = 0; i != num_samples; ++i)
|
||||
{
|
||||
m_dma_mixer.PushSample(Common::swap16(samples[1]), Common::swap16(samples[0]));
|
||||
samples += 2;
|
||||
m_dma_mixer.PushSample(Common::swap16(ptr[1]), Common::swap16(ptr[0]));
|
||||
ptr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,10 +237,11 @@ void Mixer::PushStreamingSamples(const s16* samples, std::size_t num_samples)
|
||||
{
|
||||
// Big-endian RL-orderered stereo samples.
|
||||
|
||||
while (num_samples--)
|
||||
const s16* ptr = samples;
|
||||
for (std::size_t i = 0; i != num_samples; ++i)
|
||||
{
|
||||
m_streaming_mixer.PushSample(Common::swap16(samples[1]), Common::swap16(samples[0]));
|
||||
samples += 2;
|
||||
m_streaming_mixer.PushSample(Common::swap16(ptr[1]), Common::swap16(ptr[0]));
|
||||
ptr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -170,6 +170,8 @@ void AchievementManager::LoadGame(const DiscIO::Volume* volume)
|
||||
WARN_LOG_FMT(ACHIEVEMENTS, "Software format unsupported by AchievementManager.");
|
||||
if (rc_client_get_game_info(m_client))
|
||||
{
|
||||
OSD::AddMessage("Unsupported media change; disabling achievements.", OSD::Duration::VERY_LONG,
|
||||
OSD::Color::RED);
|
||||
CloseGame();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -442,7 +442,6 @@ void DVDInterface::AutoChangeDiscCallback(Core::System& system, u64 userdata, s6
|
||||
|
||||
void DVDInterface::EjectDiscCallback(Core::System& system, u64 userdata, s64 cyclesLate)
|
||||
{
|
||||
AchievementManager::GetInstance().ChangeDisc(nullptr);
|
||||
system.GetDVDInterface().SetDisc(nullptr, {});
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
#include <QCompleter>
|
||||
#include <QDesktopServices>
|
||||
#include <QFile>
|
||||
#include <QHBoxLayout>
|
||||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
#include <QMenuBar>
|
||||
#include <QPushButton>
|
||||
#include <QRegularExpression>
|
||||
#include <QScrollBar>
|
||||
@@ -72,7 +71,6 @@ GameConfigEdit::GameConfigEdit(QWidget* parent, QString path, bool read_only)
|
||||
m_completer->setCompletionMode(QCompleter::PopupCompletion);
|
||||
m_completer->setWidget(m_edit);
|
||||
|
||||
AddMenubarOptions();
|
||||
ConnectWidgets();
|
||||
}
|
||||
|
||||
@@ -82,17 +80,21 @@ void GameConfigEdit::CreateWidgets()
|
||||
m_edit->setReadOnly(m_read_only);
|
||||
m_edit->setAcceptRichText(false);
|
||||
|
||||
m_refresh_button = new QPushButton(tr("Refresh"));
|
||||
m_external_editor_button = new QPushButton(tr("Open in External Editor"));
|
||||
|
||||
if (m_read_only)
|
||||
{
|
||||
m_refresh_button->hide();
|
||||
m_external_editor_button->hide();
|
||||
}
|
||||
|
||||
auto* button_layout = new QHBoxLayout;
|
||||
button_layout->addWidget(m_refresh_button);
|
||||
button_layout->addWidget(m_external_editor_button);
|
||||
|
||||
auto* layout = new QVBoxLayout;
|
||||
|
||||
auto* menu_button = new QPushButton;
|
||||
|
||||
menu_button->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
|
||||
menu_button->setText(tr("Presets"));
|
||||
|
||||
m_menu = new QMenu(menu_button);
|
||||
menu_button->setMenu(m_menu);
|
||||
|
||||
layout->addWidget(menu_button);
|
||||
layout->addLayout(button_layout);
|
||||
layout->addWidget(m_edit);
|
||||
|
||||
setLayout(layout);
|
||||
@@ -138,6 +140,10 @@ void GameConfigEdit::ConnectWidgets()
|
||||
connect(m_edit, &QTextEdit::selectionChanged, this, &GameConfigEdit::OnSelectionChanged);
|
||||
connect(m_completer, qOverload<const QString&>(&QCompleter::activated), this,
|
||||
&GameConfigEdit::OnAutoComplete);
|
||||
|
||||
connect(m_refresh_button, &QPushButton::clicked, this, &GameConfigEdit::LoadFile);
|
||||
connect(m_external_editor_button, &QPushButton::clicked, this,
|
||||
&GameConfigEdit::OpenExternalEditor);
|
||||
}
|
||||
|
||||
void GameConfigEdit::OnSelectionChanged()
|
||||
@@ -148,47 +154,6 @@ void GameConfigEdit::OnSelectionChanged()
|
||||
QWhatsThis::showText(QCursor::pos(), m_keyword_map[keyword], this);
|
||||
}
|
||||
|
||||
void GameConfigEdit::AddBoolOption(QMenu* menu, const QString& name, const QString& section,
|
||||
const QString& key)
|
||||
{
|
||||
auto* option = menu->addMenu(name);
|
||||
|
||||
option->addAction(tr("On"), this,
|
||||
[this, section, key] { SetOption(section, key, QStringLiteral("True")); });
|
||||
option->addAction(tr("Off"), this,
|
||||
[this, section, key] { SetOption(section, key, QStringLiteral("False")); });
|
||||
}
|
||||
|
||||
void GameConfigEdit::SetOption(const QString& section, const QString& key, const QString& value)
|
||||
{
|
||||
auto section_cursor =
|
||||
m_edit->document()->find(QRegularExpression(QStringLiteral("^\\[%1\\]").arg(section)), 0);
|
||||
|
||||
// Check if the section this belongs in can be found
|
||||
if (section_cursor.isNull())
|
||||
{
|
||||
m_edit->append(QStringLiteral("[%1]\n\n%2 = %3\n").arg(section).arg(key).arg(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto value_cursor = m_edit->document()->find(
|
||||
QRegularExpression(QStringLiteral("^%1 = .*").arg(key)), section_cursor);
|
||||
|
||||
const QString new_line = QStringLiteral("%1 = %2").arg(key).arg(value);
|
||||
|
||||
// Check if the value that has to be set already exists
|
||||
if (value_cursor.isNull())
|
||||
{
|
||||
section_cursor.clearSelection();
|
||||
section_cursor.insertText(QLatin1Char{'\n'} + new_line);
|
||||
}
|
||||
else
|
||||
{
|
||||
value_cursor.insertText(new_line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString GameConfigEdit::GetTextUnderCursor()
|
||||
{
|
||||
QTextCursor tc = m_edit->textCursor();
|
||||
@@ -196,48 +161,6 @@ QString GameConfigEdit::GetTextUnderCursor()
|
||||
return tc.selectedText();
|
||||
}
|
||||
|
||||
void GameConfigEdit::AddMenubarOptions()
|
||||
{
|
||||
auto* editor = m_menu->addMenu(tr("Editor"));
|
||||
|
||||
editor->addAction(tr("Refresh"), this, &GameConfigEdit::LoadFile);
|
||||
editor->addAction(tr("Open in External Editor"), this, &GameConfigEdit::OpenExternalEditor);
|
||||
|
||||
if (!m_read_only)
|
||||
{
|
||||
m_menu->addSeparator();
|
||||
auto* core_menubar = m_menu->addMenu(tr("Core"));
|
||||
|
||||
AddBoolOption(core_menubar, tr("Dual Core"), QStringLiteral("Core"),
|
||||
QStringLiteral("CPUThread"));
|
||||
AddBoolOption(core_menubar, tr("MMU"), QStringLiteral("Core"), QStringLiteral("MMU"));
|
||||
|
||||
auto* video_menubar = m_menu->addMenu(tr("Video"));
|
||||
|
||||
AddBoolOption(video_menubar, tr("Store EFB Copies to Texture Only"),
|
||||
QStringLiteral("Video_Hacks"), QStringLiteral("EFBToTextureEnable"));
|
||||
|
||||
AddBoolOption(video_menubar, tr("Store XFB Copies to Texture Only"),
|
||||
QStringLiteral("Video_Hacks"), QStringLiteral("XFBToTextureEnable"));
|
||||
|
||||
{
|
||||
auto* texture_cache = video_menubar->addMenu(tr("Texture Cache"));
|
||||
texture_cache->addAction(tr("Safe"), this, [this] {
|
||||
SetOption(QStringLiteral("Video_Settings"), QStringLiteral("SafeTextureCacheColorSamples"),
|
||||
QStringLiteral("0"));
|
||||
});
|
||||
texture_cache->addAction(tr("Medium"), this, [this] {
|
||||
SetOption(QStringLiteral("Video_Settings"), QStringLiteral("SafeTextureCacheColorSamples"),
|
||||
QStringLiteral("512"));
|
||||
});
|
||||
texture_cache->addAction(tr("Fast"), this, [this] {
|
||||
SetOption(QStringLiteral("Video_Settings"), QStringLiteral("SafeTextureCacheColorSamples"),
|
||||
QStringLiteral("128"));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameConfigEdit::OnAutoComplete(const QString& completion)
|
||||
{
|
||||
QTextCursor cursor = m_edit->textCursor();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QMap>
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QWidget>
|
||||
@@ -24,7 +25,6 @@ protected:
|
||||
private:
|
||||
void CreateWidgets();
|
||||
void ConnectWidgets();
|
||||
void AddMenubarOptions();
|
||||
|
||||
void LoadFile();
|
||||
void SaveFile();
|
||||
@@ -35,15 +35,12 @@ private:
|
||||
|
||||
QString GetTextUnderCursor();
|
||||
|
||||
void AddBoolOption(QMenu* menu, const QString& name, const QString& section, const QString& key);
|
||||
|
||||
void SetOption(const QString& section, const QString& key, const QString& value);
|
||||
|
||||
void AddDescription(const QString& keyword, const QString& description);
|
||||
|
||||
QCompleter* m_completer;
|
||||
QStringList m_completions;
|
||||
QMenu* m_menu;
|
||||
QPushButton* m_refresh_button;
|
||||
QPushButton* m_external_editor_button;
|
||||
QTextEdit* m_edit;
|
||||
|
||||
const QString m_path;
|
||||
|
||||
@@ -310,9 +310,14 @@ void BreakpointWidget::Update()
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(Qt::transparent);
|
||||
// Center and radius
|
||||
painter.drawEllipse(QPoint(downscale / 2, downscale / 2), downscale / 4, downscale / 4);
|
||||
|
||||
const float icon_radius = static_cast<float>(image.height()) / 2.0f;
|
||||
const float gap_radius = icon_radius / 2.0f;
|
||||
const QPointF center(icon_radius, icon_radius);
|
||||
|
||||
painter.drawEllipse(center, gap_radius, gap_radius);
|
||||
painter.end();
|
||||
|
||||
enabled_icon = QPixmap::fromImage(image);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user