Merge pull request #4738 from FearlessTobi/port-1020-new

Port yuzu-emu/yuzu#1020: "core: Namespace EmuWindow"
This commit is contained in:
James Rowe 2019-04-26 08:58:09 -06:00 committed by GitHub
commit 3f2c7eb471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 39 additions and 20 deletions

View File

@ -10,7 +10,7 @@
struct SDL_Window;
class EmuWindow_SDL2 : public EmuWindow {
class EmuWindow_SDL2 : public Frontend::EmuWindow {
public:
explicit EmuWindow_SDL2(bool fullscreen);
~EmuWindow_SDL2();

View File

@ -103,7 +103,7 @@ signals:
void ErrorThrown(Core::System::ResultStatus, std::string);
};
class GRenderWindow : public QWidget, public EmuWindow {
class GRenderWindow : public QWidget, public Frontend::EmuWindow {
Q_OBJECT
public:

View File

@ -92,7 +92,7 @@ System::ResultStatus System::SingleStep() {
return RunLoop(false);
}
System::ResultStatus System::Load(EmuWindow& emu_window, const std::string& filepath) {
System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath) {
app_loader = Loader::GetLoader(filepath);
if (!app_loader) {
@ -167,7 +167,7 @@ void System::Reschedule() {
kernel->GetThreadManager().Reschedule();
}
System::ResultStatus System::Init(EmuWindow& emu_window, u32 system_mode) {
System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mode) {
LOG_DEBUG(HW_Memory, "initialized OK");
memory = std::make_unique<Memory::MemorySystem>();

View File

@ -14,9 +14,12 @@
#include "core/perf_stats.h"
#include "core/telemetry_session.h"
class EmuWindow;
class ARM_Interface;
namespace Frontend {
class EmuWindow;
}
namespace Memory {
class MemorySystem;
}
@ -121,7 +124,7 @@ public:
* @param filepath String path to the executable application to load on the host file system.
* @returns ResultStatus code, indicating if the operation succeeded.
*/
ResultStatus Load(EmuWindow& emu_window, const std::string& filepath);
ResultStatus Load(Frontend::EmuWindow& emu_window, const std::string& filepath);
/**
* Indicates if the emulated system is powered on (all subsystems initialized and able to run an
@ -243,7 +246,7 @@ private:
* @param system_mode The system mode.
* @return ResultStatus code, indicating if the operation succeeded.
*/
ResultStatus Init(EmuWindow& emu_window, u32 system_mode);
ResultStatus Init(Frontend::EmuWindow& emu_window, u32 system_mode);
/// Reschedule the core emulation
void Reschedule();
@ -288,7 +291,7 @@ private:
ResultStatus status = ResultStatus::Success;
std::string status_details = "";
/// Saved variables for reset
EmuWindow* m_emu_window;
Frontend::EmuWindow* m_emu_window;
std::string m_filepath;
std::atomic<bool> reset_requested;

View File

@ -8,6 +8,8 @@
#include "core/frontend/input.h"
#include "core/settings.h"
namespace Frontend {
class EmuWindow::TouchState : public Input::Factory<Input::TouchDevice>,
public std::enable_shared_from_this<TouchState> {
public:
@ -156,3 +158,5 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height)
}
NotifyFramebufferLayoutChanged(layout);
}
} // namespace Frontend

View File

@ -10,6 +10,8 @@
#include "common/common_types.h"
#include "core/frontend/framebuffer_layout.h"
namespace Frontend {
/**
* Abstraction class used to provide an interface between emulation code and the frontend
* (e.g. SDL, QGLWidget, GLFW, etc...).
@ -166,3 +168,5 @@ private:
*/
std::tuple<unsigned, unsigned> ClipToTouchScreen(unsigned new_x, unsigned new_y) const;
};
} // namespace Frontend

View File

@ -9,7 +9,7 @@
#include "video_core/swrasterizer/swrasterizer.h"
#include "video_core/video_core.h"
RendererBase::RendererBase(EmuWindow& window) : render_window{window} {}
RendererBase::RendererBase(Frontend::EmuWindow& window) : render_window{window} {}
RendererBase::~RendererBase() = default;
void RendererBase::UpdateCurrentFramebufferLayout() {
const Layout::FramebufferLayout& layout = render_window.GetFramebufferLayout();

View File

@ -9,14 +9,16 @@
#include "core/core.h"
#include "video_core/rasterizer_interface.h"
namespace Frontend {
class EmuWindow;
}
class RendererBase : NonCopyable {
public:
/// Used to reference a framebuffer
enum kFramebuffer { kFramebuffer_VirtualXFB = 0, kFramebuffer_EFB, kFramebuffer_Texture };
explicit RendererBase(EmuWindow& window);
explicit RendererBase(Frontend::EmuWindow& window);
virtual ~RendererBase();
/// Swap buffers (render frame)
@ -46,18 +48,18 @@ public:
return rasterizer.get();
}
EmuWindow& GetRenderWindow() {
Frontend::EmuWindow& GetRenderWindow() {
return render_window;
}
const EmuWindow& GetRenderWindow() const {
const Frontend::EmuWindow& GetRenderWindow() const {
return render_window;
}
void RefreshRasterizerSetting();
protected:
EmuWindow& render_window; ///< Reference to the render window handle.
Frontend::EmuWindow& render_window; ///< Reference to the render window handle.
std::unique_ptr<VideoCore::RasterizerInterface> rasterizer;
f32 m_current_fps = 0.0f; ///< Current framerate, should be set by the renderer
int m_current_frame = 0; ///< Current frame, should be set by the renderer

View File

@ -43,7 +43,7 @@ static bool IsVendorAmd() {
return gpu_vendor == "ATI Technologies Inc." || gpu_vendor == "Advanced Micro Devices, Inc.";
}
RasterizerOpenGL::RasterizerOpenGL(EmuWindow& window)
RasterizerOpenGL::RasterizerOpenGL(Frontend::EmuWindow& window)
: is_amd(IsVendorAmd()), shader_dirty(true),
vertex_buffer(GL_ARRAY_BUFFER, VERTEX_BUFFER_SIZE, is_amd),
uniform_buffer(GL_UNIFORM_BUFFER, UNIFORM_BUFFER_SIZE, false),

View File

@ -29,14 +29,17 @@
#include "video_core/renderer_opengl/pica_to_gl.h"
#include "video_core/shader/shader.h"
namespace Frontend {
class EmuWindow;
}
class ShaderProgramManager;
namespace OpenGL {
class RasterizerOpenGL : public VideoCore::RasterizerInterface {
public:
explicit RasterizerOpenGL(EmuWindow& renderer);
explicit RasterizerOpenGL(Frontend::EmuWindow& renderer);
~RasterizerOpenGL() override;
void AddTriangle(const Pica::Shader::OutputVertex& v0, const Pica::Shader::OutputVertex& v1,
@ -261,7 +264,7 @@ private:
RasterizerCacheOpenGL res_cache;
EmuWindow& emu_window;
Frontend::EmuWindow& emu_window;
std::vector<HardwareVertex> vertex_batch;

View File

@ -93,7 +93,7 @@ static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, cons
return matrix;
}
RendererOpenGL::RendererOpenGL(EmuWindow& window) : RendererBase{window} {}
RendererOpenGL::RendererOpenGL(Frontend::EmuWindow& window) : RendererBase{window} {}
RendererOpenGL::~RendererOpenGL() = default;
/// Swap buffers (render frame)

View File

@ -38,7 +38,7 @@ struct ScreenInfo {
class RendererOpenGL : public RendererBase {
public:
explicit RendererOpenGL(EmuWindow& window);
explicit RendererOpenGL(Frontend::EmuWindow& window);
~RendererOpenGL() override;
/// Swap buffers (render frame)

View File

@ -33,7 +33,7 @@ Layout::FramebufferLayout g_screenshot_framebuffer_layout;
Memory::MemorySystem* g_memory;
/// Initialize the video core
Core::System::ResultStatus Init(EmuWindow& emu_window, Memory::MemorySystem& memory) {
Core::System::ResultStatus Init(Frontend::EmuWindow& emu_window, Memory::MemorySystem& memory) {
g_memory = &memory;
Pica::Init();

View File

@ -9,7 +9,10 @@
#include "core/core.h"
#include "core/frontend/emu_window.h"
namespace Frontend {
class EmuWindow;
}
class RendererBase;
namespace Memory {
@ -40,7 +43,7 @@ extern Layout::FramebufferLayout g_screenshot_framebuffer_layout;
extern Memory::MemorySystem* g_memory;
/// Initialize the video core
Core::System::ResultStatus Init(EmuWindow& emu_window, Memory::MemorySystem& memory);
Core::System::ResultStatus Init(Frontend::EmuWindow& emu_window, Memory::MemorySystem& memory);
/// Shutdown the video core
void Shutdown();