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
=============
This is the source code for early-access 3140.
This is the source code for early-access 3141.
## Legal Notice

View File

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

View File

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

View File

@ -88,9 +88,6 @@ 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

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
* usages later in this file. This allows explicit definition of some types that don't work
* 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];
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>(
qt_config
->value(QStringLiteral("%1type").arg(player_prefix),
@ -404,26 +388,9 @@ 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();
@ -445,6 +412,18 @@ 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();
@ -926,6 +905,7 @@ void Config::ReadMultiplayerValues() {
void Config::ReadValues() {
if (global) {
ReadControlValues();
ReadDataStorageValues();
ReadDebuggingValues();
ReadDisabledAddOnValues();
@ -934,7 +914,6 @@ void Config::ReadValues() {
ReadWebServiceValues();
ReadMiscellaneousValues();
}
ReadControlValues();
ReadCoreValues();
ReadCpuValues();
ReadRendererValues();
@ -953,20 +932,12 @@ 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() || !Settings::IsConfiguringGlobal()) {
if (!player_prefix.isEmpty()) {
WriteSetting(QStringLiteral("%1connected").arg(player_prefix), player.connected,
player_index == 0);
WriteSetting(QStringLiteral("%1vibration_enabled").arg(player_prefix),
@ -1048,22 +1019,19 @@ 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(map.name),
WriteSetting(QStringLiteral("name"),
QString::fromStdString(Settings::values.touch_from_button_maps[p].name),
QStringLiteral("default"));
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));
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();
}
@ -1087,6 +1055,7 @@ void Config::SaveIrCameraValues() {
void Config::SaveValues() {
if (global) {
SaveControlValues();
SaveDataStorageValues();
SaveDebuggingValues();
SaveDisabledAddOnValues();
@ -1095,7 +1064,6 @@ void Config::SaveValues() {
SaveWebServiceValues();
SaveMiscellaneousValues();
}
SaveControlValues();
SaveCoreValues();
SaveCpuValues();
SaveRendererValues();
@ -1120,19 +1088,9 @@ 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();
@ -1140,6 +1098,10 @@ 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);
@ -1617,13 +1579,6 @@ 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;
}

View File

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

View File

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

View File

@ -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_per_game.h"
#include "yuzu/configuration/configure_input.h"
#include "yuzu/configuration/configure_per_game.h"
#include "yuzu/configuration/configure_per_game_addons.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);
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);
@ -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_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"));
@ -93,7 +91,6 @@ void ConfigurePerGame::ApplyConfiguration() {
graphics_tab->ApplyConfiguration();
graphics_advanced_tab->ApplyConfiguration();
audio_tab->ApplyConfiguration();
input_tab->ApplyConfiguration();
system.ApplySettings();
Settings::LogSettings();

View File

@ -16,17 +16,12 @@ 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;
@ -77,6 +72,5 @@ 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;
};

View File

@ -126,7 +126,6 @@ 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"
@ -1671,11 +1670,6 @@ 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;
@ -1692,10 +1686,14 @@ 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) {
@ -2816,7 +2814,6 @@ void GMainWindow::OnStopGame() {
ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn());
system->HIDCore().ReloadInputDevices();
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
const bool is_powered_on = system->IsPoweredOn();
Settings::RestoreGlobalState(is_powered_on);
system->HIDCore().ReloadInputDevices();
UISettings::values.configuration_applied = false;
@ -3739,7 +3735,6 @@ void GMainWindow::OnCoreError(Core::SystemResultStatus result, std::string detai
ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn());
system->HIDCore().ReloadInputDevices();
UpdateStatusButtons();
}
} else {
@ -3891,19 +3886,18 @@ 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);