From 23ebc1edc1a4d8924c2290f962df1fecb77738ed Mon Sep 17 00:00:00 2001 From: CocoSimone Date: Thu, 4 Aug 2022 21:52:18 +0200 Subject: [PATCH] Fix Windows --- external/imgui/CMakeLists.txt | 5 +++-- external/portable_endian_bswap.h | 9 +++++++++ src/cores/util.hpp | 14 +++++++------- src/frontend/imgui/Window.cpp | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/external/imgui/CMakeLists.txt b/external/imgui/CMakeLists.txt index fca5fcf2..18356973 100644 --- a/external/imgui/CMakeLists.txt +++ b/external/imgui/CMakeLists.txt @@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.20) project(imgui) find_package(SDL2 REQUIRED) -find_package(Vulkan REQUIRED FATAL_ERROR) +find_package(PkgConfig REQUIRED) +pkg_search_module(Vulkan REQUIRED vulkan) add_library(imgui imgui/imgui_demo.cpp @@ -18,5 +19,5 @@ add_library(imgui imgui/backends/imgui_impl_vulkan.h imgui/backends/imgui_impl_vulkan.cpp) -target_link_libraries(imgui PUBLIC SDL2 ${Vulkan_LIBRARY}) +target_link_libraries(imgui PUBLIC SDL2 vulkan) target_include_directories(imgui PUBLIC ${SDL2_INCLUDE_DIRS} imgui imgui/backends) \ No newline at end of file diff --git a/external/portable_endian_bswap.h b/external/portable_endian_bswap.h index 66aaab49..101058ec 100644 --- a/external/portable_endian_bswap.h +++ b/external/portable_endian_bswap.h @@ -63,6 +63,15 @@ # include # include + +#if __BIG_ENDIAN__ + #define htonll(x) (x) + #define ntohll(x) (x) +#else + #define htonll(x) ((((uint64_t)htonl(x&0xFFFFFFFF)) << 32) + htonl(x >> 32)) + #define ntohll(x) ((((uint64_t)ntohl(x&0xFFFFFFFF)) << 32) + ntohl(x >> 32)) +#endif + # if BYTE_ORDER == LITTLE_ENDIAN # define htobe16(x) htons(x) diff --git a/src/cores/util.hpp b/src/cores/util.hpp index 19f96682..84b3dc73 100644 --- a/src/cores/util.hpp +++ b/src/cores/util.hpp @@ -7,29 +7,29 @@ namespace util { enum MessageType : u8 { - INFO, WARN, ERROR + Info, Warn, Error }; -template +template constexpr void print(const std::string& fmt, Args... args) { - if constexpr(messageType == ERROR) { + if constexpr(messageType == Error) { fmt::print(fmt::emphasis::bold | fg(fmt::color::red), fmt, args...); exit(-1); - } else if constexpr(messageType == WARN) { + } else if constexpr(messageType == Warn) { fmt::print(fg(fmt::color::yellow), fmt, args...); - } else if constexpr(messageType == INFO) { + } else if constexpr(messageType == Info) { fmt::print(fmt, args...); } } template constexpr void panic(const std::string& fmt, Args... args) { - print(fmt, args...); + print(fmt, args...); } template constexpr void warn(const std::string& fmt, Args... args) { - print(fmt, args...); + print(fmt, args...); } template diff --git a/src/frontend/imgui/Window.cpp b/src/frontend/imgui/Window.cpp index 5d06be43..2f613be6 100644 --- a/src/frontend/imgui/Window.cpp +++ b/src/frontend/imgui/Window.cpp @@ -367,7 +367,7 @@ void Window::Update(std::unique_ptr& core) { if(ImGui::BeginMenu("Open")) { if(ImGui::MenuItem("Nintendo 64")) { nfdchar_t* outpath; - const nfdnfilteritem_t filter {"Nintendo 64 roms", "n64,z64,v64,N64,Z64,V64"}; + const nfdu8filteritem_t filter {"Nintendo 64 roms", "n64,z64,v64,N64,Z64,V64"}; nfdresult_t result = NFD_OpenDialog(&outpath, &filter, 1, nullptr); if(result == NFD_OKAY) { core = std::make_unique(outpath);