Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,10 @@ if(FASTLOG)
add_definitions(-DDEBUGFAST)
endif()

if (MINGW)
add_definitions(-D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00)
endif()

if(ENABLE_VTUNE)
set(VTUNE_DIR "/opt/intel/vtune_amplifier")
add_definitions(-DUSE_VTUNE)
Expand Down Expand Up @@ -769,8 +773,11 @@ else()
message(STATUS "libsystemd not found, disabling traversal server watchdog support")
endif()

if (WIN32)
if (MSVC)
include_directories(Externals/WIL/include)
endif()

if (WIN32)
include_directories(Externals/OpenAL/include)
endif()

Expand Down
2 changes: 1 addition & 1 deletion Externals/libiconv-1.14/lib/loop_wchar.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# include <wchar.h>
# define BUF_SIZE 64 /* assume MB_LEN_MAX <= 64 */
/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
extern size_t mbrtowc ();
extern size_t mbrtowc(wchar_t *restrict, const char *restrict, size_t, mbstate_t *restrict);
# ifdef mbstate_t
# define mbrtowc(pwc, s, n, ps) (mbrtowc)(pwc, s, n, 0)
# define mbsinit(ps) 1
Expand Down
4 changes: 4 additions & 0 deletions Externals/liblzma/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ endif()
add_definitions(-DHAVE_CONFIG_H)
add_definitions(-DLZMA_API_STATIC)

if(NOT MINGW)
add_definitions(-DHAVE_WCWIDTH=1)
endif()

#============================================================================
# lzma
#============================================================================
Expand Down
2 changes: 1 addition & 1 deletion Externals/liblzma/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
#define HAVE_VISIBILITY 1

/* Define to 1 if you have the `wcwidth' function. */
#define HAVE_WCWIDTH 1
//#define HAVE_WCWIDTH 1

/* Define to 1 if the system has the type `_Bool'. */
#define HAVE__BOOL 1
Expand Down
2 changes: 1 addition & 1 deletion Externals/libusb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ add_library(usb STATIC EXCLUDE_FROM_ALL
dolphin_disable_warnings(usb)

set_target_properties(usb PROPERTIES VERSION 1.0.26)
if(WIN32)
if(MSVC)
target_include_directories(usb BEFORE PUBLIC libusb/libusb PRIVATE libusb/msvc)
else()
target_include_directories(usb
Expand Down
4 changes: 4 additions & 0 deletions Externals/watcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ add_library(watcher INTERFACE IMPORTED GLOBAL)
set_target_properties(watcher PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/watcher/include
)

if (MINGW)
target_compile_options(watcher INTERFACE -fexceptions)
endif()
7 changes: 6 additions & 1 deletion Source/Core/AudioCommon/AudioCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include "AudioCommon/OpenALStream.h"
#include "AudioCommon/OpenSLESStream.h"
#include "AudioCommon/PulseAudioStream.h"
#ifdef _MSC_VER
#include "AudioCommon/WASAPIStream.h"
#endif
#include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
#include "Common/TimeUtil.h"
Expand All @@ -40,8 +42,10 @@ static std::unique_ptr<SoundStream> CreateSoundStreamForBackend(std::string_view
return std::make_unique<PulseAudio>();
else if (backend == BACKEND_OPENSLES && OpenSLESStream::IsValid())
return std::make_unique<OpenSLESStream>();
#ifdef _MSC_VER
else if (backend == BACKEND_WASAPI && WASAPIStream::IsValid())
return std::make_unique<WASAPIStream>();
#endif
return {};
}

Expand Down Expand Up @@ -129,9 +133,10 @@ std::vector<std::string> GetSoundBackends()
backends.emplace_back(BACKEND_OPENAL);
if (OpenSLESStream::IsValid())
backends.emplace_back(BACKEND_OPENSLES);
#ifdef _MSC_VER
if (WASAPIStream::IsValid())
backends.emplace_back(BACKEND_WASAPI);

#endif
return backends;
}

Expand Down
4 changes: 4 additions & 0 deletions Source/Core/AudioCommon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ if(WIN32)
# Dolphin loads openal32.dll at runtime
OpenALStream.cpp
OpenALStream.h
)
endif()

if(MSVC)
target_sources(audiocommon PRIVATE
WASAPIStream.cpp
WASAPIStream.h
)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/AudioCommon/CubebStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Core/Config/MainSettings.h"

#ifdef _WIN32
#include <Objbase.h>
#include <objbase.h>
#endif

// ~10 ms - needs to be at least 240 for surround
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/AudioCommon/CubebUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <cubeb/cubeb.h>

