diff --git a/.gitignore b/.gitignore
index aa12e67..ea51266 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,6 @@ build-*
*.user
*.o
-client/bin/
-client/obj/
-client/retired/
+bin/
+obj/
+retired/
diff --git a/client/Makefile.djgpp b/Makefile.djgpp
similarity index 87%
rename from client/Makefile.djgpp
rename to Makefile.djgpp
index ddd89ea..725b045 100644
--- a/client/Makefile.djgpp
+++ b/Makefile.djgpp
@@ -26,16 +26,15 @@ DEBUG = -g
## CHANGE THIS ##
TARGET = client
-SRCDIR = src
-SHARED = ../shared
+SRCDIR = .
OBJDIR = obj
BINDIR = bin
## CHANGE THIS ##
# CFLAGS, LDFLAGS, CPPFLAGS, PREFIX can be overriden on CLI
CFLAGS := $(DEBUG)
-CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/system -I$(SRCDIR)/dos -I$(SRCDIR)/gui -I$(SRCDIR)/thirdparty
-CFLAGS += -I$(SHARED) -I$(SHARED)/thirdparty
+CFLAGS += -I$(SRCDIR)/client/src -I$(SRCDIR)/client/src/system -I$(SRCDIR)/client/src/dos -I$(SRCDIR)/client/src/gui -I$(SRCDIR)/client/src/thirdparty
+CFLAGS += -I$(SRCDIR)/shared -I$(SRCDIR)/shared/thirdparty
CPPFLAGS :=
LDFLAGS :=
PREFIX := /usr/local
@@ -55,13 +54,17 @@ ALL_LDLIBS := -lc
# Source, Binaries, Dependencies
-SRC := $(shell find $(SRCDIR) -type f -name '*.c' | grep -v '/linux/' && find $(SHARED) -type f -name '*.c')
+SRC := $(shell find $(SRCDIR) -type f -name '*.c' | grep -v '/linux/' | grep -v '/server/' | grep -v '/font/' | grep -v '/retired/')
OBJ := $(patsubst $(SRCDIR)/%,$(OBJDIR)/%,$(SRC:.c=.o))
DEP := $(OBJ:.o=.d)
BIN := $(BINDIR)/$(TARGET)
-include $(DEP)
+#$(info [${SRC}])
+#$(info [${OBJ}])
+
+
# Verbosity Control, ala automake
V = 0
diff --git a/client/build.sh b/build.sh
similarity index 68%
rename from client/build.sh
rename to build.sh
index 12bd7f3..53fd798 100755
--- a/client/build.sh
+++ b/build.sh
@@ -18,26 +18,20 @@
# along with this program. If not, see .
#
-mkdir -p bin obj/system obj/dos obj/gui obj/thirdparty/memwatch obj/thirdparty/serial
+mkdir -p \
+ bin/data \
+ obj/client/src/system \
+ obj/client/src/dos \
+ obj/client/src/gui \
+ obj/client/src/thirdparty/serial \
+ obj/shared/thirdparty/memwatch \
+ obj/shared/thirdparty/blowfish-api \
+ obj/shared/thirdparty/ini/src
+
source /opt/cross/djgpp/setenv
+
make -f Makefile.djgpp
+
rm bin/client
-cp data/* bin/.
-:<<'SKIP'
-[[ -f bin/CLIENT.LOG ]] && rm bin/CLIENT.LOG
-
-cat <<-'BATCH' > bin/test.bat
- @echo off
- :wait
- if not exist flag.dat goto wait
- del flag.dat
- client.exe 800 600 16
-BATCH
-
-touch bin/flag.dat
-while [[ ! -f bin/CLIENT.LOG ]]; do
- /bin/true
-done
-tail -f bin/CLIENT.LOG
-SKIP
+cp client/data/* bin/data/.
diff --git a/client/client.pro b/client/client.pro
index b427574..d56b1dc 100644
--- a/client/client.pro
+++ b/client/client.pro
@@ -137,15 +137,18 @@ LIBS = \
-lSDL2
OTHER_FILES = \
- Makefile.djgpp \
$$DOS_HEADERS \
$$DOS_SOURCES \
- build.sh \
- test.sh \
- test.conf
+ ../Makefile.djgpp \
+ ../build.sh \
+ ../test.sh \
+ ../test.conf \
+ postBuild.sh
testing {
DEFINES *= TESTING
HEADERS += src/test.h
SOURCES += src/test.c
}
+
+QMAKE_POST_LINK = $$PWD/postBuild.sh "$$PWD" "$$DESTDIR"
diff --git a/client/postBuild.sh b/client/postBuild.sh
new file mode 100755
index 0000000..e1a7182
--- /dev/null
+++ b/client/postBuild.sh
@@ -0,0 +1,26 @@
+#!/bin/bash -e
+
+#
+# Kangaroo Punch MultiPlayer Game Server Mark II
+# Copyright (C) 2020-2021 Scott Duensing
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+
+SOURCE=$1
+TARGET=$2
+
+mkdir -p ${TARGET}/data
+cp ${SOURCE}/data/* ${TARGET}/data/.
diff --git a/client/src/main.c b/client/src/main.c
index 9b0f158..8a532ec 100644
--- a/client/src/main.c
+++ b/client/src/main.c
@@ -30,7 +30,6 @@
* - Find a light grey to replace white widget data areas
* - No thumb in listbox scrollbar
* - Layout container widgets!
- * - DOS makefile is placing thirdparty object files in the wrong place
*/
@@ -46,6 +45,7 @@
#include "timer.h"
#include "gui.h"
#include "config.h"
+#include "util.h"
#include "welcome.h"
@@ -68,7 +68,7 @@ static void taskGuiEventLoop(void *data) {
(void)data;
- pointer = imageLoad("mouse.png");
+ pointer = imageLoad("data/mouse.png");
alpha = imagePixelGet(pointer, 5, 0);
do {
@@ -110,6 +110,11 @@ static void taskGuiEventLoop(void *data) {
int main(int argc, char *argv[]) {
+#ifndef __linux__
+ // On DOS, display the contets of the log now that we're back in text mode.
+ char *logName = NULL;
+ FILE *in = NULL;
+#endif
memoryStartup(argv[0]);
logOpenByHandle(memoryLogHandleGet());
@@ -163,5 +168,22 @@ int main(int argc, char *argv[]) {
logClose();
memoryShutdown();
+#ifndef __linux__
+ //***TODO*** Why the frack does this not work?!
+ textmode(C80);
+ // On DOS, display the contets of the log now that we're back in text mode.
+ logName = utilAppNameWithNewExtensionGet(argv[0], "log");
+ in = fopen(logName, "r");
+ if (in) {
+ while (!feof(in)) {
+ putc(fgetc(in), stdout);
+ }
+ fclose(in);
+ free(in);
+ }
+ free(logName);
+ _Exit(0);
+#endif
+
return 0;
}
diff --git a/client/src/system/memory.c b/client/src/system/memory.c
index 64c48ff..0ca517f 100644
--- a/client/src/system/memory.c
+++ b/client/src/system/memory.c
@@ -40,8 +40,11 @@ void memoryOutput(int c) {
fputc(c, _memoryLog);
fflush(_memoryLog);
+#ifdef __linux__
+ // Also output to stdout on Linux.
fputc(c, stdout);
fflush(stdout);
+#endif
}
#endif
diff --git a/client/src/system/os.h b/client/src/system/os.h
index c1ea19c..25df85c 100644
--- a/client/src/system/os.h
+++ b/client/src/system/os.h
@@ -49,6 +49,7 @@ long biostime(int cmd, long newtime);
#include
#include
#include
+#include
#include
#include
diff --git a/client/src/test.c b/client/src/test.c
index f7f3d07..eefdf91 100644
--- a/client/src/test.c
+++ b/client/src/test.c
@@ -123,7 +123,7 @@ static void test(void *data) {
guiAttach(W(desktop), W(w4));
// Window 1
- p1 = pictureNew(0, 0, "kanga.png");
+ p1 = pictureNew(0, 0, "data/kanga.png");
guiAttach(W(w1), W(p1));
lb1 = listboxNew(155, 10, 120, 140, "List Box");
listboxItemAdd(lb1, "One");
@@ -213,7 +213,7 @@ void taskTestTagList(void *data) {
T_X, 300, T_Y, 25, T_WIDTH, 300, T_HEIGHT, 200,
T_PICTURE, O(p1),
T_X, 0, T_Y, 0,
- T_FILENAME, P("kanga.png"),
+ T_FILENAME, P("data/kanga.png"),
T_PICTURE, T_DONE,
T_LISTBOX, O(lb1),
T_TITLE, P("Listbox"),
@@ -331,7 +331,7 @@ static void testTerminal(void *data) {
(void)data;
// Load ANSI file for terminal test.
- in = fopen("kanga.ans", "rt");
+ in = fopen("data/kanga.ans", "rt");
fseek(in, 0, SEEK_END);
length = ftell(in);
fseek(in, 0, SEEK_SET);
diff --git a/client/src/welcome.c b/client/src/welcome.c
index 36ba852..407d4c8 100644
--- a/client/src/welcome.c
+++ b/client/src/welcome.c
@@ -71,7 +71,7 @@ void taskWelcome(void *data) {
T_TITLE, P("Welcome to KangaWorld!"),
T_WIDTH, 500, T_HEIGHT, 225,
T_PICTURE, O(picLogo),
- T_FILENAME, P("logo.png"),
+ T_FILENAME, P("data/logo.png"),
T_X, 18, T_Y, 18,
T_PICTURE, T_DONE,
T_BUTTON, O(btnQuit),
diff --git a/shared/thirdparty/memwatch/memwatch.o b/shared/thirdparty/memwatch/memwatch.o
deleted file mode 100644
index 0e6b4d0..0000000
Binary files a/shared/thirdparty/memwatch/memwatch.o and /dev/null differ
diff --git a/client/test.conf b/test.conf
similarity index 100%
rename from client/test.conf
rename to test.conf
diff --git a/client/test.sh b/test.sh
similarity index 100%
rename from client/test.sh
rename to test.sh