early-access version 3142
This commit is contained in:
parent
76dfef85d9
commit
2c4739c196
@ -1,7 +1,7 @@
|
||||
yuzu emulator early access
|
||||
=============
|
||||
|
||||
This is the source code for early-access 3141.
|
||||
This is the source code for early-access 3142.
|
||||
|
||||
## Legal Notice
|
||||
|
||||
|
@ -391,6 +391,7 @@ struct PlayerInput {
|
||||
u32 body_color_right;
|
||||
u32 button_color_left;
|
||||
u32 button_color_right;
|
||||
std::string profile_name;
|
||||
};
|
||||
|
||||
struct TouchscreenInput {
|
||||
|
@ -107,10 +107,9 @@ void EmulatedController::ReloadFromSettings() {
|
||||
original_npad_type = npad_type;
|
||||
}
|
||||
|
||||
Disconnect();
|
||||
if (player.connected) {
|
||||
Connect();
|
||||
} else {
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
ReloadInput();
|
||||
|
@ -88,6 +88,9 @@ add_executable(yuzu
|
||||
configuration/configure_input_advanced.cpp
|
||||
configuration/configure_input_advanced.h
|
||||
configuration/configure_input_advanced.ui
|
||||
configuration/configure_input_per_game.cpp
|
||||
configuration/configure_input_per_game.h
|
||||
configuration/configure_input_per_game.ui
|
||||
configuration/configure_input_player.cpp
|
||||
configuration/configure_input_player.h
|
||||
configuration/configure_input_player.ui
|
||||
|
@ -13,7 +13,9 @@
|
||||
#include "input_common/drivers/virtual_amiibo.h"
|
||||
#include "input_common/main.h"
|
||||
#include "ui_qt_amiibo_settings.h"
|
||||
#ifdef ENABLE_WEB_SERVICE
|
||||
#include "web_service/web_backend.h"
|
||||
#endif
|
||||
#include "yuzu/applets/qt_amiibo_settings.h"
|
||||
#include "yuzu/main.h"
|
||||
|
||||
@ -90,6 +92,7 @@ void QtAmiiboSettingsDialog::LoadAmiiboInfo() {
|
||||
}
|
||||
|
||||
void QtAmiiboSettingsDialog::LoadAmiiboApiInfo(std::string_view amiibo_id) {
|
||||
#ifdef ENABLE_WEB_SERVICE
|
||||
// TODO: Host this data on our website
|
||||
WebService::Client client{"https://amiiboapi.com", {}, {}};
|
||||
WebService::Client image_client{"https://raw.githubusercontent.com", {}, {}};
|
||||
@ -134,6 +137,7 @@ void QtAmiiboSettingsDialog::LoadAmiiboApiInfo(std::string_view amiibo_id) {
|
||||
pixmap = pixmap.scaled(250, 350, Qt::AspectRatioMode::KeepAspectRatio,
|
||||
Qt::TransformationMode::SmoothTransformation);
|
||||
ui->amiiboImageLabel->setPixmap(pixmap);
|
||||
#endif
|
||||
}
|
||||
|
||||
void QtAmiiboSettingsDialog::LoadAmiiboData() {
|
||||
|
@ -124,6 +124,10 @@ void Config::Initialize(const std::string& config_name) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Config::IsCustomConfig() {
|
||||
return type == ConfigType::PerGameConfig;
|
||||
}
|
||||
|
||||
/* {Read,Write}BasicSetting and WriteGlobalSetting templates must be defined here before their
|
||||
* usages later in this file. This allows explicit definition of some types that don't work
|
||||
* nicely with the general version.
|
||||
@ -194,8 +198,20 @@ void Config::ReadPlayerValue(std::size_t player_index) {
|
||||
}();
|
||||
|
||||
auto& player = Settings::values.players.GetValue()[player_index];
|
||||
if (IsCustomConfig()) {
|
||||
const auto profile_name =
|
||||
qt_config->value(QStringLiteral("%1profile_name").arg(player_prefix), QString{})
|
||||
.toString()
|
||||
.toStdString();
|
||||
if (profile_name.empty()) {
|
||||
// Use the global input config
|
||||
player = Settings::values.players.GetValue(true)[player_index];
|
||||
return;
|
||||
}
|
||||
player.profile_name = profile_name;
|
||||
}
|
||||
|
||||
if (player_prefix.isEmpty()) {
|
||||
if (player_prefix.isEmpty() && Settings::IsConfiguringGlobal()) {
|
||||
const auto controller = static_cast<Settings::ControllerType>(
|
||||
qt_config
|
||||
->value(QStringLiteral("%1type").arg(player_prefix),
|
||||
@ -388,9 +404,26 @@ void Config::ReadAudioValues() {
|
||||
void Config::ReadControlValues() {
|
||||
qt_config->beginGroup(QStringLiteral("Controls"));
|
||||
|
||||
Settings::values.players.SetGlobal(!IsCustomConfig());
|
||||
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
|
||||
ReadPlayerValue(p);
|
||||
}
|
||||
Settings::values.use_docked_mode.SetGlobal(!IsCustomConfig());
|
||||
ReadGlobalSetting(Settings::values.use_docked_mode);
|
||||
|
||||
// Disable docked mode if handheld is selected
|
||||
const auto controller_type = Settings::values.players.GetValue()[0].controller_type;
|
||||
if (controller_type == Settings::ControllerType::Handheld) {
|
||||
Settings::values.use_docked_mode.SetValue(false);
|
||||
}
|
||||
|
||||
ReadGlobalSetting(Settings::values.vibration_enabled);
|
||||
ReadGlobalSetting(Settings::values.enable_accurate_vibrations);
|
||||
ReadGlobalSetting(Settings::values.motion_enabled);
|
||||
if (IsCustomConfig()) {
|
||||
qt_config->endGroup();
|
||||
return;
|
||||
}
|
||||
ReadDebugValues();
|
||||
ReadKeyboardValues();
|
||||
ReadMouseValues();
|
||||
@ -412,18 +445,6 @@ void Config::ReadControlValues() {
|
||||
ReadBasicSetting(Settings::values.tas_loop);
|
||||
ReadBasicSetting(Settings::values.pause_tas_on_load);
|
||||
|
||||
ReadGlobalSetting(Settings::values.use_docked_mode);
|
||||
|
||||
// Disable docked mode if handheld is selected
|
||||
const auto controller_type = Settings::values.players.GetValue()[0].controller_type;
|
||||
if (controller_type == Settings::ControllerType::Handheld) {
|
||||
Settings::values.use_docked_mode.SetValue(false);
|
||||
}
|
||||
|
||||
ReadGlobalSetting(Settings::values.vibration_enabled);
|
||||
ReadGlobalSetting(Settings::values.enable_accurate_vibrations);
|
||||
ReadGlobalSetting(Settings::values.motion_enabled);
|
||||
|
||||
ReadBasicSetting(Settings::values.controller_navigation);
|
||||
|
||||
qt_config->endGroup();
|
||||
@ -905,7 +926,6 @@ void Config::ReadMultiplayerValues() {
|
||||
|
||||
void Config::ReadValues() {
|
||||
if (global) {
|
||||
ReadControlValues();
|
||||
ReadDataStorageValues();
|
||||
ReadDebuggingValues();
|
||||
ReadDisabledAddOnValues();
|
||||
@ -914,6 +934,7 @@ void Config::ReadValues() {
|
||||
ReadWebServiceValues();
|
||||
ReadMiscellaneousValues();
|
||||
}
|
||||
ReadControlValues();
|
||||
ReadCoreValues();
|
||||
ReadCpuValues();
|
||||
ReadRendererValues();
|
||||
@ -932,12 +953,20 @@ void Config::SavePlayerValue(std::size_t player_index) {
|
||||
}();
|
||||
|
||||
const auto& player = Settings::values.players.GetValue()[player_index];
|
||||
if (IsCustomConfig()) {
|
||||
if (player.profile_name.empty()) {
|
||||
// No custom profile selected
|
||||
return;
|
||||
}
|
||||
WriteSetting(QStringLiteral("%1profile_name").arg(player_prefix),
|
||||
QString::fromStdString(player.profile_name), QString{});
|
||||
}
|
||||
|
||||
WriteSetting(QStringLiteral("%1type").arg(player_prefix),
|
||||
static_cast<u8>(player.controller_type),
|
||||
static_cast<u8>(Settings::ControllerType::ProController));
|
||||
|
||||
if (!player_prefix.isEmpty()) {
|
||||
if (!player_prefix.isEmpty() || !Settings::IsConfiguringGlobal()) {
|
||||
WriteSetting(QStringLiteral("%1connected").arg(player_prefix), player.connected,
|
||||
player_index == 0);
|
||||
WriteSetting(QStringLiteral("%1vibration_enabled").arg(player_prefix),
|
||||
@ -1019,19 +1048,22 @@ void Config::SaveMotionTouchValues() {
|
||||
WriteBasicSetting(Settings::values.udp_input_servers);
|
||||
WriteBasicSetting(Settings::values.enable_udp_controller);
|
||||
|
||||
if (Settings::values.touch_from_button_maps.empty()) {
|
||||
return;
|
||||
}
|
||||
qt_config->beginWriteArray(QStringLiteral("touch_from_button_maps"));
|
||||
for (std::size_t p = 0; p < Settings::values.touch_from_button_maps.size(); ++p) {
|
||||
const auto& map = Settings::values.touch_from_button_maps[p];
|
||||
if (map.buttons.empty()) {
|
||||
continue;
|
||||
}
|
||||
qt_config->setArrayIndex(static_cast<int>(p));
|
||||
WriteSetting(QStringLiteral("name"),
|
||||
QString::fromStdString(Settings::values.touch_from_button_maps[p].name),
|
||||
WriteSetting(QStringLiteral("name"), QString::fromStdString(map.name),
|
||||
QStringLiteral("default"));
|
||||
qt_config->beginWriteArray(QStringLiteral("entries"));
|
||||
for (std::size_t q = 0; q < Settings::values.touch_from_button_maps[p].buttons.size();
|
||||
++q) {
|
||||
for (std::size_t q = 0; q < map.buttons.size(); ++q) {
|
||||
qt_config->setArrayIndex(static_cast<int>(q));
|
||||
WriteSetting(
|
||||
QStringLiteral("bind"),
|
||||
QString::fromStdString(Settings::values.touch_from_button_maps[p].buttons[q]));
|
||||
WriteSetting(QStringLiteral("bind"), QString::fromStdString(map.buttons[q]));
|
||||
}
|
||||
qt_config->endArray();
|
||||
}
|
||||
@ -1055,7 +1087,6 @@ void Config::SaveIrCameraValues() {
|
||||
|
||||
void Config::SaveValues() {
|
||||
if (global) {
|
||||
SaveControlValues();
|
||||
SaveDataStorageValues();
|
||||
SaveDebuggingValues();
|
||||
SaveDisabledAddOnValues();
|
||||
@ -1064,6 +1095,7 @@ void Config::SaveValues() {
|
||||
SaveWebServiceValues();
|
||||
SaveMiscellaneousValues();
|
||||
}
|
||||
SaveControlValues();
|
||||
SaveCoreValues();
|
||||
SaveCpuValues();
|
||||
SaveRendererValues();
|
||||
@ -1088,9 +1120,19 @@ void Config::SaveAudioValues() {
|
||||
void Config::SaveControlValues() {
|
||||
qt_config->beginGroup(QStringLiteral("Controls"));
|
||||
|
||||
Settings::values.players.SetGlobal(!IsCustomConfig());
|
||||
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
|
||||
SavePlayerValue(p);
|
||||
}
|
||||
Settings::values.use_docked_mode.SetGlobal(!IsCustomConfig());
|
||||
WriteGlobalSetting(Settings::values.use_docked_mode);
|
||||
WriteGlobalSetting(Settings::values.vibration_enabled);
|
||||
WriteGlobalSetting(Settings::values.enable_accurate_vibrations);
|
||||
WriteGlobalSetting(Settings::values.motion_enabled);
|
||||
if (IsCustomConfig()) {
|
||||
qt_config->endGroup();
|
||||
return;
|
||||
}
|
||||
SaveDebugValues();
|
||||
SaveMouseValues();
|
||||
SaveTouchscreenValues();
|
||||
@ -1098,10 +1140,6 @@ void Config::SaveControlValues() {
|
||||
SaveHidbusValues();
|
||||
SaveIrCameraValues();
|
||||
|
||||
WriteGlobalSetting(Settings::values.use_docked_mode);
|
||||
WriteGlobalSetting(Settings::values.vibration_enabled);
|
||||
WriteGlobalSetting(Settings::values.enable_accurate_vibrations);
|
||||
WriteGlobalSetting(Settings::values.motion_enabled);
|
||||
WriteBasicSetting(Settings::values.enable_raw_input);
|
||||
WriteBasicSetting(Settings::values.keyboard_enabled);
|
||||
WriteBasicSetting(Settings::values.emulate_analog_keyboard);
|
||||
@ -1579,6 +1617,13 @@ void Config::SaveControlPlayerValue(std::size_t player_index) {
|
||||
qt_config->endGroup();
|
||||
}
|
||||
|
||||
void Config::ClearControlPlayerValues() {
|
||||
qt_config->beginGroup(QStringLiteral("Controls"));
|
||||
// If key is an empty string, all keys in the current group() are removed.
|
||||
qt_config->remove(QString{});
|
||||
qt_config->endGroup();
|
||||
}
|
||||
|
||||
const std::string& Config::GetConfigFilePath() const {
|
||||
return qt_config_loc;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
|
||||
void ReadControlPlayerValue(std::size_t player_index);
|
||||
void SaveControlPlayerValue(std::size_t player_index);
|
||||
void ClearControlPlayerValues();
|
||||
|
||||
const std::string& GetConfigFilePath() const;
|
||||
|
||||
@ -58,6 +59,7 @@ public:
|
||||
|
||||
private:
|
||||
void Initialize(const std::string& config_name);
|
||||
bool IsCustomConfig();
|
||||
|
||||
void ReadValues();
|
||||
void ReadPlayerValue(std::size_t player_index);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
||||
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/settings.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
||||
// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
@ -1553,6 +1553,7 @@ void ConfigureInputPlayer::LoadProfile() {
|
||||
}
|
||||
|
||||
void ConfigureInputPlayer::SaveProfile() {
|
||||
static constexpr size_t HANDHELD_INDEX = 8;
|
||||
const QString profile_name = ui->comboProfiles->itemText(ui->comboProfiles->currentIndex());
|
||||
|
||||
if (profile_name.isEmpty()) {
|
||||
@ -1561,7 +1562,12 @@ void ConfigureInputPlayer::SaveProfile() {
|
||||
|
||||
ApplyConfiguration();
|
||||
|
||||
if (!profiles->SaveProfile(profile_name.toStdString(), player_index)) {
|
||||
// When we're in handheld mode, only the handheld emulated controller bindings are updated
|
||||
const bool is_handheld = player_index == 0 && emulated_controller->GetNpadIdType() ==
|
||||
Core::HID::NpadIdType::Handheld;
|
||||
const auto profile_player_index = is_handheld ? HANDHELD_INDEX : player_index;
|
||||
|
||||
if (!profiles->SaveProfile(profile_name.toStdString(), profile_player_index)) {
|
||||
QMessageBox::critical(this, tr("Save Input Profile"),
|
||||
tr("Failed to save the input profile \"%1\"").arg(profile_name));
|
||||
UpdateInputProfiles();
|
||||
|
@ -38,7 +38,7 @@ enum class InputType;
|
||||
|
||||
namespace Ui {
|
||||
class ConfigureInputPlayer;
|
||||
}
|
||||
} // namespace Ui
|
||||
|
||||
namespace Core::HID {
|
||||
class HIDCore;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "yuzu/configuration/configure_general.h"
|
||||
#include "yuzu/configuration/configure_graphics.h"
|
||||
#include "yuzu/configuration/configure_graphics_advanced.h"
|
||||
#include "yuzu/configuration/configure_input.h"
|
||||
#include "yuzu/configuration/configure_input_per_game.h"
|
||||
#include "yuzu/configuration/configure_per_game.h"
|
||||
#include "yuzu/configuration/configure_per_game_addons.h"
|
||||
#include "yuzu/configuration/configure_system.h"
|
||||
@ -50,6 +50,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
|
||||
general_tab = std::make_unique<ConfigureGeneral>(system_, this);
|
||||
graphics_tab = std::make_unique<ConfigureGraphics>(system_, this);
|
||||
graphics_advanced_tab = std::make_unique<ConfigureGraphicsAdvanced>(system_, this);
|
||||
input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this);
|
||||
system_tab = std::make_unique<ConfigureSystem>(system_, this);
|
||||
|
||||
ui->setupUi(this);
|
||||
@ -61,6 +62,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
|
||||
ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics"));
|
||||
ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("Adv. Graphics"));
|
||||
ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
|
||||
ui->tabWidget->addTab(input_tab.get(), tr("Input Profiles"));
|
||||
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
setWindowTitle(tr("Properties"));
|
||||
@ -91,6 +93,7 @@ void ConfigurePerGame::ApplyConfiguration() {
|
||||
graphics_tab->ApplyConfiguration();
|
||||
graphics_advanced_tab->ApplyConfiguration();
|
||||
audio_tab->ApplyConfiguration();
|
||||
input_tab->ApplyConfiguration();
|
||||
|
||||
system.ApplySettings();
|
||||
Settings::LogSettings();
|
||||
|
@ -16,12 +16,17 @@ namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace InputCommon {
|
||||
class InputSubsystem;
|
||||
}
|
||||
|
||||
class ConfigurePerGameAddons;
|
||||
class ConfigureAudio;
|
||||
class ConfigureCpu;
|
||||
class ConfigureGeneral;
|
||||
class ConfigureGraphics;
|
||||
class ConfigureGraphicsAdvanced;
|
||||
class ConfigureInputPerGame;
|
||||
class ConfigureSystem;
|
||||
|
||||
class QGraphicsScene;
|
||||
@ -72,5 +77,6 @@ private:
|
||||
std::unique_ptr<ConfigureGeneral> general_tab;
|
||||
std::unique_ptr<ConfigureGraphics> graphics_tab;
|
||||
std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab;
|
||||
std::unique_ptr<ConfigureInputPerGame> input_tab;
|
||||
std::unique_ptr<ConfigureSystem> system_tab;
|
||||
};
|
||||
|
@ -126,6 +126,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
|
||||
#include "yuzu/compatibility_list.h"
|
||||
#include "yuzu/configuration/config.h"
|
||||
#include "yuzu/configuration/configure_dialog.h"
|
||||
#include "yuzu/configuration/configure_input_per_game.h"
|
||||
#include "yuzu/debugger/console.h"
|
||||
#include "yuzu/debugger/controller.h"
|
||||
#include "yuzu/debugger/profiler.h"
|
||||
@ -1670,6 +1671,11 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
|
||||
LOG_INFO(Frontend, "yuzu starting...");
|
||||
StoreRecentFile(filename); // Put the filename on top of the list
|
||||
|
||||
// Save configurations
|
||||
UpdateUISettings();
|
||||
game_list->SaveInterfaceLayout();
|
||||
config->Save();
|
||||
|
||||
u64 title_id{0};
|
||||
|
||||
last_filename_booted = filename;
|
||||
@ -1686,14 +1692,10 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
|
||||
? Common::FS::PathToUTF8String(file_path.filename())
|
||||
: fmt::format("{:016X}", title_id);
|
||||
Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig);
|
||||
system->HIDCore().ReloadInputDevices();
|
||||
system->ApplySettings();
|
||||
}
|
||||
|
||||
// Save configurations
|
||||
UpdateUISettings();
|
||||
game_list->SaveInterfaceLayout();
|
||||
config->Save();
|
||||
|
||||
Settings::LogSettings();
|
||||
|
||||
if (UISettings::values.select_user_on_boot) {
|
||||
@ -2814,6 +2816,7 @@ void GMainWindow::OnStopGame() {
|
||||
ShutdownGame();
|
||||
|
||||
Settings::RestoreGlobalState(system->IsPoweredOn());
|
||||
system->HIDCore().ReloadInputDevices();
|
||||
UpdateStatusButtons();
|
||||
}
|
||||
|
||||
@ -3275,6 +3278,7 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file
|
||||
// Do not cause the global config to write local settings into the config file
|
||||
const bool is_powered_on = system->IsPoweredOn();
|
||||
Settings::RestoreGlobalState(is_powered_on);
|
||||
system->HIDCore().ReloadInputDevices();
|
||||
|
||||
UISettings::values.configuration_applied = false;
|
||||
|
||||
@ -3735,6 +3739,7 @@ void GMainWindow::OnCoreError(Core::SystemResultStatus result, std::string detai
|
||||
ShutdownGame();
|
||||
|
||||
Settings::RestoreGlobalState(system->IsPoweredOn());
|
||||
system->HIDCore().ReloadInputDevices();
|
||||
UpdateStatusButtons();
|
||||
}
|
||||
} else {
|
||||
@ -3886,18 +3891,19 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
|
||||
// Unload controllers early
|
||||
controller_dialog->UnloadController();
|
||||
game_list->UnloadController();
|
||||
system->HIDCore().UnloadInputDevices();
|
||||
|
||||
// Shutdown session if the emu thread is active...
|
||||
if (emu_thread != nullptr) {
|
||||
ShutdownGame();
|
||||
|
||||
Settings::RestoreGlobalState(system->IsPoweredOn());
|
||||
system->HIDCore().ReloadInputDevices();
|
||||
UpdateStatusButtons();
|
||||
}
|
||||
|
||||
render_window->close();
|
||||
multiplayer_state->Close();
|
||||
system->HIDCore().UnloadInputDevices();
|
||||
system->GetRoomNetwork().Shutdown();
|
||||
|
||||
QWidget::closeEvent(event);
|
||||
|
Loading…
Reference in New Issue
Block a user