Merge pull request #7283 from Techjar/netplay-improve-settings-sync

NetPlay: Improve settings synchronization and UI
This commit is contained in:
spycrab
2018-07-30 11:47:48 +02:00
committed by GitHub
21 changed files with 685 additions and 31 deletions

View File

@ -98,6 +98,7 @@ add_executable(dolphin-emu
NetPlay/PadMappingDialog.cpp
QtUtils/DoubleClickEventFilter.cpp
QtUtils/ElidedButton.cpp
QtUtils/FlowLayout.cpp
QtUtils/ImageConverter.cpp
QtUtils/SignalDaemon.cpp
QtUtils/WindowActivationEventFilter.cpp

View File

@ -148,6 +148,7 @@
<QtMoc Include="QtUtils\BlockUserInputFilter.h" />
<QtMoc Include="QtUtils\DoubleClickEventFilter.h" />
<QtMoc Include="QtUtils\ElidedButton.h" />
<QtMoc Include="QtUtils\FlowLayout.h" />
<QtMoc Include="QtUtils\WindowActivationEventFilter.h" />
<QtMoc Include="QtUtils\WrapInScrollArea.h" />
<QtMoc Include="RenderWidget.h" />
@ -176,6 +177,7 @@
<ClCompile Include="$(QtMocOutPrefix)ControllersWindow.cpp" />
<ClCompile Include="$(QtMocOutPrefix)DoubleClickEventFilter.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ElidedButton.cpp" />
<ClCompile Include="$(QtMocOutPrefix)FlowLayout.cpp" />
<ClCompile Include="$(QtMocOutPrefix)EnhancementsWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)FIFOAnalyzer.cpp" />
<ClCompile Include="$(QtMocOutPrefix)FIFOPlayerWindow.cpp" />
@ -351,6 +353,7 @@
<ClCompile Include="QtUtils\BlockUserInputFilter.cpp" />
<ClCompile Include="QtUtils\DoubleClickEventFilter.cpp" />
<ClCompile Include="QtUtils\ElidedButton.cpp" />
<ClCompile Include="QtUtils\FlowLayout.cpp" />
<ClCompile Include="QtUtils\ImageConverter.cpp" />
<ClCompile Include="QtUtils\WindowActivationEventFilter.cpp" />
<ClCompile Include="QtUtils\WrapInScrollArea.cpp" />

View File

@ -31,7 +31,10 @@
#include "Common/Config/Config.h"
#include "Common/TraversalClient.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/GameConfigLoader.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/NetPlayServer.h"
@ -40,11 +43,14 @@
#include "DolphinQt/NetPlay/GameListDialog.h"
#include "DolphinQt/NetPlay/MD5Dialog.h"
#include "DolphinQt/NetPlay/PadMappingDialog.h"
#include "DolphinQt/QtUtils/FlowLayout.h"
#include "DolphinQt/QtUtils/QueueOnObject.h"
#include "DolphinQt/QtUtils/RunOnObject.h"
#include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h"
#include "UICommon/GameFile.h"
#include "VideoCommon/VideoConfig.h"
NetPlayDialog::NetPlayDialog(QWidget* parent)
@ -89,6 +95,7 @@ void NetPlayDialog::CreateMainLayout()
m_sync_save_data_box = new QCheckBox(tr("Sync Saves"));
m_record_input_box = new QCheckBox(tr("Record inputs"));
m_reduce_polling_rate_box = new QCheckBox(tr("Reduce Polling Rate"));
m_strict_settings_sync_box = new QCheckBox(tr("Strict Settings Sync"));
m_buffer_label = new QLabel(tr("Buffer:"));
m_quit_button = new QPushButton(tr("Quit"));
m_splitter = new QSplitter(Qt::Horizontal);
@ -128,6 +135,10 @@ void NetPlayDialog::CreateMainLayout()
m_reduce_polling_rate_box->setToolTip(
tr("This will reduce bandwidth usage by polling GameCube controllers only twice per frame. "
"Does not affect Wii Remotes."));
m_strict_settings_sync_box->setToolTip(
tr("This will sync additional graphics settings, and force everyone to the same internal "
"resolution.\nMay prevent desync in some games that use EFB reads. Please ensure everyone "
"uses the same video backend."));
m_main_layout->addWidget(m_game_button, 0, 0);
m_main_layout->addWidget(m_md5_button, 0, 1);
@ -136,18 +147,25 @@ void NetPlayDialog::CreateMainLayout()
m_splitter->addWidget(m_chat_box);
m_splitter->addWidget(m_players_box);
auto* options_widget = new QHBoxLayout;
auto* options_widget = new QGridLayout;
auto* options_boxes = new FlowLayout;
options_widget->addWidget(m_start_button, 0, 0, Qt::AlignVCenter);
options_widget->addWidget(m_buffer_label, 0, 1, Qt::AlignVCenter);
options_widget->addWidget(m_buffer_size_box, 0, 2, Qt::AlignVCenter);
options_widget->addWidget(m_quit_button, 0, 4, Qt::AlignVCenter);
options_boxes->addWidget(m_save_sd_box);
options_boxes->addWidget(m_load_wii_box);
options_boxes->addWidget(m_sync_save_data_box);
options_boxes->addWidget(m_record_input_box);
options_boxes->addWidget(m_reduce_polling_rate_box);
options_boxes->addWidget(m_strict_settings_sync_box);
options_widget->addLayout(options_boxes, 0, 3, Qt::AlignTop);
options_widget->setColumnStretch(3, 1000);
options_widget->addWidget(m_start_button);
options_widget->addWidget(m_buffer_label);
options_widget->addWidget(m_buffer_size_box);
options_widget->addWidget(m_save_sd_box);
options_widget->addWidget(m_load_wii_box);
options_widget->addWidget(m_sync_save_data_box);
options_widget->addWidget(m_record_input_box);
options_widget->addWidget(m_reduce_polling_rate_box);
options_widget->addWidget(m_quit_button);
m_main_layout->addLayout(options_widget, 2, 0, 1, -1, Qt::AlignRight);
m_main_layout->setRowStretch(1, 1000);
setLayout(m_main_layout);
}
@ -289,28 +307,97 @@ void NetPlayDialog::OnStart()
return;
}
if (m_strict_settings_sync_box->isChecked() && Config::Get(Config::GFX_EFB_SCALE) == 0)
{
QMessageBox::critical(
this, tr("Error"),
tr("Auto internal resolution is not allowed in strict sync mode, as it depends on window "
"size.\n\nPlease select a specific internal resolution."));
return;
}
const auto game = FindGameFile(m_current_game);
if (!game)
{
PanicAlertT("Selected game doesn't exist in game list!");
return;
}
NetPlay::NetSettings settings;
// Load GameINI so we can sync the settings from it
Config::AddLayer(
ConfigLoaders::GenerateGlobalGameConfigLoader(game->GetGameID(), game->GetRevision()));
Config::AddLayer(
ConfigLoaders::GenerateLocalGameConfigLoader(game->GetGameID(), game->GetRevision()));
// Copy all relevant settings
SConfig& instance = SConfig::GetInstance();
settings.m_CPUthread = instance.bCPUThread;
settings.m_CPUcore = instance.cpu_core;
settings.m_EnableCheats = instance.bEnableCheats;
settings.m_SelectedLanguage = instance.SelectedLanguage;
settings.m_OverrideGCLanguage = instance.bOverrideGCLanguage;
settings.m_CPUthread = Config::Get(Config::MAIN_CPU_THREAD);
settings.m_CPUcore = Config::Get(Config::MAIN_CPU_CORE);
settings.m_EnableCheats = Config::Get(Config::MAIN_ENABLE_CHEATS);
settings.m_SelectedLanguage = Config::Get(Config::MAIN_GC_LANGUAGE);
settings.m_OverrideGCLanguage = Config::Get(Config::MAIN_OVERRIDE_GC_LANGUAGE);
settings.m_ProgressiveScan = Config::Get(Config::SYSCONF_PROGRESSIVE_SCAN);
settings.m_PAL60 = Config::Get(Config::SYSCONF_PAL60);
settings.m_DSPHLE = instance.bDSPHLE;
settings.m_DSPEnableJIT = instance.m_DSPEnableJIT;
settings.m_DSPHLE = Config::Get(Config::MAIN_DSP_HLE);
settings.m_DSPEnableJIT = Config::Get(Config::MAIN_DSP_JIT);
settings.m_WriteToMemcard = m_save_sd_box->isChecked();
settings.m_CopyWiiSave = m_load_wii_box->isChecked();
settings.m_OCEnable = instance.m_OCEnable;
settings.m_OCFactor = instance.m_OCFactor;
settings.m_OCEnable = Config::Get(Config::MAIN_OVERCLOCK_ENABLE);
settings.m_OCFactor = Config::Get(Config::MAIN_OVERCLOCK);
settings.m_ReducePollingRate = m_reduce_polling_rate_box->isChecked();
settings.m_EXIDevice[0] = instance.m_EXIDevice[0];
settings.m_EXIDevice[1] = instance.m_EXIDevice[1];
settings.m_EXIDevice[0] =
static_cast<ExpansionInterface::TEXIDevices>(Config::Get(Config::MAIN_SLOT_A));
settings.m_EXIDevice[1] =
static_cast<ExpansionInterface::TEXIDevices>(Config::Get(Config::MAIN_SLOT_B));
settings.m_EFBAccessEnable = Config::Get(Config::GFX_HACK_EFB_ACCESS_ENABLE);
settings.m_BBoxEnable = Config::Get(Config::GFX_HACK_BBOX_ENABLE);
settings.m_ForceProgressive = Config::Get(Config::GFX_HACK_FORCE_PROGRESSIVE);
settings.m_EFBToTextureEnable = Config::Get(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM);
settings.m_XFBToTextureEnable = Config::Get(Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM);
settings.m_DisableCopyToVRAM = Config::Get(Config::GFX_HACK_DISABLE_COPY_TO_VRAM);
settings.m_ImmediateXFBEnable = Config::Get(Config::GFX_HACK_IMMEDIATE_XFB);
settings.m_EFBEmulateFormatChanges = Config::Get(Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES);
settings.m_SafeTextureCacheColorSamples =
Config::Get(Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES);
settings.m_PerfQueriesEnable = Config::Get(Config::GFX_PERF_QUERIES_ENABLE);
settings.m_FPRF = Config::Get(Config::MAIN_FPRF);
settings.m_AccurateNaNs = Config::Get(Config::MAIN_ACCURATE_NANS);
settings.m_SyncOnSkipIdle = Config::Get(Config::MAIN_SYNC_ON_SKIP_IDLE);
settings.m_SyncGPU = Config::Get(Config::MAIN_SYNC_GPU);
settings.m_SyncGpuMaxDistance = Config::Get(Config::MAIN_SYNC_GPU_MAX_DISTANCE);
settings.m_SyncGpuMinDistance = Config::Get(Config::MAIN_SYNC_GPU_MIN_DISTANCE);
settings.m_SyncGpuOverclock = Config::Get(Config::MAIN_SYNC_GPU_OVERCLOCK);
settings.m_JITFollowBranch = Config::Get(Config::MAIN_JIT_FOLLOW_BRANCH);
settings.m_FastDiscSpeed = Config::Get(Config::MAIN_FAST_DISC_SPEED);
settings.m_MMU = Config::Get(Config::MAIN_MMU);
settings.m_Fastmem = Config::Get(Config::MAIN_FASTMEM);
settings.m_SkipIPL = Config::Get(Config::MAIN_SKIP_IPL) ||
!Settings::Instance().GetNetPlayServer()->DoAllPlayersHaveIPLDump();
settings.m_LoadIPLDump = Config::Get(Config::MAIN_LOAD_IPL_DUMP) &&
Settings::Instance().GetNetPlayServer()->DoAllPlayersHaveIPLDump();
settings.m_VertexRounding = Config::Get(Config::GFX_HACK_VERTEX_ROUDING);
settings.m_InternalResolution = Config::Get(Config::GFX_EFB_SCALE);
settings.m_EFBScaledCopy = Config::Get(Config::GFX_HACK_COPY_EFB_SCALED);
settings.m_FastDepthCalc = Config::Get(Config::GFX_FAST_DEPTH_CALC);
settings.m_EnablePixelLighting = Config::Get(Config::GFX_ENABLE_PIXEL_LIGHTING);
settings.m_WidescreenHack = Config::Get(Config::GFX_WIDESCREEN_HACK);
settings.m_ForceFiltering = Config::Get(Config::GFX_ENHANCE_FORCE_FILTERING);
settings.m_MaxAnisotropy = Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY);
settings.m_ForceTrueColor = Config::Get(Config::GFX_ENHANCE_FORCE_TRUE_COLOR);
settings.m_DisableCopyFilter = Config::Get(Config::GFX_ENHANCE_DISABLE_COPY_FILTER);
settings.m_DisableFog = Config::Get(Config::GFX_DISABLE_FOG);
settings.m_ArbitraryMipmapDetection = Config::Get(Config::GFX_ENHANCE_ARBITRARY_MIPMAP_DETECTION);
settings.m_ArbitraryMipmapDetectionThreshold =
Config::Get(Config::GFX_ENHANCE_ARBITRARY_MIPMAP_DETECTION_THRESHOLD);
settings.m_EnableGPUTextureDecoding = Config::Get(Config::GFX_ENABLE_GPU_TEXTURE_DECODING);
settings.m_StrictSettingsSync = m_strict_settings_sync_box->isChecked();
settings.m_SyncSaveData = m_sync_save_data_box->isChecked();
// Unload GameINI to restore things to normal
Config::RemoveLayer(Config::LayerType::GlobalGame);
Config::RemoveLayer(Config::LayerType::LocalGame);
Settings::Instance().GetNetPlayServer()->SetNetSettings(settings);
if (Settings::Instance().GetNetPlayServer()->RequestStartGame())
SetOptionsEnabled(false);
@ -354,6 +441,7 @@ void NetPlayDialog::show(std::string nickname, bool use_traversal)
m_load_wii_box->setHidden(!is_hosting);
m_sync_save_data_box->setHidden(!is_hosting);
m_reduce_polling_rate_box->setHidden(!is_hosting);
m_strict_settings_sync_box->setHidden(!is_hosting);
m_buffer_size_box->setHidden(!is_hosting);
m_buffer_label->setHidden(!is_hosting);
m_kick_button->setHidden(!is_hosting);
@ -564,6 +652,7 @@ void NetPlayDialog::SetOptionsEnabled(bool enabled)
m_sync_save_data_box->setEnabled(enabled);
m_assign_ports_button->setEnabled(enabled);
m_reduce_polling_rate_box->setEnabled(enabled);
m_strict_settings_sync_box->setEnabled(enabled);
}
m_record_input_box->setEnabled(enabled);

