Start of server code.

This commit is contained in:
Scott Duensing 2021-11-20 17:54:19 -06:00
parent bea760abc6
commit cf73087076
22 changed files with 222 additions and 27 deletions

View file

@ -36,8 +36,7 @@ DOS_SOURCES = \
src/dos/vesa.c
LINUX_INCLUDES = \
$$PWD/src/linux \
$$SHARED/thirdparty/enet/include
$$PWD/src/linux
LINUX_HEADERS = \
$$SHARED/thirdparty/enet/include/enet.h
@ -48,8 +47,6 @@ LINUX_SOURCES = \
INCLUDEPATH += \
$$LINUX_INCLUDES \
$$SHARED \
$$SHARED/thirdparty \
$$PWD/src/thirdparty \
$$PWD/src/system \
$$PWD/src/gui \
$$PWD/src
@ -63,19 +60,20 @@ HEADERS = \
$$SHARED/thirdparty/blowfish-api/blowfish.h \
$$SHARED/thirdparty/ini/src/ini.h \
src/config.h \
src/system/util.h \
src/connect.h \
$$SHARED/util.h \
src/thirdparty/minicoro/minicoro.h \
src/system/comport.h \
src/settings.h \
src/system/color.h \
src/system/memory.h \
$$SHARED/memory.h \
src/system/surface.h \
src/system/taglist.h \
src/system/keyboard.h \
src/system/task.h \
src/system/timer.h \
src/system/array.h \
src/system/log.h \
$$SHARED/array.h \
$$SHARED/log.h \
src/system/mouse.h \
src/system/vesa.h \
src/system/os.h \
@ -104,14 +102,15 @@ SOURCES = \
$$SHARED/thirdparty/blowfish-api/blowfish.c \
$$SHARED/thirdparty/ini/src/ini.c \
src/config.c \
src/system/memory.c \
src/connect.c \
$$SHARED/memory.c \
src/settings.c \
src/system/surface.c \
src/system/taglist.c \
src/system/util.c \
$$SHARED/util.c \
src/test.c \
src/system/array.c \
src/system/log.c \
$$SHARED/array.c \
$$SHARED/log.c \
src/system/timer.c \
src/system/task.c \
src/gui/listbox.c \

28
client/src/connect.c Normal file
View file

@ -0,0 +1,28 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*
*/
#include "config.h"
#include "connect.h"
void taskConnect(void *data) {
(void)data;
}

31
client/src/connect.h Normal file
View file

@ -0,0 +1,31 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*
*/
#ifndef CONNECT_H
#define CONNECT_H
#include "os.h"
void taskConnect(void *data);
#endif // CONNECT_H

View file

@ -22,7 +22,7 @@
#include "vesa.h"
#include "surface.h"
#include "../system/log.h"
#include "log.h"
// http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html

View file

