diff --git a/external/cflags/CMakeLists.txt b/external/cflags/CMakeLists.txt index bf7cc8cf..9db269bf 100644 --- a/external/cflags/CMakeLists.txt +++ b/external/cflags/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.20 FATAL_ERROR) project( cflags @@ -118,4 +118,4 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) CXX_STANDARD_REQUIRED ON ) -endif() \ No newline at end of file +endif() diff --git a/src/frontend/EmuThread.hpp b/src/frontend/EmuThread.hpp index af61655c..260f46b3 100644 --- a/src/frontend/EmuThread.hpp +++ b/src/frontend/EmuThread.hpp @@ -1,6 +1,5 @@ #pragma once #include -#include #include #include #include @@ -9,14 +8,13 @@ namespace n64 { struct Core; } -class EmuThread final : public QThread { - Q_OBJECT +class EmuThread final { RenderWidget &renderWidget; public: - explicit EmuThread(const std::shared_ptr &, QLabel &, RenderWidget &, SettingsWindow &) noexcept; + explicit EmuThread(const std::shared_ptr &, RenderWidget &, SettingsWindow &) noexcept; - void run() noexcept override; + void run() noexcept; void TogglePause() const noexcept; void SetRender(bool v) const noexcept; void Reset() const noexcept; @@ -24,5 +22,4 @@ public: std::shared_ptr core; SettingsWindow &settings; - QLabel &fps; }; diff --git a/src/frontend/KaizenQt.hpp b/src/frontend/KaizenQt.hpp index 0f85162b..77e586c5 100644 --- a/src/frontend/KaizenQt.hpp +++ b/src/frontend/KaizenQt.hpp @@ -22,16 +22,11 @@ static CompositorCategory GetOSCompositorCategory() { return CompositorCategory::Windows; } -class KaizenQt : public QWidget { - Q_OBJECT +class KaizenQt { public: KaizenQt() noexcept; - void LoadTAS(const QString &path) const noexcept; - void LoadROM(const QString &path) const noexcept; - void dropEvent(QDropEvent *) override; - void dragEnterEvent(QDragEnterEvent *) override; - void keyPressEvent(QKeyEvent *) override; - void keyReleaseEvent(QKeyEvent *) override; + void LoadTAS(const std::string &path) const noexcept; + void LoadROM(const std::string &path) const noexcept; private: void Quit() const noexcept; diff --git a/src/frontend/RenderWidget.hpp b/src/frontend/RenderWidget.hpp index 2eb9036c..07f4df88 100644 --- a/src/frontend/RenderWidget.hpp +++ b/src/frontend/RenderWidget.hpp @@ -1,70 +1,53 @@ #pragma once #undef signals #include -#include -#include -#include -#include +#include +#include namespace n64 { struct Core; } -struct QtInstanceFactory final : Vulkan::InstanceFactory { +struct ImGuiInstanceFactory final : Vulkan::InstanceFactory { VkInstance create_instance(const VkInstanceCreateInfo *info) override { - handle.setApiVersion({1, 3, 0}); - QByteArrayList exts; - exts.resize(info->enabledExtensionCount); - for (int i = 0; i < info->enabledExtensionCount; i++) { - exts[i] = info->ppEnabledExtensionNames[i]; - } - - QByteArrayList layers; - layers.resize(info->enabledExtensionCount); - for (int i = 0; i < info->enabledLayerCount; i++) { - layers[i] = info->ppEnabledLayerNames[i]; - } - - handle.setExtensions(exts); - handle.setLayers(layers); - handle.setApiVersion({1, 3, 0}); - handle.create(); - - return handle.vkInstance(); } - QVulkanInstance handle; + VkInstance instance; }; -class QtParallelRdpWindowInfo final : public ParallelRDP::WindowInfo { +class ImGuiParallelRdpWindowInfo final : public ParallelRDP::WindowInfo { public: - explicit QtParallelRdpWindowInfo(QWindow *window) : window(window) {} + explicit ImGuiParallelRdpWindowInfo(SDL_Window *window) : window(window) {} CoordinatePair get_window_size() override { - return CoordinatePair{static_cast(window->width()), static_cast(window->height())}; + int w,h; + SDL_GetWindowSizeInPixels(window.get(), &w, &h); + return CoordinatePair{static_cast(w), static_cast(h)}; } private: - std::shared_ptr window{}; + std::shared_ptr window{}; }; -class QtWSIPlatform final : public Vulkan::WSIPlatform { +class ImGuiWSIPlatform final : public Vulkan::WSIPlatform { public: - explicit QtWSIPlatform(const std::shared_ptr &core, QWindow *window) : window(window), core(core) {} + explicit ImGuiWSIPlatform(const std::shared_ptr &core, SDL_Window *window) : window(window), core(core) {} std::vector get_instance_extensions() override { auto vec = std::vector(); - const auto &extensions = window->vulkanInstance()->supportedExtensions(); - vec.reserve(extensions.size()); + u32 extCount; + const auto &extensions = SDL_Vulkan_GetInstanceExtensions(&extCount); + vec.reserve(extCount); - for (const auto &[name, _] : extensions) { - vec.emplace_back(name); + for (u32 i = 0; i < extCount; i++) { + vec.emplace_back(extensions[i]); } return vec; } - VkSurfaceKHR create_surface(VkInstance, VkPhysicalDevice) override { - return QVulkanInstance::surfaceForWindow(window.get()); + VkSurfaceKHR create_surface(VkInstance instance, VkPhysicalDevice pDevice) override { + SDL_Vulkan_CreateSurface(window.get(), instance, nullptr, &surface); + return surface; } void destroy_surface(VkInstance, VkSurfaceKHR) override {} @@ -87,8 +70,8 @@ public: VkApplicationInfo appInfo{.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .apiVersion = VK_API_VERSION_1_3}; - std::shared_ptr window{}; - + std::shared_ptr window{}; + VkSurfaceKHR surface; private: std::shared_ptr core; SDL_Gamepad *gamepad{}; @@ -96,16 +79,12 @@ private: bool canPollEvents = true; }; -class RenderWidget final : public QWidget { +class RenderWidget final { public: - [[nodiscard]] VkInstance instance() const { return qtVkInstanceFactory->handle.vkInstance(); } + [[nodiscard]] VkInstance instance() const { return imGuiVkInstanceFactory->instance; } explicit RenderWidget(const std::shared_ptr &); - [[nodiscard]] QPaintEngine *paintEngine() const override { return nullptr; } std::shared_ptr windowInfo; - std::shared_ptr wsiPlatform; - std::shared_ptr qtVkInstanceFactory; -Q_SIGNALS: - void Show() { show(); } - void Hide() { hide(); } + std::shared_ptr wsiPlatform; + std::shared_ptr imGuiVkInstanceFactory; };