View File

@ -105,6 +105,7 @@ private:
QCheckBox* m_sync_save_data_box;
QCheckBox* m_record_input_box;
QCheckBox* m_reduce_polling_rate_box;
QCheckBox* m_strict_settings_sync_box;
QPushButton* m_quit_button;
QSplitter* m_splitter;

View File

@ -0,0 +1,212 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "DolphinQt/QtUtils/FlowLayout.h"
#include <QtWidgets>
FlowLayout::FlowLayout(QWidget* parent, int margin, int h_spacing, int v_spacing)
: QLayout(parent), m_h_space(h_spacing), m_v_space(v_spacing)
{
setContentsMargins(margin, margin, margin, margin);
}
FlowLayout::FlowLayout(int margin, int h_spacing, int v_spacing)
: m_h_space(h_spacing), m_v_space(v_spacing)
{
setContentsMargins(margin, margin, margin, margin);
}
FlowLayout::~FlowLayout()
{
QLayoutItem* item;
while ((item = takeAt(0)))
delete item;
}
void FlowLayout::addItem(QLayoutItem* item)
{
m_item_list.append(item);
}
int FlowLayout::horizontalSpacing() const
{
if (m_h_space >= 0)
{
return m_h_space;
}
else
{
return smartSpacing(QStyle::PM_LayoutHorizontalSpacing);
}
}
int FlowLayout::verticalSpacing() const
{
if (m_v_space >= 0)
{
return m_v_space;
}
else
{
return smartSpacing(QStyle::PM_LayoutVerticalSpacing);
}
}
int FlowLayout::count() const
{
return m_item_list.size();
}
QLayoutItem* FlowLayout::itemAt(int index) const
{
return m_item_list.value(index);
}
QLayoutItem* FlowLayout::takeAt(int index)
{
if (index >= 0 && index < m_item_list.size())
return m_item_list.takeAt(index);
else
return 0;
}
Qt::Orientations FlowLayout::expandingDirections() const
{
return 0;
}
bool FlowLayout::hasHeightForWidth() const
{
return true;
}
int FlowLayout::heightForWidth(int width) const
{
int height = doLayout(QRect(0, 0, width, 0), true);
return height;
}
void FlowLayout::setGeometry(const QRect& rect)
{
QLayout::setGeometry(rect);
doLayout(rect, false);
}
QSize FlowLayout::sizeHint() const
{
return minimumSize();
}
QSize FlowLayout::minimumSize() const
{
QSize size;
for (const auto& item : m_item_list)
size = size.expandedTo(item->minimumSize());
size += QSize(2 * margin(), 2 * margin());
return size;
}
int FlowLayout::doLayout(const QRect& rect, bool testOnly) const
{
int left, top, right, bottom;
getContentsMargins(&left, &top, &right, &bottom);
QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom);
int x = effectiveRect.x();
int y = effectiveRect.y();
int lineHeight = 0;
for (const auto& item : m_item_list)
{
QWidget* wid = item->widget();
int spaceX = horizontalSpacing();
if (spaceX == -1)
spaceX = wid->style()->layoutSpacing(QSizePolicy::PushButton, QSizePolicy::PushButton,
Qt::Horizontal);
int spaceY = verticalSpacing();
if (spaceY == -1)
spaceY = wid->style()->layoutSpacing(QSizePolicy::PushButton, QSizePolicy::PushButton,
Qt::Vertical);
int nextX = x + item->sizeHint().width() + spaceX;
if (nextX - spaceX > effectiveRect.right() && lineHeight > 0)
{
x = effectiveRect.x();
y = y + lineHeight + spaceY;
nextX = x + item->sizeHint().width() + spaceX;
lineHeight = 0;
}
if (!testOnly)
item->setGeometry(QRect(QPoint(x, y), item->sizeHint()));
x = nextX;
lineHeight = qMax(lineHeight, item->sizeHint().height());
}
return y + lineHeight - rect.y() + bottom;
}
int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
{
QObject* parent = this->parent();
if (!parent)
{
return -1;
}
else if (parent->isWidgetType())
{
QWidget* pw = static_cast<QWidget*>(parent);
return pw->style()->pixelMetric(pm, 0, pw);
}
else
{
return static_cast<QLayout*>(parent)->spacing();
}
}

