diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.cpp | 14 | ||||
-rw-r--r-- | src/yuzu/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/yuzu/about_dialog.cpp | 8 | ||||
-rw-r--r-- | src/yuzu/applets/profile_select.cpp | 4 | ||||
-rw-r--r-- | src/yuzu/bootmanager.cpp | 1 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 8 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 25 | ||||
-rw-r--r-- | src/yuzu/main.h | 1 | ||||
-rw-r--r-- | src/yuzu/util/spinbox.cpp | 278 | ||||
-rw-r--r-- | src/yuzu/util/spinbox.h | 86 | ||||
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 6 | ||||
-rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 1 |
13 files changed, 48 insertions, 392 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a417017c..bfa104034 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,7 +132,7 @@ find_package(Threads REQUIRED) if (ENABLE_SDL2) if (YUZU_USE_BUNDLED_SDL2) # Detect toolchain and platform - if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920) AND ARCHITECTURE_x86_64) + if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64) set(SDL2_VER "SDL2-2.0.8") else() message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.") @@ -165,7 +165,7 @@ if (YUZU_USE_BUNDLED_UNICORN) if (MSVC) message(STATUS "unicorn not found, falling back to bundled") # Detect toolchain and platform - if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920) AND ARCHITECTURE_x86_64) + if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64) set(UNICORN_VER "unicorn-yuzu") else() message(FATAL_ERROR "No bundled Unicorn binaries for your toolchain. Disable YUZU_USE_BUNDLED_UNICORN and provide your own.") @@ -233,7 +233,7 @@ endif() if (ENABLE_QT) if (YUZU_USE_BUNDLED_QT) - if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920) AND ARCHITECTURE_x86_64) + if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64) set(QT_VER qt-5.12.0-msvc2017_64) else() message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own.") diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 6abf948f8..7ab0b4553 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -33,14 +33,14 @@ layout (std140, binding = EMULATION_UBO_BINDING) uniform vs_config { }; )"; - ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET); + const ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET); ProgramResult program = Decompile(device, program_ir, Maxwell3D::Regs::ShaderStage::Vertex, "vertex"); out += program.first; if (setup.IsDualProgram()) { - ShaderIR program_ir_b(setup.program.code_b, PROGRAM_OFFSET); + const ShaderIR program_ir_b(setup.program.code_b, PROGRAM_OFFSET); ProgramResult program_b = Decompile(device, program_ir_b, Maxwell3D::Regs::ShaderStage::Vertex, "vertex_b"); @@ -76,7 +76,7 @@ void main() { } })"; - return {out, program.second}; + return {std::move(out), std::move(program.second)}; } ProgramResult GenerateGeometryShader(const Device& device, const ShaderSetup& setup) { @@ -97,7 +97,7 @@ layout (std140, binding = EMULATION_UBO_BINDING) uniform gs_config { }; )"; - ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET); + const ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET); ProgramResult program = Decompile(device, program_ir, Maxwell3D::Regs::ShaderStage::Geometry, "geometry"); out += program.first; @@ -107,7 +107,7 @@ void main() { execute_geometry(); };)"; - return {out, program.second}; + return {std::move(out), std::move(program.second)}; } ProgramResult GenerateFragmentShader(const Device& device, const ShaderSetup& setup) { @@ -160,7 +160,7 @@ bool AlphaFunc(in float value) { } )"; - ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET); + const ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET); ProgramResult program = Decompile(device, program_ir, Maxwell3D::Regs::ShaderStage::Fragment, "fragment"); @@ -172,7 +172,7 @@ void main() { } )"; - return {out, program.second}; + return {std::move(out), std::move(program.second)}; } } // namespace OpenGL::GLShader diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 5138bd9a3..7e883991a 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -82,8 +82,6 @@ add_executable(yuzu util/limitable_input_dialog.h util/sequence_dialog/sequence_dialog.cpp util/sequence_dialog/sequence_dialog.h - util/spinbox.cpp - util/spinbox.h util/util.cpp util/util.h compatdb.cpp diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp index 3efa65a38..d39b3f07a 100644 --- a/src/yuzu/about_dialog.cpp +++ b/src/yuzu/about_dialog.cpp @@ -9,10 +9,10 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) { ui->setupUi(this); - ui->labelLogo->setPixmap(QIcon::fromTheme("yuzu").pixmap(200)); - ui->labelBuildInfo->setText( - ui->labelBuildInfo->text().arg(Common::g_build_fullname, Common::g_scm_branch, - Common::g_scm_desc, QString(Common::g_build_date).left(10))); + ui->labelLogo->setPixmap(QIcon::fromTheme(QStringLiteral("yuzu")).pixmap(200)); + ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg( + QString::fromUtf8(Common::g_build_fullname), QString::fromUtf8(Common::g_scm_branch), + QString::fromUtf8(Common::g_scm_desc), QString::fromUtf8(Common::g_build_date).left(10))); } AboutDialog::~AboutDialog() = default; diff --git a/src/yuzu/applets/profile_select.cpp b/src/yuzu/applets/profile_select.cpp index 743b24d76..7fbc9deeb 100644 --- a/src/yuzu/applets/profile_select.cpp +++ b/src/yuzu/applets/profile_select.cpp @@ -84,10 +84,10 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(QWidget* parent) tree_view->setContextMenuPolicy(Qt::NoContextMenu); item_model->insertColumns(0, 1); - item_model->setHeaderData(0, Qt::Horizontal, "Users"); + item_model->setHeaderData(0, Qt::Horizontal, tr("Users")); // We must register all custom types with the Qt Automoc system so that we are able to use it - // with signals/slots. In this case, QList falls under the umbrells of custom types. + // with signals/slots. In this case, QList falls under the umbrella of custom types. qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>"); layout->setContentsMargins(0, 0, 0, 0); diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 5c98636c5..810954b36 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -379,6 +379,7 @@ void GRenderWindow::InitRenderTarget() { fmt.setVersion(4, 3); if (Settings::values.use_compatibility_profile) { fmt.setProfile(QSurfaceFormat::CompatibilityProfile); + fmt.setOption(QSurfaceFormat::FormatOption::DeprecatedFunctions); } else { fmt.setProfile(QSurfaceFormat::CoreProfile); } diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index c299c0b5b..08ea41b0f 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -69,16 +69,20 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) ConfigureGraphics::~ConfigureGraphics() = default; void ConfigureGraphics::setConfiguration() { + const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); + ui->resolution_factor_combobox->setCurrentIndex( static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor))); ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit); ui->frame_limit->setValue(Settings::values.frame_limit); + ui->use_compatibility_profile->setEnabled(runtime_lock); ui->use_compatibility_profile->setChecked(Settings::values.use_compatibility_profile); + ui->use_disk_shader_cache->setEnabled(runtime_lock); ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache); ui->use_accurate_gpu_emulation->setChecked(Settings::values.use_accurate_gpu_emulation); - ui->use_asynchronous_gpu_emulation->setEnabled(!Core::System::GetInstance().IsPoweredOn()); + ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); ui->use_asynchronous_gpu_emulation->setChecked(Settings::values.use_asynchronous_gpu_emulation); - ui->force_30fps_mode->setEnabled(!Core::System::GetInstance().IsPoweredOn()); + ui->force_30fps_mode->setEnabled(runtime_lock); ui->force_30fps_mode->setChecked(Settings::values.force_30fps_mode); UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue)); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index e33e3aaaf..a59abf6e8 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -198,11 +198,11 @@ GMainWindow::GMainWindow() ConnectMenuEvents(); ConnectWidgetEvents(); + LOG_INFO(Frontend, "yuzu Version: {} | {}-{}", Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc); + UpdateWindowTitle(); - setWindowTitle(QString("yuzu %1| %2-%3") - .arg(Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc)); show(); Core::System::GetInstance().SetContentProvider( @@ -936,9 +936,7 @@ void GMainWindow::BootGame(const QString& filename) { title_name = FileUtil::GetFilename(filename.toStdString()); } - setWindowTitle(QString("yuzu %1| %4 | %2-%3") - .arg(Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc, - QString::fromStdString(title_name))); + UpdateWindowTitle(QString::fromStdString(title_name)); loading_screen->Prepare(Core::System::GetInstance().GetAppLoader()); loading_screen->show(); @@ -979,8 +977,8 @@ void GMainWindow::ShutdownGame() { loading_screen->Clear(); game_list->show(); game_list->setFilterFocus(); - setWindowTitle(QString("yuzu %1| %2-%3") - .arg(Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc)); + + UpdateWindowTitle(); // Disable status bar updates status_bar_update_timer.stop(); @@ -1767,6 +1765,19 @@ void GMainWindow::OnCaptureScreenshot() { OnStartGame(); } +void GMainWindow::UpdateWindowTitle(const QString& title_name) { + const QString full_name = QString::fromUtf8(Common::g_build_fullname); + const QString branch_name = QString::fromUtf8(Common::g_scm_branch); + const QString description = QString::fromUtf8(Common::g_scm_desc); + + if (title_name.isEmpty()) { + setWindowTitle(QStringLiteral("yuzu %1| %2-%3").arg(full_name, branch_name, description)); + } else { + setWindowTitle(QStringLiteral("yuzu %1| %4 | %2-%3") + .arg(full_name, branch_name, description, title_name)); + } +} + void GMainWindow::UpdateStatusBar() { if (emu_thread == nullptr) { status_bar_update_timer.stop(); diff --git a/src/yuzu/main.h b/src/yuzu/main.h index fb2a193cb..7bf82e665 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -209,6 +209,7 @@ private slots: private: std::optional<u64> SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id); + void UpdateWindowTitle(const QString& title_name = {}); void UpdateStatusBar(); Ui::MainWindow ui; diff --git a/src/yuzu/util/spinbox.cpp b/src/yuzu/util/spinbox.cpp deleted file mode 100644 index 14ef1e884..000000000 --- a/src/yuzu/util/spinbox.cpp +++ /dev/null @@ -1,278 +0,0 @@ -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -// Copyright 2014 Tony Wasserka -// All rights reserved. -// -// 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 owner 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. - -#include <cstdlib> -#include <QLineEdit> -#include <QRegExpValidator> -#include "common/assert.h" -#include "yuzu/util/spinbox.h" - -CSpinBox::CSpinBox(QWidget* parent) - : QAbstractSpinBox(parent), min_value(-100), max_value(100), value(0), base(10), num_digits(0) { - // TODO: Might be nice to not immediately call the slot. - // Think of an address that is being replaced by a different one, in which case a lot - // invalid intermediate addresses would be read from during editing. - connect(lineEdit(), &QLineEdit::textEdited, this, &CSpinBox::OnEditingFinished); - - UpdateText(); -} - -void CSpinBox::SetValue(qint64 val) { - auto old_value = value; - value = std::max(std::min(val, max_value), min_value); - - if (old_value != value) { - UpdateText(); - emit ValueChanged(value); - } -} - -void CSpinBox::SetRange(qint64 min, qint64 max) { - min_value = min; - max_value = max; - - SetValue(value); - UpdateText(); -} - -void CSpinBox::stepBy(int steps) { - auto new_value = value; - // Scale number of steps by the currently selected digit - // TODO: Move this code elsewhere and enable it. - // TODO: Support for num_digits==0, too - // TODO: Support base!=16, too - // TODO: Make the cursor not jump back to the end of the line... - /*if (base == 16 && num_digits > 0) { - int digit = num_digits - (lineEdit()->cursorPosition() - prefix.length()) - 1; - digit = std::max(0, std::min(digit, num_digits - 1)); - steps <<= digit * 4; - }*/ - - // Increment "new_value" by "steps", and perform annoying overflow checks, too. - if (steps < 0 && new_value + steps > new_value) { - new_value = std::numeric_limits<qint64>::min(); - } else if (steps > 0 && new_value + steps < new_value) { - new_value = std::numeric_limits<qint64>::max(); - } else { - new_value += steps; - } - - SetValue(new_value); - UpdateText(); -} - -QAbstractSpinBox::StepEnabled CSpinBox::stepEnabled() const { - StepEnabled ret = StepNone; - - if (value > min_value) - ret |= StepDownEnabled; - - if (value < max_value) - ret |= StepUpEnabled; - - return ret; -} - -void CSpinBox::SetBase(int base) { - this->base = base; - - UpdateText(); -} - -void CSpinBox::SetNumDigits(int num_digits) { - this->num_digits = num_digits; - - UpdateText(); -} - -void CSpinBox::SetPrefix(const QString& prefix) { - this->prefix = prefix; - - UpdateText(); -} - -void CSpinBox::SetSuffix(const QString& suffix) { - this->suffix = suffix; - - UpdateText(); -} - -static QString StringToInputMask(const QString& input) { - QString mask = input; - - // ... replace any special characters by their escaped counterparts ... - mask.replace("\\", "\\\\"); - mask.replace("A", "\\A"); - mask.replace("a", "\\a"); - mask.replace("N", "\\N"); - mask.replace("n", "\\n"); - mask.replace("X", "\\X"); - mask.replace("x", "\\x"); - mask.replace("9", "\\9"); - mask.replace("0", "\\0"); - mask.replace("D", "\\D"); - mask.replace("d", "\\d"); - mask.replace("#", "\\#"); - mask.replace("H", "\\H"); - mask.replace("h", "\\h"); - mask.replace("B", "\\B"); - mask.replace("b", "\\b"); - mask.replace(">", "\\>"); - mask.replace("<", "\\<"); - mask.replace("!", "\\!"); - - return mask; -} - -void CSpinBox::UpdateText() { - // If a fixed number of digits is used, we put the line edit in insertion mode by setting an - // input mask. - QString mask; - if (num_digits != 0) { - mask += StringToInputMask(prefix); - - // For base 10 and negative range, demand a single sign character - if (HasSign()) - mask += "X"; // identified as "-" or "+" in the validator - - // Uppercase digits greater than 9. - mask += ">"; - - // Match num_digits digits - // Digits irrelevant to the chosen number base are filtered in the validator - mask += QString("H").repeated(std::max(num_digits, 1)); - - // Switch off case conversion - mask += "!"; - - mask += StringToInputMask(suffix); - } - lineEdit()->setInputMask(mask); - - // Set new text without changing the cursor position. This will cause the cursor to briefly - // appear at the end of the line and then to jump back to its original position. That's - // a bit ugly, but better than having setText() move the cursor permanently all the time. - int cursor_position = lineEdit()->cursorPosition(); - lineEdit()->setText(TextFromValue()); - lineEdit()->setCursorPosition(cursor_position); -} - -QString CSpinBox::TextFromValue() { - return prefix + QString(HasSign() ? ((value < 0) ? "-" : "+") : "") + - QString("%1").arg(std::abs(value), num_digits, base, QLatin1Char('0')).toUpper() + - suffix; -} - -qint64 CSpinBox::ValueFromText() { - unsigned strpos = prefix.length(); - - QString num_string = text().mid(strpos, text().length() - strpos - suffix.length()); - return num_string.toLongLong(nullptr, base); -} - -bool CSpinBox::HasSign() const { - return base == 10 && min_value < 0; -} - -void CSpinBox::OnEditingFinished() { - // Only update for valid input - QString input = lineEdit()->text(); - int pos = 0; - if (QValidator::Acceptable == validate(input, pos)) - SetValue(ValueFromText()); -} - -QValidator::State CSpinBox::validate(QString& input, int& pos) const { - if (!prefix.isEmpty() && input.left(prefix.length()) != prefix) - return QValidator::Invalid; - - int strpos = prefix.length(); - - // Empty "numbers" allowed as intermediate values - if (strpos >= input.length() - HasSign() - suffix.length()) - return QValidator::Intermediate; - - DEBUG_ASSERT(base <= 10 || base == 16); - QString regexp; - - // Demand sign character for negative ranges - if (HasSign()) - regexp += "[+\\-]"; - - // Match digits corresponding to the chosen number base. - regexp += QString("[0-%1").arg(std::min(base, 9)); - if (base == 16) { - regexp += "a-fA-F"; - } - regexp += "]"; - - // Specify number of digits - if (num_digits > 0) { - regexp += QString("{%1}").arg(num_digits); - } else { - regexp += "+"; - } - - // Match string - QRegExp num_regexp(regexp); - int num_pos = strpos; - QString sub_input = input.mid(strpos, input.length() - strpos - suffix.length()); - - if (!num_regexp.exactMatch(sub_input) && num_regexp.matchedLength() == 0) - return QValidator::Invalid; - - sub_input = sub_input.left(num_regexp.matchedLength()); - bool ok; - qint64 val = sub_input.toLongLong(&ok, base); - - if (!ok) - return QValidator::Invalid; - - // Outside boundaries => don't accept - if (val < min_value || val > max_value) - return QValidator::Invalid; - - // Make sure we are actually at the end of this string... - strpos += num_regexp.matchedLength(); - - if (!suffix.isEmpty() && input.mid(strpos) != suffix) { - return QValidator::Invalid; - } else { - strpos += suffix.length(); - } - - if (strpos != input.length()) - return QValidator::Invalid; - - // At this point we can say for sure that the input is fine. Let's fix it up a bit though - input.replace(num_pos, sub_input.length(), sub_input.toUpper()); - - return QValidator::Acceptable; -} diff --git a/src/yuzu/util/spinbox.h b/src/yuzu/util/spinbox.h deleted file mode 100644 index 2fa1db3a4..000000000 --- a/src/yuzu/util/spinbox.h +++ /dev/null @@ -1,86 +0,0 @@ -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -// Copyright 2014 Tony Wasserka -// All rights reserved. -// -// 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 owner 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. - -#pragma once - -#include <QAbstractSpinBox> -#include <QtGlobal> - -class QVariant; - -/** - * A custom spin box widget with enhanced functionality over Qt's QSpinBox - */ -class CSpinBox : public QAbstractSpinBox { - Q_OBJECT - -public: - explicit CSpinBox(QWidget* parent = nullptr); - - void stepBy(int steps) override; - StepEnabled stepEnabled() const override; - - void SetValue(qint64 val); - - void SetRange(qint64 min, qint64 max); - - void SetBase(int base); - - void SetPrefix(const QString& prefix); - void SetSuffix(const QString& suffix); - - void SetNumDigits(int num_digits); - - QValidator::State validate(QString& input, int& pos) const override; - -signals: - void ValueChanged(qint64 val); - -private slots: - void OnEditingFinished(); - -private: - void UpdateText(); - - bool HasSign() const; - - QString TextFromValue(); - qint64 ValueFromText(); - - qint64 min_value, max_value; - - qint64 value; - - QString prefix, suffix; - - int base; - - int num_digits; -}; diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index 68a176032..8f104062d 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp @@ -176,9 +176,13 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) { SDL_SetMainReady(); + const SDL_GLprofile profile = Settings::values.use_compatibility_profile + ? SDL_GL_CONTEXT_PROFILE_COMPATIBILITY + : SDL_GL_CONTEXT_PROFILE_CORE; + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index a1d7879b1..d3734927b 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -222,6 +222,7 @@ int main(int argc, char** argv) { system.TelemetrySession().AddField(Telemetry::FieldType::App, "Frontend", "SDL"); + emu_window->MakeCurrent(); system.Renderer().Rasterizer().LoadDiskResources(); while (emu_window->IsOpen()) { |