citra-emu
/
citra-canary
Archived
1
0
Fork 0

common: Remove dependency from core

This commit is contained in:
GPUCode 2023-06-30 13:39:38 +03:00
parent ba98bf058a
commit 9527bfffed
14 changed files with 105 additions and 96 deletions

View File

@ -141,7 +141,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
app_loader->ReadProgramId(program_id);
GameSettings::LoadOverrides(program_id);
}
Settings::Apply();
system.ApplySettings();
Settings::LogSettings();
Camera::RegisterFactory("image", std::make_unique<Camera::StillImage::Factory>());
@ -472,7 +472,7 @@ void Java_org_citra_citra_1emu_NativeLibrary_ReloadSettings(JNIEnv* env,
GameSettings::LoadOverrides(program_id);
}
Settings::Apply();
system.ApplySettings();
}
jstring Java_org_citra_citra_1emu_NativeLibrary_GetUserSetting(JNIEnv* env,

View File

@ -343,7 +343,7 @@ int main(int argc, char** argv) {
// Apply the command line arguments
Settings::values.gdbstub_port = gdb_port;
Settings::values.use_gdbstub = use_gdbstub;
Settings::Apply();
system.ApplySettings();
// Register frontend applets
Frontend::RegisterDefaultApplets();

View File

@ -8,10 +8,13 @@
#include "citra_qt/configuration/configure_dialog.h"
#include "citra_qt/hotkeys.h"
#include "common/settings.h"
#include "core/core.h"
#include "ui_configure.h"
ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, bool enable_web_config)
: QDialog(parent), ui(std::make_unique<Ui::ConfigureDialog>()), registry(registry) {
ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, Core::System& system_,
bool enable_web_config)
: QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()}, registry{registry_},
system{system_} {
Settings::SetConfiguringGlobal(true);
ui->setupUi(this);
@ -68,7 +71,7 @@ void ConfigureDialog::ApplyConfiguration() {
ui->webTab->ApplyConfiguration();
ui->uiTab->ApplyConfiguration();
ui->storageTab->ApplyConfiguration();
Settings::Apply();
system.ApplySettings();
Settings::LogSettings();
}

View File

@ -13,11 +13,15 @@ namespace Ui {
class ConfigureDialog;
}
namespace Core {
class System;
}
class ConfigureDialog : public QDialog {
Q_OBJECT
public:
explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry,
explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, Core::System& system,
bool enable_web_config = true);
~ConfigureDialog() override;
@ -37,4 +41,5 @@ private:
std::unique_ptr<Ui::ConfigureDialog> ui;
HotkeyRegistry& registry;
Core::System& system;
};

View File

