BACKENDS: ENET: Preliminary ENet backend.

This commit is contained in:
Little Cat 2022-10-20 05:59:40 -03:00 committed by Eugene Sandulenko
parent ade9fab8d6
commit 68425432ab
3 changed files with 101 additions and 0 deletions

View File

@ -99,6 +99,11 @@ MODULE_OBJS += \
networking/sdl_net/uploadfileclienthandler.o
endif
ifdef USE_ENET
MODULE_OBJS += \
networking/enet/enet.o
endif
ifdef USE_ELF_LOADER
MODULE_OBJS += \
plugins/elf/arm-loader.o \

View File

@ -0,0 +1,56 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include <enet/enet.h>
#include "backends/networking/enet/enet.h"
#include "common/debug.h"
namespace Networking {
ENet::ENet() {
_initialized = false;
}
ENet::~ENet() {
if (_initialized) {
// Deinitialize the library.
debug(1, "ENet: Deinitalizing.");
enet_deinitialize();
}
}
bool ENet::initalize() {
if (ENet::_initialized) {
return true;
}
if (enet_initialize() != 0) {
warning("ENet: ENet library failed to initalize.");
return false;
}
debug(1, "ENet: Initalized.");
_initialized = true;
return true;
}
} // End of namespace Networking

View File

@ -0,0 +1,40 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef BACKENDS_NETWORKING_ENET_ENET
#define BACKENDS_NETWORKING_ENET_ENET
namespace Networking {
class ENet {
public:
ENet();
~ENet();
bool initalize();
protected:
bool _initialized;
};
} // End of namespace Networking
#endif