From 40904ab35c1eafd28df2d13e676c9529d580ce5d Mon Sep 17 00:00:00 2001 From: BroGamer <64546358+BroGamer4256@users.noreply.github.com> Date: Tue, 16 Aug 2022 02:56:16 +1200 Subject: [PATCH] Maybe fix gh actions --- .gitmodules | 3 +++ Makefile | 2 +- mingw-std-threads | 1 + src/card.cpp | 9 +++++---- 4 files changed, 10 insertions(+), 5 deletions(-) create mode 160000 mingw-std-threads diff --git a/.gitmodules b/.gitmodules index 7b87da7..f5e14da 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "tomlc99"] path = tomlc99 url = https://github.com/cktan/tomlc99 +[submodule "mingw-std-threads"] + path = mingw-std-threads + url = https://github.com/meganz/mingw-std-threads diff --git a/Makefile b/Makefile index 054e386..11dfa24 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ SDL_TARGET := x86_64-w64-mingw32 SRC = src/dllmain.c src/helpers.c src/poll.c src/boilerplate.c src/card.cpp tomlc99/toml.c minhook/src/buffer.c minhook/src/hook.c minhook/src/trampoline.c minhook/src/hde/hde32.c minhook/src/hde/hde64.c OBJ = ${addprefix ${TARGET}/,${subst .cpp,.o,${SRC:.c=.o}}} CFLAGS = -std=c99 -Iminhook/include -ISDL/${SDL_TARGET}/include -ISDL/include -Itomlc99 -Wall -Ofast -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=_WIN32_WINNT_WIN7 -CXXFLAGS = -std=c++17 -Iminhook/include -ISDL/${SDL_TARGET}/include -ISDL/include -Itomlc99 -Wall -Ofast -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=_WIN32_WINNT_WIN7 +CXXFLAGS = -std=c++17 -Imingw-std-threads -Iminhook/include -ISDL/${SDL_TARGET}/include -ISDL/include -Itomlc99 -Wall -Ofast -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=_WIN32_WINNT_WIN7 LDFLAGS := -shared -static -static-libgcc -s LIBS := SDL/${SDL_TARGET}/build/.libs/libSDL2.a SDL/${SDL_TARGET}/build/.libs/libSDL2main.a -lmingw32 -luuid -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lsetupapi -lversion -pthread DEPS = SDL diff --git a/mingw-std-threads b/mingw-std-threads new file mode 160000 index 0000000..6c2061b --- /dev/null +++ b/mingw-std-threads @@ -0,0 +1 @@ +Subproject commit 6c2061b7da41d6aa1b2162ff4383ec3ece864bc6 diff --git a/src/card.cpp b/src/card.cpp index 8d5121d..7c8e4d2 100644 --- a/src/card.cpp +++ b/src/card.cpp @@ -1,12 +1,13 @@ #include "card.h" +#include "mingw.thread.h" #include using namespace std::chrono_literals; void attach (callbackAttach callback, i32 *data) { - std::thread t ([callback, data] () { - std::this_thread::sleep_for (250ms); + mingw_stdthread::thread t ([callback, data] () { + mingw_stdthread::this_thread::sleep_for (250ms); callback (0, 0, data); }); t.detach (); @@ -14,8 +15,8 @@ attach (callbackAttach callback, i32 *data) { void touch (callbackTouch callback, u64 data) { - std::thread t ([callback, data] () { - std::this_thread::sleep_for (250ms); + mingw_stdthread::thread t ([callback, data] () { + mingw_stdthread::this_thread::sleep_for (250ms); u8 cardData[168] = { 0x01, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x2E, 0x58, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x5C, 0x97, 0x44, 0xF0, 0x88, 0x04, 0x00, 0x43, 0x26, 0x2C, 0x33, 0x00, 0x04,