From cfb59aad3ff5ab782a0c4212c3085094e15d7ede Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 29 May 2019 01:53:30 -0400 Subject: yuzu/bootmanager: Remove pointer downcast in GRenderWindow's constructor We can just pass a pointer to GMainWindow directly and make it a requirement of the interface. This makes the interface a little safer, since this would technically otherwise allow any random QWidget to be the parent of a render window, downcasting it to GMainWindow (which is undefined behavior). --- src/yuzu/bootmanager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/yuzu/bootmanager.h') diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index 7f9f8e8e3..5a1ebd0fe 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h @@ -114,7 +114,7 @@ class GRenderWindow : public QWidget, public Core::Frontend::EmuWindow { Q_OBJECT public: - GRenderWindow(QWidget* parent, EmuThread* emu_thread); + GRenderWindow(GMainWindow* parent, EmuThread* emu_thread); ~GRenderWindow() override; // EmuWindow implementation -- cgit v1.2.3 From 0a650ec99e7141ea0a28b4f196a9b7d3f3bbe24e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 29 May 2019 02:02:36 -0400 Subject: yuzu/bootmanager: unsigned -> u32 Same thing (for platforms we support), less reading. --- src/yuzu/bootmanager.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/yuzu/bootmanager.h') diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index 5a1ebd0fe..85c080000 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h @@ -133,13 +133,13 @@ public: QByteArray saveGeometry(); // overridden qreal GetWindowPixelRatio() const; - std::pair ScaleTouch(const QPointF pos) const; + std::pair ScaleTouch(QPointF pos) const; void closeEvent(QCloseEvent* event) override; bool event(QEvent* event) override; void focusOutEvent(QFocusEvent* event) override; - void OnClientAreaResized(unsigned width, unsigned height); + void OnClientAreaResized(u32 width, u32 height); void InitRenderTarget(); @@ -162,7 +162,7 @@ private: void TouchUpdateEvent(const QTouchEvent* event); void TouchEndEvent(); - void OnMinimalClientAreaChangeRequest(std::pair minimal_size) override; + void OnMinimalClientAreaChangeRequest(std::pair minimal_size) override; QWidget* container = nullptr; GGLWidgetInternal* child = nullptr; -- cgit v1.2.3 From 536c9cf006750927aa06d842d8bd18d7274c0be6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 29 May 2019 02:05:06 -0400 Subject: yuzu/bootmanager: Default EmuThread's destructor in the cpp file This class contains non-trivial members, so we should default the destructor's definition within the cpp file. --- src/yuzu/bootmanager.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/yuzu/bootmanager.h') diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index 85c080000..21b4958ff 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h @@ -27,11 +27,12 @@ namespace VideoCore { enum class LoadCallbackStage; } -class EmuThread : public QThread { +class EmuThread final : public QThread { Q_OBJECT public: explicit EmuThread(GRenderWindow* render_window); + ~EmuThread() override; /** * Start emulation (on new thread) -- cgit v1.2.3 From e32bf646cfb4a2b86fe2645c20722d55f0f4f96c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 29 May 2019 02:14:24 -0400 Subject: yuzu/bootmanager: Treat the resolution factor as a u32 Treating it as a u16 can result in a sign-conversion warning when performing arithmetic with it, as u16 promotes to an int when aritmetic is performed on it, not unsigned int. This also makes the interface more uniform, as the layout interface now operates on u32 across the board. --- src/yuzu/bootmanager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/yuzu/bootmanager.h') diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index 21b4958ff..2fc64895f 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h @@ -144,7 +144,7 @@ public: void InitRenderTarget(); - void CaptureScreenshot(u16 res_scale, const QString& screenshot_path); + void CaptureScreenshot(u32 res_scale, const QString& screenshot_path); public slots: void moveContext(); // overridden -- cgit v1.2.3