You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
========================== MAJOR FEATURES + CHANGES ========================== Change 2816560 on 2016/01/05 by Jeff.Campeau Remove duplicate CEF binaries Change 2835599 on 2016/01/20 by Lee.Clark PS4 - Added pragma optimization macros Change 2841103 on 2016/01/23 by Mark.Satterthwaite Integrate Git PR #1958: Fixed typo in EMetalFeatures enum #jira UE-25721 Change 2841369 on 2016/01/24 by Mark.Satterthwaite Fix for Metal crash due to attempt to set a null uniform & null SRV to a shader which requires both exist. #jira UE-25910 Change 2841795 on 2016/01/25 by Lee.Clark PS4 - MovieStreamer improvements * Use GPU for YUV conversion * Use new Software2 Decoder Change 2842261 on 2016/01/25 by Mark.Satterthwaite Fix some memory leaks. Change 2842831 on 2016/01/25 by Mark.Satterthwaite Metal implementation for RHIBlockUntilGPUIdle. Change 2842838 on 2016/01/25 by Mark.Satterthwaite When using parallel command contexts in Metal we must ensure that the FRingBuffer is still valid, which means some smart/weak pointers are in order. We should also ensure that functions that may return auto-released objects are appropriately wrapped with scoped autorelease pools. Texture creation failures should also be fatal as we never expect that to occur. Change 2842914 on 2016/01/25 by Mark.Satterthwaite Change assert in MetalTexture's format-shifting SRV constructor to enforce the Metal textureView limits: 1. No format shifting for MSAA color buffers. 2. No access to stencil in MSAA packed depth/stencil surface. This will allow Metal MSAA support to work on iOS when using separate depth & stencil textures since there's no format shifting involved there. #codereview peter.sauerbrei Change 2843028 on 2016/01/25 by Mark.Satterthwaite In Metal wwitch to blit on the correct context when copying out the stencil data into the stencil SRV copy. Change 2845531 on 2016/01/27 by Lee.Clark PS4 - Fix memory alignment for back buffers * Fix memory alignment for MapLargeBlock * Fix available direct memory tracking Change 2846491 on 2016/01/27 by Jeff.Campeau 2015 compile fixes for Orion Change 2847395 on 2016/01/28 by Mark.Satterthwaite Clear the stencil-SRV copy to 0 in Metal using a blit when created to avoid artefacts if used prior to the parent texture being rendered. #jira UE-25834 Change 2847419 on 2016/01/28 by Mark.Satterthwaite Apply the same fix to OpenGL's Stencil SRV logic as CL #2847395 applies to Metal. Change 2848093 on 2016/01/28 by Mark.Satterthwaite Cache parallel encoding Metal contexts & reuse them rather than creating a new one each time in order to massively improve parallel encoding performance. This required adding a reset function to Metal's internal state-cache which calls the CommandEncoder wrapper's reset so we don't accidently retain previous state. Change 2849469 on 2016/01/29 by Mark.Satterthwaite Defer render & compute command encoder construction to draw/dispatch etc to eliminate redundant encoders that then perform unnecessary driver & GPU synchronisation work. Currently Clear loadActions force an encoder even if it would then be empty as otherwise we see incorrect rendering. This needs to be tracked and optimised away too in order to achieve the same performance as D3D11. Change 2849820 on 2016/01/29 by Daniel.Lamb Fixed issue where a single DDC back end would not create a hierarchy. #codereview Peter.Sauerbrei Change 2850762 on 2016/02/01 by Jeff.Campeau System-wide critical section support for Xbox One Change 2850763 on 2016/02/01 by Jeff.Campeau Network and product config for Orion Change 2852459 on 2016/02/02 by Mark.Satterthwaite Temporarily disable the lazy render command-encoder construction while investigating why it turns some samples black in Metal SM5 mode. Change 2853947 on 2016/02/03 by Mark.Satterthwaite Fix some lazy encoder construction fallout which also means we don't need to recreate render encoder state when performing profiling - the next draw/clear will do that as required. Change 2854015 on 2016/02/03 by Mark.Satterthwaite Move Stencil SRV blitting into FMetalSurface::UpdateSRV called when binding the texture SRV instead of having it done immediately post-rendering. This should avoid paying for the blit when stencil SRV sampling is never used or multiple blits when render-encoders that write stencil are split up due to query buffer overflow or similar. The cost will be a blit per-bind instead which should be more predictable. Change 2854142 on 2016/02/03 by Mark.Satterthwaite Implemented GetTextureBaseRHI (brought over from Dev-Rendering CL #2853948) for Metal to avoid unnecessary virtual function call chain to resolve the FMetalSurface* from an RHI texture. Change 2854222 on 2016/02/03 by Mark.Satterthwaite Remove the uniform buffer resource caching from Metal to match Dev-Rendering CL #2853948. Change 2854246 on 2016/02/03 by Mark.Satterthwaite Removed the uniform buffer resource caching from OpenGLDrv & implemented GetTextureBaseRHI to avoid unnecessary virtual function calls to match Dev-Rendering CL #2853948. Change 2854279 on 2016/02/03 by Mark.Satterthwaite Remove direct access to the MTLCommandQueue, for parallel rendering to work we're going to need to do a bit of management that means its more sensible to keep it private. Change 2855524 on 2016/02/04 by Lee.Clark PS4 - Fix Grayscale SRGB support [CL 2898161 by Josh Adams in Main branch]
172 lines
4.9 KiB
C++
172 lines
4.9 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "BootstrapPackagedGame.h"
|
|
|
|
#define IDI_EXEC_FILE 201
|
|
#define IDI_EXEC_ARGS 202
|
|
|
|
WCHAR* ReadResourceString(HMODULE ModuleHandle, LPCWSTR Name)
|
|
{
|
|
WCHAR* Result = NULL;
|
|
|
|
HRSRC ResourceHandle = FindResource(ModuleHandle, Name, RT_RCDATA);
|
|
if(ResourceHandle != NULL)
|
|
{
|
|
HGLOBAL AllocHandle = LoadResource(ModuleHandle, ResourceHandle);
|
|
if(AllocHandle != NULL)
|
|
{
|
|
WCHAR* Data = (WCHAR*)LockResource(AllocHandle);
|
|
DWORD DataLen = SizeofResource(ModuleHandle, ResourceHandle) / sizeof(WCHAR);
|
|
|
|
Result = new WCHAR[DataLen + 1];
|
|
memcpy(Result, Data, DataLen * sizeof(WCHAR));
|
|
Result[DataLen] = 0;
|
|
}
|
|
}
|
|
|
|
return Result;
|
|
}
|
|
|
|
int InstallMissingPrerequisites(const WCHAR* BaseDirectory)
|
|
{
|
|
// Look for missing prerequisites
|
|
WCHAR MissingPrerequisites[1024] = { 0, };
|
|
if(LoadLibrary(L"MSVCP140.DLL") == NULL || LoadLibrary(L"ucrtbase.dll") == NULL)
|
|
{
|
|
wcscat_s(MissingPrerequisites, TEXT("Microsoft Visual C++ 2015 Runtime\n"));
|
|
}
|
|
if(LoadLibrary(L"XINPUT1_3.DLL") == NULL)
|
|
{
|
|
wcscat_s(MissingPrerequisites, TEXT("DirectX Runtime\n"));
|
|
}
|
|
|
|
// Check if there's anything missing
|
|
if(MissingPrerequisites[0] != 0)
|
|
{
|
|
WCHAR MissingPrerequisitesMsg[1024];
|
|
wsprintf(MissingPrerequisitesMsg, L"The following component(s) are required to run this program:\n\n%s", MissingPrerequisites);
|
|
|
|
// If we don't have the installer, just notify the user and quit
|
|
WCHAR PrereqInstaller[MAX_PATH];
|
|
#ifdef _M_X64
|
|
PathCombine(PrereqInstaller, BaseDirectory, L"Engine\\Extras\\Redist\\en-us\\UE4PrereqSetup_x64.exe");
|
|
#else
|
|
PathCombine(PrereqInstaller, BaseDirectory, L"Engine\\Extras\\Redist\\en-us\\UE4PrereqSetup_x86.exe");
|
|
#endif
|
|
if(GetFileAttributes(PrereqInstaller) == INVALID_FILE_ATTRIBUTES)
|
|
{
|
|
MessageBox(NULL, MissingPrerequisitesMsg, NULL, MB_OK);
|
|
return 9001;
|
|
}
|
|
|
|
// Otherwise ask them if they want to install them
|
|
wcscat_s(MissingPrerequisitesMsg, L"\nWould you like to install them now?");
|
|
if(MessageBox(NULL, MissingPrerequisitesMsg, NULL, MB_YESNO) == IDNO)
|
|
{
|
|
return 9002;
|
|
}
|
|
|
|
// Start the installer
|
|
SHELLEXECUTEINFO ShellExecuteInfo;
|
|
ZeroMemory(&ShellExecuteInfo, sizeof(ShellExecuteInfo));
|
|
ShellExecuteInfo.cbSize = sizeof(ShellExecuteInfo);
|
|
ShellExecuteInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
|
|
ShellExecuteInfo.nShow = SW_SHOWNORMAL;
|
|
ShellExecuteInfo.lpFile = PrereqInstaller;
|
|
if(!ShellExecuteExW(&ShellExecuteInfo))
|
|
{
|
|
return 9003;
|
|
}
|
|
|
|
// Wait for the process to complete, then get its exit code
|
|
DWORD ExitCode = 0;
|
|
WaitForSingleObject(ShellExecuteInfo.hProcess, INFINITE);
|
|
GetExitCodeProcess(ShellExecuteInfo.hProcess, &ExitCode);
|
|
CloseHandle(ShellExecuteInfo.hProcess);
|
|
if(ExitCode != 0)
|
|
{
|
|
return 9004;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
int SpawnTarget(WCHAR* CmdLine)
|
|
{
|
|
STARTUPINFO StartupInfo;
|
|
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
|
|
StartupInfo.cb = sizeof(StartupInfo);
|
|
|
|
PROCESS_INFORMATION ProcessInfo;
|
|
ZeroMemory(&ProcessInfo, sizeof(ProcessInfo));
|
|
|
|
if(!CreateProcess(NULL, CmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &StartupInfo, &ProcessInfo))
|
|
{
|
|
DWORD ErrorCode = GetLastError();
|
|
|
|
WCHAR* Buffer = new WCHAR[wcslen(CmdLine) + 50];
|
|
wsprintf(Buffer, L"Couldn't start:\n%s\nCreateProcess() returned %x.", CmdLine, ErrorCode);
|
|
MessageBoxW(NULL, Buffer, NULL, MB_OK);
|
|
delete Buffer;
|
|
|
|
return 9005;
|
|
}
|
|
|
|
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
|
|
DWORD ExitCode = 9006;
|
|
GetExitCodeProcess(ProcessInfo.hProcess, &ExitCode);
|
|
|
|
CloseHandle(ProcessInfo.hThread);
|
|
CloseHandle(ProcessInfo.hProcess);
|
|
return (int)ExitCode;
|
|
}
|
|
|
|
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, TCHAR* CmdLine, int ShowCmd)
|
|
{
|
|
(void)hPrevInstance;
|
|
(void)ShowCmd;
|
|
|
|
// Get the current module filename
|
|
WCHAR CurrentModuleFile[MAX_PATH];
|
|
GetModuleFileNameW(hInstance, CurrentModuleFile, sizeof(CurrentModuleFile));
|
|
|
|
// Get the base directory from the current module filename
|
|
WCHAR BaseDirectory[MAX_PATH];
|
|
PathCanonicalize(BaseDirectory, CurrentModuleFile);
|
|
PathRemoveFileSpec(BaseDirectory);
|
|
|
|
// Get the executable to run
|
|
WCHAR* ExecFile = ReadResourceString(hInstance, MAKEINTRESOURCE(IDI_EXEC_FILE));
|
|
if(ExecFile == NULL)
|
|
{
|
|
MessageBoxW(NULL, L"This program is used for packaged games and is not meant to be run directly.", NULL, MB_OK);
|
|
return 9000;
|
|
}
|
|
|
|
// Create a full command line for the program to run
|
|
WCHAR* BaseArgs = ReadResourceString(hInstance, MAKEINTRESOURCE(IDI_EXEC_ARGS));
|
|
WCHAR* ChildCmdLine = new WCHAR[wcslen(BaseDirectory) + wcslen(ExecFile) + wcslen(BaseArgs) + wcslen(CmdLine) + 20];
|
|
wsprintf(ChildCmdLine, L"\"%s\\%s\" %s %s", BaseDirectory, ExecFile, BaseArgs, CmdLine);
|
|
delete BaseArgs;
|
|
delete ExecFile;
|
|
|
|
// Install the prerequisites
|
|
int ExitCode = InstallMissingPrerequisites(BaseDirectory);
|
|
if(ExitCode != 0)
|
|
{
|
|
delete ChildCmdLine;
|
|
return ExitCode;
|
|
}
|
|
|
|
// Spawn the target executable
|
|
ExitCode = SpawnTarget(ChildCmdLine);
|
|
if(ExitCode != 0)
|
|
{
|
|
delete ChildCmdLine;
|
|
return ExitCode;
|
|
}
|
|
|
|
delete ChildCmdLine;
|
|
return ExitCode;
|
|
}
|