Fix building for Xbox Scarlett
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||
//
|
||||
// TODO: Check defines so we can disable ENet
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "Engine/Core/Math/Math.h"
|
||||
#include "Engine/Core/Collections/HashFunctions.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Engine/CommandLine.h"
|
||||
#include "IncludeWindowsHeaders.h"
|
||||
#include <Psapi.h>
|
||||
#include <WinSock2.h>
|
||||
@@ -19,7 +18,6 @@
|
||||
#include <WinBase.h>
|
||||
#include <xmmintrin.h>
|
||||
#include <intrin.h>
|
||||
#include <cstdio>
|
||||
#pragma comment(lib, "Iphlpapi.lib")
|
||||
|
||||
namespace
|
||||
@@ -65,28 +63,6 @@ bool Win32Platform::Init()
|
||||
if (PlatformBase::Init())
|
||||
return true;
|
||||
|
||||
// Init console output (engine is linked with /SUBSYSTEM:WINDOWS so it lacks of proper console output on Windows)
|
||||
if (CommandLine::Options.Std)
|
||||
{
|
||||
// Attaches output of application to parent console, returns true if running in console-mode
|
||||
// [Reference: https://www.tillett.info/2013/05/13/how-to-create-a-windows-program-that-works-as-both-as-a-gui-and-console-application]
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS))
|
||||
{
|
||||
const HANDLE consoleHandleOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
if (consoleHandleOut != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
}
|
||||
const HANDLE consoleHandleError = GetStdHandle(STD_ERROR_HANDLE);
|
||||
if (consoleHandleError != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Init timing
|
||||
LARGE_INTEGER frequency;
|
||||
const auto freqResult = QueryPerformanceFrequency(&frequency);
|
||||
|
||||
@@ -15,12 +15,14 @@
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
#include "Engine/Platform/MessageBox.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Engine/CommandLine.h"
|
||||
#include "../Win32/IncludeWindowsHeaders.h"
|
||||
#include <VersionHelpers.h>
|
||||
#include <ShellAPI.h>
|
||||
#include <timeapi.h>
|
||||
#include <Psapi.h>
|
||||
#include <objbase.h>
|
||||
#include <cstdio>
|
||||
#if CRASH_LOG_ENABLE
|
||||
#include <dbghelp.h>
|
||||
#endif
|
||||
@@ -593,6 +595,28 @@ bool WindowsPlatform::Init()
|
||||
{
|
||||
if (Win32Platform::Init())
|
||||
return true;
|
||||
|
||||
// Init console output (engine is linked with /SUBSYSTEM:WINDOWS so it lacks of proper console output on Windows)
|
||||
if (CommandLine::Options.Std)
|
||||
{
|
||||
// Attaches output of application to parent console, returns true if running in console-mode
|
||||
// [Reference: https://www.tillett.info/2013/05/13/how-to-create-a-windows-program-that-works-as-both-as-a-gui-and-console-application]
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS))
|
||||
{
|
||||
const HANDLE consoleHandleOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
if (consoleHandleOut != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
}
|
||||
const HANDLE consoleHandleError = GetStdHandle(STD_ERROR_HANDLE);
|
||||
if (consoleHandleError != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if can run Engine on current platform (requires Windows Vista SP1 or above)
|
||||
if (!IsWindowsVistaSP1OrGreater() && !IsWindowsServer())
|
||||
|
||||
8
Source/ThirdParty/enet/enet.h
vendored
8
Source/ThirdParty/enet/enet.h
vendored
@@ -5723,17 +5723,25 @@ extern "C" {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
timeBeginPeriod(1);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void enet_deinitialize(void) {
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
timeEndPeriod(1);
|
||||
#endif
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
enet_uint64 enet_host_random_seed(void) {
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
return (enet_uint64) timeGetTime();
|
||||
#else
|
||||
return (enet_uint64) time(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
int enet_address_set_host_ip_old(ENetAddress *address, const char *name) {
|
||||
|
||||
Reference in New Issue
Block a user