mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-03 05:49:04 +03:00
* WIP C++03 + Xbox 360 Support * math.h & _USE_MATH_DEFINES on Level.hpp Updated Xenon vcxproj file for new file structure. * * Fix bad GUI scale setup. * * Gui: Use ratios instead of hardcoded sub-1 floating point values, to make the mechanism more clear. * Add Direct Connect Button and Screen (#30) * Add Direct Connect Button and Screen * Remove accidental extra build directories for wasm * Add DirectConnectScreen.cpp to the CMake * Use Hungarian coding style notation * * Fix errors caused by #30 * * Improve the Chat Screen * * Improve the DirectConnectScreen, among other things. * * Update the game title once again. * * Add build-wasm.bat. * * Add info about compiling for wasm * * Fix send to specific GUID actually broadcasting to everyone * * Add command manager. * * Add writeable configuration. * * Allow dynamic screen size change on windows * * Allow the same thing on the emscripten version. * WIP C++03 + Xbox 360 Support * Fixed a possible merging issue that broke RakNet? * Additional Xbox 360 compatability fixes --------- Co-authored-by: Brent Da Mage <BrentDaMage@users.noreply.github.com> Co-authored-by: iProgramInCpp <iprogramincpp@gmail.com> Co-authored-by: ts <124226059+uniformization@users.noreply.github.com>
90 lines
1.7 KiB
C++
90 lines
1.7 KiB
C++
/*
|
|
* Copyright (c) 2014, Oculus VR, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
|
|
#include "WSAStartupSingleton.h"
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(_WIN32) && !defined(WINDOWS_STORE_RT)
|
|
#if defined(_XBOX)
|
|
#include <xtl.h>
|
|
#else
|
|
#include <winsock2.h>
|
|
#include <ws2tcpip.h>
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
#include "RakNetDefines.h"
|
|
#include <stdio.h>
|
|
|
|
int WSAStartupSingleton::refCount=0;
|
|
|
|
WSAStartupSingleton::WSAStartupSingleton() {}
|
|
WSAStartupSingleton::~WSAStartupSingleton() {}
|
|
void WSAStartupSingleton::AddRef(void)
|
|
{
|
|
#if defined(_WIN32) && !defined(WINDOWS_STORE_RT)
|
|
|
|
refCount++;
|
|
|
|
if (refCount!=1)
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
WSADATA winsockInfo;
|
|
if ( WSAStartup( MAKEWORD( 2, 2 ), &winsockInfo ) != 0 )
|
|
{
|
|
#if defined(_DEBUG) && !defined(WINDOWS_PHONE_8) && !defined(_XBOX)
|
|
DWORD dwIOError = GetLastError();
|
|
LPVOID messageBuffer;
|
|
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
|
NULL, dwIOError, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
|
|
( LPTSTR ) & messageBuffer, 0, NULL );
|
|
// something has gone wrong here...
|
|
RAKNET_DEBUG_PRINTF( "WSAStartup failed:Error code - %d\n%s", dwIOError, messageBuffer );
|
|
//Free the buffer.
|
|
LocalFree( messageBuffer );
|
|
#endif
|
|
}
|
|
|
|
#endif
|
|
}
|
|
void WSAStartupSingleton::Deref(void)
|
|
{
|
|
#if defined(_WIN32) && !defined(WINDOWS_STORE_RT)
|
|
if (refCount==0)
|
|
return;
|
|
|
|
if (refCount>1)
|
|
{
|
|
refCount--;
|
|
return;
|
|
}
|
|
|
|
WSACleanup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
refCount=0;
|
|
#endif
|
|
}
|