#ifdef _WIN32
#include <Objbase.h>
#include <objbase.h>
#endif

static void LogCallback(const char* format, ...)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/AudioCommon/WASAPIStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifdef _WIN32

// clang-format off
#include <Windows.h>
#include <windows.h>
#include <mmreg.h>
#include <objbase.h>
#include <wil/resource.h>
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/Arm64Emitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "Common/SmallVector.h"

#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#endif
#ifdef __APPLE__
#include <libkern/OSCacheControl.h>
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/ArmCPUDetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifdef __APPLE__
#include <sys/sysctl.h>
#elif defined(_WIN32)
#include <Windows.h>
#include <windows.h>
#include <arm64intr.h>
#include "Common/WindowsRegistry.h"
#elif defined(__linux__)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/CommonFuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#ifdef _WIN32
#include <windows.h>
#include <SetupAPI.h>
#include <setupapi.h>

#define strerror_r(err, buf, len) strerror_s(buf, len, err)

Expand Down
7 changes: 7 additions & 0 deletions Source/Core/Common/CommonFuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

#include <optional>
#include <string>
#ifdef __MINGW32__
#include <sys/stat.h>
#endif

#include "Common/CommonTypes.h"

Expand All @@ -27,8 +30,12 @@
#define fseeko _fseeki64
#define ftello _ftelli64
#define atoll _atoi64
#ifndef stat
#define stat _stat64
#endif
#ifndef fstat
#define fstat _fstat64
#endif
#define fileno _fileno

extern "C" {
Expand Down
38 changes: 38 additions & 0 deletions Source/Core/Common/CommonTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

#ifdef _WIN32
#include <tchar.h>
#if defined(__MINGW32__)
#include <windows.h>
#include <string>
#endif
#else
// For using Windows lock code
#define TCHAR char
Expand All @@ -34,3 +38,37 @@ using DT = Clock::duration;
using DT_us = std::chrono::duration<double, std::micro>;
using DT_ms = std::chrono::duration<double, std::milli>;
using DT_s = std::chrono::duration<double, std::ratio<1>>;
#if defined(__MINGW32__)
namespace winrt
{
struct hresult
{
HRESULT value;
constexpr hresult(HRESULT v = 0) noexcept : value(v) {}
constexpr operator HRESULT() const noexcept { return value; }
};

struct hresult_error
{
HRESULT m_hr;
explicit hresult_error(HRESULT hr) : m_hr(hr) {}
HRESULT code() const noexcept { return m_hr; }

std::string message() const noexcept
{
return "HRESULT 0x" + std::to_string(static_cast<unsigned long>(m_hr));
}
};

inline void check_hresult(HRESULT hr) noexcept
{
if (FAILED(hr))
std::abort();
}

inline std::string to_string(const std::string& s)
{
return s;
}
} // namespace winrt
#endif
2 changes: 1 addition & 1 deletion Source/Core/Common/CompatPatches.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2008 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#include <Windows.h>
#include <windows.h>
#include <functional>
#include <optional>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/DynamicLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "Common/Assert.h"

#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#else
#include <dlfcn.h>
#endif
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/FileSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "Common/StringUtil.h"

#ifdef _MSC_VER
#include <Windows.h>
#include <windows.h>
#else
#ifdef ANDROID
#include "jni/AndroidCommon/AndroidCommon.h"
Expand Down
7 changes: 5 additions & 2 deletions Source/Core/Common/FileUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@
#include "Common/StringUtil.h"

#ifdef _WIN32
#include <Windows.h>
#include <Shlwapi.h>
#include <windows.h>
#include <shlwapi.h>
#include <commdlg.h> // for GetSaveFileName
#include <direct.h> // getcwd
#include <io.h>
#include <objbase.h> // guid stuff
#include <shellapi.h>
#ifdef __MINGW32__
#include <share.h>
#endif
#else
#include <dirent.h>
#include <errno.h>
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Common/HRWrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
#include <fmt/format.h>
#include <string>
#include <winerror.h>
#ifdef _MSC_VER
#include <winrt/base.h>

#endif
#include "Common/CommonTypes.h"

namespace Common
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/Common/IOFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

#include "Common/CommonFuncs.h"
#include "Common/StringUtil.h"
#ifdef __MINGW32__
#include <share.h>
#endif
#else
#include <unistd.h>
#endif
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/LdrWatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "Common/LdrWatcher.h"

#include <Windows.h>
#include <windows.h>
#include <TlHelp32.h>
#include <string>
#include <winternl.h>
Expand Down
Loading