mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Remove some global usages of system (#6688)
This commit is contained in:
		
							parent
							
								
									943d5eeddf
								
							
						
					
					
						commit
						d702915624
					
				
					 14 changed files with 57 additions and 35 deletions
				
			
		|  | @ -44,7 +44,8 @@ | |||
| 
 | ||||
| static Frontend::WindowSystemType GetWindowSystemType(); | ||||
| 
 | ||||
| EmuThread::EmuThread(Frontend::GraphicsContext& core_context) : core_context(core_context) {} | ||||
| EmuThread::EmuThread(Core::System& system_, Frontend::GraphicsContext& core_context) | ||||
|     : system{system_}, core_context(core_context) {} | ||||
| 
 | ||||
| EmuThread::~EmuThread() = default; | ||||
| 
 | ||||
|  | @ -62,7 +63,6 @@ static GMainWindow* GetMainWindow() { | |||
| void EmuThread::run() { | ||||
|     MicroProfileOnThreadCreate("EmuThread"); | ||||
|     const auto scope = core_context.Acquire(); | ||||
|     Core::System& system = Core::System::GetInstance(); | ||||
| 
 | ||||
|     if (Settings::values.preload_textures) { | ||||
|         emit LoadProgress(VideoCore::LoadCallbackStage::Preload, 0, 0); | ||||
|  | @ -107,7 +107,7 @@ void EmuThread::run() { | |||
|             } | ||||
|             if (result != Core::System::ResultStatus::Success) { | ||||
|                 this->SetRunning(false); | ||||
|                 emit ErrorThrown(result, Core::System::GetInstance().GetStatusDetails()); | ||||
|                 emit ErrorThrown(result, system.GetStatusDetails()); | ||||
|             } | ||||
| 
 | ||||
|             was_active = running || exec_step; | ||||
|  | @ -248,8 +248,8 @@ public: | |||
| #ifdef HAS_OPENGL | ||||
| class OpenGLRenderWidget : public RenderWidget { | ||||
| public: | ||||
|     explicit OpenGLRenderWidget(GRenderWindow* parent, bool is_secondary) | ||||
|         : RenderWidget(parent), is_secondary(is_secondary) { | ||||
|     explicit OpenGLRenderWidget(GRenderWindow* parent, Core::System& system_, bool is_secondary) | ||||
|         : RenderWidget(parent), system(system_), is_secondary(is_secondary) { | ||||
|         setAttribute(Qt::WA_NativeWindow); | ||||
|         setAttribute(Qt::WA_PaintOnScreen); | ||||
|         if (GetWindowSystemType() == Frontend::WindowSystemType::Wayland) { | ||||
|  | @ -266,7 +266,7 @@ public: | |||
|         if (!isVisible()) { | ||||
|             return; | ||||
|         } | ||||
|         if (!Core::System::GetInstance().IsPoweredOn()) { | ||||
|         if (!system.IsPoweredOn()) { | ||||
|             return; | ||||
|         } | ||||
|         context->MakeCurrent(); | ||||
|  | @ -284,6 +284,7 @@ public: | |||
| 
 | ||||
| private: | ||||
|     std::unique_ptr<Frontend::GraphicsContext> context{}; | ||||
|     Core::System& system; | ||||
|     bool is_secondary; | ||||
| }; | ||||
| #endif | ||||
|  | @ -296,7 +297,7 @@ struct SoftwareRenderWidget : public RenderWidget { | |||
|         if (!isVisible()) { | ||||
|             return; | ||||
|         } | ||||
|         if (!Core::System::GetInstance().IsPoweredOn()) { | ||||
|         if (!system.IsPoweredOn()) { | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|  | @ -666,7 +667,7 @@ bool GRenderWindow::InitializeOpenGL() { | |||
| 
 | ||||
|     // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground,
 | ||||
|     // WA_DontShowOnScreen, WA_DeleteOnClose
 | ||||
|     auto child = new OpenGLRenderWidget(this, is_secondary); | ||||
|     auto child = new OpenGLRenderWidget(this, system, is_secondary); | ||||
|     child_widget = child; | ||||
|     child_widget->windowHandle()->create(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,6 +18,10 @@ class QTouchEvent; | |||
| 
 | ||||
| class GRenderWindow; | ||||
| 
 | ||||
| namespace Core { | ||||
| class System; | ||||
| } | ||||
| 
 | ||||
| namespace VideoCore { | ||||
| enum class LoadCallbackStage; | ||||
| } | ||||
|  | @ -26,7 +30,7 @@ class EmuThread final : public QThread { | |||
|     Q_OBJECT | ||||
| 
 | ||||
| public: | ||||
|     explicit EmuThread(Frontend::GraphicsContext& context); | ||||
|     explicit EmuThread(Core::System& system_, Frontend::GraphicsContext& context); | ||||
|     ~EmuThread() override; | ||||
| 
 | ||||
|     /**
 | ||||
|  | @ -80,6 +84,7 @@ private: | |||
|     std::mutex running_mutex; | ||||
|     std::condition_variable running_cv; | ||||
| 
 | ||||
|     Core::System& system; | ||||
|     Frontend::GraphicsContext& core_context; | ||||
| 
 | ||||
| signals: | ||||
|  |  | |||
|  | @ -11,9 +11,9 @@ | |||
| #include "core/core.h" | ||||
| #include "ui_compatdb.h" | ||||
| 
 | ||||
| CompatDB::CompatDB(QWidget* parent) | ||||
| CompatDB::CompatDB(Core::TelemetrySession& telemetry_session_, QWidget* parent) | ||||
|     : QWizard(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint), | ||||
|       ui{std::make_unique<Ui::CompatDB>()} { | ||||
|       ui{std::make_unique<Ui::CompatDB>()}, telemetry_session{telemetry_session_} { | ||||
|     ui->setupUi(this); | ||||
|     connect(ui->radioButton_Perfect, &QRadioButton::clicked, this, &CompatDB::EnableNext); | ||||
|     connect(ui->radioButton_Great, &QRadioButton::clicked, this, &CompatDB::EnableNext); | ||||
|  | @ -51,16 +51,15 @@ void CompatDB::Submit() { | |||
|     case CompatDBPage::Final: | ||||
|         back(); | ||||
|         LOG_DEBUG(Frontend, "Compatibility Rating: {}", compatibility->checkedId()); | ||||
|         Core::System::GetInstance().TelemetrySession().AddField( | ||||
|             Common::Telemetry::FieldType::UserFeedback, "Compatibility", | ||||
|             compatibility->checkedId()); | ||||
|         telemetry_session.AddField(Common::Telemetry::FieldType::UserFeedback, "Compatibility", | ||||
|                                    compatibility->checkedId()); | ||||
| 
 | ||||
|         button(NextButton)->setEnabled(false); | ||||
|         button(NextButton)->setText(tr("Submitting")); | ||||
|         button(CancelButton)->setVisible(false); | ||||
| 
 | ||||
|         testcase_watcher.setFuture(QtConcurrent::run( | ||||
|             [] { return Core::System::GetInstance().TelemetrySession().SubmitTestcase(); })); | ||||
|         testcase_watcher.setFuture( | ||||
|             QtConcurrent::run([this] { return telemetry_session.SubmitTestcase(); })); | ||||
|         break; | ||||
|     default: | ||||
|         LOG_ERROR(Frontend, "Unexpected page: {}", currentId()); | ||||
|  |  | |||
|  | @ -8,6 +8,10 @@ | |||
| #include <QFutureWatcher> | ||||
| #include <QWizard> | ||||
| 
 | ||||
| namespace Core { | ||||
| class TelemetrySession; | ||||
| } | ||||
| 
 | ||||
| namespace Ui { | ||||
| class CompatDB; | ||||
| } | ||||
|  | @ -16,7 +20,7 @@ class CompatDB : public QWizard { | |||
|     Q_OBJECT | ||||
| 
 | ||||
| public: | ||||
|     explicit CompatDB(QWidget* parent = nullptr); | ||||
|     explicit CompatDB(Core::TelemetrySession& telemetry_session_, QWidget* parent = nullptr); | ||||
|     ~CompatDB(); | ||||
| 
 | ||||
| private: | ||||
|  | @ -27,4 +31,6 @@ private: | |||
|     void Submit(); | ||||
|     void OnTestcaseSubmitted(); | ||||
|     void EnableNext(); | ||||
| 
 | ||||
|     Core::TelemetrySession& telemetry_session; | ||||
| }; | ||||
|  |  | |||
|  | @ -1223,7 +1223,7 @@ void GMainWindow::BootGame(const QString& filename) { | |||
|     } | ||||
| 
 | ||||
|     // Create and start the emulation thread
 | ||||
|     emu_thread = std::make_unique<EmuThread>(*render_window); | ||||
|     emu_thread = std::make_unique<EmuThread>(system, *render_window); | ||||
|     emit EmulationStarting(emu_thread.get()); | ||||
|     emu_thread->start(); | ||||
| 
 | ||||
|  | @ -1814,7 +1814,7 @@ void GMainWindow::OnLoadComplete() { | |||
| 
 | ||||
| void GMainWindow::OnMenuReportCompatibility() { | ||||
|     if (!NetSettings::values.citra_token.empty() && !NetSettings::values.citra_username.empty()) { | ||||
|         CompatDB compatdb{this}; | ||||
|         CompatDB compatdb{system.TelemetrySession(), this}; | ||||
|         compatdb.exec(); | ||||
|     } else { | ||||
|         QMessageBox::critical(this, tr("Missing Citra Account"), | ||||
|  | @ -2931,7 +2931,7 @@ int main(int argc, char* argv[]) { | |||
|     GMainWindow main_window(system); | ||||
| 
 | ||||
|     // Register frontend applets
 | ||||
|     Frontend::RegisterDefaultApplets(); | ||||
|     Frontend::RegisterDefaultApplets(system); | ||||
| 
 | ||||
|     system.RegisterMiiSelector(std::make_shared<QtMiiSelector>(main_window)); | ||||
|     system.RegisterSoftwareKeyboard(std::make_shared<QtKeyboard>(main_window)); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue