Commit d8c1eea2 authored by nanahira's avatar nanahira

Merge branch 'server' into server-develop

parents 84beb267 b45cce4f
......@@ -124,6 +124,15 @@ exec_windows:
- mkdir dist\windows
- copy bin\release\x64\ygopro.exe dist\windows\ygopro.exe
exec_windows_pro2:
extends: .exec_windows
script:
- '.\premake5.exe vs2019 --server-pro2-support'
- cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" build\YGOPro.sln /m /p:Configuration=Release /p:Platform=x64'
- mkdir dist
- mkdir dist\windows
- copy bin\release\x64\AI.Server.exe dist\windows\AI.Server.exe
exec_windows_pro3:
extends: .exec_windows
script:
......@@ -133,12 +142,24 @@ exec_windows_pro3:
- mkdir dist\windows
- copy bin\release\x64\ygoserver.dll dist\windows\ygoserver.dll
exec_windows_mdpro2:
extends: .exec_windows
script:
- '.\premake5.exe vs2019 --server-pro3-support --log-in-chat --server-pro2-support'
- cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" build\YGOPro.sln /m /p:Configuration=Release /p:Platform=x64'
- mkdir dist
- mkdir dist\windows
- copy bin\release\x64\ygoserver.dll dist\windows\ygoserver-mdpro2.dll
.exec_unix_common:
extends: ._exec_build
variables:
RELEASE_DIR: ''
TARGET_FILE: ygopro
PREMAKE5_BIN: premake5
BUILD_EVENT: '1'
BUILD_IRRLICHT: '1'
BUILD_SQLITE: '1'
script:
- ./.ci/configure-libevent.sh
- $PREMAKE5_BIN gmake
......@@ -318,6 +339,8 @@ upload_to_minio:
- exec_linux
- exec_linuxarm
- exec_windows_pro3
- exec_windows_pro2
- exec_windows_mdpro2
- exec_linux_pro3
- exec_linuxarm_pro3
- exec_debian
......
......@@ -50,8 +50,7 @@ void DeckManager::LoadLFListSingle(irr::io::IReadFile* reader, bool insert) {
void DeckManager::LoadLFList() {
#ifdef SERVER_PRO2_SUPPORT
LoadLFListSingle("config/lflist.conf");
#endif
#ifdef SERVER_PRO3_SUPPORT
#elif defined(SERVER_PRO3_SUPPORT)
LoadLFListSingle("Data/lflist.conf");
#endif
LoadLFListSingle("specials/lflist.conf");
......
......@@ -101,8 +101,7 @@ void Game::MainServerLoop() {
LoadExpansionsAll();
#ifdef SERVER_PRO2_SUPPORT
DataManager::FileSystem->addFileArchive("data/script.zip", true, false, irr::io::EFAT_ZIP);
#endif
#ifdef SERVER_PRO3_SUPPORT
#elif defined(SERVER_PRO3_SUPPORT)
DataManager::FileSystem->addFileArchive("Data/script.zip", true, false, irr::io::EFAT_ZIP);
#endif
......@@ -1419,8 +1418,7 @@ void Game::LoadExpansionsAll() {
dataManager.LoadDB(fpath);
}
});
#endif // SERVER_PRO2_SUPPORT
#ifdef SERVER_PRO3_SUPPORT
#elif defined(SERVER_PRO3_SUPPORT)
FileSystem::TraversalDir(L"./Data/locales/zh-CN", [](const wchar_t* name, bool isdir) {
wchar_t fpath[1024];
myswprintf(fpath, L"./Data/locales/zh-CN/%ls", name);
......
......@@ -95,7 +95,7 @@ bool NetServer::StartServer(unsigned short port) {
std::memset(&sin, 0, sizeof sin);
server_port = port;
sin.sin_family = AF_INET;
#ifdef SERVER_PRO2_SUPPORT
#if defined(SERVER_PRO2_SUPPORT) && !defined(SERVER_PRO3_SUPPORT)
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
#else
sin.sin_addr.s_addr = htonl(INADDR_ANY);
......
......@@ -114,10 +114,12 @@ end
end
filter "system:windows"
if not SERVER_PRO3_SUPPORT then
entrypoint "mainCRTStartup"
end
defines { "_IRR_WCHAR_FILESYSTEM" }
files "ygopro.rc"
if SERVER_PRO2_SUPPORT then
if SERVER_PRO2_SUPPORT and not SERVER_PRO3_SUPPORT then
targetname ("AI.Server")
end
if SERVER_MODE then
......
#include "serverapi.h"
#include "game.h"
#include "netserver.h"
#include "network.h"
#include "config.h"
#include "data_manager.h"
#include "gframe.h"
#include <event2/thread.h>
#include <memory>
namespace ygo {
extern "C" DECL_DLLEXPORT int start_server(const char* args) {
YGOSERVER_API int start_server(const char* args) {
int argc = 1;
char** argv = new char* [13];
const char* server_name = "ygoserver";
......@@ -36,7 +44,7 @@ namespace ygo {
return result;
}
extern "C" DECL_DLLEXPORT void stop_server() {
YGOSERVER_API void stop_server() {
NetServer::StopServer();
}
}
#ifndef SERVERAPI_H
#define SERVERAPI_H
#include "game.h"
#include "netserver.h"
#include "network.h"
#include "config.h"
#include "data_manager.h"
#include "gframe.h"
#include <event2/thread.h>
#include <memory>
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C
#endif
#ifdef WIN32
#define DECL_DLLEXPORT __declspec(dllexport)
#ifndef YGOSERVER_API
#if defined(__EMSCRIPTEN__)
#include <emscripten/emscripten.h>
#define YGOSERVER_API EXTERN_C EMSCRIPTEN_KEEPALIVE
#elif defined(_WIN32)
#define YGOSERVER_API EXTERN_C __declspec(dllexport)
#else
#define DECL_DLLEXPORT
#define YGOSERVER_API EXTERN_C __attribute__ ((visibility ("default")))
#endif
#endif
namespace ygo {
extern "C" DECL_DLLEXPORT int start_server(const char* args);
extern "C" DECL_DLLEXPORT void stop_server();
YGOSERVER_API int start_server(const char* args);
YGOSERVER_API void stop_server();
}
#endif // !SERVERAPI_H
......@@ -8,6 +8,10 @@ project "lua"
if not GetParam("no-lua-safe") then
removefiles { "src/linit.c" }
end
if SERVER_PRO3_SUPPORT then
defines { "LUA_USE_LONGJMP" }
end
filter "configurations:Debug"
defines { "LUA_USE_APICHECK" }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment