proper cmake uris, fix game carousel

Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
crueter 2025-08-07 21:47:08 -04:00
parent 06fe470e5c
commit 0793e85b47
Signed by: crueter
GPG key ID: 425ACD2D4830EBC6
105 changed files with 266 additions and 2043 deletions

View file

@ -6,78 +6,4 @@ find_package(Qt6 REQUIRED COMPONENTS Widgets Core Gui Quick QuickControls2)
qt_standard_project_setup(REQUIRES 6.7)
qt_add_executable(yuzu
main.cpp
icons.qrc
)
add_subdirectory(qml)
add_subdirectory(interface)
add_subdirectory(models)
set(PLUGINS
edenMainplugin
edenItemsplugin
edenConfigplugin
edenInterfaceplugin
edenConstantsplugin
edenUtilplugin
)
if (ENABLE_SDL2)
add_subdirectory(gamepad)
set(PLUGINS ${PLUGINS} edenGamepadplugin)
endif()
target_link_libraries(yuzu
PRIVATE
Qt6::Core
Qt6::Widgets
Qt6::Gui
Qt6::Quick
Qt6::QuickControls2
edenModels
# Explicitly link to static plugins
${PLUGINS}
)
set(NATIVE_MODULES yuzu edenInterface)
foreach(MODULE ${NATIVE_MODULES})
target_link_libraries(${MODULE} PRIVATE common core input_common frontend_common network video_core)
target_link_libraries(${MODULE} PRIVATE Boost::headers glad fmt)
target_link_libraries(${MODULE} PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
target_link_libraries(${MODULE} PRIVATE Vulkan::Headers)
if (NOT WIN32)
target_include_directories(${MODULE} PRIVATE ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
endif()
if (UNIX AND NOT APPLE)
target_link_libraries(${MODULE} PRIVATE Qt6::DBus)
endif()
target_compile_definitions(${MODULE} PRIVATE
# Use QStringBuilder for string concatenation to reduce
# the overall number of temporary strings created.
-DQT_USE_QSTRINGBUILDER
# Disable implicit type narrowing in signal/slot connect() calls.
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
# Disable unsafe overloads of QProcess' start() function.
-DQT_NO_PROCESS_COMBINED_ARGUMENT_START
# Disable implicit QString->QUrl conversions to enforce use of proper resolving functions.
-DQT_NO_URL_CAST_FROM_STRING
)
endforeach()
set_target_properties(yuzu PROPERTIES OUTPUT_NAME "eden")
include(GNUInstallDirs)
install(TARGETS yuzu
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
add_subdirectory(Eden)

View file

@ -0,0 +1,9 @@
include_directories(AFTER "${CMAKE_CURRENT_SOURCE_DIR}")
add_subdirectory(Config)
add_subdirectory(Constants)
add_subdirectory(Items)
add_subdirectory(Util)
add_subdirectory(Main)
add_subdirectory(Native)

View file

@ -1,8 +1,8 @@
set(CMAKE_AUTOMOC ON)
qt_add_library(edenConfig STATIC)
qt_add_qml_module(edenConfig
URI org.eden_emu.config
qt_add_library(EdenConfig STATIC)
qt_add_qml_module(EdenConfig
URI Eden.Config
VERSION 1.0
QML_FILES GlobalConfigureDialog.qml

View file

@ -2,10 +2,10 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.constants
import org.eden_emu.items
import org.eden_emu.interface
import org.eden_emu.util
import Eden.Constants
import Eden.Items
import Eden.Native.Interface
import Eden.Util
AnimatedDialog {
property list<var> configs

View file

@ -1,6 +1,6 @@
import QtQuick
import org.eden_emu.constants
import Eden.Constants
Text {
color: Constants.text

View file

@ -2,7 +2,7 @@ import QtQuick
import Qt.labs.qmlmodels
import org.eden_emu.config
import Eden.Config
// TODO: make settings independently available (model vs setting?
DelegateChooser {

View file

@ -1,7 +1,7 @@
import QtQuick
import QtQuick.Layouts
import org.eden_emu.constants
import Eden.Constants
Column {
topPadding: 5 * Constants.scalar

View file

@ -1,9 +1,9 @@
import QtQuick
import QtQuick.Layouts
import org.eden_emu.items
import org.eden_emu.config
import org.eden_emu.constants
import Eden.Items
import Eden.Config
import Eden.Constants
Item {
id: field

View file

@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.constants
import Eden.Constants
BaseField {
forceCheckbox: true

View file

@ -3,8 +3,8 @@ import QtQuick.Controls.Material
import QtQuick.Layouts
import QtQuick.Controls.Material.impl
import org.eden_emu.constants
import org.eden_emu.config
import Eden.Constants
import Eden.Config
BaseField {
contentItem: ComboBox {

View file

@ -1,9 +1,9 @@
import QtQuick
import QtQuick.Layouts
import org.eden_emu.items
import org.eden_emu.config
import org.eden_emu.constants
import Eden.Items
import Eden.Config
import Eden.Constants
BaseField {
contentItem: BetterTextField {

View file

@ -1,9 +1,9 @@
import QtQuick
import QtQuick.Layouts
import org.eden_emu.items
import org.eden_emu.config
import org.eden_emu.constants
import Eden.Items
import Eden.Config
import Eden.Constants
BaseField {
contentItem: BetterTextField {

View file

@ -2,9 +2,9 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.items
import org.eden_emu.config
import org.eden_emu.constants
import Eden.Items
import Eden.Config
import Eden.Constants
// Lots of cancer but idrc
BaseField {

View file

@ -1,9 +1,9 @@
import QtQuick
import QtQuick.Layouts
import org.eden_emu.items
import org.eden_emu.config
import org.eden_emu.constants
import Eden.Items
import Eden.Config
import Eden.Constants
BaseField {
id: field

View file

@ -1,9 +1,9 @@
import QtQuick
import QtQuick.Layouts
import org.eden_emu.items
import org.eden_emu.config
import org.eden_emu.constants
import Eden.Items
import Eden.Config
import Eden.Constants
BaseField {
contentItem: BetterTextField {

View file

@ -1,9 +1,9 @@
import QtQuick
import QtQuick.Layouts
import org.eden_emu.items
import org.eden_emu.config
import org.eden_emu.constants
import Eden.Items
import Eden.Config
import Eden.Constants
BaseField {
// TODO: real impl

View file

@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import org.eden_emu.constants
import Eden.Constants
CheckBox {
property bool force: false

View file

@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import org.eden_emu.constants
import Eden.Constants
Text {
property var setting

View file

@ -1,9 +1,9 @@
import QtQuick
import QtQuick.Layouts
import org.eden_emu.config
import org.eden_emu.constants
import org.eden_emu.interface
import Eden.Config
import Eden.Constants
import Eden.Native.Interface
ColumnLayout {
required property int category

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -1,6 +1,6 @@
import QtQuick
import org.eden_emu.config
import Eden.Config
GlobalTab {
property alias swipe: swipe

View file

@ -1,6 +1,6 @@
import QtQuick
import org.eden_emu.config
import Eden.Config
GlobalTab {
property alias swipe: swipe

View file

@ -1,6 +1,6 @@
import QtQuick
import org.eden_emu.config
import Eden.Config
GlobalTab {
property alias swipe: swipe

View file

@ -1,6 +1,6 @@
import QtQuick
import org.eden_emu.config
import Eden.Config
GlobalTab {
property alias swipe: swipe

View file

@ -1,6 +1,6 @@
import QtQuick
import org.eden_emu.config
import Eden.Config
GlobalTab {
property alias swipe: swipe

View file

@ -1,6 +1,6 @@
import QtQuick
import org.eden_emu.config
import Eden.Config
GlobalTab {
property alias swipe: swipe

View file

@ -1,7 +1,7 @@
import QtQuick 2.15
import QtQuick.Controls.Material
import org.eden_emu.constants
import Eden.Constants
Item {
required property list<string> tabs

View file

@ -1,7 +1,7 @@
import QtQuick 2.15
import QtQuick.Controls.Material
import org.eden_emu.constants
import Eden.Constants
SwipeView {
anchors {

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.interface
import org.eden_emu.config
import Eden.Native.Interface
import Eden.Config
ScrollView {
id: scroll

View file

@ -7,9 +7,9 @@ set_source_files_properties(Constants.qml
QT_QML_SINGLETON_TYPE true
)
qt_add_library(edenConstants STATIC)
qt_add_qml_module(edenConstants
URI org.eden_emu.constants
qt_add_library(EdenConstants STATIC)
qt_add_qml_module(EdenConstants
URI Eden.Constants
OUTPUT_DIRECTORY EdenConstants
VERSION 1.0
QML_FILES
@ -17,7 +17,7 @@ qt_add_qml_module(edenConstants
Constants.qml
)
target_link_libraries(edenConstants
target_link_libraries(EdenConstants
PRIVATE
Qt6::Quick
)

View file

@ -1,7 +1,7 @@
import QtQuick
import QtQuick.Controls.Material
import org.eden_emu.constants
import Eden.Constants
Dialog {
id: dia

View file

@ -1,7 +1,7 @@
import QtQuick
import QtQuick.Controls
import org.eden_emu.constants
import Eden.Constants
Menu {
background: Rectangle {

View file

@ -1,7 +1,7 @@
import QtQuick
import QtQuick.Controls
import org.eden_emu.constants
import Eden.Constants
MenuBar {
background: Rectangle {

View file

@ -1,9 +1,9 @@
set(CMAKE_AUTOMOC ON)
qt_add_library(edenItems STATIC)
qt_add_library(EdenItems STATIC)
qt_add_qml_module(edenItems
URI org.eden_emu.items
qt_add_qml_module(EdenItems
URI Eden.Items
VERSION 1.0
QML_FILES

View file

@ -1,7 +1,7 @@
import QtQuick
import QtQuick.Controls.Material
import org.eden_emu.constants
import Eden.Constants
Button {
required property string label

View file

@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.constants
import Eden.Constants
TabButton {
required property string label

View file

@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import org.eden_emu.constants
import Eden.Constants
MouseArea {
id: button

View file

@ -1,7 +1,7 @@
import QtQuick
import QtQuick.Controls.Material
import org.eden_emu.constants
import Eden.Constants
TabBar {
clip: true

View file

@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Controls.impl
import org.eden_emu.constants
import Eden.Constants
SpinBox {
id: control

View file

@ -1,8 +1,8 @@
import QtQuick
import QtQuick.Controls.Material
import org.eden_emu.constants
import org.eden_emu.items
import Eden.Constants
import Eden.Items
TextField {
property string suffix: ""

View file

@ -1,6 +1,6 @@
import QtQuick
import QtQuick.Controls.Material
import org.eden_emu.constants
import Eden.Constants
Rectangle {
height: 2 * Constants.scalar

View file

@ -1,8 +1,8 @@
set(CMAKE_AUTOMOC ON)
qt_add_library(edenMain STATIC)
qt_add_qml_module(edenMain
URI org.eden_emu.main
qt_add_library(EdenMain STATIC)
qt_add_qml_module(EdenMain
URI Eden.Main
VERSION 1.0
QML_FILES

View file

@ -3,8 +3,8 @@ import QtQuick.Controls
import Qt.labs.platform
import QtCore
import org.eden_emu.constants
import org.eden_emu.interface
import Eden.Constants
import Eden.Native.Interface
ListView {
id: carousel
@ -15,24 +15,42 @@ ListView {
model: EdenGameList
orientation: ListView.Horizontal
clip: false
flickDeceleration: 1000
flickDeceleration: 1500
snapMode: ListView.SnapToItem
onHeightChanged: console.log(width, height)
spacing: 20
Keys.enabled: true
Keys.onRightPressed: incrementCurrentIndex()
Keys.onLeftPressed: decrementCurrentIndex()
keyNavigationWraps: true
onCurrentIndexChanged: scrollToCenter()
function increment() {
incrementCurrentIndex()
if (currentIndex === count)
currentIndex = 0
}
highlight: Rectangle {
function decrement() {
decrementCurrentIndex()
if (currentIndex === -1)
currentIndex = count - 1
}
// TODO(crueter): handle move/displace/add (requires thread worker on game list and a bunch of other shit)
Rectangle {
id: hg
clip: false
z: 3
property var item: carousel.currentItem
anchors {
centerIn: parent
}
height: item === null ? 0 : item.height + 10
width: item === null ? 0 : item.width + 10
color: "transparent"
border {
color: "deepskyblue"
@ -48,9 +66,7 @@ ListView {
) + text.substring(1).toLowerCase())
}
property var item: carousel.currentItem
text: toTitleCase(item.title)
text: hg.item === null ? "" : toTitleCase(hg.item.title)
font.pixelSize: 22 * Constants.scalar
color: "lightblue"
@ -67,28 +83,14 @@ ListView {
}
}
highlightFollowsCurrentItem: true
highlightMoveDuration: 300
highlightMoveVelocity: -1
highlightRangeMode: ListView.StrictlyEnforceRange
preferredHighlightBegin: currentItem === null ? 0 : x + width / 2 - currentItem.width / 2
preferredHighlightEnd: currentItem === null ? 0 : x + width / 2 + currentItem.width / 2
highlightMoveDuration: 300
delegate: GameCarouselCard {
id: game
width: 300
height: 300
}
function scrollToCenter() {
let targetX = currentIndex * 320 - (width - 320) / 2
let min = 0
let max = contentWidth
contentX = Math.max(min, Math.min(max, targetX))
}
Behavior on contentX {
NumberAnimation {
duration: 300
easing.type: Easing.OutQuad
}
}
}

View file

@ -3,7 +3,7 @@ import QtQuick.Controls
import Qt.labs.platform
import QtCore
import org.eden_emu.constants
import Eden.Constants
Item {
property string title: model.name.replace(/-/g, " ")

View file

@ -3,9 +3,9 @@ import QtQuick.Controls
import Qt.labs.platform
import QtCore
import org.eden_emu.constants
import org.eden_emu.interface
import org.eden_emu.gamepad
import Eden.Constants
import Eden.Native.Interface
import Eden.Native.Gamepad
GridView {
property var setting

View file

@ -3,7 +3,7 @@ import QtQuick.Controls
import Qt.labs.platform
import QtCore
import org.eden_emu.constants
import Eden.Constants
Rectangle {
id: wrapper

View file

@ -3,9 +3,9 @@ import QtQuick.Controls
import Qt.labs.platform
import QtCore
import org.eden_emu.constants
import org.eden_emu.interface
import org.eden_emu.gamepad
import Eden.Constants
import Eden.Native.Interface
import Eden.Native.Gamepad
Rectangle {
id: root
@ -28,8 +28,8 @@ Rectangle {
// onDownPressed: grid.moveCurrentIndexDown()
// onLeftPressed: grid.moveCurrentIndexLeft()
// onRightPressed: grid.moveCurrentIndexRight()
onLeftPressed: carousel.decrementCurrentIndex()
onRightPressed: carousel.incrementCurrentIndex()
onLeftPressed: carousel.decrement()
onRightPressed: carousel.increment()
onAPressed: console.log("A pressed")
onLeftStickMoved: (x, y) => {
gx = x
@ -71,17 +71,6 @@ Rectangle {
}
}
// GameGrid {
// setting: parent.setting
// id: grid
// anchors.bottom: button.top
// anchors.left: parent.left
// anchors.margins: 8
// anchors.right: parent.right
// anchors.top: parent.top
// }
Item {
id: view
@ -93,6 +82,13 @@ Rectangle {
margins: 8 * Constants.scalar
}
// GameGrid {
// setting: root.setting
// id: grid
// anchors.fill: parent
// }
GameCarousel {
id: carousel

View file

@ -1,9 +1,9 @@
import QtQuick
import QtQuick.Controls.Material
import org.eden_emu.config
import org.eden_emu.items
import org.eden_emu.constants
import Eden.Config
import Eden.Items
import Eden.Constants
ApplicationWindow {
width: Constants.width

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts
import org.eden_emu.constants
import org.eden_emu.items
import Eden.Constants
import Eden.Items
ToolBar {
id: toolbar

View file

@ -0,0 +1,71 @@
qt_add_executable(eden
main.cpp
icons.qrc
)
add_subdirectory(Interface)
add_subdirectory(Models)
set(PLUGINS
EdenUtilplugin
EdenItemsplugin
EdenConfigplugin
EdenInterfaceplugin
EdenConstantsplugin
EdenMainplugin
)
if (ENABLE_SDL2)
add_subdirectory(Gamepad)
set(PLUGINS ${PLUGINS} edenGamepadplugin)
endif()
target_link_libraries(eden
PRIVATE
Qt6::Core
Qt6::Widgets
Qt6::Gui
Qt6::Quick
Qt6::QuickControls2
EdenModels
# Explicitly link to static plugins
${PLUGINS}
)
set(NATIVE_MODULES eden EdenInterface)
foreach(MODULE ${NATIVE_MODULES})
target_link_libraries(${MODULE} PRIVATE common core input_common frontend_common qt_common network video_core)
target_link_libraries(${MODULE} PRIVATE Boost::headers glad fmt)
target_link_libraries(${MODULE} PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
target_link_libraries(${MODULE} PRIVATE Vulkan::Headers)
if (UNIX AND NOT APPLE)
target_link_libraries(${MODULE} PRIVATE Qt6::DBus)
endif()
target_compile_definitions(${MODULE} PRIVATE
# Use QStringBuilder for string concatenation to reduce
# the overall number of temporary strings created.
-DQT_USE_QSTRINGBUILDER
# Disable implicit type narrowing in signal/slot connect() calls.
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
# Disable unsafe overloads of QProcess' start() function.
-DQT_NO_PROCESS_COMBINED_ARGUMENT_START
# Disable implicit QString->QUrl conversions to enforce use of proper resolving functions.
-DQT_NO_URL_CAST_FROM_STRING
)
endforeach()
set_target_properties(eden PROPERTIES OUTPUT_NAME "eden")
include(GNUInstallDirs)
install(TARGETS eden
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

View file

@ -3,7 +3,7 @@ set(CMAKE_AUTOMOC ON)
qt_add_library(edenGamepad STATIC)
qt_add_qml_module(edenGamepad
URI org.eden_emu.gamepad
URI Eden.Native.Gamepad
VERSION 1.0
SOURCES gamepad.h gamepad.cpp
)

View file

@ -1,5 +1,6 @@
#include "gamepad.h"
// TODO(crueter): This is just temporary
Gamepad::Gamepad(QObject *parent)
: QObject(parent)
{

View file

@ -0,0 +1,11 @@
qt_add_library(EdenInterface STATIC)
qt_add_qml_module(EdenInterface
URI Eden.Native.Interface
VERSION 1.0
SOURCES
SettingsInterface.h SettingsInterface.cpp
QMLSetting.h QMLSetting.cpp
MetaObjectHelper.h
SOURCES QMLConfig.h
)

View file

@ -1,7 +1,7 @@
#ifndef QMLCONFIG_H
#define QMLCONFIG_H
#include "eden/interface/qt_config.h"
#include "qt_common/qt_config.h"
#include <QObject>

View file

@ -1,7 +1,7 @@
#include "SettingsInterface.h"
#include "common/settings.h"
#include "common/logging/log.h"
#include "uisettings.h"
#include "qt_common/uisettings.h"
SettingsInterface::SettingsInterface(QObject* parent)
: QObject{parent}

View file

@ -2,11 +2,11 @@
#define SETTINGSINTERFACE_H
#include <QObject>
#include <QtQmlIntegration/QtQmlIntegration>
#include <QQmlEngine>
#include "QMLSetting.h"
#include "shared_translation.h"
#include "eden/models/SettingsModel.h"
#include "qt_common/shared_translation.h"
#include "Native/Models/SettingsModel.h"
namespace SettingsCategories {
Q_NAMESPACE

View file

@ -1,16 +1,16 @@
set(CMAKE_AUTOMOC ON)
# TODO: This might not need to be exposed to QML?
qt_add_library(edenModels STATIC)
qt_add_qml_module(edenModels
URI org.eden_emu.models
qt_add_library(EdenModels STATIC)
qt_add_qml_module(EdenModels
URI Eden.Native.Models
VERSION 1.0
SOURCES
GameListModel.h GameListModel.cpp
SettingsModel.h SettingsModel.cpp
)
target_link_libraries(edenModels
target_link_libraries(EdenModels
PRIVATE
Qt6::Gui
)

View file

@ -2,7 +2,7 @@
#define SETTINGSMODEL_H
#include <QAbstractListModel>
#include "eden/interface/QMLSetting.h"
#include "Native/Interface/QMLSetting.h"
class SettingsModel : public QAbstractListModel {
Q_OBJECT

View file

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 378 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 435 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 566 B

After

Width:  |  Height:  |  Size: 566 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 771 B

After

Width:  |  Height:  |  Size: 771 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 695 B

After

Width:  |  Height:  |  Size: 695 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 539 B

After

Width:  |  Height:  |  Size: 539 B

Before After
Before After

View file

@ -2,9 +2,9 @@
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "core/core.h"
#include "interface/QMLConfig.h"
#include "models/GameListModel.h"
#include "interface/SettingsInterface.h"
#include "Native/Interface/QMLConfig.h"
#include "Native/Models/GameListModel.h"
#include "Native/Interface/SettingsInterface.h"
#include <QQuickStyle>
@ -39,7 +39,7 @@ int main(int argc, char *argv[])
ctx->setContextProperty(QStringLiteral("QtConfig"), QVariant::fromValue(config));
// Enums
qmlRegisterUncreatableMetaObject(SettingsCategories::staticMetaObject, "org.eden_emu.interface", 1, 0, "SettingsCategories", QString());
qmlRegisterUncreatableMetaObject(SettingsCategories::staticMetaObject, "Eden.Native.Interface", 1, 0, "SettingsCategories", QString());
// Directory List
GameListModel *gameListModel = new GameListModel(&app);
@ -53,7 +53,7 @@ int main(int argc, char *argv[])
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.loadFromModule("org.eden_emu.main", "Main");
engine.loadFromModule("Eden.Main", "Main");
return app.exec();
}

View file

@ -7,9 +7,9 @@ set_source_files_properties(Util.qml
QT_QML_SINGLETON_TYPE true
)
qt_add_library(edenUtil STATIC)
qt_add_qml_module(edenUtil
URI org.eden_emu.util
qt_add_library(EdenUtil STATIC)
qt_add_qml_module(EdenUtil
URI Eden.Util
OUTPUT_DIRECTORY EdenUtil
VERSION 1.0
QML_FILES
@ -17,7 +17,7 @@ qt_add_qml_module(edenUtil
Util.qml
)
target_link_libraries(edenUtil
target_link_libraries(EdenUtil
PRIVATE
Qt6::Quick
)

View file

@ -1,14 +0,0 @@
qt_add_library(edenInterface STATIC)
qt_add_qml_module(edenInterface
URI org.eden_emu.interface
VERSION 1.0
SOURCES
SettingsInterface.h SettingsInterface.cpp
uisettings.h uisettings.cpp
qt_config.h qt_config.cpp
shared_translation.h shared_translation.cpp
QMLSetting.h QMLSetting.cpp
MetaObjectHelper.h
SOURCES QMLConfig.h
)

View file

@ -1,562 +0,0 @@
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "qt_config.h"
#include "common/logging/log.h"
#include "input_common/main.h"
#include "uisettings.h"
const std::array<int, Settings::NativeButton::NumButtons> QtConfig::default_buttons = {
Qt::Key_C, Qt::Key_X, Qt::Key_V, Qt::Key_Z, Qt::Key_F,
Qt::Key_G, Qt::Key_Q, Qt::Key_E, Qt::Key_R, Qt::Key_T,
Qt::Key_M, Qt::Key_N, Qt::Key_Left, Qt::Key_Up, Qt::Key_Right,
Qt::Key_Down, Qt::Key_Q, Qt::Key_E, 0, 0,
Qt::Key_Q, Qt::Key_E,
};
const std::array<int, Settings::NativeMotion::NumMotions> QtConfig::default_motions = {
Qt::Key_7,
Qt::Key_8,
};
const std::array<std::array<int, 4>, Settings::NativeAnalog::NumAnalogs> QtConfig::default_analogs{{
{
Qt::Key_W,
Qt::Key_S,
Qt::Key_A,
Qt::Key_D,
},
{
Qt::Key_I,
Qt::Key_K,
Qt::Key_J,
Qt::Key_L,
},
}};
const std::array<int, 2> QtConfig::default_stick_mod = {
Qt::Key_Shift,
0,
};
const std::array<int, 2> QtConfig::default_ringcon_analogs{{
Qt::Key_A,
Qt::Key_D,
}};
QtConfig::QtConfig(const std::string& config_name, const ConfigType config_type)
: Config(config_type) {
Initialize(config_name);
if (config_type != ConfigType::InputProfile) {
ReadQtValues();
SaveQtValues();
}
}
QtConfig::~QtConfig() {
if (global) {
QtConfig::SaveAllValues();
}
}
void QtConfig::ReloadAllValues() {
Reload();
ReadQtValues();
SaveQtValues();
}
void QtConfig::SaveAllValues() {
SaveValues();
SaveQtValues();
}
void QtConfig::ReadQtValues() {
if (global) {
ReadUIValues();
}
ReadQtControlValues();
}
void QtConfig::ReadQtPlayerValues(const std::size_t player_index) {
std::string player_prefix;
if (type != ConfigType::InputProfile) {
player_prefix.append("player_").append(ToString(player_index)).append("_");
}
auto& player = Settings::values.players.GetValue()[player_index];
if (IsCustomConfig()) {
const auto profile_name =
ReadStringSetting(std::string(player_prefix).append("profile_name"));
if (profile_name.empty()) {
// Use the global input config
player = Settings::values.players.GetValue(true)[player_index];
player.profile_name = "";
return;
}
}
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
const std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
auto& player_buttons = player.buttons[i];
player_buttons = ReadStringSetting(
std::string(player_prefix).append(Settings::NativeButton::mapping[i]), default_param);
if (player_buttons.empty()) {
player_buttons = default_param;
}
}
for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
const std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
default_analogs[i][0], default_analogs[i][1], default_analogs[i][2],
default_analogs[i][3], default_stick_mod[i], 0.5f);
auto& player_analogs = player.analogs[i];
player_analogs = ReadStringSetting(
std::string(player_prefix).append(Settings::NativeAnalog::mapping[i]), default_param);
if (player_analogs.empty()) {
player_analogs = default_param;
}
}
for (int i = 0; i < Settings::NativeMotion::NumMotions; ++i) {
const std::string default_param = InputCommon::GenerateKeyboardParam(default_motions[i]);
auto& player_motions = player.motions[i];
player_motions = ReadStringSetting(
std::string(player_prefix).append(Settings::NativeMotion::mapping[i]), default_param);
if (player_motions.empty()) {
player_motions = default_param;
}
}
}
void QtConfig::ReadHidbusValues() {
const std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
0, 0, default_ringcon_analogs[0], default_ringcon_analogs[1], 0, 0.05f);
auto& ringcon_analogs = Settings::values.ringcon_analogs;
ringcon_analogs = ReadStringSetting(std::string("ring_controller"), default_param);
if (ringcon_analogs.empty()) {
ringcon_analogs = default_param;
}
}
void QtConfig::ReadDebugControlValues() {
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
const std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
auto& debug_pad_buttons = Settings::values.debug_pad_buttons[i];
debug_pad_buttons = ReadStringSetting(
std::string("debug_pad_").append(Settings::NativeButton::mapping[i]), default_param);
if (debug_pad_buttons.empty()) {
debug_pad_buttons = default_param;
}
}
for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
const std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
default_analogs[i][0], default_analogs[i][1], default_analogs[i][2],
default_analogs[i][3], default_stick_mod[i], 0.5f);
auto& debug_pad_analogs = Settings::values.debug_pad_analogs[i];
debug_pad_analogs = ReadStringSetting(
std::string("debug_pad_").append(Settings::NativeAnalog::mapping[i]), default_param);
if (debug_pad_analogs.empty()) {
debug_pad_analogs = default_param;
}
}
}
void QtConfig::ReadQtControlValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Controls));
Settings::values.players.SetGlobal(!IsCustomConfig());
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
ReadQtPlayerValues(p);
}
if (IsCustomConfig()) {
EndGroup();
return;
}
ReadDebugControlValues();
ReadHidbusValues();
EndGroup();
}
void QtConfig::ReadPathValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Paths));
UISettings::values.roms_path = ReadStringSetting(std::string("romsPath"));
UISettings::values.game_dir_deprecated =
ReadStringSetting(std::string("gameListRootDir"), std::string("."));
UISettings::values.game_dir_deprecated_deepscan =
ReadBooleanSetting(std::string("gameListDeepScan"), std::make_optional(false));
const int gamedirs_size = BeginArray(std::string("gamedirs"));
for (int i = 0; i < gamedirs_size; ++i) {
SetArrayIndex(i);
UISettings::GameDir game_dir;
game_dir.path = ReadStringSetting(std::string("path"));
game_dir.deep_scan =
ReadBooleanSetting(std::string("deep_scan"), std::make_optional(false));
game_dir.expanded = ReadBooleanSetting(std::string("expanded"), std::make_optional(true));
UISettings::values.game_dirs.append(game_dir);
}
EndArray();
// Create NAND and SD card directories if empty, these are not removable through the UI,
// also carries over old game list settings if present
if (UISettings::values.game_dirs.empty()) {
UISettings::GameDir game_dir;
game_dir.path = std::string("SDMC");
game_dir.expanded = true;
UISettings::values.game_dirs.append(game_dir);
game_dir.path = std::string("UserNAND");
UISettings::values.game_dirs.append(game_dir);
game_dir.path = std::string("SysNAND");
UISettings::values.game_dirs.append(game_dir);
if (UISettings::values.game_dir_deprecated != std::string(".")) {
game_dir.path = UISettings::values.game_dir_deprecated;
game_dir.deep_scan = UISettings::values.game_dir_deprecated_deepscan;
UISettings::values.game_dirs.append(game_dir);
}
}
UISettings::values.recent_files =
QString::fromStdString(ReadStringSetting(std::string("recentFiles")))
.split(QStringLiteral(", "), Qt::SkipEmptyParts, Qt::CaseSensitive);
ReadCategory(Settings::Category::Paths);
EndGroup();
}
void QtConfig::ReadShortcutValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Shortcuts));
for (const auto& [name, group, shortcut] : UISettings::default_hotkeys) {
BeginGroup(group);
BeginGroup(name);
// No longer using ReadSetting for shortcut.second as it inaccurately returns a value of 1
// for WidgetWithChildrenShortcut which is a value of 3. Needed to fix shortcuts the open
// a file dialog in windowed mode
UISettings::values.shortcuts.push_back(
{name,
group,
{ReadStringSetting(std::string("KeySeq"), shortcut.keyseq),
ReadStringSetting(std::string("Controller_KeySeq"), shortcut.controller_keyseq),
shortcut.context,
ReadBooleanSetting(std::string("Repeat"), std::optional(shortcut.repeat))}});
EndGroup(); // name
EndGroup(); // group
}
EndGroup();
}
void QtConfig::ReadUIValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Ui));
UISettings::values.theme = ReadStringSetting(
std::string("theme"),
std::string(UISettings::themes[static_cast<size_t>(UISettings::default_theme)].second));
ReadUIGamelistValues();
ReadUILayoutValues();
ReadPathValues();
ReadScreenshotValues();
ReadShortcutValues();
ReadMultiplayerValues();
ReadCategory(Settings::Category::Ui);
ReadCategory(Settings::Category::UiGeneral);
EndGroup();
}
void QtConfig::ReadUIGamelistValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::UiGameList));
ReadCategory(Settings::Category::UiGameList);
// const int favorites_size = BeginArray("favorites");
// for (int i = 0; i < favorites_size; i++) {
// SetArrayIndex(i);
// UISettings::values.favorited_ids.append(
// ReadUnsignedIntegerSetting(std::string("program_id")));
// }
// EndArray();
EndGroup();
}
void QtConfig::ReadUILayoutValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::UiGameList));
ReadCategory(Settings::Category::UiLayout);
EndGroup();
}
void QtConfig::ReadMultiplayerValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Multiplayer));
ReadCategory(Settings::Category::Multiplayer);
// Read ban list back
int size = BeginArray(std::string("username_ban_list"));
UISettings::values.multiplayer_ban_list.first.resize(size);
for (int i = 0; i < size; ++i) {
SetArrayIndex(i);
UISettings::values.multiplayer_ban_list.first[i] =
ReadStringSetting(std::string("username"), std::string(""));
}
EndArray();
size = BeginArray(std::string("ip_ban_list"));
UISettings::values.multiplayer_ban_list.second.resize(size);
for (int i = 0; i < size; ++i) {
UISettings::values.multiplayer_ban_list.second[i] =
ReadStringSetting("username", std::string(""));
}
EndArray();
EndGroup();
}
void QtConfig::SaveQtValues()
{
if (global) {
LOG_DEBUG(Config, "Saving global Qt configuration values");
SaveUIValues();
} else {
LOG_DEBUG(Config, "Saving Qt configuration values");
}
SaveQtControlValues();
WriteToIni();
}
void QtConfig::SaveQtPlayerValues(const std::size_t player_index) {
std::string player_prefix;
if (type != ConfigType::InputProfile) {
player_prefix = std::string("player_").append(ToString(player_index)).append("_");
}
const auto& player = Settings::values.players.GetValue()[player_index];
if (IsCustomConfig() && player.profile_name.empty()) {
// No custom profile selected
return;
}
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
const std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
WriteStringSetting(std::string(player_prefix).append(Settings::NativeButton::mapping[i]),
player.buttons[i], std::make_optional(default_param));
}
for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
const std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
default_analogs[i][0], default_analogs[i][1], default_analogs[i][2],
default_analogs[i][3], default_stick_mod[i], 0.5f);
WriteStringSetting(std::string(player_prefix).append(Settings::NativeAnalog::mapping[i]),
player.analogs[i], std::make_optional(default_param));
}
for (int i = 0; i < Settings::NativeMotion::NumMotions; ++i) {
const std::string default_param = InputCommon::GenerateKeyboardParam(default_motions[i]);
WriteStringSetting(std::string(player_prefix).append(Settings::NativeMotion::mapping[i]),
player.motions[i], std::make_optional(default_param));
}
}
void QtConfig::SaveDebugControlValues() {
for (int i = 0; i < Settings::NativeButton::NumButtons; ++i) {
const std::string default_param = InputCommon::GenerateKeyboardParam(default_buttons[i]);
WriteStringSetting(std::string("debug_pad_").append(Settings::NativeButton::mapping[i]),
Settings::values.debug_pad_buttons[i],
std::make_optional(default_param));
}
for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
const std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
default_analogs[i][0], default_analogs[i][1], default_analogs[i][2],
default_analogs[i][3], default_stick_mod[i], 0.5f);
WriteStringSetting(std::string("debug_pad_").append(Settings::NativeAnalog::mapping[i]),
Settings::values.debug_pad_analogs[i],
std::make_optional(default_param));
}
}
void QtConfig::SaveHidbusValues() {
const std::string default_param = InputCommon::GenerateAnalogParamFromKeys(
0, 0, default_ringcon_analogs[0], default_ringcon_analogs[1], 0, 0.05f);
WriteStringSetting(std::string("ring_controller"), Settings::values.ringcon_analogs,
std::make_optional(default_param));
}
void QtConfig::SaveQtControlValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Controls));
Settings::values.players.SetGlobal(!IsCustomConfig());
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
SaveQtPlayerValues(p);
}
if (IsCustomConfig()) {
EndGroup();
return;
}
SaveDebugControlValues();
SaveHidbusValues();
EndGroup();
}
void QtConfig::SavePathValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Paths));
WriteCategory(Settings::Category::Paths);
WriteStringSetting(std::string("romsPath"), UISettings::values.roms_path);
BeginArray(std::string("gamedirs"));
for (int i = 0; i < UISettings::values.game_dirs.size(); ++i) {
SetArrayIndex(i);
const auto& game_dir = UISettings::values.game_dirs[i];
WriteStringSetting(std::string("path"), game_dir.path);
WriteBooleanSetting(std::string("deep_scan"), game_dir.deep_scan,
std::make_optional(false));
WriteBooleanSetting(std::string("expanded"), game_dir.expanded, std::make_optional(true));
}
EndArray();
WriteStringSetting(std::string("recentFiles"),
UISettings::values.recent_files.join(QStringLiteral(", ")).toStdString());
EndGroup();
}
void QtConfig::SaveShortcutValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Shortcuts));
// Lengths of UISettings::values.shortcuts & default_hotkeys are same.
// However, their ordering must also be the same.
for (std::size_t i = 0; i < UISettings::default_hotkeys.size(); i++) {
const auto& [name, group, shortcut] = UISettings::values.shortcuts[i];
const auto& default_hotkey = UISettings::default_hotkeys[i].shortcut;
BeginGroup(group);
BeginGroup(name);
WriteStringSetting(std::string("KeySeq"), shortcut.keyseq,
std::make_optional(default_hotkey.keyseq));
WriteStringSetting(std::string("Controller_KeySeq"), shortcut.controller_keyseq,
std::make_optional(default_hotkey.controller_keyseq));
WriteIntegerSetting(std::string("Context"), shortcut.context,
std::make_optional(default_hotkey.context));
WriteBooleanSetting(std::string("Repeat"), shortcut.repeat,
std::make_optional(default_hotkey.repeat));
EndGroup(); // name
EndGroup(); // group
}
EndGroup();
}
void QtConfig::SaveUIValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::Ui));
WriteCategory(Settings::Category::Ui);
WriteCategory(Settings::Category::UiGeneral);
WriteStringSetting(
std::string("theme"), UISettings::values.theme,
std::make_optional(std::string(
UISettings::themes[static_cast<size_t>(UISettings::default_theme)].second)));
SaveUIGamelistValues();
SaveUILayoutValues();
SavePathValues();
SaveScreenshotValues();
SaveShortcutValues();
SaveMultiplayerValues();
EndGroup();
}
void QtConfig::SaveUIGamelistValues()
{
BeginGroup(Settings::TranslateCategory(Settings::Category::UiGameList));
WriteCategory(Settings::Category::UiGameList);
// BeginArray(std::string("favorites"));
// for (int i = 0; i < UISettings::values.favorited_ids.size(); i++) {
// SetArrayIndex(i);
// WriteIntegerSetting(std::string("program_id"), UISettings::values.favorited_ids[i]);
// }
// EndArray(); // favorites
EndGroup();
}
void QtConfig::SaveUILayoutValues() {
BeginGroup(Settings::TranslateCategory(Settings::Category::UiLayout));
WriteCategory(Settings::Category::UiLayout);
EndGroup();
}
void QtConfig::SaveMultiplayerValues() {
BeginGroup(std::string("Multiplayer"));
WriteCategory(Settings::Category::Multiplayer);
// Write ban list
BeginArray(std::string("username_ban_list"));
for (std::size_t i = 0; i < UISettings::values.multiplayer_ban_list.first.size(); ++i) {
SetArrayIndex(static_cast<int>(i));
WriteStringSetting(std::string("username"),
UISettings::values.multiplayer_ban_list.first[i]);
}
EndArray(); // username_ban_list
BeginArray(std::string("ip_ban_list"));
for (std::size_t i = 0; i < UISettings::values.multiplayer_ban_list.second.size(); ++i) {
SetArrayIndex(static_cast<int>(i));
WriteStringSetting(std::string("ip"), UISettings::values.multiplayer_ban_list.second[i]);
}
EndArray(); // ip_ban_list
EndGroup();
}
std::vector<Settings::BasicSetting*>& QtConfig::FindRelevantList(Settings::Category category) {
auto& map = Settings::values.linkage.by_category;
if (!map[category].empty()) {
return map[category];
}
return UISettings::values.linkage.by_category[category];
}
void QtConfig::ReadQtControlPlayerValues(std::size_t player_index) {
BeginGroup(Settings::TranslateCategory(Settings::Category::Controls));
ReadPlayerValues(player_index);
ReadQtPlayerValues(player_index);
EndGroup();
}
void QtConfig::SaveQtControlPlayerValues(std::size_t player_index) {
BeginGroup(Settings::TranslateCategory(Settings::Category::Controls));
LOG_DEBUG(Config, "Saving players control configuration values");
SavePlayerValues(player_index);
SaveQtPlayerValues(player_index);
EndGroup();
WriteToIni();
}

View file

@ -1,55 +0,0 @@
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QMetaType>
#include "frontend_common/config.h"
class QtConfig final : public Config {
public:
explicit QtConfig(const std::string& config_name = "qt-config",
ConfigType config_type = ConfigType::GlobalConfig);
~QtConfig() override;
void ReloadAllValues() override;
void SaveAllValues() override;
void ReadQtControlPlayerValues(std::size_t player_index);
void SaveQtControlPlayerValues(std::size_t player_index);
protected:
void ReadQtValues();
void ReadQtPlayerValues(std::size_t player_index);
void ReadQtControlValues();
void ReadHidbusValues() override;
void ReadDebugControlValues() override;
void ReadPathValues() override;
void ReadShortcutValues() override;
void ReadUIValues() override;
void ReadUIGamelistValues() override;
void ReadUILayoutValues() override;
void ReadMultiplayerValues() override;
void SaveQtValues();
void SaveQtPlayerValues(std::size_t player_index);
void SaveQtControlValues();
void SaveHidbusValues() override;
void SaveDebugControlValues() override;
void SavePathValues() override;
void SaveShortcutValues() override;
void SaveUIValues() override;
void SaveUIGamelistValues() override;
void SaveUILayoutValues() override;
void SaveMultiplayerValues() override;
std::vector<Settings::BasicSetting*>& FindRelevantList(Settings::Category category) override;
public:
static const std::array<int, Settings::NativeButton::NumButtons> default_buttons;
static const std::array<int, Settings::NativeMotion::NumMotions> default_motions;
static const std::array<std::array<int, 4>, Settings::NativeAnalog::NumAnalogs> default_analogs;
static const std::array<int, 2> default_stick_mod;
static const std::array<int, 2> default_ringcon_analogs;
};

View file

@ -1,692 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "eden/interface/shared_translation.h"
#include <QCoreApplication>
#include "common/settings.h"
#include "common/settings_enums.h"
#include "common/settings_setting.h"
#include "common/time_zone.h"
#include "yuzu/uisettings.h"
#include <map>
#include <memory>
#include <tuple>
#include <utility>
namespace ConfigurationShared {
std::unique_ptr<TranslationMap> InitializeTranslations(QObject* parent)
{
std::unique_ptr<TranslationMap> translations = std::make_unique<TranslationMap>();
const auto& tr = [parent](const char* text) -> QString { return parent->tr(text); };
#define INSERT(SETTINGS, ID, NAME, TOOLTIP) \
translations->insert(std::pair{SETTINGS::values.ID.Id(), std::pair{(NAME), (TOOLTIP)}})
// A setting can be ignored by giving it a blank name
// Applets
INSERT(Settings, cabinet_applet_mode, tr("Amiibo editor"), QString());
INSERT(Settings, controller_applet_mode, tr("Controller configuration"), QString());
INSERT(Settings, data_erase_applet_mode, tr("Data erase"), QString());
INSERT(Settings, error_applet_mode, tr("Error"), QString());
INSERT(Settings, net_connect_applet_mode, tr("Net connect"), QString());
INSERT(Settings, player_select_applet_mode, tr("Player select"), QString());
INSERT(Settings, swkbd_applet_mode, tr("Software keyboard"), QString());
INSERT(Settings, mii_edit_applet_mode, tr("Mii Edit"), QString());
INSERT(Settings, web_applet_mode, tr("Online web"), QString());
INSERT(Settings, shop_applet_mode, tr("Shop"), QString());
INSERT(Settings, photo_viewer_applet_mode, tr("Photo viewer"), QString());
INSERT(Settings, offline_web_applet_mode, tr("Offline web"), QString());
INSERT(Settings, login_share_applet_mode, tr("Login share"), QString());
INSERT(Settings, wifi_web_auth_applet_mode, tr("Wifi web auth"), QString());
INSERT(Settings, my_page_applet_mode, tr("My page"), QString());
// Audio
INSERT(Settings, sink_id, tr("Output Engine:"), QString());
INSERT(Settings, audio_output_device_id, tr("Output Device:"), QString());
INSERT(Settings, audio_input_device_id, tr("Input Device:"), QString());
INSERT(Settings, audio_muted, tr("Mute audio"), QString());
INSERT(Settings, volume, tr("Volume:"), QString());
INSERT(Settings, dump_audio_commands, QString(), QString());
INSERT(UISettings, mute_when_in_background, tr("Mute audio when in background"), QString());
// Core
INSERT(
Settings,
use_multi_core,
tr("Multicore CPU Emulation"),
tr("This option increases CPU emulation thread use from 1 to the Switchs maximum of 4.\n"
"This is mainly a debug option and shouldnt be disabled."));
INSERT(
Settings,
memory_layout_mode,
tr("Memory Layout"),
tr("Increases the amount of emulated RAM from the stock 4GB of the retail Switch to the "
"developer kit's 8/6GB.\nIts doesnt improve stability or performance and is intended "
"to let big texture mods fit in emulated RAM.\nEnabling it will increase memory "
"use. It is not recommended to enable unless a specific game with a texture mod needs "
"it."));
INSERT(Settings, use_speed_limit, QString(), QString());
INSERT(Settings,
speed_limit,
tr("Limit Speed Percent"),
tr("Controls the game's maximum rendering speed, but its up to each game if it runs "
"faster or not.\n200% for a 30 FPS game is 60 FPS, and for a "
"60 FPS game it will be 120 FPS.\nDisabling it means unlocking the framerate to the "
"maximum your PC can reach."));
INSERT(Settings,
sync_core_speed,
tr("Synchronize Core Speed"),
tr("Synchronizes CPU core speed with the game's maximum rendering speed to boost FPS "
"without affecting game speed (animations, physics, etc.).\n"
"Compatibility varies by game; many (especially older ones) may not respond well.\n"
"Can help reduce stuttering at lower framerates."));
// Cpu
INSERT(Settings,
cpu_accuracy,
tr("Accuracy:"),
tr("This setting controls the accuracy of the emulated CPU.\nDon't change this unless "
"you know what you are doing."));
INSERT(Settings, cpu_backend, tr("Backend:"), QString());
INSERT(Settings, use_fast_cpu_time, QString(), QString());
INSERT(Settings,
fast_cpu_time,
tr("Fast CPU Time"),
tr("Overclocks the emulated CPU to remove some FPS limiters. Weaker CPUs may see reduced performance, "
"and certain games may behave improperly.\nUse Boost (1700MHz) to run at the Switch's highest native "
"clock, or Fast (2000MHz) to run at 2x clock."));
INSERT(Settings, cpu_backend, tr("Backend:"), QString());
// Cpu Debug
// Cpu Unsafe
INSERT(
Settings,
cpuopt_unsafe_unfuse_fma,
tr("Unfuse FMA (improve performance on CPUs without FMA)"),
tr("This option improves speed by reducing accuracy of fused-multiply-add instructions on "
"CPUs without native FMA support."));
INSERT(
Settings,
cpuopt_unsafe_reduce_fp_error,
tr("Faster FRSQRTE and FRECPE"),
tr("This option improves the speed of some approximate floating-point functions by using "
"less accurate native approximations."));
INSERT(Settings,
cpuopt_unsafe_ignore_standard_fpcr,
tr("Faster ASIMD instructions (32 bits only)"),
tr("This option improves the speed of 32 bits ASIMD floating-point functions by running "
"with incorrect rounding modes."));
INSERT(Settings,
cpuopt_unsafe_inaccurate_nan,
tr("Inaccurate NaN handling"),
tr("This option improves speed by removing NaN checking.\nPlease note this also reduces "
"accuracy of certain floating-point instructions."));
INSERT(Settings,
cpuopt_unsafe_fastmem_check,
tr("Disable address space checks"),
tr("This option improves speed by eliminating a safety check before every memory "
"read/write in guest.\nDisabling it may allow a game to read/write the emulator's "
"memory."));
INSERT(
Settings,
cpuopt_unsafe_ignore_global_monitor,
tr("Ignore global monitor"),
tr("This option improves speed by relying only on the semantics of cmpxchg to ensure "
"safety of exclusive access instructions.\nPlease note this may result in deadlocks and "
"other race conditions."));
// Renderer
INSERT(
Settings,
renderer_backend,
tr("API:"),
tr("Switches between the available graphics APIs.\nVulkan is recommended in most cases."));
INSERT(Settings,
vulkan_device,
tr("Device:"),
tr("This setting selects the GPU to use with the Vulkan backend."));
INSERT(Settings,
shader_backend,
tr("Shader Backend:"),
tr("The shader backend to use for the OpenGL renderer.\nGLSL is the fastest in "
"performance and the best in rendering accuracy.\n"
"GLASM is a deprecated NVIDIA-only backend that offers much better shader building "
"performance at the cost of FPS and rendering accuracy.\n"
"SPIR-V compiles the fastest, but yields poor results on most GPU drivers."));
INSERT(Settings,
resolution_setup,
tr("Resolution:"),
tr("Forces the game to render at a different resolution.\nHigher resolutions require "
"much more VRAM and bandwidth.\n"
"Options lower than 1X can cause rendering issues."));
INSERT(Settings, scaling_filter, tr("Window Adapting Filter:"), QString());
INSERT(Settings,
fsr_sharpening_slider,
tr("FSR Sharpness:"),
tr("Determines how sharpened the image will look while using FSRs dynamic contrast."));
INSERT(Settings,
anti_aliasing,
tr("Anti-Aliasing Method:"),
tr("The anti-aliasing method to use.\nSMAA offers the best quality.\nFXAA has a "
"lower performance impact and can produce a better and more stable picture under "
"very low resolutions."));
INSERT(Settings,
fullscreen_mode,
tr("Fullscreen Mode:"),
tr("The method used to render the window in fullscreen.\nBorderless offers the best "
"compatibility with the on-screen keyboard that some games request for "
"input.\nExclusive "
"fullscreen may offer better performance and better Freesync/Gsync support."));
INSERT(Settings,
aspect_ratio,
tr("Aspect Ratio:"),
tr("Stretches the game to fit the specified aspect ratio.\nSwitch games only support "
"16:9, so custom game mods are required to get other ratios.\nAlso controls the "
"aspect ratio of captured screenshots."));
INSERT(Settings,
use_disk_shader_cache,
tr("Use disk pipeline cache"),
tr("Allows saving shaders to storage for faster loading on following game "
"boots.\nDisabling "
"it is only intended for debugging."));
INSERT(Settings,
optimize_spirv_output,
tr("Optimize SPIRV output shader"),
tr("Runs an additional optimization pass over generated SPIRV shaders.\n"
"Will increase time required for shader compilation.\nMay slightly improve "
"performance.\nThis feature is experimental."));
INSERT(
Settings,
use_asynchronous_gpu_emulation,
tr("Use asynchronous GPU emulation"),
tr("Uses an extra CPU thread for rendering.\nThis option should always remain enabled."));
INSERT(Settings,
nvdec_emulation,
tr("NVDEC emulation:"),
tr("Specifies how videos should be decoded.\nIt can either use the CPU or the GPU for "
"decoding, or perform no decoding at all (black screen on videos).\n"
"In most cases, GPU decoding provides the best performance."));
INSERT(Settings,
accelerate_astc,
tr("ASTC Decoding Method:"),
tr("This option controls how ASTC textures should be decoded.\n"
"CPU: Use the CPU for decoding, slowest but safest method.\n"
"GPU: Use the GPU's compute shaders to decode ASTC textures, recommended for most "
"games and users.\n"
"CPU Asynchronously: Use the CPU to decode ASTC textures as they arrive. Completely "
"eliminates ASTC decoding\nstuttering at the cost of rendering issues while the "
"texture is being decoded."));
INSERT(
Settings,
astc_recompression,
tr("ASTC Recompression Method:"),
tr("Almost all desktop and laptop dedicated GPUs lack support for ASTC textures, forcing "
"the emulator to decompress to an intermediate format any card supports, RGBA8.\n"
"This option recompresses RGBA8 to either the BC1 or BC3 format, saving VRAM but "
"negatively affecting image quality."));
INSERT(Settings,
vram_usage_mode,
tr("VRAM Usage Mode:"),
tr("Selects whether the emulator should prefer to conserve memory or make maximum usage "
"of available video memory for performance. Has no effect on integrated graphics. "
"Aggressive mode may severely impact the performance of other applications such as "
"recording software."));
INSERT(
Settings,
vsync_mode,
tr("VSync Mode:"),
tr("FIFO (VSync) does not drop frames or exhibit tearing but is limited by the screen "
"refresh rate.\nFIFO Relaxed is similar to FIFO but allows tearing as it recovers from "
"a slow down.\nMailbox can have lower latency than FIFO and does not tear but may drop "
"frames.\nImmediate (no synchronization) just presents whatever is available and can "
"exhibit tearing."));
INSERT(Settings, bg_red, QString(), QString());
INSERT(Settings, bg_green, QString(), QString());
INSERT(Settings, bg_blue, QString(), QString());
// Renderer (Advanced Graphics)
INSERT(Settings,
async_presentation,
tr("Enable asynchronous presentation (Vulkan only)"),
tr("Slightly improves performance by moving presentation to a separate CPU thread."));
INSERT(
Settings,
renderer_force_max_clock,
tr("Force maximum clocks (Vulkan only)"),
tr("Runs work in the background while waiting for graphics commands to keep the GPU from "
"lowering its clock speed."));
INSERT(Settings,
max_anisotropy,
tr("Anisotropic Filtering:"),
tr("Controls the quality of texture rendering at oblique angles.\nIts a light setting "
"and safe to set at 16x on most GPUs."));
INSERT(Settings,
gpu_accuracy,
tr("Accuracy Level:"),
tr("GPU emulation accuracy.\nMost games render fine with Normal, but High is still "
"required for some.\nParticles tend to only render correctly with High "
"accuracy.\nExtreme should only be used for debugging.\nThis option can "
"be changed while playing.\nSome games may require booting on high to render "
"properly."));
INSERT(Settings,
use_asynchronous_shaders,
tr("Use asynchronous shader building (Hack)"),
tr("Enables asynchronous shader compilation, which may reduce shader stutter.\nThis "
"feature "
"is experimental."));
INSERT(Settings, use_fast_gpu_time, QString(), QString());
INSERT(Settings,
fast_gpu_time,
tr("Fast GPU Time (Hack)"),
tr("Overclocks the emulated GPU to increase dynamic resolution and render "
"distance.\nUse 128 for maximal performance and 512 for maximal graphics fidelity."));
INSERT(Settings,
use_vulkan_driver_pipeline_cache,
tr("Use Vulkan pipeline cache"),
tr("Enables GPU vendor-specific pipeline cache.\nThis option can improve shader loading "
"time significantly in cases where the Vulkan driver does not store pipeline cache "
"files internally."));
INSERT(
Settings,
enable_compute_pipelines,
tr("Enable Compute Pipelines (Intel Vulkan Only)"),
tr("Enable compute pipelines, required by some games.\nThis setting only exists for Intel "
"proprietary drivers, and may crash if enabled.\nCompute pipelines are always enabled "
"on all other drivers."));
INSERT(
Settings,
use_reactive_flushing,
tr("Enable Reactive Flushing"),
tr("Uses reactive flushing instead of predictive flushing, allowing more accurate memory "
"syncing."));
INSERT(Settings,
use_video_framerate,
tr("Sync to framerate of video playback"),
tr("Run the game at normal speed during video playback, even when the framerate is "
"unlocked."));
INSERT(Settings,
barrier_feedback_loops,
tr("Barrier feedback loops"),
tr("Improves rendering of transparency effects in specific games."));
// Renderer (Extensions)
INSERT(Settings,
dyna_state,
tr("Extended Dynamic State"),
tr("Enables the VkExtendedDynamicState* extensions.\nHigher dynamic states will "
"generally improve "
"performance, but may cause issues on certain games or devices."));
INSERT(Settings,
provoking_vertex,
tr("Provoking Vertex"),
tr("Improves lighting and vertex handling in certain games.\n"
"Only Vulkan 1.0+ devices support this extension."));
INSERT(Settings,
descriptor_indexing,
tr("Descriptor Indexing"),
tr("Improves texture & buffer handling and the Maxwell translation layer.\n"
"Some Vulkan 1.1+ and all 1.2+ devices support this extension."));
// Renderer (Debug)
// System
INSERT(Settings,
rng_seed,
tr("RNG Seed"),
tr("Controls the seed of the random number generator.\nMainly used for speedrunning "
"purposes."));
INSERT(Settings, rng_seed_enabled, QString(), QString());
INSERT(Settings, device_name, tr("Device Name"), tr("The name of the emulated Switch."));
INSERT(Settings,
custom_rtc,
tr("Custom RTC Date:"),
tr("This option allows to change the emulated clock of the Switch.\n"
"Can be used to manipulate time in games."));
INSERT(Settings, custom_rtc_enabled, QString(), QString());
INSERT(Settings,
custom_rtc_offset,
QStringLiteral(" "),
QStringLiteral("The number of seconds from the current unix time"));
INSERT(Settings,
language_index,
tr("Language:"),
tr("Note: this can be overridden when region setting is auto-select"));
INSERT(Settings, region_index, tr("Region:"), tr("The region of the emulated Switch."));
INSERT(Settings, time_zone_index, tr("Time Zone:"), tr("The time zone of the emulated Switch."));
INSERT(Settings, sound_index, tr("Sound Output Mode:"), QString());
INSERT(Settings,
use_docked_mode,
tr("Console Mode:"),
tr("Selects if the console is emulated in Docked or Handheld mode.\nGames will change "
"their resolution, details and supported controllers and depending on this setting.\n"
"Setting to Handheld can help improve performance for low end systems."));
INSERT(Settings, current_user, QString(), QString());
// Controls
// Data Storage
// Debugging
// Debugging Graphics
// Network
// Web Service
// Ui
// Ui General
INSERT(UISettings,
select_user_on_boot,
tr("Prompt for user on game boot"),
tr("Ask to select a user profile on each boot, useful if multiple people use eden on "
"the same PC."));
INSERT(UISettings,
pause_when_in_background,
tr("Pause emulation when in background"),
tr("This setting pauses eden when focusing other windows."));
INSERT(UISettings,
confirm_before_stopping,
tr("Confirm before stopping emulation"),
tr("This setting overrides game prompts asking to confirm stopping the game.\nEnabling "
"it bypasses such prompts and directly exits the emulation."));
INSERT(UISettings,
hide_mouse,
tr("Hide mouse on inactivity"),
tr("This setting hides the mouse after 2.5s of inactivity."));
INSERT(UISettings,
controller_applet_disabled,
tr("Disable controller applet"),
tr("Forcibly disables the use of the controller applet by guests.\nWhen a guest "
"attempts to open the controller applet, it is immediately closed."));
INSERT(UISettings,
check_for_updates,
tr("Check for updates"),
tr("Whether or not to check for updates upon startup."));
// Linux
INSERT(Settings, enable_gamemode, tr("Enable Gamemode"), QString());
// Ui Debugging
// Ui Multiplayer
// Ui Games list
#undef INSERT
return translations;
}
std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QObject* parent)
{
std::unique_ptr<ComboboxTranslationMap> translations = std::make_unique<ComboboxTranslationMap>();
const auto& tr = [&](const char* text, const char* context = "") {
return parent->tr(text, context);
};
#define PAIR(ENUM, VALUE, TRANSLATION) {static_cast<u32>(Settings::ENUM::VALUE), (TRANSLATION)}
// Intentionally skipping VSyncMode to let the UI fill that one out
translations->insert({Settings::EnumMetadata<Settings::AppletMode>::Index(),
{
PAIR(AppletMode, HLE, tr("Custom frontend")),
PAIR(AppletMode, LLE, tr("Real applet")),
}});
translations->insert({Settings::EnumMetadata<Settings::SpirvOptimizeMode>::Index(),
{
PAIR(SpirvOptimizeMode, Never, tr("Never")),
PAIR(SpirvOptimizeMode, OnLoad, tr("On Load")),
PAIR(SpirvOptimizeMode, Always, tr("Always")),
}});
translations->insert({Settings::EnumMetadata<Settings::AstcDecodeMode>::Index(),
{
PAIR(AstcDecodeMode, Cpu, tr("CPU")),
PAIR(AstcDecodeMode, Gpu, tr("GPU")),
PAIR(AstcDecodeMode, CpuAsynchronous, tr("CPU Asynchronous")),
}});
translations->insert(
{Settings::EnumMetadata<Settings::AstcRecompression>::Index(),
{
PAIR(AstcRecompression, Uncompressed, tr("Uncompressed (Best quality)")),
PAIR(AstcRecompression, Bc1, tr("BC1 (Low quality)")),
PAIR(AstcRecompression, Bc3, tr("BC3 (Medium quality)")),
}});
translations->insert({Settings::EnumMetadata<Settings::VramUsageMode>::Index(),
{
PAIR(VramUsageMode, Conservative, tr("Conservative")),
PAIR(VramUsageMode, Aggressive, tr("Aggressive")),
}});
translations->insert({Settings::EnumMetadata<Settings::RendererBackend>::Index(),
{
#ifdef HAS_OPENGL
PAIR(RendererBackend, OpenGL, tr("OpenGL")),
#endif
PAIR(RendererBackend, Vulkan, tr("Vulkan")),
PAIR(RendererBackend, Null, tr("Null")),
}});
translations->insert(
{Settings::EnumMetadata<Settings::ShaderBackend>::Index(),
{
PAIR(ShaderBackend, Glsl, tr("GLSL")),
PAIR(ShaderBackend, Glasm, tr("GLASM (Assembly Shaders, NVIDIA Only)")),
PAIR(ShaderBackend, SpirV, tr("SPIR-V (Experimental, AMD/Mesa Only)")),
}});
translations->insert({Settings::EnumMetadata<Settings::GpuAccuracy>::Index(),
{
PAIR(GpuAccuracy, Normal, tr("Normal")),
PAIR(GpuAccuracy, High, tr("High")),
PAIR(GpuAccuracy, Extreme, tr("Extreme")),
}});
translations->insert(
{Settings::EnumMetadata<Settings::CpuAccuracy>::Index(),
{
PAIR(CpuAccuracy, Auto, tr("Auto")),
PAIR(CpuAccuracy, Accurate, tr("Accurate")),
PAIR(CpuAccuracy, Unsafe, tr("Unsafe")),
PAIR(CpuAccuracy, Paranoid, tr("Paranoid (disables most optimizations)")),
}});
translations->insert({Settings::EnumMetadata<Settings::CpuBackend>::Index(),
{
PAIR(CpuBackend, Dynarmic, tr("Dynarmic")),
PAIR(CpuBackend, Nce, tr("NCE")),
}});
translations->insert({Settings::EnumMetadata<Settings::FullscreenMode>::Index(),
{
PAIR(FullscreenMode, Borderless, tr("Borderless Windowed")),
PAIR(FullscreenMode, Exclusive, tr("Exclusive Fullscreen")),
}});
translations->insert({Settings::EnumMetadata<Settings::NvdecEmulation>::Index(),
{
PAIR(NvdecEmulation, Off, tr("No Video Output")),
PAIR(NvdecEmulation, Cpu, tr("CPU Video Decoding")),
PAIR(NvdecEmulation, Gpu, tr("GPU Video Decoding (Default)")),
}});
translations->insert(
{Settings::EnumMetadata<Settings::ResolutionSetup>::Index(),
{
PAIR(ResolutionSetup, Res1_4X, tr("0.25X (180p/270p) [EXPERIMENTAL]")),
PAIR(ResolutionSetup, Res1_2X, tr("0.5X (360p/540p) [EXPERIMENTAL]")),
PAIR(ResolutionSetup, Res3_4X, tr("0.75X (540p/810p) [EXPERIMENTAL]")),
PAIR(ResolutionSetup, Res1X, tr("1X (720p/1080p)")),
PAIR(ResolutionSetup, Res3_2X, tr("1.5X (1080p/1620p) [EXPERIMENTAL]")),
PAIR(ResolutionSetup, Res2X, tr("2X (1440p/2160p)")),
PAIR(ResolutionSetup, Res3X, tr("3X (2160p/3240p)")),
PAIR(ResolutionSetup, Res4X, tr("4X (2880p/4320p)")),
PAIR(ResolutionSetup, Res5X, tr("5X (3600p/5400p)")),
PAIR(ResolutionSetup, Res6X, tr("6X (4320p/6480p)")),
PAIR(ResolutionSetup, Res7X, tr("7X (5040p/7560p)")),
PAIR(ResolutionSetup, Res8X, tr("8X (5760p/8640p)")),
}});
translations->insert({Settings::EnumMetadata<Settings::ScalingFilter>::Index(),
{
PAIR(ScalingFilter, NearestNeighbor, tr("Nearest Neighbor")),
PAIR(ScalingFilter, Bilinear, tr("Bilinear")),
PAIR(ScalingFilter, Bicubic, tr("Bicubic")),
PAIR(ScalingFilter, Gaussian, tr("Gaussian")),
PAIR(ScalingFilter, ScaleForce, tr("ScaleForce")),
PAIR(ScalingFilter, Fsr, tr("AMD FidelityFX™ Super Resolution")),
}});
translations->insert({Settings::EnumMetadata<Settings::AntiAliasing>::Index(),
{
PAIR(AntiAliasing, None, tr("None")),
PAIR(AntiAliasing, Fxaa, tr("FXAA")),
PAIR(AntiAliasing, Smaa, tr("SMAA")),
}});
translations->insert({Settings::EnumMetadata<Settings::AspectRatio>::Index(),
{
PAIR(AspectRatio, R16_9, tr("Default (16:9)")),
PAIR(AspectRatio, R4_3, tr("Force 4:3")),
PAIR(AspectRatio, R21_9, tr("Force 21:9")),
PAIR(AspectRatio, R16_10, tr("Force 16:10")),
PAIR(AspectRatio, Stretch, tr("Stretch to Window")),
}});
translations->insert({Settings::EnumMetadata<Settings::AnisotropyMode>::Index(),
{
PAIR(AnisotropyMode, Automatic, tr("Automatic")),
PAIR(AnisotropyMode, Default, tr("Default")),
PAIR(AnisotropyMode, X2, tr("2x")),
PAIR(AnisotropyMode, X4, tr("4x")),
PAIR(AnisotropyMode, X8, tr("8x")),
PAIR(AnisotropyMode, X16, tr("16x")),
}});
translations->insert(
{Settings::EnumMetadata<Settings::Language>::Index(),
{
PAIR(Language, Japanese, tr("Japanese (日本語)")),
PAIR(Language, EnglishAmerican, tr("American English")),
PAIR(Language, French, tr("French (français)")),
PAIR(Language, German, tr("German (Deutsch)")),
PAIR(Language, Italian, tr("Italian (italiano)")),
PAIR(Language, Spanish, tr("Spanish (español)")),
PAIR(Language, Chinese, tr("Chinese")),
PAIR(Language, Korean, tr("Korean (한국어)")),
PAIR(Language, Dutch, tr("Dutch (Nederlands)")),
PAIR(Language, Portuguese, tr("Portuguese (português)")),
PAIR(Language, Russian, tr("Russian (Русский)")),
PAIR(Language, Taiwanese, tr("Taiwanese")),
PAIR(Language, EnglishBritish, tr("British English")),
PAIR(Language, FrenchCanadian, tr("Canadian French")),
PAIR(Language, SpanishLatin, tr("Latin American Spanish")),
PAIR(Language, ChineseSimplified, tr("Simplified Chinese")),
PAIR(Language, ChineseTraditional, tr("Traditional Chinese (正體中文)")),
PAIR(Language, PortugueseBrazilian, tr("Brazilian Portuguese (português do Brasil)")),
}});
translations->insert({Settings::EnumMetadata<Settings::Region>::Index(),
{
PAIR(Region, Japan, tr("Japan")),
PAIR(Region, Usa, tr("USA")),
PAIR(Region, Europe, tr("Europe")),
PAIR(Region, Australia, tr("Australia")),
PAIR(Region, China, tr("China")),
PAIR(Region, Korea, tr("Korea")),
PAIR(Region, Taiwan, tr("Taiwan")),
}});
translations->insert(
{Settings::EnumMetadata<Settings::TimeZone>::Index(),
{
{static_cast<u32>(Settings::TimeZone::Auto),
tr("Auto (%1)", "Auto select time zone")
.arg(QString::fromStdString(
Settings::GetTimeZoneString(Settings::TimeZone::Auto)))},
{static_cast<u32>(Settings::TimeZone::Default),
tr("Default (%1)", "Default time zone")
.arg(QString::fromStdString(Common::TimeZone::GetDefaultTimeZone()))},
PAIR(TimeZone, Cet, tr("CET")),
PAIR(TimeZone, Cst6Cdt, tr("CST6CDT")),
PAIR(TimeZone, Cuba, tr("Cuba")),
PAIR(TimeZone, Eet, tr("EET")),
PAIR(TimeZone, Egypt, tr("Egypt")),
PAIR(TimeZone, Eire, tr("Eire")),
PAIR(TimeZone, Est, tr("EST")),
PAIR(TimeZone, Est5Edt, tr("EST5EDT")),
PAIR(TimeZone, Gb, tr("GB")),
PAIR(TimeZone, GbEire, tr("GB-Eire")),
PAIR(TimeZone, Gmt, tr("GMT")),
PAIR(TimeZone, GmtPlusZero, tr("GMT+0")),
PAIR(TimeZone, GmtMinusZero, tr("GMT-0")),
PAIR(TimeZone, GmtZero, tr("GMT0")),
PAIR(TimeZone, Greenwich, tr("Greenwich")),
PAIR(TimeZone, Hongkong, tr("Hongkong")),
PAIR(TimeZone, Hst, tr("HST")),
PAIR(TimeZone, Iceland, tr("Iceland")),
PAIR(TimeZone, Iran, tr("Iran")),
PAIR(TimeZone, Israel, tr("Israel")),
PAIR(TimeZone, Jamaica, tr("Jamaica")),
PAIR(TimeZone, Japan, tr("Japan")),
PAIR(TimeZone, Kwajalein, tr("Kwajalein")),
PAIR(TimeZone, Libya, tr("Libya")),
PAIR(TimeZone, Met, tr("MET")),
PAIR(TimeZone, Mst, tr("MST")),
PAIR(TimeZone, Mst7Mdt, tr("MST7MDT")),
PAIR(TimeZone, Navajo, tr("Navajo")),
PAIR(TimeZone, Nz, tr("NZ")),
PAIR(TimeZone, NzChat, tr("NZ-CHAT")),
PAIR(TimeZone, Poland, tr("Poland")),
PAIR(TimeZone, Portugal, tr("Portugal")),
PAIR(TimeZone, Prc, tr("PRC")),
PAIR(TimeZone, Pst8Pdt, tr("PST8PDT")),
PAIR(TimeZone, Roc, tr("ROC")),
PAIR(TimeZone, Rok, tr("ROK")),
PAIR(TimeZone, Singapore, tr("Singapore")),
PAIR(TimeZone, Turkey, tr("Turkey")),
PAIR(TimeZone, Uct, tr("UCT")),
PAIR(TimeZone, Universal, tr("Universal")),
PAIR(TimeZone, Utc, tr("UTC")),
PAIR(TimeZone, WSu, tr("W-SU")),
PAIR(TimeZone, Wet, tr("WET")),
PAIR(TimeZone, Zulu, tr("Zulu")),
}});
translations->insert({Settings::EnumMetadata<Settings::AudioMode>::Index(),
{
PAIR(AudioMode, Mono, tr("Mono")),
PAIR(AudioMode, Stereo, tr("Stereo")),
PAIR(AudioMode, Surround, tr("Surround")),
}});
translations->insert({Settings::EnumMetadata<Settings::MemoryLayout>::Index(),
{
PAIR(MemoryLayout, Memory_4Gb, tr("4GB DRAM (Default)")),
PAIR(MemoryLayout, Memory_6Gb, tr("6GB DRAM (Unsafe)")),
PAIR(MemoryLayout, Memory_8Gb, tr("8GB DRAM")),
PAIR(MemoryLayout, Memory_10Gb, tr("10GB DRAM (Unsafe)")),
PAIR(MemoryLayout, Memory_12Gb, tr("12GB DRAM (Unsafe)")),
}});
translations->insert({Settings::EnumMetadata<Settings::ConsoleMode>::Index(),
{
PAIR(ConsoleMode, Docked, tr("Docked")),
PAIR(ConsoleMode, Handheld, tr("Handheld")),
}});
translations->insert({Settings::EnumMetadata<Settings::CpuClock>::Index(),
{
PAIR(CpuClock, Boost, tr("Boost (1700MHz)")),
PAIR(CpuClock, Fast, tr("Fast (2000MHz)")),
}});
translations->insert(
{Settings::EnumMetadata<Settings::ConfirmStop>::Index(),
{
PAIR(ConfirmStop, Ask_Always, tr("Always ask (Default)")),
PAIR(ConfirmStop, Ask_Based_On_Game, tr("Only if game specifies not to stop")),
PAIR(ConfirmStop, Ask_Never, tr("Never ask")),
}});
translations->insert({Settings::EnumMetadata<Settings::GpuOverclock>::Index(),
{
PAIR(GpuOverclock, Low, tr("Low (128)")),
PAIR(GpuOverclock, Medium, tr("Medium (256)")),
PAIR(GpuOverclock, High, tr("High (512)")),
}});
#undef PAIR
#undef CTX_PAIR
return translations;
}
} // namespace ConfigurationShared

View file

@ -1,65 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <map>
#include <memory>
#include <utility>
#include <vector>
#include <QString>
#include "common/common_types.h"
#include "common/settings.h"
namespace ConfigurationShared {
using TranslationMap = std::map<u32, std::pair<QString, QString>>;
using ComboboxTranslations = std::vector<std::pair<u32, QString>>;
using ComboboxTranslationMap = std::map<u32, ComboboxTranslations>;
std::unique_ptr<TranslationMap> InitializeTranslations(QObject *parent);
std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QObject *parent);
static const std::map<Settings::AntiAliasing, QString> anti_aliasing_texts_map = {
{Settings::AntiAliasing::None, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "None"))},
{Settings::AntiAliasing::Fxaa, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "FXAA"))},
{Settings::AntiAliasing::Smaa, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "SMAA"))},
};
static const std::map<Settings::ScalingFilter, QString> scaling_filter_texts_map = {
{Settings::ScalingFilter::NearestNeighbor,
QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Nearest"))},
{Settings::ScalingFilter::Bilinear,
QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Bilinear"))},
{Settings::ScalingFilter::Bicubic, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Bicubic"))},
{Settings::ScalingFilter::Gaussian,
QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Gaussian"))},
{Settings::ScalingFilter::ScaleForce,
QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "ScaleForce"))},
{Settings::ScalingFilter::Fsr, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "FSR"))},
};
static const std::map<Settings::ConsoleMode, QString> use_docked_mode_texts_map = {
{Settings::ConsoleMode::Docked, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Docked"))},
{Settings::ConsoleMode::Handheld, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Handheld"))},
};
static const std::map<Settings::GpuAccuracy, QString> gpu_accuracy_texts_map = {
{Settings::GpuAccuracy::Normal, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Normal"))},
{Settings::GpuAccuracy::High, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "High"))},
{Settings::GpuAccuracy::Extreme, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Extreme"))},
};
static const std::map<Settings::RendererBackend, QString> renderer_backend_texts_map = {
{Settings::RendererBackend::Vulkan, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Vulkan"))},
{Settings::RendererBackend::OpenGL, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "OpenGL"))},
{Settings::RendererBackend::Null, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "Null"))},
};
static const std::map<Settings::ShaderBackend, QString> shader_backend_texts_map = {
{Settings::ShaderBackend::Glsl, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "GLSL"))},
{Settings::ShaderBackend::Glasm, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "GLASM"))},
{Settings::ShaderBackend::SpirV, QStringLiteral(QT_TRANSLATE_NOOP("GMainWindow", "SPIRV"))},
};
} // namespace ConfigurationShared

Some files were not shown because too many files have changed in this diff Show more