diff --git a/trunk/xrNetServer/NET_Client.cpp b/trunk/xrNetServer/NET_Client.cpp index b32aa9d6..f0fbca9d 100644 --- a/trunk/xrNetServer/NET_Client.cpp +++ b/trunk/xrNetServer/NET_Client.cpp @@ -4,7 +4,6 @@ #include "net_server.h" #include "net_messages.h" #include "NET_Log.h" -#include "../xr_3da/xrGame/battleye.h" #pragma warning(push) #pragma warning(disable:4995) @@ -228,16 +227,6 @@ void IPureClient::_Recieve( const void* data, u32 data_size, u32 /*param*/ ) if ( data_size == sizeof(MSYS_CONFIG) ) { MSYS_CONFIG* msys_cfg = (MSYS_CONFIG*)data; - if ( msys_cfg->is_battleye ) - { -#ifdef BATTLEYE - if ( !TestLoadBEClient() ) - { - net_Connected = EnmConnectionFails; - return; - } -#endif // BATTLEYE - } net_Connected = EnmConnectionCompleted; return; } diff --git a/trunk/xrNetServer/NET_Messages.h b/trunk/xrNetServer/NET_Messages.h index cd337781..52e4d4c3 100644 --- a/trunk/xrNetServer/NET_Messages.h +++ b/trunk/xrNetServer/NET_Messages.h @@ -17,7 +17,6 @@ struct MSYS_CONFIG { u32 sign1; // 0x12071980; u32 sign2; // 0x26111975; - u32 is_battleye; }; struct MSYS_PING { diff --git a/trunk/xr_3da/xrGame/Level.cpp b/trunk/xr_3da/xrGame/Level.cpp index 46f59971..634f7e49 100644 --- a/trunk/xr_3da/xrGame/Level.cpp +++ b/trunk/xr_3da/xrGame/Level.cpp @@ -1035,15 +1035,6 @@ bool IsGameTypeSingle() return g_pGamePersistent->GameType()==GAME_SINGLE || g_pGamePersistent->GameType()==GAME_ANY; } -#ifdef BATTLEYE - -bool CLevel::TestLoadBEClient() -{ - return battleye_system.TestLoadClient(); -} - -#endif // BATTLEYE - GlobalFeelTouch::GlobalFeelTouch() { } diff --git a/trunk/xr_3da/xrGame/Level.h b/trunk/xr_3da/xrGame/Level.h index c3b9b5e0..da466453 100644 --- a/trunk/xr_3da/xrGame/Level.h +++ b/trunk/xr_3da/xrGame/Level.h @@ -14,7 +14,6 @@ #include "alife_space.h" #include "xrDebug.h" #include "xrServer.h" -#include "battleye_system.h" class CHUDManager; class CParticlesObject; @@ -178,12 +177,6 @@ class CLevel : public IGame_Level, public IPureClient xrServer* Server; GlobalFeelTouch m_feel_deny; - -#ifdef BATTLEYE - BattlEyeSystem battleye_system; - virtual bool TestLoadBEClient(); -#endif // BATTLEYE - private: // preload sounds registry DEFINE_MAP (shared_str,ref_sound,SoundRegistryMap,SoundRegistryMapIt); diff --git a/trunk/xr_3da/xrGame/Level_network.cpp b/trunk/xr_3da/xrGame/Level_network.cpp index e8b510d2..1bfb55ad 100644 --- a/trunk/xr_3da/xrGame/Level_network.cpp +++ b/trunk/xr_3da/xrGame/Level_network.cpp @@ -129,10 +129,6 @@ void CLevel::ClientSend() if ( !net_HasBandwidth() ) return; }; -#ifdef BATTLEYE - battleye_system.UpdateClient(); -#endif // BATTLEYE - NET_Packet P; u32 start = 0; //----------- for E3 ----------------------------- diff --git a/trunk/xr_3da/xrGame/Level_network_messages.cpp b/trunk/xr_3da/xrGame/Level_network_messages.cpp index c60eefe5..b2b5b5d8 100644 --- a/trunk/xr_3da/xrGame/Level_network_messages.cpp +++ b/trunk/xr_3da/xrGame/Level_network_messages.cpp @@ -321,12 +321,6 @@ void CLevel::ClientReceive() if (GameID() != GAME_SINGLE) Game().m_WeaponUsageStatistic->OnUpdateRespond(P); }break; - case M_BATTLEYE: - { -#ifdef BATTLEYE - battleye_system.ReadPacketClient( P ); -#endif // BATTLEYE - }break; } net_msg_Release(); diff --git a/trunk/xr_3da/xrGame/Level_start.cpp b/trunk/xr_3da/xrGame/Level_start.cpp index 48918d30..17ea0322 100644 --- a/trunk/xr_3da/xrGame/Level_start.cpp +++ b/trunk/xr_3da/xrGame/Level_start.cpp @@ -237,10 +237,6 @@ bool xr_stdcall net_start_finalizer() DEL_INSTANCE (g_pGameLevel); Console->Execute("main_menu on"); - if (g_connect_server_err==xrServer::ErrBELoad) - { - MainMenu()->OnLoadError("BattlEye/BEServer.dll"); - }else if(g_connect_server_err==xrServer::ErrConnect && !psNET_direct_connect && !g_dedicated_server) { MainMenu()->SwitchToMultiplayerMenu(); diff --git a/trunk/xr_3da/xrGame/battleye.h b/trunk/xr_3da/xrGame/battleye.h deleted file mode 100644 index c0dbaf25..00000000 --- a/trunk/xr_3da/xrGame/battleye.h +++ /dev/null @@ -1,4 +0,0 @@ -// battleye.h -// header for all file, using BattlEye - -#define BATTLEYE diff --git a/trunk/xr_3da/xrGame/battleye_system.cpp b/trunk/xr_3da/xrGame/battleye_system.cpp deleted file mode 100644 index df06ac2f..00000000 --- a/trunk/xr_3da/xrGame/battleye_system.cpp +++ /dev/null @@ -1,363 +0,0 @@ -// battleye_system.cpp -// BattlEyeSystem class implementation - -#include "stdafx.h" -#include "battleye_system.h" -#include "object_broker.h" -#include "MainMenu.h" - -#ifdef BATTLEYE - -#define BATTLEYE_DIR "BattlEye" - -int g_be_message_out = 1; - -BattlEyeSystem::BattlEyeSystem() -{ - client = NULL; - server = NULL; - - m_test_load_client = false; -//- auto_update = 1; -} - -BattlEyeSystem::~BattlEyeSystem() -{ - xr_delete( client ); - xr_delete( server ); -} - -void BattlEyeSystem::SetServerPath( LPCSTR path ) -{ - VERIFY( path ); - m_server_path._set( path ); -} - -void BattlEyeSystem::SetClientPath( LPCSTR path ) -{ - VERIFY( path ); - m_client_path._set( path ); -} - -LPCSTR BattlEyeSystem::GetServerPath() -{ - return m_server_path.c_str(); -} - -LPCSTR BattlEyeSystem::GetClientPath() -{ - return m_client_path.c_str(); -} - -bool BattlEyeSystem::ReloadServerDLL( xrServer* xr_server ) -{ - xr_delete( server ); - server = NULL; - - LPCSTR dll_file_name = m_server_path.c_str(); - string_path old_file_name; - string_path new_file_name; - string_path err_file_name; - - strconcat( sizeof(old_file_name), old_file_name, dll_file_name, ".old" ); - strconcat( sizeof(new_file_name), new_file_name, dll_file_name, ".new" ); - strconcat( sizeof(err_file_name), err_file_name, dll_file_name, ".error" ); - - if ( rename( dll_file_name, old_file_name ) ) - { - Msg( "! Could not rename %s to %s", dll_file_name, old_file_name ); - return false; - } - if ( rename( new_file_name, dll_file_name ) ) - { - Msg( "! Could not rename %s to %s", new_file_name, dll_file_name ); - return false; - } - - server = xr_new( xr_server ); - if ( server->IsLoaded() ) // (1) if loaded from BEServer.dll (new version) - { - server->AddConnectedPlayers(); - if ( !DeleteFile( old_file_name ) ) - { - Msg( "! Could not delete old %s", old_file_name ); - //return _false; - } - return true; - } - - xr_delete( server ); - server = NULL; - - if ( rename( dll_file_name, err_file_name ) ) - { - Msg( "! Could not rename %s to %s", dll_file_name, err_file_name ); - return false; - } - if ( rename( old_file_name, dll_file_name ) ) - { - Msg( "! Could not rename %s to %s", old_file_name, dll_file_name ); - return false; - } - - server = xr_new( xr_server ); - if ( server->IsLoaded() ) // (2) if loaded from BEServer.dll (prev version) - { - server->AddConnectedPlayers(); - return true; - } - - xr_delete( server ); - server = NULL; - return false; -} - -bool BattlEyeSystem::ReloadClientDLL() -{ - xr_delete( client ); - client = NULL; - - LPCSTR dll_file_name = m_client_path.c_str(); - string_path old_file_name; - string_path new_file_name; - string_path err_file_name; - strconcat( sizeof(old_file_name), old_file_name, dll_file_name, ".old" ); - strconcat( sizeof(new_file_name), new_file_name, dll_file_name, ".new" ); - strconcat( sizeof(err_file_name), err_file_name, dll_file_name, ".error" ); - - if ( rename( dll_file_name, old_file_name ) ) - { - Msg( "! Could not rename %s to %s", dll_file_name, old_file_name ); - return false; - } - if ( rename( new_file_name, dll_file_name ) ) - { - Msg( "! Could not rename %s to %s", new_file_name, dll_file_name ); - return false; - } - - client = xr_new(); - if ( client->IsLoaded() ) // (1) if loaded from BEClient.dll (new version) - { - if ( !DeleteFile( old_file_name ) ) - { - Msg( "! Could not delete old %s", old_file_name ); - //return _false; - } - return true; - } - - xr_delete( client ); - client = NULL; - - if ( rename( dll_file_name, err_file_name ) ) - { - Msg( "! Could not rename %s to %s", dll_file_name, err_file_name ); - return false; - } - if ( rename( old_file_name, dll_file_name ) ) - { - Msg( "! Could not rename %s to %s", old_file_name, dll_file_name ); - return false; - } - - client = xr_new(); - if ( client->IsLoaded() ) // (2) if loaded from BEClient.dll (prev version) - { - return true; - } - - xr_delete( client ); - client = NULL; - return false; -} - -bool BattlEyeSystem::LoadClient() -{ - //if ( Level().IsClient() ) - { - if ( client ) - { - return true; - } - client = xr_new(); - if ( client->IsLoaded() ) - { - return true; - } - xr_delete( client ); - client = NULL; - Msg( "! Error loading BattlEye Client!" ); - MainMenu()->OnLoadError( BATTLEYE_CLIENT_DLL ); - } - return false; -} - -bool BattlEyeSystem::LoadServer( xrServer* xr_server ) -{ - if ( server ) - { - return true; - } - server = xr_new( xr_server ); - if ( server->IsLoaded() ) - { - return true; - } - xr_delete( server ); - server = NULL; - - Msg( "! Error loading BattlEye Server!" ); - MainMenu()->OnLoadError( BATTLEYE_SERVER_DLL ); - return false; -} - -void BattlEyeSystem::UpdateClient() -{ - if ( !client ) - { - return; - } - if ( !client->Run() ) - { - ReloadClientDLL(); - } -} - -void BattlEyeSystem::UpdateServer( xrServer* xr_server ) -{ - if ( !server ) - { - return; - } - if ( !server->Run() ) - { - ReloadServerDLL( xr_server ); - } -} - -void BattlEyeSystem::ReadPacketClient( NET_Packet* pack ) -{ - if ( !client ) - { - return; - } - u32 len; - pack->r_u32( len ); - - void* data = xr_malloc( len ); - pack->r( data, len ); - - client->NewPacket( data, len ); - xr_delete( data ); -} - -void BattlEyeSystem::ReadPacketServer( u32 sender, NET_Packet* pack ) -{ - if ( !server ) - { - return; - } - u32 len; - pack->r_u32( len ); - - void* data = xr_malloc( len ); - pack->r( data, len ); - - server->NewPacket( sender, data, len ); - xr_delete( data ); -} - -bool BattlEyeSystem::TestLoadClient() -{ - m_test_load_client = false; - if ( g_dedicated_server ) - { - return true; //false = Error - } - - if ( LoadClient() ) // test load - { - xr_delete( client ); - client = NULL; - - m_test_load_client = true; - } - return m_test_load_client; -} - -bool BattlEyeSystem::InitDir() -{ - string_path dir_be; - FS.update_path( dir_be, "$app_data_root$", "" ); - strcat_s( dir_be, sizeof(dir_be), BATTLEYE_DIR ); - - if( FS.can_write_to_folder(dir_be) == NULL ) - { - if ( !CreateDirectory( dir_be, NULL ) ) - { - Msg( "! Cannot make folder >>> %s", dir_be ); - return false; - } - } - - string_path fn_sv; - if ( !InitDLL( BATTLEYE_SERVER_DLL, fn_sv ) ) - { - return false; - } - SetServerPath( fn_sv ); - - string_path fn_cl; - if ( !InitDLL( BATTLEYE_CLIENT_DLL, fn_cl ) ) - { - return false; - } - SetClientPath( fn_cl ); - - return true; -} - -bool BattlEyeSystem::InitDLL( LPCSTR dll_name, string_path& out_file ) -{ - FILE* ft; - FS.update_path( out_file, "$app_data_root$", "" ); - strcat_s( out_file, sizeof(out_file), dll_name ); - - ft = fopen( out_file, "r" ); - if( ft == NULL ) - { - HMODULE h_game = GetModuleHandle("xrGame.dll"); - R_ASSERT( h_game ); - - string_path cur_dir, full_dir; - GetModuleFileName( h_game, full_dir, sizeof(full_dir) ); - - string_path fn_orig; - string16 disk, ext; - string64 fn_temp; - _splitpath( full_dir, disk, cur_dir, fn_temp, ext ); - strconcat( sizeof(fn_orig), fn_orig, disk, cur_dir, dll_name ); - - ft = fopen( fn_orig, "r" ); - if( ft == NULL ) - { - Msg( "! File not found >>> %s", fn_orig ); - return false; - } - fclose( ft ); - - CopyFile( fn_orig, out_file, FALSE ); - ft = fopen( out_file, "r" ); - if( ft == NULL ) - { - Msg( "! File not found >>> %s", out_file ); - return false; - } - fclose( ft ); - } - fclose( ft ); - return true; -} - -#endif // BATTLEYE diff --git a/trunk/xr_3da/xrGame/battleye_system.h b/trunk/xr_3da/xrGame/battleye_system.h deleted file mode 100644 index 140594ce..00000000 --- a/trunk/xr_3da/xrGame/battleye_system.h +++ /dev/null @@ -1,64 +0,0 @@ -// battleye_system.h -// BattlEyeSystem class - -#ifndef XR_BATTLEYE_SYSTEM_H_INCLUDED -#define XR_BATTLEYE_SYSTEM_H_INCLUDED - -#include "battleye.h" - -#ifdef BATTLEYE - -#include "xr_Server_BattlEye.h" -#include "xr_Client_BattlEye.h" - -#define BATTLEYE_SERVER_DLL "BattlEye\\BEServer.dll" -#define BATTLEYE_CLIENT_DLL "BattlEye\\BEClient.dll" - -class xrServer; -class BattlEyeServer; -class BattlEyeClient; - -class BattlEyeSystem -{ -private: - shared_str m_server_path; - shared_str m_client_path; - - bool m_test_load_client; - bool InitDLL( LPCSTR dll_name, string_path& out_file ); - -public: - BattlEyeSystem(); - ~BattlEyeSystem(); - - void SetServerPath( LPCSTR path ); - void SetClientPath( LPCSTR path ); - LPCSTR GetServerPath(); - LPCSTR GetClientPath(); - - bool ReloadServerDLL( xrServer* xr_server ); - bool ReloadClientDLL(); - - bool LoadClient(); - bool LoadServer( xrServer* xr_server ); - void UpdateClient(); - void UpdateServer( xrServer* xr_server ); - - void ReadPacketClient( NET_Packet* pack ); - void ReadPacketServer( u32 sender, NET_Packet* pack ); - - bool TestLoadClient(); - IC bool GetTestClient() { return m_test_load_client; } - - bool InitDir(); -public: - BattlEyeClient* client; - BattlEyeServer* server; - -//- int auto_update; - -}; // class BattlEyeSystem - -#endif // BATTLEYE - -#endif // XR_BATTLEYE_H_INCLUDED diff --git a/trunk/xr_3da/xrGame/console_commands_mp.cpp b/trunk/xr_3da/xrGame/console_commands_mp.cpp index e97c1de8..e18552c1 100644 --- a/trunk/xr_3da/xrGame/console_commands_mp.cpp +++ b/trunk/xr_3da/xrGame/console_commands_mp.cpp @@ -1040,100 +1040,6 @@ class CCC_SwapTeams : public IConsole_Command { virtual void Info (TInfo& I){strcpy(I,"swap teams for artefacthunt game"); } }; - -#ifdef BATTLEYE - -class CCC_BattlEyeSrv : public IConsole_Command -{ -public: - CCC_BattlEyeSrv( LPCSTR N ) : IConsole_Command(N) { bEmptyArgsHandled = true; } - bool ExecuteGetState( LPCSTR args ) - { - if ( args[0] == 0 ) - { - if ( Level().battleye_system.server ) - { - Msg( "BattlEye Server is enabled" ); - } - else - { - Msg( "BattlEye Server is disabled" ); - } - return true; - } - return false; - } - bool ExecuteBattlEyeServerCmd( LPCSTR args ) - { - if ( Level().battleye_system.server ) - { - Level().battleye_system.server->Command( (char*)args ); - return true; - } - return false; - } - virtual void Execute( LPCSTR args ) - { - if ( !g_pGameLevel || !OnServer() ) - { - return; - } - if ( ExecuteGetState( args ) ) return; - ExecuteBattlEyeServerCmd( args ); - } - virtual void Info( TInfo& I ) - { - strcpy( I, "BattlEye Server commands" ); - } -}; - -class CCC_BattlEyeCl : public IConsole_Command -{ -public: - CCC_BattlEyeCl( LPCSTR N ) : IConsole_Command(N) { bEmptyArgsHandled = true; } - bool ExecuteGetState( LPCSTR args ) - { - if ( args[0] == 0 ) - { - if ( Level().battleye_system.client ) - { - Msg("BattlEye Client is enabled"); - } - else - { - Msg("BattlEye Client is disabled"); - } - return true; - } - return false; - } - bool ExecuteBattlEyeClientCmd( LPCSTR args ) - { - if ( Level().battleye_system.client ) - { - Level().battleye_system.client->Command( (char*)args ); - return true; - } - return false; - } - virtual void Execute( LPCSTR args ) - { - if ( !g_pGameLevel ) - { - return; - } - if ( ExecuteGetState( args ) ) return; - ExecuteBattlEyeClientCmd( args ); - } - - virtual void Info( TInfo& I ) - { - strcpy( I, "BattlEye Client commands" ); - } -}; - -#endif // BATTLEYE - class CCC_Name : public IConsole_Command { public: @@ -1384,11 +1290,6 @@ void register_mp_console_commands() CMD1(CCC_Name, "name"); CMD1(CCC_SvStatus, "sv_status"); CMD1(CCC_SvChat, "chat"); -#ifdef BATTLEYE - CMD1(CCC_BattlEyeSrv, "beserver" ); - CMD1(CCC_BattlEyeCl, "beclient" ); - CMD4(CCC_SV_Integer, "bemsg" , (int*)&g_be_message_out, 0, 1 ); -#endif // BATTLEYE CMD1(CCC_CompressorStatus,"net_compressor_status"); CMD4(CCC_SV_Integer, "net_compressor_enabled" , (int*)&g_net_compressor_enabled , 0,1); diff --git a/trunk/xr_3da/xrGame/game_cl_base.cpp b/trunk/xr_3da/xrGame/game_cl_base.cpp index 050af13d..949e5247 100644 --- a/trunk/xr_3da/xrGame/game_cl_base.cpp +++ b/trunk/xr_3da/xrGame/game_cl_base.cpp @@ -189,15 +189,6 @@ void game_cl_GameState::TranslateGameMessage (u32 msg, NET_Packet& P) { case GAME_EVENT_PLAYER_CONNECTED: { - -#ifdef BATTLEYE - if ( g_pGameLevel && Level().battleye_system.GetTestClient() ) - { - bool res_battleye = Level().battleye_system.LoadClient(); - VERIFY( res_battleye ); - } -#endif // BATTLEYE - string64 PlayerName; P.r_stringZ(PlayerName); diff --git a/trunk/xr_3da/xrGame/gamespy/GameSpy_Browser.cpp b/trunk/xr_3da/xrGame/gamespy/GameSpy_Browser.cpp index b101472e..060caa6a 100644 --- a/trunk/xr_3da/xrGame/gamespy/GameSpy_Browser.cpp +++ b/trunk/xr_3da/xrGame/gamespy/GameSpy_Browser.cpp @@ -340,10 +340,6 @@ void CGameSpy_Browser::ReadServerInfo (ServerInfo* pServerInfo, void* pServer) pServerInfo->m_bPassword = xrGS_SBServerGetBoolValue(pServer, m_pQR2->xrGS_RegisteredKey(PASSWORD_KEY), SBFalse) == SBTrue; pServerInfo->m_bUserPass = xrGS_SBServerGetBoolValue(pServer, m_pQR2->xrGS_RegisteredKey(G_USER_PASSWORD_KEY), SBFalse) == SBTrue; -#ifdef BATTLEYE - pServerInfo->m_bBattlEye = xrGS_SBServerGetBoolValue(pServer, m_pQR2->xrGS_RegisteredKey(G_BATTLEYE_KEY), SBFalse) == SBTrue; -#endif // BATTLEYE - pServerInfo->m_Ping = (s16)(xrGS_SBServerGetPing(pServer) & 0xffff); pServerInfo->m_ServerNumPlayers = (s16)xrGS_SBServerGetIntValue(pServer, m_pQR2->xrGS_RegisteredKey(NUMPLAYERS_KEY), 0); pServerInfo->m_ServerMaxPlayers = (s16)xrGS_SBServerGetIntValue(pServer, m_pQR2->xrGS_RegisteredKey(MAXPLAYERS_KEY), 32); @@ -373,10 +369,6 @@ void CGameSpy_Browser::ReadServerInfo (ServerInfo* pServerInfo, void* pServer) // pServerInfo->m_aInfos.push_back(GameInfo("Version:", pServerInfo->m_ServerVersion)); pServerInfo->m_aInfos.push_back(GameInfo(*st.translate("mp_si_servername"), pServerInfo->m_ServerName)); pServerInfo->m_aInfos.push_back(GameInfo(*st.translate("mp_si_version"), pServerInfo->m_ServerVersion)); - -#ifdef BATTLEYE - ADD_BOOL_INFO(pServerInfo, pServer, "BattlEye", G_BATTLEYE_KEY); -#endif // BATTLEYE ADD_INT_INFO_N (pServerInfo, pServer, 1, "Max ping", "", G_MAX_PING_KEY); ADD_BOOL_INFO(pServerInfo, pServer, *st.translate("mp_si_maprotation"), G_MAP_ROTATION_KEY); diff --git a/trunk/xr_3da/xrGame/gamespy/GameSpy_Browser.h b/trunk/xr_3da/xrGame/gamespy/GameSpy_Browser.h index 12a956fe..808d7632 100644 --- a/trunk/xr_3da/xrGame/gamespy/GameSpy_Browser.h +++ b/trunk/xr_3da/xrGame/gamespy/GameSpy_Browser.h @@ -45,7 +45,6 @@ struct ServerInfo{ s16 m_s16FFire; bool m_bPassword; bool m_bUserPass; - bool m_bBattlEye; s16 m_Ping; s16 m_Port, m_HPort; diff --git a/trunk/xr_3da/xrGame/gamespy/GameSpy_Keys.h b/trunk/xr_3da/xrGame/gamespy/GameSpy_Keys.h index d77c1bb0..46fbf7bc 100644 --- a/trunk/xr_3da/xrGame/gamespy/GameSpy_Keys.h +++ b/trunk/xr_3da/xrGame/gamespy/GameSpy_Keys.h @@ -82,5 +82,5 @@ #define T_SCORE_T_KEY 132 #define G_MAX_PING_KEY 133 -#define G_BATTLEYE_KEY 134 +//#define G_BATTLEYE_KEY 134 #define G_USER_PASSWORD_KEY 135 diff --git a/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2.cpp b/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2.cpp index 1f7c1bff..4a79874b 100644 --- a/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2.cpp +++ b/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2.cpp @@ -78,9 +78,6 @@ void CGameSpy_QR2::RegisterAdditionalKeys () xrGS_qr2_register_key(G_SPECTATOR_MODES_KEY, ("spectatormodes")); xrGS_qr2_register_key(G_MAX_PING_KEY, ("max_ping_limit")); xrGS_qr2_register_key(G_USER_PASSWORD_KEY, ("user_password")); -#ifdef BATTLEYE - xrGS_qr2_register_key(G_BATTLEYE_KEY, ("use_battleye")); -#endif // BATTLEYE //---- game_sv_deathmatch ---- xrGS_qr2_register_key(G_FRAG_LIMIT_KEY, ("fraglimit")); diff --git a/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2.h b/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2.h index 5b84fe8e..4b7e73a8 100644 --- a/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2.h +++ b/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2.h @@ -1,7 +1,6 @@ #pragma once #include "GameSpy_FuncDefs.h" -#include "..\battleye.h" class CGameSpy_QR2 { diff --git a/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2_callbacks.cpp b/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2_callbacks.cpp index 1213f2b1..1320cf37 100644 --- a/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2_callbacks.cpp +++ b/trunk/xr_3da/xrGame/gamespy/GameSpy_QR2_callbacks.cpp @@ -55,18 +55,6 @@ void __cdecl callback_serverkey(int keyid, void* outbuf, void *userdata) pQR2->BufferAdd_Int( outbuf, 0 ); } break; - case G_BATTLEYE_KEY: -#ifdef BATTLEYE - if ( g_pGameLevel && Level().battleye_system.server ) - { - pQR2->BufferAdd_Int( outbuf, 1 ); - } - else - { - pQR2->BufferAdd_Int( outbuf, 0 ); - } -#endif // BATTLEYE - break; case HOSTPORT_KEY: pQR2->BufferAdd_Int(outbuf, pServer->GetPort()); break; case DEDICATED_KEY: pQR2->BufferAdd_Int(outbuf, pServer->IsDedicated()); break; @@ -197,9 +185,6 @@ void __cdecl callback_keylist(qr2_key_type keytype, void* keybuffer, void *userd pQR2->KeyBufferAdd(keybuffer, GAMETYPE_NAME_KEY); pQR2->KeyBufferAdd(keybuffer, NUMTEAMS_KEY); pQR2->KeyBufferAdd(keybuffer, G_MAX_PING_KEY); -#ifdef BATTLEYE - pQR2->KeyBufferAdd(keybuffer, G_BATTLEYE_KEY); -#endif // BATTLEYE //---- game_sv_base --- pQR2->KeyBufferAdd(keybuffer, G_MAP_ROTATION_KEY); pQR2->KeyBufferAdd(keybuffer, G_VOTING_ENABLED_KEY); diff --git a/trunk/xr_3da/xrGame/ui/ServerList.cpp b/trunk/xr_3da/xrGame/ui/ServerList.cpp index 21193ce7..5800062e 100644 --- a/trunk/xr_3da/xrGame/ui/ServerList.cpp +++ b/trunk/xr_3da/xrGame/ui/ServerList.cpp @@ -403,12 +403,6 @@ bool CServerList::IsValidItem(ServerInfo& item) result &= !m_sf.with_pass ? (m_sf.with_pass == item.m_bPassword) : true; result &= !m_sf.without_pass ? (m_sf.without_pass != item.m_bPassword) : true; result &= !m_sf.without_ff ? (m_sf.without_ff != item.m_bFFire) : true; -#ifdef BATTLEYE - if ( !m_b_local ) - { - result &= m_sf.with_battleye ? (/*m_sf.with_battleye == */item.m_bBattlEye) : true; - } -#endif // BATTLEYE result &= !m_sf.listen_servers ? (m_sf.listen_servers != item.m_bDedicated) : true; return result; diff --git a/trunk/xr_3da/xrGame/ui/ServerList.h b/trunk/xr_3da/xrGame/ui/ServerList.h index 0033013c..45e8283c 100644 --- a/trunk/xr_3da/xrGame/ui/ServerList.h +++ b/trunk/xr_3da/xrGame/ui/ServerList.h @@ -6,8 +6,6 @@ #include "UIFrameWindow.h" #include "UIEditBox.h" #include "UI3tButton.h" -#include "../battleye.h" - class CUIXml; class CGameSpy_Browser; @@ -29,7 +27,6 @@ class SServerFilters{ bool with_pass; bool without_pass; bool without_ff; - bool with_battleye; bool listen_servers; }; diff --git a/trunk/xr_3da/xrGame/ui/UIListWnd_script.cpp b/trunk/xr_3da/xrGame/ui/UIListWnd_script.cpp index de0dd30d..d418bac0 100644 --- a/trunk/xr_3da/xrGame/ui/UIListWnd_script.cpp +++ b/trunk/xr_3da/xrGame/ui/UIListWnd_script.cpp @@ -75,9 +75,6 @@ void CUIListWnd::script_register(lua_State *L) .def_readwrite("with_pass", &SServerFilters::with_pass) .def_readwrite("without_pass", &SServerFilters::without_pass) .def_readwrite("without_ff", &SServerFilters::without_ff) -#ifdef BATTLEYE - .def_readwrite("with_battleye", &SServerFilters::with_battleye) -#endif // BATTLEYE .def_readwrite("listen_servers", &SServerFilters::listen_servers), class_("CServerList") diff --git a/trunk/xr_3da/xrGame/ui/UIOptConCom.cpp b/trunk/xr_3da/xrGame/ui/UIOptConCom.cpp index 311aceb2..4c0b2a66 100644 --- a/trunk/xr_3da/xrGame/ui/UIOptConCom.cpp +++ b/trunk/xr_3da/xrGame/ui/UIOptConCom.cpp @@ -5,7 +5,6 @@ #include "../../xrcore/xrCore.h" #include "../game_base_space.h" #include "../RegistryFuncs.h" -#include "../battleye.h" xr_token g_GameModes [] = { { "st_deathmatch", GAME_DEATHMATCH }, @@ -50,10 +49,6 @@ void CUIOptConCom::Init() CMD3(CCC_Mask, "mm_mm_net_srv_dedicated", &m_uNetSrvParams, flNetSrvDedicated); CMD3(CCC_Mask, "mm_net_con_publicserver", &m_uNetSrvParams, flNetConPublicServer); CMD3(CCC_Mask, "mm_net_con_spectator_on", &m_uNetSrvParams, flNetConSpectatorOn); -#ifdef BATTLEYE - CMD3(CCC_Mask, "mm_net_use_battleye", &m_uNetSrvParams, flNetConBattlEyeOn); -//- CMD3(CCC_Mask, "mm_net_battleye_auto_update", &m_uNetSrvParams, flNetConBattlEyeAutoUpdate); -#endif // BATTLEYE m_iNetConSpectator = 20; CMD4(CCC_Integer, "mm_net_con_spectator", &m_iNetConSpectator, 1, 32); @@ -77,11 +72,6 @@ void CUIOptConCom::Init() CMD3(CCC_Mask, "mm_net_filter_wo_pass", &m_uNetFilter, fl_wo_pass); CMD3(CCC_Mask, "mm_net_filter_wo_ff", &m_uNetFilter, fl_wo_ff); CMD3(CCC_Mask, "mm_net_filter_listen", &m_uNetFilter, fl_listen); - -#ifdef BATTLEYE - CMD3(CCC_Mask, "mm_net_filter_battleye", &m_uNetFilter, fl_battleye); -#endif // BATTLEYE - }; void CUIOptConCom::ReadPlayerNameFromRegistry () diff --git a/trunk/xr_3da/xrGame/ui/UIOptConCom.h b/trunk/xr_3da/xrGame/ui/UIOptConCom.h index 36163c90..fc6b4279 100644 --- a/trunk/xr_3da/xrGame/ui/UIOptConCom.h +++ b/trunk/xr_3da/xrGame/ui/UIOptConCom.h @@ -9,8 +9,6 @@ class CUIOptConCom { flNetSrvDedicated = 1, flNetConPublicServer = 2, flNetConSpectatorOn = 8, - flNetConBattlEyeOn = 16, -//= flNetConBattlEyeAutoUpdate = 32, }; enum{ fl_empty = (1<<0), @@ -19,7 +17,6 @@ class CUIOptConCom { fl_wo_pass = (1<<3), fl_wo_ff = (1<<4), fl_listen = (1<<5), - fl_battleye = (1<<6), }; int m_iMaxPlayers; Flags32 m_uNetSrvParams; diff --git a/trunk/xr_3da/xrGame/xrGameSpy/xrGameSpy_ServerBrowser.cpp b/trunk/xr_3da/xrGame/xrGameSpy/xrGameSpy_ServerBrowser.cpp index a768e643..ab092939 100644 --- a/trunk/xr_3da/xrGame/xrGameSpy/xrGameSpy_ServerBrowser.cpp +++ b/trunk/xr_3da/xrGame/xrGameSpy/xrGameSpy_ServerBrowser.cpp @@ -4,11 +4,10 @@ #include "xrGameSpy_ServerBrowser.h" #include "gamespy/qr2/qr2regkeys.h" -#include "../battleye.h" #define GAMETYPE_NAME_KEY 100 #define DEDICATED_KEY 101 -#define G_BATTLEYE_KEY 134 +//#define G_BATTLEYE_KEY 134 #define G_USER_PASSWORD_KEY 135 static unsigned char Fields_Of_Interest[] = @@ -22,9 +21,6 @@ static unsigned char Fields_Of_Interest[] = GAMEVER_KEY, PASSWORD_KEY, G_USER_PASSWORD_KEY, -#ifdef BATTLEYE - G_BATTLEYE_KEY, -#endif // BATTLEYE DEDICATED_KEY, GAMETYPE_NAME_KEY }; diff --git a/trunk/xr_3da/xrGame/xrGameSpyServer.cpp b/trunk/xr_3da/xrGame/xrGameSpyServer.cpp index 493c145b..05367734 100644 --- a/trunk/xr_3da/xrGame/xrGameSpyServer.cpp +++ b/trunk/xr_3da/xrGame/xrGameSpyServer.cpp @@ -298,11 +298,10 @@ void xrGameSpyServer::GetServerInfo( CServerInfo* si ) si->AddItem( "Game version", QR2()->GetGameVersion( res ), RGB(0,158,255) ); strcpy_s( res, "" ); - if ( HasProtected() || Password.size() > 0 || HasBattlEye() ) + if ( HasProtected() || Password.size() > 0 ) { if ( HasProtected() ) strcat_s( res, "protected " ); if ( Password.size() > 0 ) strcat_s( res, "password " ); - if ( HasBattlEye() ) strcat_s( res, "battleye " ); } else { diff --git a/trunk/xr_3da/xrGame/xrMessages.h b/trunk/xr_3da/xrGame/xrMessages.h index 93f72002..7028c5e8 100644 --- a/trunk/xr_3da/xrGame/xrMessages.h +++ b/trunk/xr_3da/xrGame/xrMessages.h @@ -65,7 +65,7 @@ enum { M_CHANGE_SELF_NAME, M_REMOTE_CONTROL_AUTH, M_REMOTE_CONTROL_CMD, - M_BATTLEYE, + M_BATTLEYE, // not used, to be removed M_MAP_SYNC, MSG_FORCEDWORD = u32(-1) diff --git a/trunk/xr_3da/xrGame/xrServer.cpp b/trunk/xr_3da/xrGame/xrServer.cpp index 1655ab64..3498e521 100644 --- a/trunk/xr_3da/xrGame/xrServer.cpp +++ b/trunk/xr_3da/xrGame/xrServer.cpp @@ -68,15 +68,6 @@ xrServer::~xrServer() m_aDelayedPackets.clear(); } -bool xrServer::HasBattlEye() -{ -#ifdef BATTLEYE - return (g_pGameLevel && Level().battleye_system.server)? true : false; -#else - return false; -#endif // BATTLEYE -} - //-------------------------------------------------------------------- CSE_Abstract* xrServer::ID_to_entity (u16 ID) @@ -413,13 +404,6 @@ void xrServer::SendUpdatesToAll() if (game->sv_force_sync) Perform_game_export(); VERIFY (verify_entities()); - -#ifdef BATTLEYE - if ( g_pGameLevel ) - { - Level().battleye_system.UpdateServer( this ); - } -#endif // BATTLEYE } xr_vector _tmp_log; @@ -567,13 +551,6 @@ u32 xrServer::OnMessage (NET_Packet& P, ClientID sender) // Non-Zero means bro CL->ps->DeathTime = Device.dwTimeGlobal; game->OnPlayerConnectFinished(sender); CL->ps->setName( CL->name.c_str() ); - -#ifdef BATTLEYE - if ( g_pGameLevel && Level().battleye_system.server ) - { - Level().battleye_system.server->AddConnected_OnePlayer( CL ); - } -#endif // BATTLEYE }; game->signal_Syncronize (); VERIFY (verify_entities()); @@ -679,15 +656,6 @@ u32 xrServer::OnMessage (NET_Packet& P, ClientID sender) // Non-Zero means bro { AddDelayedPacket(P, sender); }break; - case M_BATTLEYE: - { -#ifdef BATTLEYE - if ( g_pGameLevel ) - { - Level().battleye_system.ReadPacketServer( sender.value(), &P ); - } -#endif // BATTLEYE - } } VERIFY (verify_entities()); diff --git a/trunk/xr_3da/xrGame/xrServer.h b/trunk/xr_3da/xrGame/xrServer.h index 775e96af..8a8c6a71 100644 --- a/trunk/xr_3da/xrGame/xrServer.h +++ b/trunk/xr_3da/xrGame/xrServer.h @@ -10,7 +10,6 @@ #include "../../xrNetServer/net_server.h" #include "game_sv_base.h" #include "id_generator.h" -#include "battleye.h" #ifdef DEBUG //. #define SLOW_VERIFY_ENTITIES @@ -203,7 +202,6 @@ class xrServer : public IPureServer virtual void Assign_ServerType ( string512& res ) {}; virtual bool HasPassword () { return false; } virtual bool HasProtected () { return false; } - bool HasBattlEye (); virtual void GetServerInfo ( CServerInfo* si ); public: diff --git a/trunk/xr_3da/xrGame/xrServer_CL_disconnect.cpp b/trunk/xr_3da/xrGame/xrServer_CL_disconnect.cpp index 148bba8a..8f98aa7b 100644 --- a/trunk/xr_3da/xrGame/xrServer_CL_disconnect.cpp +++ b/trunk/xr_3da/xrGame/xrServer_CL_disconnect.cpp @@ -47,12 +47,4 @@ void xrServer::OnCL_Disconnected (IClient* CL) csPlayers.Leave (); Server_Client_Check(CL); - -#ifdef BATTLEYE - if ( g_pGameLevel && Level().battleye_system.server ) - { - Level().battleye_system.server->RemovePlayer( CL->ID.value() ); - } -#endif // BATTLEYE - } diff --git a/trunk/xr_3da/xrGame/xrServer_Connect.cpp b/trunk/xr_3da/xrGame/xrServer_Connect.cpp index bc0506a7..f9c73dc0 100644 --- a/trunk/xr_3da/xrGame/xrServer_Connect.cpp +++ b/trunk/xr_3da/xrGame/xrServer_Connect.cpp @@ -48,39 +48,7 @@ xrServer::EConnect xrServer::Connect(shared_str &session_name) game->Create (session_name); csPlayers.Leave (); - -#ifdef BATTLEYE - if ( game->get_option_i( *session_name, "battleye", 1) != 0 ) // default => battleye enable (always) - { - // if level exist & if server in internet - if ( g_pGameLevel && (game->get_option_i( *session_name, "public", 0) != 0) ) - { - if ( Level().battleye_system.server ) - { - Msg( "Warning: BattlEye already loaded!" ); - } - else - { - if ( !Level().battleye_system.LoadServer( this ) ) - { - return ErrBELoad; - } - } - }//g_pGameLevel - } -/* if ( g_pGameLevel && Level().battleye_system.server ) - { - if ( game->get_option_i( *session_name, "battleye_update", 1) != 0 ) // default => battleye auto_update enable (always) - { - Level().battleye_system.auto_update = 1; - } - else - { - Level().battleye_system.auto_update = 0; - } - }*/ -#endif // BATTLEYE - + return IPureServer::Connect(*session_name); } @@ -123,11 +91,6 @@ void xrServer::AttachNewClient (IClient* CL) MSYS_CONFIG msgConfig; msgConfig.sign1 = 0x12071980; msgConfig.sign2 = 0x26111975; - msgConfig.is_battleye = 0; - -#ifdef BATTLEYE - msgConfig.is_battleye = (g_pGameLevel && Level().battleye_system.server != 0)? 1 : 0; -#endif // BATTLEYE if(psNET_direct_connect) //single_game { diff --git a/trunk/xr_3da/xrGame/xr_Client_BattlEye.cpp b/trunk/xr_3da/xrGame/xr_Client_BattlEye.cpp deleted file mode 100644 index cf7b5534..00000000 --- a/trunk/xr_3da/xrGame/xr_Client_BattlEye.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include "stdafx.h" - -#include "xr_Client_BattlEye.h" -#include "xrMessages.h" -#include "Level.h" -#include "game_cl_base.h" - -#ifdef BATTLEYE - -extern int g_be_message_out; - -BattlEyeClient::BattlEyeClient() -{ - m_module = NULL; - pfnRun = NULL; - pfnCommand = NULL; - pfnNewPacket = NULL; - m_succefull = false; - InitDLL(); -} - -void BattlEyeClient::InitDLL() -{ - if ( !Level().battleye_system.InitDir() ) - { - return; - } - - m_module = LoadLibrary( Level().battleye_system.GetClientPath() ); - if ( !m_module ) - { - Msg( "! Error LoadLibrary %s", BATTLEYE_CLIENT_DLL ); - return; - } -// string_path path_dll; -// GetModuleFileName( m_module, path_dll, sizeof(path_dll) ); -// Level().battleye_system.SetClientPath( path_dll ); - - Init = (InitCl_t)GetProcAddress( m_module, "Init" ); - if ( !Init ) - { - Msg( "! Error GetProcAddress from %s", BATTLEYE_CLIENT_DLL ); - if ( !FreeLibrary( m_module ) ) - { - Msg( "! Error FreeLibrary for %s " BATTLEYE_CLIENT_DLL ); - } - m_module = NULL; - return; - } - - m_succefull = Init( - // Level().battleye_system.auto_update, - PrintMessage, - SendPacket, - &pfnExit, - &pfnRun, - &pfnCommand, - &pfnNewPacket - ); - - if ( !m_succefull ) - { - Msg( "! Error initialization of %s (function Init return false)", BATTLEYE_CLIENT_DLL ); - if ( !FreeLibrary( m_module ) ) - { - Msg( "! Error FreeLibrary for %s", BATTLEYE_CLIENT_DLL ); - } - m_module = NULL; - pfnRun = NULL; - pfnCommand = NULL; - pfnNewPacket = NULL; - return; - } -} - -void BattlEyeClient::PrintMessage( char* message ) -{ - //if ( g_be_message_out ) - { - string512 text; - sprintf_s( text, sizeof(text), "BattlEye Client: %s", message ); - Msg( "%s", text ); - - if( g_be_message_out ) //==2 - { - if ( Level().game ) - { - Level().game->CommonMessageOut( text ); - } - } - } -} - -void BattlEyeClient::SendPacket( void* packet, int len ) -{ - NET_Packet P; - P.w_begin( M_BATTLEYE ); - P.w_u32( len ); - P.w( packet, len ); - Level().Send( P, net_flags() ); -} - -bool BattlEyeClient::Run() -{ - R_ASSERT( m_module ); - R_ASSERT( pfnRun ); - return pfnRun(); -} - -void BattlEyeClient::Command( char* command ) -{ - R_ASSERT( m_module ); - R_ASSERT( pfnCommand ); - pfnCommand( command ); -} - -void BattlEyeClient::NewPacket( void* packet, int len ) -{ - R_ASSERT( m_module ); - R_ASSERT( pfnNewPacket ); - pfnNewPacket( packet, len ); -} - -bool BattlEyeClient::IsLoaded() -{ - return m_module != NULL; -} - -BattlEyeClient::~BattlEyeClient() -{ - ReleaseDLL(); -} - -void BattlEyeClient::ReleaseDLL() -{ - if ( m_succefull ) - { - if ( !pfnExit() ) - { - Msg( "! Error unloading data in %s", BATTLEYE_CLIENT_DLL ); - } - } - if ( m_module ) - { - if ( !FreeLibrary( m_module ) ) - { - Msg( "! Error FreeLibrary for %s", BATTLEYE_CLIENT_DLL ); - } - } - m_module = NULL; - pfnRun = NULL; - pfnCommand = NULL; - pfnNewPacket = NULL; - m_succefull = false; -} - -#endif // BATTLEYE diff --git a/trunk/xr_3da/xrGame/xr_Client_BattlEye.h b/trunk/xr_3da/xrGame/xr_Client_BattlEye.h deleted file mode 100644 index 828fb36e..00000000 --- a/trunk/xr_3da/xrGame/xr_Client_BattlEye.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __XR_CLIENT_BATTLEYE_H__ -#define __XR_CLIENT_BATTLEYE_H__ - -#include "battleye.h" - -#ifdef BATTLEYE - -class BattlEyeClient -{ - HMODULE m_module; - bool m_succefull; - - typedef bool ( __cdecl* InitCl_t ) - ( - // int iAutoUpdate, - //in func pointers - void ( __cdecl *pfnPrintMessage )( char* ), - void ( __cdecl *pfnSendPacket )( void*, int ), - //out func pointers - bool ( __cdecl **ppfnExit )( void ), - bool ( __cdecl **ppfnRun )( void ), - void ( __cdecl **ppfnCommand )( char* ), - void ( __cdecl **ppfnNewPacket )( void*, int ) - ); - - InitCl_t Init; - - //in func - static void __cdecl PrintMessage( char* ); - static void __cdecl SendPacket ( void*, int ); - - //out func pointers - bool ( __cdecl *pfnExit )( void ); - bool ( __cdecl *pfnRun )( void ); - void ( __cdecl *pfnCommand )( char* ); - void ( __cdecl *pfnNewPacket)( void*, int ); - - void InitDLL(); - void ReleaseDLL(); - -public: - bool Run ( void ); - void Command ( char* ); - void NewPacket ( void*, int ); - ////////////////////////////////////////////////////////////////////////// - BattlEyeClient(); - ~BattlEyeClient(); - bool IsLoaded(); - -}; // class BattlEyeClient - -#endif // BATTLEYE - -#endif // __XR_CLIENT_BATTLEYE_H__ diff --git a/trunk/xr_3da/xrGame/xr_Server_BattlEye.cpp b/trunk/xr_3da/xrGame/xr_Server_BattlEye.cpp deleted file mode 100644 index e94ea220..00000000 --- a/trunk/xr_3da/xrGame/xr_Server_BattlEye.cpp +++ /dev/null @@ -1,269 +0,0 @@ -#include "stdafx.h" - -#include "xr_Server_BattlEye.h" - -#include "xrMessages.h" -#include "Level.h" -#include "xrServer.h" -#include "game_cl_base.h" - -#include "xrGameSpy/xrGameSpy_MainDefs.h" -#include "xrGameSpyServer.h" -#include "gamespy/GameSpy_Full.h" - -#ifdef BATTLEYE - -extern int g_be_message_out; -ENGINE_API bool g_dedicated_server; - -BattlEyeServer::BattlEyeServer( xrServer* Server ) -{ - m_module = NULL; - pfnRun = NULL; - pfnCommand = NULL; - pfnAddPlayer = NULL; - pfnRemovePlayer = NULL; - pfnNewPacket = NULL; - Init = NULL; - m_succefull = false; - - if ( !Level().battleye_system.InitDir() ) - { - return; - } - m_pServer = Server; - - m_module = LoadLibrary( Level().battleye_system.GetServerPath() );//= - if ( !m_module ) - { - Msg( "! Error LoadLibrary %s", BATTLEYE_SERVER_DLL ); - return; - } -// string_path path_dll; -// GetModuleFileName( m_module, path_dll, sizeof(path_dll) ); -// Level().battleye_system.SetServerPath( path_dll ); - - Init = (InitSrv_t)( GetProcAddress( m_module, "Init" ) );//= - if ( !Init ) - { - Msg( "! Error GetProcAddress from %s", BATTLEYE_SERVER_DLL ); - if ( !FreeLibrary( m_module ) ) - { - Msg( "! Error FreeLibrary for %s", BATTLEYE_SERVER_DLL ); - } - m_module = NULL; - return; - } - - string64 game_version; - strcpy_s( game_version, GAME_VERSION ); - - m_succefull = Init( - game_version, -// Level().battleye_system.auto_update, - &PrintMessage, - &SendPacket, - &KickPlayer, - &pfnExit, - &pfnRun, - &pfnCommand, - &pfnAddPlayer, - &pfnRemovePlayer, - &pfnNewPacket - ); - - if ( !m_succefull ) - { - Msg( "! Error initialization of %s (function Init return false)", BATTLEYE_SERVER_DLL ); - if ( !FreeLibrary( m_module ) ) - { - Msg( "! Error FreeLibrary for %s", BATTLEYE_SERVER_DLL ); - } - m_module = NULL; - pfnRun = NULL; - pfnCommand = NULL; - pfnAddPlayer = NULL; - pfnRemovePlayer = NULL; - pfnNewPacket = NULL; - return; - } -} - -void BattlEyeServer::AddConnectedPlayers() // if net_Ready -{ - Level().Server->clients_Lock(); - u32 cnt = Level().Server->game->get_players_count(); - for( u32 it = 0; it < cnt; ++it ) - { - xrClientData* CL = (xrClientData*)Level().Server->client_Get( it ); - if ( CL->net_Ready ) - { - AddConnected_OnePlayer( CL ); - } - } - Level().Server->clients_Unlock(); -} - -void BattlEyeServer::AddConnected_OnePlayer( xrClientData* CL ) -{ - if ( g_dedicated_server && (CL->ID.value() == Level().Server->GetServerClient()->ID.value()) ) - { - return; - } - - if ( CL->m_guid[0] == 0 ) - { - AddPlayer( CL->ID.value(), (char*)CL->ps->getName(), 0, 0 ); - } - else - { - AddPlayer( CL->ID.value(), (char*)CL->ps->getName(), CL->m_guid, xr_strlen(CL->m_guid)+1 ); - } -} - -void BattlEyeServer::PrintMessage( char* message ) -{ - //if( g_be_message_out ) - { - string512 text; - sprintf_s( text, sizeof(text), "BattlEye Server: %s", message ); - Msg( "%s", text ); - - if( g_be_message_out )//==2 - { - if ( Level().game ) - { - Level().game->CommonMessageOut( text ); - } - } - } -} - -void BattlEyeServer::SendPacket( int player, void* packet, int len ) -{ - NET_Packet P; - P.w_begin( M_BATTLEYE ); - P.w_u32( len ); - P.w( packet, len ); - Level().Server->SendTo( (u32)player, P, net_flags() ); -} - -void BattlEyeServer::KickPlayer( int player, char* reason ) -{ - Level().Server->clients_Lock(); - - u32 cnt = Level().Server->game->get_players_count(); - for( u32 it = 0; it < cnt; ++it ) - { - xrClientData *l_pC = (xrClientData*)Level().Server->client_Get(it); - if ( l_pC->ID.value()==(u32)player ) - { - if ( Level().Server->GetServerClient() != l_pC ) - { - Msg( "- Disconnecting : %s ! Kicked by BattlEye Server. Reason: %s", l_pC->ps->getName(), reason ); - string512 reason2; - strcpy_s( reason2, reason ); - - Level().Server->DisconnectClient( l_pC, reason2 ); - break; - } - else - { -// Msg("BattlEye Server disconnect server's client"); - //*CStringTable().translate( ui_st_kicked_by_battleye ); //reason translate? - string512 reason2; - sprintf_s( reason2, sizeof(reason2), - " Disconnecting : %s ! Server's Client kicked by BattlEye Server. Reason: %s", - l_pC->ps->getName(), reason ); - Msg( reason2 ); - - NET_Packet P; - P.w_begin( M_GAMEMESSAGE ); - P.w_u32( GAME_EVENT_SERVER_DIALOG_MESSAGE ); - P.w_stringZ( reason2 ); - Level().Server->SendBroadcast( l_pC->ID, P ); // to all, except self - - Level().OnSessionTerminate( reason2 ); //to self - Engine.Event.Defer("KERNEL:disconnect"); - break; - } - } - } - if ( it == cnt ) - { - Msg( "! No such player found : %i", player ); - } - - Level().Server->clients_Unlock(); -} - -bool BattlEyeServer::Run() -{ - R_ASSERT( m_module ); - R_ASSERT( pfnRun ); - return pfnRun(); -} - -void BattlEyeServer::Command( char* command ) -{ - R_ASSERT( m_module ); - R_ASSERT( pfnCommand ); - pfnCommand( command ); -} - -void BattlEyeServer::AddPlayer( int player, char* name, void* guid, int guidlen ) -{ - R_ASSERT( m_module ); - R_ASSERT( pfnAddPlayer ); - pfnAddPlayer( player, name, guid, guidlen ); -} - -void BattlEyeServer::RemovePlayer( int player ) -{ - R_ASSERT( m_module ); - R_ASSERT( pfnRemovePlayer ); - pfnRemovePlayer( player ); -} - -void BattlEyeServer::NewPacket( int player, void *packet, int len ) -{ - R_ASSERT( m_module ); - R_ASSERT( pfnNewPacket ); - pfnNewPacket( player, packet, len ); -} - -bool BattlEyeServer::IsLoaded() -{ - return m_module != NULL; -} - -BattlEyeServer::~BattlEyeServer() -{ - ReleaseDLL(); -} - -void BattlEyeServer::ReleaseDLL() -{ - if ( m_succefull ) - { - if ( !pfnExit() ) - { - Msg( "! Error unloading data in %s", BATTLEYE_SERVER_DLL ); - } - } - if ( m_module ) - { - if ( !FreeLibrary( m_module ) ) - { - Msg( "! Error FreeLibrary for %s", BATTLEYE_SERVER_DLL ); - } - } - m_module = NULL; - pfnRun = NULL; - pfnCommand = NULL; - pfnAddPlayer = NULL; - pfnRemovePlayer = NULL; - pfnNewPacket = NULL; -} - -#endif // BATTLEYE diff --git a/trunk/xr_3da/xrGame/xr_Server_BattlEye.h b/trunk/xr_3da/xrGame/xr_Server_BattlEye.h deleted file mode 100644 index 2beea941..00000000 --- a/trunk/xr_3da/xrGame/xr_Server_BattlEye.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __XR_SERVER_BATTLEYE_H__ -#define __XR_SERVER_BATTLEYE_H__ - -#include "battleye.h" - -#ifdef BATTLEYE - -class xrServer; -class xrClientData; - -typedef bool ( __cdecl* InitSrv_t ) - ( - char* pstrGameVersion, -// int iAutoUpdate, - //in func pointers - void (__cdecl *pfnPrintMessage )( char* ), - void (__cdecl *pfnSendPacket )( int, void*, int ), - void (__cdecl *pfnKickPlayer )( int, char* ), - //out func pointers - bool (__cdecl **ppfnExit )( void ), - bool (__cdecl **ppfnRun )( void ), - void (__cdecl **ppfnCommand )( char* ), - void (__cdecl **ppfnAddPlayer )( int, char*, void*, int ), - void (__cdecl **ppfnRemovePlayer )( int ), - void (__cdecl **ppfnNewPacket )( int, void*, int ) - ); - -class BattlEyeServer -{ - HMODULE m_module; - bool m_succefull; - InitSrv_t Init; - - xrServer* m_pServer; - - //in func - static void __cdecl PrintMessage (char *); - static void __cdecl SendPacket (int, void *, int); - static void __cdecl KickPlayer (int, char *); - - //out func pointers - bool (__cdecl *pfnExit )(void); - bool (__cdecl *pfnRun )(void); - void (__cdecl *pfnCommand )(char *); - void (__cdecl *pfnAddPlayer )(int, char *, void *, int); - void (__cdecl *pfnRemovePlayer )(int); - void (__cdecl *pfnNewPacket )(int, void *, int); - - void ReleaseDLL(); - -public: - bool Run (void); - void Command (char *); - void AddPlayer (int, char *, void *, int); - void RemovePlayer (int); - void NewPacket (int, void *, int); - - ////////////////////////////////////////////////////////////////////////// - BattlEyeServer( xrServer* Server ); - ~BattlEyeServer(); - bool IsLoaded(); - void AddConnectedPlayers(); - void AddConnected_OnePlayer( xrClientData* CL ); - -}; // class BattlEyeServer - -#endif // BATTLEYE - -#endif // __XR_SERVER_BATTLEYE_H__