Fix Windows

This commit is contained in:
CocoSimone
2022-08-04 21:52:18 +02:00
parent c448143432
commit 23ebc1edc1
4 changed files with 20 additions and 10 deletions

View File

@@ -2,7 +2,8 @@ cmake_minimum_required(VERSION 3.20)
project(imgui) project(imgui)
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
find_package(Vulkan REQUIRED FATAL_ERROR) find_package(PkgConfig REQUIRED)
pkg_search_module(Vulkan REQUIRED vulkan)
add_library(imgui add_library(imgui
imgui/imgui_demo.cpp imgui/imgui_demo.cpp
@@ -18,5 +19,5 @@ add_library(imgui
imgui/backends/imgui_impl_vulkan.h imgui/backends/imgui_impl_vulkan.h
imgui/backends/imgui_impl_vulkan.cpp) 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) target_include_directories(imgui PUBLIC ${SDL2_INCLUDE_DIRS} imgui imgui/backends)

View File

@@ -63,6 +63,15 @@
# include <winsock2.h> # include <winsock2.h>
# include <sys/param.h> # include <sys/param.h>
#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 # if BYTE_ORDER == LITTLE_ENDIAN
# define htobe16(x) htons(x) # define htobe16(x) htons(x)

View File

@@ -7,29 +7,29 @@
namespace util { namespace util {
enum MessageType : u8 { enum MessageType : u8 {
INFO, WARN, ERROR Info, Warn, Error
}; };
template <MessageType messageType = INFO, typename ...Args> template <MessageType messageType = Info, typename ...Args>
constexpr void print(const std::string& fmt, Args... args) { 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...); fmt::print(fmt::emphasis::bold | fg(fmt::color::red), fmt, args...);
exit(-1); exit(-1);
} else if constexpr(messageType == WARN) { } else if constexpr(messageType == Warn) {
fmt::print(fg(fmt::color::yellow), fmt, args...); fmt::print(fg(fmt::color::yellow), fmt, args...);
} else if constexpr(messageType == INFO) { } else if constexpr(messageType == Info) {
fmt::print(fmt, args...); fmt::print(fmt, args...);
} }
} }
template <typename ...Args> template <typename ...Args>
constexpr void panic(const std::string& fmt, Args... args) { constexpr void panic(const std::string& fmt, Args... args) {
print<ERROR>(fmt, args...); print<Error>(fmt, args...);
} }
template <typename ...Args> template <typename ...Args>
constexpr void warn(const std::string& fmt, Args... args) { constexpr void warn(const std::string& fmt, Args... args) {
print<WARN>(fmt, args...); print<Warn>(fmt, args...);
} }
template <typename ...Args> template <typename ...Args>

View File

@@ -367,7 +367,7 @@ void Window::Update(std::unique_ptr<BaseCore>& core) {
if(ImGui::BeginMenu("Open")) { if(ImGui::BeginMenu("Open")) {
if(ImGui::MenuItem("Nintendo 64")) { if(ImGui::MenuItem("Nintendo 64")) {
nfdchar_t* outpath; 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); nfdresult_t result = NFD_OpenDialog(&outpath, &filter, 1, nullptr);
if(result == NFD_OKAY) { if(result == NFD_OKAY) {
core = std::make_unique<n64::Core>(outpath); core = std::make_unique<n64::Core>(outpath);