Dynload winmm, which is weird but it fixes vs2022 builds
This commit is contained in:
parent
6f976ae0ce
commit
9856979906
5 changed files with 28 additions and 3 deletions
|
|
@ -85,7 +85,7 @@ if(MW_TRY_VULKAN)
|
||||||
if(${Vulkan_FOUND})
|
if(${Vulkan_FOUND})
|
||||||
set(MW_BUILD_VULKAN ON)
|
set(MW_BUILD_VULKAN ON)
|
||||||
message(STATUS "Vulkan widget has been enabled")
|
message(STATUS "Vulkan widget has been enabled")
|
||||||
else()
|
else(
|
||||||
message(WARNING "Vulkan widget has been disabled")
|
message(WARNING "Vulkan widget has been disabled")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -471,6 +471,12 @@ if(MW_BUILD_VULKAN)
|
||||||
PRIVATE
|
PRIVATE
|
||||||
MW_VULKAN
|
MW_VULKAN
|
||||||
)
|
)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(
|
||||||
|
Mw
|
||||||
|
PRIVATE
|
||||||
|
MW_VULKAN_NO_INCLUDE
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
|
|
|
||||||
|
|
@ -363,6 +363,12 @@ MWDECL int (*MwFLTextHeightWithText)(MwFLFont ttf, const char* text);
|
||||||
MWDECL void* (*MwFLFontLoad)(unsigned char* data, unsigned int size, int px);
|
MWDECL void* (*MwFLFontLoad)(unsigned char* data, unsigned int size, int px);
|
||||||
MWDECL void (*MwFLFontFree)(void* handle);
|
MWDECL void (*MwFLFontFree)(void* handle);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
void *MwLL_winmmLib;
|
||||||
|
long (__stdcall* MwLL_PFN_timeGetTime)(void);
|
||||||
|
unsigned int (__stdcall* MwLL_PFN_timeBeginPeriod)(unsigned int period);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#ifdef _MILSKO
|
#ifdef _MILSKO
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
|
#include <timeapi.h>
|
||||||
#ifndef GWLP_USERDATA
|
#ifndef GWLP_USERDATA
|
||||||
#define GWLP_USERDATA GWL_USERDATA
|
#define GWLP_USERDATA GWL_USERDATA
|
||||||
#define GWLP_WNDPROC GWL_WNDPROC
|
#define GWLP_WNDPROC GWL_WNDPROC
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
long MwTimeGetTick(void) {
|
long MwTimeGetTick(void) {
|
||||||
return timeGetTime();
|
return MwLL_PFN_timeGetTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwTimeSleep(int ms) {
|
void MwTimeSleep(int ms) {
|
||||||
|
|
|
||||||
14
src/core.c
14
src/core.c
|
|
@ -1090,7 +1090,19 @@ int MwLibraryInit(void) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
timeBeginPeriod(10);
|
/*
|
||||||
|
There's no Windows configuration that Milsko supports that doesn't have winmm.
|
||||||
|
However, uhh, Visual Studio 2022. For some fucking reason.
|
||||||
|
Thanks for coming to my TED Talk.
|
||||||
|
*/
|
||||||
|
char winmmPath[MAX_PATH] = {0};
|
||||||
|
GetSystemDirectory(winmmPath, MAX_PATH);
|
||||||
|
strcat_s(winmmPath, MAX_PATH, "\\winmm.dll");
|
||||||
|
MwLL_winmmLib = LoadLibraryA(winmmPath);
|
||||||
|
MwLL_PFN_timeGetTime = (void *)GetProcAddress(MwLL_winmmLib, "timeGetTime");
|
||||||
|
MwLL_PFN_timeBeginPeriod = (void *)GetProcAddress(MwLL_winmmLib, "timeBeginPeriod");
|
||||||
|
|
||||||
|
MwLL_PFN_timeBeginPeriod(10);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_WAYLAND
|
#ifdef USE_WAYLAND
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue