diff --git a/external/parallel-rdp/ParallelRDPWrapper.cpp b/external/parallel-rdp/ParallelRDPWrapper.cpp index ff792b76..7da8359e 100644 --- a/external/parallel-rdp/ParallelRDPWrapper.cpp +++ b/external/parallel-rdp/ParallelRDPWrapper.cpp @@ -23,8 +23,7 @@ Program *fullscreen_quad_program; // Copied and modified from WSI::init_context_from_platform Util::IntrusivePtr InitVulkanContext(WSIPlatform *platform, unsigned num_thread_indices, - const Context::SystemHandles &system_handles, - InstanceFactory *instance_factory) { + const Context::SystemHandles &system_handles) { VK_ASSERT(platform); auto instance_ext = platform->get_instance_extensions(); auto device_ext = platform->get_device_extensions(); @@ -33,9 +32,6 @@ Util::IntrusivePtr InitVulkanContext(WSIPlatform *platform, unsigned nu new_context->set_application_info(platform->get_application_info()); new_context->set_num_thread_indices(num_thread_indices); new_context->set_system_handles(system_handles); - if (instance_factory) { - new_context->set_instance_factory(instance_factory); - } if (!new_context->init_instance(instance_ext.data(), instance_ext.size(), CONTEXT_CREATION_ENABLE_ADVANCED_WSI_BIT)) { Util::panic("Failed to create Vulkan instance.\n"); @@ -57,8 +53,7 @@ Util::IntrusivePtr InitVulkanContext(WSIPlatform *platform, unsigned nu return new_context; } -void ParallelRDP::LoadWSIPlatform(const std::shared_ptr &instanceFactory, - const std::shared_ptr &wsi_platform, +void ParallelRDP::LoadWSIPlatform(const std::shared_ptr &wsi_platform, const std::shared_ptr &newWindowInfo) { wsi = std::make_shared(); wsi->set_backbuffer_srgb(false); @@ -66,7 +61,7 @@ void ParallelRDP::LoadWSIPlatform(const std::shared_ptr &instan wsi->set_present_mode(PresentMode::SyncToVBlank); Context::SystemHandles handles; - if (!wsi->init_from_existing_context(InitVulkanContext(wsi_platform.get(), 1, handles, instanceFactory.get()))) { + if (!wsi->init_from_existing_context(InitVulkanContext(wsi_platform.get(), 1, handles))) { Util::panic("Failed to initialize WSI: init_from_existing_context() failed"); } @@ -83,7 +78,7 @@ void ParallelRDP::LoadWSIPlatform(const std::shared_ptr &instan void ParallelRDP::Init(const std::shared_ptr &wsiPlatform, const std::shared_ptr &newWindowInfo, const u8 *rdram) { - LoadWSIPlatform(nullptr, wsiPlatform, newWindowInfo); + LoadWSIPlatform(wsiPlatform, newWindowInfo); ResourceLayout vertLayout; ResourceLayout fragLayout; diff --git a/external/parallel-rdp/ParallelRDPWrapper.hpp b/external/parallel-rdp/ParallelRDPWrapper.hpp index b69af360..6c1968af 100644 --- a/external/parallel-rdp/ParallelRDPWrapper.hpp +++ b/external/parallel-rdp/ParallelRDPWrapper.hpp @@ -34,8 +34,7 @@ public: std::shared_ptr windowInfo; private: - void LoadWSIPlatform(const std::shared_ptr &, const std::shared_ptr &, - const std::shared_ptr &); + void LoadWSIPlatform(const std::shared_ptr &, const std::shared_ptr &); void DrawFullscreenTexturedQuad(Util::IntrusivePtr, Util::IntrusivePtr) const; void UpdateScreen(Util::IntrusivePtr) const; }; diff --git a/src/backend/core/mmio/Audio.cpp b/src/backend/core/mmio/Audio.cpp index b019de1d..55829055 100644 --- a/src/backend/core/mmio/Audio.cpp +++ b/src/backend/core/mmio/Audio.cpp @@ -1,7 +1,6 @@ #include -#include -#include #include +#include namespace n64 { #define AUDIO_SAMPLE_RATE 44100 diff --git a/src/backend/core/mmio/Audio.hpp b/src/backend/core/mmio/Audio.hpp index f6b29aea..a2bc8301 100644 --- a/src/backend/core/mmio/Audio.hpp +++ b/src/backend/core/mmio/Audio.hpp @@ -1,6 +1,6 @@ #pragma once #include -#include +#include namespace n64 { struct AudioDevice { diff --git a/src/frontend/InputSettings.cpp b/src/frontend/InputSettings.cpp index cf5dc268..66a1f6ee 100644 --- a/src/frontend/InputSettings.cpp +++ b/src/frontend/InputSettings.cpp @@ -1,8 +1,6 @@ #include #include -#include -#include -#include +#include InputSettings::InputSettings(nlohmann::json &settings) : settings(settings) { for(auto& kb : kbButtons) { diff --git a/src/frontend/InputSettings.hpp b/src/frontend/InputSettings.hpp index c6a6d3fb..2f5f4be6 100644 --- a/src/frontend/InputSettings.hpp +++ b/src/frontend/InputSettings.hpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include class InputSettings final { bool grabbing = false; diff --git a/src/frontend/KaizenGui.hpp b/src/frontend/KaizenGui.hpp index adc22054..eb1b284b 100644 --- a/src/frontend/KaizenGui.hpp +++ b/src/frontend/KaizenGui.hpp @@ -1,9 +1,9 @@ #pragma once +#include #include #include #include #include -#include #include #include @@ -14,10 +14,10 @@ public: double fpsCounter; gui::MenuBar menuBar; gui::MenuItem actionPause{"Pause"}, actionStop{"Stop"}, actionReset{"Reset"}; - std::shared_ptr core; - EmuThread emuThread; SettingsWindow settingsWindow; + std::shared_ptr core; RenderWidget vulkanWidget; + EmuThread emuThread; int run(); void LoadTAS(const std::string &path) const noexcept; @@ -28,5 +28,4 @@ private: std::function emuExitFunc; gui::PopupWindow about{"About Kaizen"}; gui::StatusBar statusBar{}; - bool textPauseToggle = false; }; diff --git a/src/frontend/NativeWindow.hpp b/src/frontend/NativeWindow.hpp index 09684b4d..d4213d6c 100644 --- a/src/frontend/NativeWindow.hpp +++ b/src/frontend/NativeWindow.hpp @@ -1,18 +1,22 @@ #pragma once -#include -#include +#include #include +#include namespace gui { struct NativeWindow { NativeWindow(const std::string& title, int w, int h, int posX = SDL_WINDOWPOS_CENTERED, int posY = SDL_WINDOWPOS_CENTERED) { SDL_Init(SDL_INIT_VIDEO); - window = std::make_shared(SDL_CreateWindow(title.c_str(), w, h, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY)); + window = SDL_CreateWindow(title.c_str(), w, h, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY); + } + + ~NativeWindow() { + SDL_DestroyWindow(window); } void setTitle(const std::string& v) { title = v; } - const std::shared_ptr& getHandle() { return window; } + SDL_Window* getHandle() { return window; } private: - std::shared_ptr window; + SDL_Window* window; std::string title; }; } \ No newline at end of file diff --git a/src/frontend/RenderWidget.cpp b/src/frontend/RenderWidget.cpp index 24de5f31..41272655 100644 --- a/src/frontend/RenderWidget.cpp +++ b/src/frontend/RenderWidget.cpp @@ -1,9 +1,9 @@ #include #include #include -#include +#include -RenderWidget::RenderWidget(const std::shared_ptr &core, const std::shared_ptr& window) { +RenderWidget::RenderWidget(const std::shared_ptr &core, SDL_Window* window) { if (!Vulkan::Context::init_loader(nullptr)) { Util::panic("Could not initialize Vulkan ICD"); } diff --git a/src/frontend/RenderWidget.hpp b/src/frontend/RenderWidget.hpp index 663c424d..c26538b1 100644 --- a/src/frontend/RenderWidget.hpp +++ b/src/frontend/RenderWidget.hpp @@ -22,7 +22,7 @@ private: class ImGuiWSIPlatform final : public Vulkan::WSIPlatform { public: - explicit ImGuiWSIPlatform(const std::shared_ptr &core, const std::shared_ptr &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(); @@ -38,7 +38,7 @@ public: } VkSurfaceKHR create_surface(VkInstance instance, VkPhysicalDevice pDevice) override { - SDL_Vulkan_CreateSurface(window.get(), instance, nullptr, &surface); + SDL_Vulkan_CreateSurface(window, instance, nullptr, &surface); return surface; } @@ -62,7 +62,7 @@ public: VkApplicationInfo appInfo{.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .apiVersion = VK_API_VERSION_1_3}; - std::shared_ptr window{}; + SDL_Window* window{}; VkSurfaceKHR surface; private: std::shared_ptr core; @@ -73,7 +73,7 @@ private: class RenderWidget final { public: - explicit RenderWidget(const std::shared_ptr &, const std::shared_ptr&); + explicit RenderWidget(const std::shared_ptr &, SDL_Window*); std::shared_ptr windowInfo; std::shared_ptr wsiPlatform; diff --git a/src/frontend/SettingsWindow.hpp b/src/frontend/SettingsWindow.hpp index 160570f3..a962f314 100644 --- a/src/frontend/SettingsWindow.hpp +++ b/src/frontend/SettingsWindow.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include class SettingsWindow final {