early-access version 3141

This commit is contained in:
pineappleEA 2022-11-20 23:51:28 +01:00
parent d832ce3b7a
commit 76dfef85d9
10 changed files with 38 additions and 103 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3140. This is the source code for early-access 3141.
## Legal Notice ## Legal Notice

View file

@ -391,7 +391,6 @@ struct PlayerInput {
u32 body_color_right; u32 body_color_right;
u32 button_color_left; u32 button_color_left;
u32 button_color_right; u32 button_color_right;
std::string profile_name;
}; };
struct TouchscreenInput { struct TouchscreenInput {

View file

@ -107,9 +107,10 @@ void EmulatedController::ReloadFromSettings() {
original_npad_type = npad_type; original_npad_type = npad_type;
} }
Disconnect();
if (player.connected) { if (player.connected) {
Connect(); Connect();
} else {
Disconnect();
} }
ReloadInput(); ReloadInput();

View file

@ -88,9 +88,6 @@ add_executable(yuzu
configuration/configure_input_advanced.cpp configuration/configure_input_advanced.cpp
configuration/configure_input_advanced.h configuration/configure_input_advanced.h
configuration/configure_input_advanced.ui 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.cpp
configuration/configure_input_player.h configuration/configure_input_player.h
configuration/configure_input_player.ui configuration/configure_input_player.ui

View file

@ -124,10 +124,6 @@ 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 /* {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 * usages later in this file. This allows explicit definition of some types that don't work
* nicely with the general version. * nicely with the general version.
@ -198,20 +194,8 @@ void Config::ReadPlayerValue(std::size_t player_index) {
}(); }();
auto& player = Settings::values.players.GetValue()[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() && Settings::IsConfiguringGlobal()) { if (player_prefix.isEmpty()) {
const auto controller = static_cast<Settings::ControllerType>( const auto controller = static_cast<Settings::ControllerType>(
qt_config qt_config
->value(QStringLiteral("%1type").arg(player_prefix), ->value(QStringLiteral("%1type").arg(player_prefix),
@ -404,26 +388,9 @@ void Config::ReadAudioValues() {
void Config::ReadControlValues() { void Config::ReadControlValues() {
qt_config->beginGroup(QStringLiteral("Controls")); qt_config->beginGroup(QStringLiteral("Controls"));
Settings::values.players.SetGlobal(!IsCustomConfig());
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) { for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
ReadPlayerValue(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(); ReadDebugValues();
ReadKeyboardValues(); ReadKeyboardValues();
ReadMouseValues(); ReadMouseValues();
@ -445,6 +412,18 @@ void Config::ReadControlValues() {
ReadBasicSetting(Settings::values.tas_loop); ReadBasicSetting(Settings::values.tas_loop);
ReadBasicSetting(Settings::values.pause_tas_on_load); 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); ReadBasicSetting(Settings::values.controller_navigation);
qt_config->endGroup(); qt_config->endGroup();
@ -926,6 +905,7 @@ void Config::ReadMultiplayerValues() {
void Config::ReadValues() { void Config::ReadValues() {
if (global) { if (global) {
ReadControlValues();
ReadDataStorageValues(); ReadDataStorageValues();
ReadDebuggingValues(); ReadDebuggingValues();
ReadDisabledAddOnValues(); ReadDisabledAddOnValues();
@ -934,7 +914,6 @@ void Config::ReadValues() {
ReadWebServiceValues(); ReadWebServiceValues();
ReadMiscellaneousValues(); ReadMiscellaneousValues();
} }
ReadControlValues();
ReadCoreValues(); ReadCoreValues();
ReadCpuValues(); ReadCpuValues();
ReadRendererValues(); ReadRendererValues();
@ -953,20 +932,12 @@ void Config::SavePlayerValue(std::size_t player_index) {
}(); }();
const auto& player = Settings::values.players.GetValue()[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), WriteSetting(QStringLiteral("%1type").arg(player_prefix),
static_cast<u8>(player.controller_type), static_cast<u8>(player.controller_type),
static_cast<u8>(Settings::ControllerType::ProController)); static_cast<u8>(Settings::ControllerType::ProController));
if (!player_prefix.isEmpty() || !Settings::IsConfiguringGlobal()) { if (!player_prefix.isEmpty()) {
WriteSetting(QStringLiteral("%1connected").arg(player_prefix), player.connected, WriteSetting(QStringLiteral("%1connected").arg(player_prefix), player.connected,
player_index == 0); player_index == 0);
WriteSetting(QStringLiteral("%1vibration_enabled").arg(player_prefix), WriteSetting(QStringLiteral("%1vibration_enabled").arg(player_prefix),
@ -1048,22 +1019,19 @@ void Config::SaveMotionTouchValues() {
WriteBasicSetting(Settings::values.udp_input_servers); WriteBasicSetting(Settings::values.udp_input_servers);
WriteBasicSetting(Settings::values.enable_udp_controller); WriteBasicSetting(Settings::values.enable_udp_controller);
if (Settings::values.touch_from_button_maps.empty()) {
return;
}
qt_config->beginWriteArray(QStringLiteral("touch_from_button_maps")); qt_config->beginWriteArray(QStringLiteral("touch_from_button_maps"));
for (std::size_t p = 0; p < Settings::values.touch_from_button_maps.size(); ++p) { 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)); qt_config->setArrayIndex(static_cast<int>(p));
WriteSetting(QStringLiteral("name"), QString::fromStdString(map.name), WriteSetting(QStringLiteral("name"),
QString::fromStdString(Settings::values.touch_from_button_maps[p].name),
QStringLiteral("default")); QStringLiteral("default"));
qt_config->beginWriteArray(QStringLiteral("entries")); qt_config->beginWriteArray(QStringLiteral("entries"));
for (std::size_t q = 0; q < map.buttons.size(); ++q) { for (std::size_t q = 0; q < Settings::values.touch_from_button_maps[p].buttons.size();
++q) {
qt_config->setArrayIndex(static_cast<int>(q)); qt_config->setArrayIndex(static_cast<int>(q));
WriteSetting(QStringLiteral("bind"), QString::fromStdString(map.buttons[q])); WriteSetting(
QStringLiteral("bind"),
QString::fromStdString(Settings::values.touch_from_button_maps[p].buttons[q]));
} }
qt_config->endArray(); qt_config->endArray();
} }
@ -1087,6 +1055,7 @@ void Config::SaveIrCameraValues() {
void Config::SaveValues() { void Config::SaveValues() {
if (global) { if (global) {
SaveControlValues();
SaveDataStorageValues(); SaveDataStorageValues();
SaveDebuggingValues(); SaveDebuggingValues();
SaveDisabledAddOnValues(); SaveDisabledAddOnValues();
@ -1095,7 +1064,6 @@ void Config::SaveValues() {
SaveWebServiceValues(); SaveWebServiceValues();
SaveMiscellaneousValues(); SaveMiscellaneousValues();
} }
SaveControlValues();
SaveCoreValues(); SaveCoreValues();
SaveCpuValues(); SaveCpuValues();
SaveRendererValues(); SaveRendererValues();
@ -1120,19 +1088,9 @@ void Config::SaveAudioValues() {
void Config::SaveControlValues() { void Config::SaveControlValues() {
qt_config->beginGroup(QStringLiteral("Controls")); qt_config->beginGroup(QStringLiteral("Controls"));
Settings::values.players.SetGlobal(!IsCustomConfig());
for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) { for (std::size_t p = 0; p < Settings::values.players.GetValue().size(); ++p) {
SavePlayerValue(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(); SaveDebugValues();
SaveMouseValues(); SaveMouseValues();
SaveTouchscreenValues(); SaveTouchscreenValues();
@ -1140,6 +1098,10 @@ void Config::SaveControlValues() {
SaveHidbusValues(); SaveHidbusValues();
SaveIrCameraValues(); 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.enable_raw_input);
WriteBasicSetting(Settings::values.keyboard_enabled); WriteBasicSetting(Settings::values.keyboard_enabled);
WriteBasicSetting(Settings::values.emulate_analog_keyboard); WriteBasicSetting(Settings::values.emulate_analog_keyboard);
@ -1617,13 +1579,6 @@ void Config::SaveControlPlayerValue(std::size_t player_index) {
qt_config->endGroup(); 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 { const std::string& Config::GetConfigFilePath() const {
return qt_config_loc; return qt_config_loc;
} }

View file

@ -34,7 +34,6 @@ public:
void ReadControlPlayerValue(std::size_t player_index); void ReadControlPlayerValue(std::size_t player_index);
void SaveControlPlayerValue(std::size_t player_index); void SaveControlPlayerValue(std::size_t player_index);
void ClearControlPlayerValues();
const std::string& GetConfigFilePath() const; const std::string& GetConfigFilePath() const;
@ -59,7 +58,6 @@ public:
private: private:
void Initialize(const std::string& config_name); void Initialize(const std::string& config_name);
bool IsCustomConfig();
void ReadValues(); void ReadValues();
void ReadPlayerValue(std::size_t player_index); void ReadPlayerValue(std::size_t player_index);

View file

@ -38,7 +38,7 @@ enum class InputType;
namespace Ui { namespace Ui {
class ConfigureInputPlayer; class ConfigureInputPlayer;
} // namespace Ui }
namespace Core::HID { namespace Core::HID {
class HIDCore; class HIDCore;

View file

@ -28,7 +28,7 @@
#include "yuzu/configuration/configure_general.h" #include "yuzu/configuration/configure_general.h"
#include "yuzu/configuration/configure_graphics.h" #include "yuzu/configuration/configure_graphics.h"
#include "yuzu/configuration/configure_graphics_advanced.h" #include "yuzu/configuration/configure_graphics_advanced.h"
#include "yuzu/configuration/configure_input_per_game.h" #include "yuzu/configuration/configure_input.h"
#include "yuzu/configuration/configure_per_game.h" #include "yuzu/configuration/configure_per_game.h"
#include "yuzu/configuration/configure_per_game_addons.h" #include "yuzu/configuration/configure_per_game_addons.h"
#include "yuzu/configuration/configure_system.h" #include "yuzu/configuration/configure_system.h"
@ -50,7 +50,6 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
general_tab = std::make_unique<ConfigureGeneral>(system_, this); general_tab = std::make_unique<ConfigureGeneral>(system_, this);
graphics_tab = std::make_unique<ConfigureGraphics>(system_, this); graphics_tab = std::make_unique<ConfigureGraphics>(system_, this);
graphics_advanced_tab = std::make_unique<ConfigureGraphicsAdvanced>(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); system_tab = std::make_unique<ConfigureSystem>(system_, this);
ui->setupUi(this); ui->setupUi(this);
@ -62,7 +61,6 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics")); ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics"));
ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("Adv. Graphics")); ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("Adv. Graphics"));
ui->tabWidget->addTab(audio_tab.get(), tr("Audio")); ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
ui->tabWidget->addTab(input_tab.get(), tr("Input Profiles"));
setFocusPolicy(Qt::ClickFocus); setFocusPolicy(Qt::ClickFocus);
setWindowTitle(tr("Properties")); setWindowTitle(tr("Properties"));
@ -93,7 +91,6 @@ void ConfigurePerGame::ApplyConfiguration() {
graphics_tab->ApplyConfiguration(); graphics_tab->ApplyConfiguration();
graphics_advanced_tab->ApplyConfiguration(); graphics_advanced_tab->ApplyConfiguration();
audio_tab->ApplyConfiguration(); audio_tab->ApplyConfiguration();
input_tab->ApplyConfiguration();
system.ApplySettings(); system.ApplySettings();
Settings::LogSettings(); Settings::LogSettings();

View file

@ -16,17 +16,12 @@ namespace Core {
class System; class System;
} }
namespace InputCommon {
class InputSubsystem;
}
class ConfigurePerGameAddons; class ConfigurePerGameAddons;
class ConfigureAudio; class ConfigureAudio;
class ConfigureCpu; class ConfigureCpu;
class ConfigureGeneral; class ConfigureGeneral;
class ConfigureGraphics; class ConfigureGraphics;
class ConfigureGraphicsAdvanced; class ConfigureGraphicsAdvanced;
class ConfigureInputPerGame;
class ConfigureSystem; class ConfigureSystem;
class QGraphicsScene; class QGraphicsScene;
@ -77,6 +72,5 @@ private:
std::unique_ptr<ConfigureGeneral> general_tab; std::unique_ptr<ConfigureGeneral> general_tab;
std::unique_ptr<ConfigureGraphics> graphics_tab; std::unique_ptr<ConfigureGraphics> graphics_tab;
std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab; std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab;
std::unique_ptr<ConfigureInputPerGame> input_tab;
std::unique_ptr<ConfigureSystem> system_tab; std::unique_ptr<ConfigureSystem> system_tab;
}; };

View file

@ -126,7 +126,6 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "yuzu/compatibility_list.h" #include "yuzu/compatibility_list.h"
#include "yuzu/configuration/config.h" #include "yuzu/configuration/config.h"
#include "yuzu/configuration/configure_dialog.h" #include "yuzu/configuration/configure_dialog.h"
#include "yuzu/configuration/configure_input_per_game.h"
#include "yuzu/debugger/console.h" #include "yuzu/debugger/console.h"
#include "yuzu/debugger/controller.h" #include "yuzu/debugger/controller.h"
#include "yuzu/debugger/profiler.h" #include "yuzu/debugger/profiler.h"
@ -1671,11 +1670,6 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
LOG_INFO(Frontend, "yuzu starting..."); LOG_INFO(Frontend, "yuzu starting...");
StoreRecentFile(filename); // Put the filename on top of the list StoreRecentFile(filename); // Put the filename on top of the list
// Save configurations
UpdateUISettings();
game_list->SaveInterfaceLayout();
config->Save();
u64 title_id{0}; u64 title_id{0};
last_filename_booted = filename; last_filename_booted = filename;
@ -1692,10 +1686,14 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
? Common::FS::PathToUTF8String(file_path.filename()) ? Common::FS::PathToUTF8String(file_path.filename())
: fmt::format("{:016X}", title_id); : fmt::format("{:016X}", title_id);
Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig); Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig);
system->HIDCore().ReloadInputDevices();
system->ApplySettings(); system->ApplySettings();
} }
// Save configurations
UpdateUISettings();
game_list->SaveInterfaceLayout();
config->Save();
Settings::LogSettings(); Settings::LogSettings();
if (UISettings::values.select_user_on_boot) { if (UISettings::values.select_user_on_boot) {
@ -2816,7 +2814,6 @@ void GMainWindow::OnStopGame() {
ShutdownGame(); ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn()); Settings::RestoreGlobalState(system->IsPoweredOn());
system->HIDCore().ReloadInputDevices();
UpdateStatusButtons(); UpdateStatusButtons();
} }
@ -3278,7 +3275,6 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file
// Do not cause the global config to write local settings into the config file // Do not cause the global config to write local settings into the config file
const bool is_powered_on = system->IsPoweredOn(); const bool is_powered_on = system->IsPoweredOn();
Settings::RestoreGlobalState(is_powered_on); Settings::RestoreGlobalState(is_powered_on);
system->HIDCore().ReloadInputDevices();
UISettings::values.configuration_applied = false; UISettings::values.configuration_applied = false;
@ -3739,7 +3735,6 @@ void GMainWindow::OnCoreError(Core::SystemResultStatus result, std::string detai
ShutdownGame(); ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn()); Settings::RestoreGlobalState(system->IsPoweredOn());
system->HIDCore().ReloadInputDevices();
UpdateStatusButtons(); UpdateStatusButtons();
} }
} else { } else {
@ -3891,19 +3886,18 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
// Unload controllers early // Unload controllers early
controller_dialog->UnloadController(); controller_dialog->UnloadController();
game_list->UnloadController(); game_list->UnloadController();
system->HIDCore().UnloadInputDevices();
// Shutdown session if the emu thread is active... // Shutdown session if the emu thread is active...
if (emu_thread != nullptr) { if (emu_thread != nullptr) {
ShutdownGame(); ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn()); Settings::RestoreGlobalState(system->IsPoweredOn());
system->HIDCore().ReloadInputDevices();
UpdateStatusButtons(); UpdateStatusButtons();
} }
render_window->close(); render_window->close();
multiplayer_state->Close(); multiplayer_state->Close();
system->HIDCore().UnloadInputDevices();
system->GetRoomNetwork().Shutdown(); system->GetRoomNetwork().Shutdown();
QWidget::closeEvent(event); QWidget::closeEvent(event);