View File

@ -0,0 +1,84 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#pragma once
#include <QLayout>
#include <QRect>
#include <QStyle>
class FlowLayout : public QLayout
{
public:
explicit FlowLayout(QWidget* parent, int margin = -1, int h_spacing = -1, int v_spacing = -1);
explicit FlowLayout(int margin = -1, int h_spacing = -1, int v_spacing = -1);
~FlowLayout();
void addItem(QLayoutItem* item) override;
int horizontalSpacing() const;
int verticalSpacing() const;
Qt::Orientations expandingDirections() const override;
bool hasHeightForWidth() const override;
int heightForWidth(int) const override;
int count() const override;
QLayoutItem* itemAt(int index) const override;
QSize minimumSize() const override;
void setGeometry(const QRect& rect) override;
QSize sizeHint() const override;
QLayoutItem* takeAt(int index) override;
private:
int doLayout(const QRect& rect, bool testOnly) const;
int smartSpacing(QStyle::PixelMetric pm) const;
QList<QLayoutItem*> m_item_list;
int m_h_space;
int m_v_space;
};

View File

@ -13,6 +13,7 @@
#include <QVBoxLayout>
#include <cmath>
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/HW/SystemTimers.h"
@ -101,13 +102,15 @@ void AdvancedPane::ConnectLayout()
m_cpu_clock_override_checkbox->setChecked(SConfig::GetInstance().m_OCEnable);
connect(m_cpu_clock_override_checkbox, &QCheckBox::toggled, [this](bool enable_clock_override) {
SConfig::GetInstance().m_OCEnable = enable_clock_override;
Config::SetBaseOrCurrent(Config::MAIN_OVERCLOCK_ENABLE, enable_clock_override);
Update();
});
connect(m_cpu_clock_override_slider, &QSlider::valueChanged, [this](int oc_factor) {
// Vaguely exponential scaling?
SConfig::GetInstance().m_OCFactor =
std::exp2f((m_cpu_clock_override_slider->value() - 100.f) / 25.f);
const float factor = std::exp2f((m_cpu_clock_override_slider->value() - 100.f) / 25.f);
SConfig::GetInstance().m_OCFactor = factor;
Config::SetBaseOrCurrent(Config::MAIN_OVERCLOCK, factor);
Update();
});