@ -594,9 +594,9 @@ DesktopT *guiStartup(void) {
_guiColor[COLOR_LISTBOX_ARROWS_INACTIVE] = vbeColorMake( 80, 84, 80);
// Load all font sizes.
_guiFont8 = fontLoad("vga8x8.dat");
_guiFont14 = fontLoad("vga8x14.dat");
_guiFont16 = fontLoad("vga8x16.dat");
_guiFont8 = fontLoad("data/vga8x8.dat");
_guiFont14 = fontLoad("data/vga8x14.dat");
_guiFont16 = fontLoad("data/vga8x16.dat");
_guiFont = _guiFont14; // Font to use for widgets.

View file

@ -25,7 +25,7 @@
#include "os.h"
#include "color.h"
#include "stb_image.h"
#include "thirdparty/stb_image.h"
typedef struct ImageS {

View file

@ -21,7 +21,7 @@
#include <SDL2/SDL.h>
#define ENET_IMPLEMENTATION
#include "enet.h"
#include "thirdparty/enet/include/enet.h"
#include "os.h"

View file

@ -21,7 +21,7 @@
#define MINICORO_IMPL
#define MCO_USE_ASM
//#define MCO_DEFAULT_STACK_SIZE 114688 // Default is 57344
#include "minicoro/minicoro.h"
#include "thirdparty/minicoro/minicoro.h"
#include "array.h"

View file

@ -20,9 +20,11 @@
#include "welcome.h"
#include "settings.h"
#include "connect.h"
#include "taglist.h"
#include "task.h"
#include "config.h"
#include "window.h"
#include "picture.h"
@ -88,7 +90,7 @@ void taskWelcome(void *data) {
T_TITLE, P("Connect"),
T_X, 379, T_Y, 157,
T_CLICK, P(btnConnectClick),
T_ENABLED, T_FALSE,
T_ENABLED, (_configData.serialCom > 0 && strlen(_configData.serverHost) > 2) ? T_TRUE : T_FALSE,
T_BUTTON, T_DONE,
T_WINDOW, T_DONE,
T_END

View file

@ -82,9 +82,9 @@ int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
makeFont("/home/scott/code/kpmpgsmkii/font/data/vga8x8.png", "/home/scott/code/kpmpgsmkii/client/bin/vga8x8.dat", 8, 8, 16, 255);
makeFont("/home/scott/code/kpmpgsmkii/font/data/vga8x14.png", "/home/scott/code/kpmpgsmkii/client/bin/vga8x14.dat", 8, 14, 16, 255);
makeFont("/home/scott/code/kpmpgsmkii/font/data/vga8x16.png", "/home/scott/code/kpmpgsmkii/client/bin/vga8x16.dat", 8, 16, 16, 255);
makeFont("/home/scott/code/kpmpgsmkii/font/data/vga8x8.png", "/home/scott/code/kpmpgsmkii/bin/data/vga8x8.dat", 8, 8, 16, 255);
makeFont("/home/scott/code/kpmpgsmkii/font/data/vga8x14.png", "/home/scott/code/kpmpgsmkii/bin/data/vga8x14.dat", 8, 14, 16, 255);
makeFont("/home/scott/code/kpmpgsmkii/font/data/vga8x16.png", "/home/scott/code/kpmpgsmkii/bin/data/vga8x16.dat", 8, 16, 16, 255);
return 0;
}

View file

@ -21,4 +21,5 @@ CONFIG *= ORDERED
SUBDIRS = \
font \
client
client \
server

41
server/os.h Normal file
View file

@ -0,0 +1,41 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*
*/
#ifndef OS_H
#define OS_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdarg.h>
#include <unistd.h>
// Should be after system headers in this file.
#define MEMORY_CHECK_ENABLED
#include "memory.h"
// Now our headers.
#include "log.h"
#endif // OS_H

52
server/server.pro Normal file
View file

@ -0,0 +1,52 @@
#
# 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 <https://www.gnu.org/licenses/>.
#
TEMPLATE = app
CONFIG -= qt
DESTDIR = $$OUT_PWD/bin
SHARED = $$PWD/../shared
INCLUDEPATH += \
$$SHARED \
$$PWD/src
HEADERS = \
$$SHARED/stddclmr.h \
$$SHARED/thirdparty/stb_ds.h \
$$SHARED/thirdparty/memwatch/memwatch.h \
$$SHARED/thirdparty/blowfish-api/blowfish.h \
$$SHARED/thirdparty/ini/src/ini.h \
$$SHARED/array.h \
$$SHARED/log.h \
$$SHARED/memory.h \
$$SHARED/util.h \
os.h
SOURCES = \
$$SHARED/thirdparty/memwatch/memwatch.c \
$$SHARED/thirdparty/blowfish-api/blowfish.c \
$$SHARED/thirdparty/ini/src/ini.c \
$$SHARED/array.c \
$$SHARED/log.c \
$$SHARED/memory.c \
$$SHARED/util.c \
src/main.c
OTHER_FILES =

41
server/src/main.c Normal file
View file

@ -0,0 +1,41 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*
*/
#include "os.h"
#include "util.h"
int main(int argc, char *argv[]) {
(void)argc;
memoryStartup(argv[0]);
logOpenByHandle(memoryLogHandleGet());
// 0 1 2 3 4 5 6 7 8
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
logWrite("%s", "Kangaroo Punch MultiPlayer DOS Game Server Mark II\n");
logWrite("%s", "Copyright (C) 2020-2021 Scott Duensing scott@kangaroopunch.com\n\n");
logClose();
memoryShutdown();
return 0;
}

View file

@ -21,4 +21,4 @@
#include "array.h"
#define STB_DS_IMPLEMENTATION
#include "stb_ds.h"
#include "thirdparty/stb_ds.h"

View file

@ -23,7 +23,7 @@
#include "os.h"
#include "stb_ds.h"
#include "thirdparty/stb_ds.h"
#endif // ARRAY_H

View file

@ -26,7 +26,7 @@
#ifdef MEMORY_CHECK_ENABLED
#define MEMWATCH
#include "memwatch/memwatch.h"
#include "thirdparty/memwatch/memwatch.h"
#endif