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 +++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 client/time_windows.c (limited to 'client') 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 -- cgit v1.2.3