From fa6af27248ec1fcbfdec433ea16154b7bdae045f Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 5 Jun 2022 16:17:32 +0200 Subject: fix windows compatibility --- client/makefile | 4 +++- client/serial_win32.c | 19 +++++++++++++++---- client/time_windows.c | 15 +++++++++++++++ scripts/install-mingw-packages.sh | 2 +- scripts/patch-june-5.sh | 3 +++ 5 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 client/time_windows.c create mode 100644 scripts/patch-june-5.sh diff --git a/client/makefile b/client/makefile index e48eaeb..a23ce4f 100644 --- a/client/makefile +++ b/client/makefile @@ -13,13 +13,15 @@ SOURCES := $(wildcard *.c) HEADERS := $(wildcard *.h) include ../shared/makefile +CFLAGS += $(if $(WIN32),-I/mingw64/include/ncursesw,) + OBJECTS := $(patsubst %.c,%.o, $(SOURCES)) .o: $(CC) -c $(CFLAGS) $< $(EXECNAME): $(OBJECTS) - $(CC) $(LDFLAGS) $(OBJECTS) -o $(EXECNAME) + $(CC) $(OBJECTS) -o $(EXECNAME) $(LDFLAGS) clean:: $(RM) $(EXECNAME) *.o diff --git a/client/serial_win32.c b/client/serial_win32.c index 9406a34..edc9db1 100644 --- a/client/serial_win32.c +++ b/client/serial_win32.c @@ -2,9 +2,20 @@ #include "serial.h" -bool w2_serial_read(uint8_t *target, uint8_t bytes); -bool w2_serial_write(uint8_t *target, uint8_t bytes); -void w2_serial_open(); -void w2_serial_close(); +int w2_serial_read() { + return 0x00; +} + +bool w2_serial_write(char *data, uint8_t length) { + return true; +} + +bool w2_serial_open(const char *port_name) { + return true; +} + +void w2_serial_close() { + return; +} #endif diff --git a/client/time_windows.c b/client/time_windows.c new file mode 100644 index 0000000..f9082d6 --- /dev/null +++ b/client/time_windows.c @@ -0,0 +1,15 @@ +#ifdef W2_HOST_WIN32 + +#include "time.h" + +unsigned long w2_get_time() { + return 0; +} + +void w2_timer_start(w2_e_client_timers label) { g_w2_client_timers[label] = w2_get_time(); } + +unsigned long w2_timer_end(w2_e_client_timers label) { + return w2_get_time() - g_w2_client_timers[label]; +} + +#endif diff --git a/scripts/install-mingw-packages.sh b/scripts/install-mingw-packages.sh index fd82909..e1c000c 100644 --- a/scripts/install-mingw-packages.sh +++ b/scripts/install-mingw-packages.sh @@ -1,2 +1,2 @@ #!/bin/sh -pacman --noconfirm -Sy make git unzip mingw-w64-x86_64-avr-toolchain mingw-w64-x86_64-toolchain mingw-w64-clang-x86_64-clang mingw-w64-x86_64-avrdude python3 python3-pip +pacman --noconfirm -Sy make git unzip mingw-w64-x86_64-avr-toolchain mingw-w64-x86_64-toolchain mingw-w64-clang-x86_64-clang mingw-w64-x86_64-avrdude python3 python3-pip ncurses mingw-w64-x86_64-ncurses diff --git a/scripts/patch-june-5.sh b/scripts/patch-june-5.sh new file mode 100644 index 0000000..cad705a --- /dev/null +++ b/scripts/patch-june-5.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +pacman --noconfirm -Sy ncurses mingw-w64-x86_64-ncurses -- cgit v1.2.3