@ -102,7 +102,7 @@ void ConfigurePerGame::ApplyConfiguration() {
audio_tab->ApplyConfiguration();
debug_tab->ApplyConfiguration();
Settings::Apply();
system.ApplySettings();
Settings::LogSettings();
game_config->Save();

View File

@ -8,10 +8,11 @@
#include "citra_qt/dumping/options_dialog.h"
#include "citra_qt/uisettings.h"
#include "common/settings.h"
#include "core/core.h"
#include "ui_dumping_dialog.h"
DumpingDialog::DumpingDialog(QWidget* parent)
: QDialog(parent), ui(std::make_unique<Ui::DumpingDialog>()) {
DumpingDialog::DumpingDialog(QWidget* parent, Core::System& system_)
: QDialog(parent), ui{std::make_unique<Ui::DumpingDialog>()}, system{system_} {
ui->setupUi(this);
@ -216,5 +217,5 @@ void DumpingDialog::ApplyConfiguration() {
Settings::values.audio_encoder_options = ui->audioEncoderOptionsLineEdit->text().toStdString();
Settings::values.audio_bitrate = ui->audioBitrateSpinBox->value();
UISettings::values.video_dumping_path = last_path;
Settings::Apply();
system.ApplySettings();
}

View File

@ -10,13 +10,17 @@ namespace Ui {
class DumpingDialog;
}
namespace Core {
class System;
}
class QLineEdit;
class DumpingDialog : public QDialog {
Q_OBJECT
public:
explicit DumpingDialog(QWidget* parent);
explicit DumpingDialog(QWidget* parent, Core::System& system);
~DumpingDialog() override;
QString GetFilePath() const;
@ -32,6 +36,7 @@ private:
QLineEdit* line_edit);
std::unique_ptr<Ui::DumpingDialog> ui;
Core::System& system;
QString last_path;

View File

@ -140,7 +140,7 @@ void GMainWindow::ShowTelemetryCallout() {
"<br/><br/>Would you like to share your usage data with us?");
if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) == QMessageBox::Yes) {
NetSettings::values.enable_telemetry = true;
Settings::Apply();
system.ApplySettings();
}
}
@ -1140,7 +1140,7 @@ void GMainWindow::BootGame(const QString& filename) {
const std::string config_file_name =
title_id == 0 ? name : fmt::format("{:016X}", title_id);
Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig);
Settings::Apply();
system.ApplySettings();
LOG_INFO(Frontend, "Using per game config file for title id {}", config_file_name);
Settings::LogSettings();
@ -1883,7 +1883,7 @@ void GMainWindow::ChangeScreenLayout() {
}
Settings::values.layout_option = new_layout;
Settings::Apply();
system.ApplySettings();
UpdateSecondaryWindowVisibility();
}
@ -1911,18 +1911,18 @@ void GMainWindow::ToggleScreenLayout() {
Settings::values.layout_option = new_layout;
SyncMenuUISettings();
Settings::Apply();
system.ApplySettings();
UpdateSecondaryWindowVisibility();
}
void GMainWindow::OnSwapScreens() {
Settings::values.swap_screen = ui->action_Screen_Layout_Swap_Screens->isChecked();
Settings::Apply();
system.ApplySettings();
}
void GMainWindow::OnRotateScreens() {
Settings::values.upright_screen = ui->action_Screen_Layout_Upright_Screens->isChecked();
Settings::Apply();
system.ApplySettings();
}
void GMainWindow::TriggerSwapScreens() {
@ -1961,7 +1961,7 @@ void GMainWindow::OnLoadState() {
void GMainWindow::OnConfigure() {
game_list->SetDirectoryWatcherEnabled(false);
Settings::SetConfiguringGlobal(true);
ConfigureDialog configureDialog(this, hotkey_registry,
ConfigureDialog configureDialog(this, hotkey_registry, system,
!multiplayer_state->IsHostingPublicRoom());
connect(&configureDialog, &ConfigureDialog::LanguageChanged, this,
&GMainWindow::OnLanguageChanged);
@ -2278,7 +2278,7 @@ void GMainWindow::OnOpenFFmpeg() {
#endif
void GMainWindow::OnStartVideoDumping() {
DumpingDialog dialog(this);
DumpingDialog dialog(this, system);
if (dialog.exec() != QDialog::DialogCode::Accepted) {
ui->action_Dump_Video->setChecked(false);
return;

View File

@ -176,5 +176,5 @@ if (CITRA_USE_PRECOMPILED_HEADERS)
target_precompile_headers(citra_common PRIVATE precompiled_headers.h)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND CMAKE_CXX_COMPILER_ID STREQUAL GNU)
target_link_libraries(citra_common PRIVATE backtrace)
target_link_libraries(citra_common PRIVATE backtrace dl)
endif()

View File

@ -5,18 +5,8 @@
#include <string_view>
#include <utility>
#include "audio_core/dsp_interface.h"
#include "common/file_util.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/gdbstub/gdbstub.h"
#include "core/hle/kernel/shared_page.h"
#include "core/hle/service/cam/cam.h"
#include "core/hle/service/hid/hid.h"
#include "core/hle/service/ir/ir_rst.h"
#include "core/hle/service/ir/ir_user.h"
#include "core/hle/service/mic_u.h"
#include "core/hle/service/plgldr/plgldr.h"
#include "video_core/renderer_base.h"
#include "video_core/video_core.h"
namespace Settings {
@ -75,64 +65,6 @@ std::string_view GetTextureFilterName(TextureFilter filter) {
Values values = {};
static bool configuring_global = true;
void Apply() {
GDBStub::SetServerPort(values.gdbstub_port.GetValue());
GDBStub::ToggleServer(values.use_gdbstub.GetValue());
VideoCore::g_shader_jit_enabled = values.use_shader_jit.GetValue();
VideoCore::g_hw_shader_enabled = values.use_hw_shader.GetValue();
VideoCore::g_hw_shader_accurate_mul = values.shaders_accurate_mul.GetValue();
#ifndef ANDROID
if (VideoCore::g_renderer) {
VideoCore::g_renderer->UpdateCurrentFramebufferLayout();
}
#endif
if (VideoCore::g_renderer) {
auto& settings = VideoCore::g_renderer->Settings();
settings.bg_color_update_requested = true;
settings.sampler_update_requested = true;
settings.shader_update_requested = true;
settings.texture_filter_update_requested = true;
}
auto& system = Core::System::GetInstance();
if (system.IsPoweredOn()) {
system.CoreTiming().UpdateClockSpeed(values.cpu_clock_percentage.GetValue());
Core::DSP().SetSink(values.output_type.GetValue(), values.output_device.GetValue());
Core::DSP().EnableStretching(values.enable_audio_stretching.GetValue());
auto hid = Service::HID::GetModule(system);
if (hid) {
hid->ReloadInputDevices();
}
auto apt = Service::APT::GetModule(system);
if (apt) {
apt->GetAppletManager()->ReloadInputDevices();
}
auto sm = system.ServiceManager();
auto ir_user = sm.GetService<Service::IR::IR_USER>("ir:USER");
if (ir_user)
ir_user->ReloadInputDevices();
auto ir_rst = sm.GetService<Service::IR::IR_RST>("ir:rst");
if (ir_rst)
ir_rst->ReloadInputDevices();
auto cam = Service::CAM::GetModule(system);
if (cam) {
cam->ReloadCameraDevices();
}
Service::MIC::ReloadMic(system);
}
Service::PLGLDR::PLG_LDR::SetEnabled(values.plugin_loader_enabled.GetValue());
Service::PLGLDR::PLG_LDR::SetAllowGameChangeState(values.allow_plugin_loader.GetValue());
}
void LogSettings() {
const auto log_setting = [](std::string_view name, const auto& value) {
LOG_INFO(Config, "{}: {}", name, value);

View File

@ -525,7 +525,6 @@ void SetConfiguringGlobal(bool is_global);
float Volume();
void Apply();
void LogSettings();
// Restore the global state of all applicable settings in the Values struct

View File

@ -13,9 +13,9 @@
#include "common/arch.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "common/texture.h"
#include "core/arm/arm_interface.h"
#include "core/arm/exclusive_monitor.h"
#include "core/hle/service/cam/cam.h"
#if CITRA_ARCH(x86_64) || CITRA_ARCH(arm64)
#include "core/arm/dynarmic/arm_dynarmic.h"
#endif
@ -24,19 +24,22 @@
#include "core/core.h"
#include "core/core_timing.h"
#include "core/dumping/backend.h"
#include "core/dumping/ffmpeg_backend.h"
#include "core/frontend/image_interface.h"
#include "core/gdbstub/gdbstub.h"
#include "core/global.h"
#include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h"
#include "core/hle/kernel/thread.h"
#include "core/hle/service/apt/applet_manager.h"
#include "core/hle/service/apt/apt.h"
#include "core/hle/service/cam/cam.h"
#include "core/hle/service/fs/archive.h"
#include "core/hle/service/gsp/gsp.h"
#include "core/hle/service/pm/pm_app.h"
#include "core/hle/service/hid/hid.h"
#include "core/hle/service/ir/ir_rst.h"
#include "core/hle/service/ir/ir_user.h"
#include "core/hle/service/mic_u.h"
#include "core/hle/service/plgldr/plgldr.h"
#include "core/hle/service/service.h"
#include "core/hle/service/sm/sm.h"
#include "core/hw/gpu.h"
@ -597,6 +600,64 @@ void System::Reset() {
}
}
void System::ApplySettings() {
GDBStub::SetServerPort(Settings::values.gdbstub_port.GetValue());
GDBStub::ToggleServer(Settings::values.use_gdbstub.GetValue());
VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit.GetValue();
VideoCore::g_hw_shader_enabled = Settings::values.use_hw_shader.GetValue();
VideoCore::g_hw_shader_accurate_mul = Settings::values.shaders_accurate_mul.GetValue();
#ifndef ANDROID
if (VideoCore::g_renderer) {
VideoCore::g_renderer->UpdateCurrentFramebufferLayout();
}
#endif
if (VideoCore::g_renderer) {
auto& settings = VideoCore::g_renderer->Settings();
settings.bg_color_update_requested = true;
settings.sampler_update_requested = true;
settings.shader_update_requested = true;
settings.texture_filter_update_requested = true;
}
if (IsPoweredOn()) {
CoreTiming().UpdateClockSpeed(Settings::values.cpu_clock_percentage.GetValue());
Core::DSP().SetSink(Settings::values.output_type.GetValue(),
Settings::values.output_device.GetValue());
Core::DSP().EnableStretching(Settings::values.enable_audio_stretching.GetValue());
auto hid = Service::HID::GetModule(*this);
if (hid) {
hid->ReloadInputDevices();
}
auto apt = Service::APT::GetModule(*this);
if (apt) {
apt->GetAppletManager()->ReloadInputDevices();
}
auto ir_user = service_manager->GetService<Service::IR::IR_USER>("ir:USER");
if (ir_user)
ir_user->ReloadInputDevices();
auto ir_rst = service_manager->GetService<Service::IR::IR_RST>("ir:rst");
if (ir_rst)
ir_rst->ReloadInputDevices();
auto cam = Service::CAM::GetModule(*this);
if (cam) {
cam->ReloadCameraDevices();
}
Service::MIC::ReloadMic(*this);
}
Service::PLGLDR::PLG_LDR::SetEnabled(Settings::values.plugin_loader_enabled.GetValue());
Service::PLGLDR::PLG_LDR::SetAllowGameChangeState(
Settings::values.allow_plugin_loader.GetValue());
}
template <class Archive>
void System::serialize(Archive& ar, const unsigned int file_version) {

View File

@ -330,6 +330,9 @@ public:
return false;
}
/// Applies any changes to settings to this core instance.
void ApplySettings();
private:
/**
* Initialize the emulated system.

View File

@ -8,7 +8,7 @@ add_executable(citra-room
create_target_directory_groups(citra-room)
target_link_libraries(citra-room PRIVATE citra_common citra_core network)
target_link_libraries(citra-room PRIVATE citra_common network)
if (ENABLE_WEB_SERVICE)
target_compile_definitions(citra-room PRIVATE -DENABLE_WEB_SERVICE)
target_link_libraries(citra-room PRIVATE web_service)