View File

@ -19,6 +19,7 @@
#include "AudioCommon/AudioCommon.h"
#include "AudioCommon/WASAPIStream.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
@ -222,7 +223,9 @@ void AudioPane::SaveSettings()
// DSP
SConfig::GetInstance().bDSPHLE = m_dsp_hle->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_DSP_HLE, m_dsp_hle->isChecked());
SConfig::GetInstance().m_DSPEnableJIT = m_dsp_lle->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_DSP_JIT, m_dsp_lle->isChecked());
// Backend
const auto selection =

View File

@ -341,8 +341,12 @@ void GameCubePane::SaveSettings()
// IPL Settings
params.bHLE_BS2 = m_skip_main_menu->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_SKIP_IPL, m_skip_main_menu->isChecked());
params.SelectedLanguage = m_language_combo->currentIndex();
Config::SetBaseOrCurrent(Config::MAIN_GC_LANGUAGE, m_language_combo->currentIndex());
params.bOverrideGCLanguage = m_override_language_ntsc->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_OVERRIDE_GC_LANGUAGE,
m_override_language_ntsc->isChecked());
for (int i = 0; i < SLOT_COUNT; i++)
{
@ -390,6 +394,18 @@ void GameCubePane::SaveSettings()
}
SConfig::GetInstance().m_EXIDevice[i] = dev;
switch (i)
{
case SLOT_A_INDEX:
Config::SetBaseOrCurrent(Config::MAIN_SLOT_A, dev);
break;
case SLOT_B_INDEX:
Config::SetBaseOrCurrent(Config::MAIN_SLOT_B, dev);
break;
case SLOT_SP1_INDEX:
Config::SetBaseOrCurrent(Config::MAIN_SERIAL_PORT_1, dev);
break;
}
}
LoadSettings();
}

View File

@ -19,6 +19,7 @@
#include <QWidget>
#include "Core/Analytics.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/UISettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
@ -291,7 +292,9 @@ void GeneralPane::OnSaveConfig()
Settings::Instance().SetAnalyticsEnabled(m_checkbox_enable_analytics->isChecked());
#endif
settings.bCPUThread = m_checkbox_dualcore->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_CPU_THREAD, m_checkbox_dualcore->isChecked());
Settings::Instance().SetCheatsEnabled(m_checkbox_cheats->isChecked());
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, m_checkbox_cheats->isChecked());
settings.m_EmulationSpeed = m_combobox_speedlimit->currentIndex() * 0.1f;
for (size_t i = 0; i < m_cpu_cores.size(); ++i)
@ -299,6 +302,7 @@ void GeneralPane::OnSaveConfig()
if (m_cpu_cores[i]->isChecked())
{
settings.cpu_core = PowerPC::AvailableCPUCores()[i];
Config::SetBaseOrCurrent(Config::MAIN_CPU_CORE, PowerPC::AvailableCPUCores()[i]);
break;
}
}