You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden #rb none ============================ MAJOR FEATURES & CHANGES ============================ Change 3771581 by Chris.Babcock Add proxy support for Android #jira UE-52671 #ue4 #android Change 3771990 by Jack.Porter Fixed a crash when duplicating a landscape level in a cooked build. #jira UE-46550 Change 3772922 by Allan.Bentham Convert half float texture coordinates to float during serialize if HW does not support halfs. #jira UE-52397 Change 3772973 by Allan.Bentham Add GLES3.1 compatibility mode to mobile preview. Use -GLESCompat alongside -featureleveles31 to run windows mobile preview with android ES3.1 shaders. Change 3775585 by Cosmin.Sulea Safe zone rotation iPhoneX #jira UEMOB-52138 Change 3776702 by Peter.Sauerbrei addition of missing default icons #jira UE-52387 Change 3776775 by Peter.Sauerbrei fix for marketing icon size in the project settings #jira UE-52388 Change 3777336 by Peter.Sauerbrei properly call OnOpenURL in the main thread start if the engine hasn't been initialized previously fix courtesy of sangpan #jira UE-51133 Change 3777602 by Dmitriy.Dyomin Fxied: Project fails to package for Android with RenderDoc debugger enabled #jira UE-52758 Change 3778247 by Bogdan.Vasilache UE-50257 --> Skeletal meshes silently fail to render if they have more than 75 bones #jira UE-50257 Change 3778318 by Peter.Sauerbrei copy NSLocalizationfiles from Build/IOS/Resources/Localizations courtesty of alexchicn #jira UE-52317 Change 3778597 by Allan.Bentham Mobile support for CSM shader culling with movable lights. Add 'Support movable light CSM shader culling' option to render settings. (default on) Add new culling mode which tests against only the shadow receiving frustum, saves on CPU searching for shadow casters intersects. (default cull mode.) Add FPrimitiveSceneProxy.bReceiveMobileCSMShadows which now applies to both stationary and movable lights. (default = true) removed FPrimitiveSceneProxy.bReceiveCombinedCSMAndStaticShadowsFromStationaryLights removed 'r.AllReceiveDynamicCSM' cvar Change 3778703 by Allan.Bentham Mobile CSM distance fading. Change 3780805 by Allan.Bentham Attempt to silence CIS static analysis. Change 3781098 by Allan.Bentham Pass per project maximum shadow cascade value to mobile shader compile environment. CSM shaders no longer loop over non-existant cascades. Change 3781155 by Chris.Babcock Fix support for GL_OES_standard_derivatives on Android (contributed by jlc-innerspace) #jira UE-52872 #PR #4267 #ue4 #android Change 3785116 by Peter.Sauerbrei fix for new iOS 11 api being called on iOS 9, 10 #jia UE-52912 Change 3785240 by Chris.Babcock Updated Android SDK license agreement #jira UE-52788 #ue4 #android Change 3786652 by Cosmin.Sulea UE-50381 - Using FMallocProfiler extremely slow resolving symbols on iOS - .udebugsymbols approach #jira UE-50381 Change 3787587 by Chris.Babcock Fix oversized UMG Designed button #jira UE-53014 #ue4 Change 3772888 by Cosmin.Sulea UE-52138 - Add support to UMG safe zone to be off-center for iPhone X #jira UE-52138 [CL 3793429 by Chris Babcock in Main branch]
277 lines
7.3 KiB
C++
277 lines
7.3 KiB
C++
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "AndroidLicenseDialog.h"
|
|
#include "Misc/Paths.h"
|
|
#include "HAL/PlatformProcess.h"
|
|
#include "Misc/FileHelper.h"
|
|
#include "Misc/EngineBuildSettings.h"
|
|
#include "Misc/EngineVersion.h"
|
|
#include "Modules/ModuleInterface.h"
|
|
#include "Modules/ModuleManager.h"
|
|
#include "Framework/Application/SlateApplication.h"
|
|
#include "Widgets/SBoxPanel.h"
|
|
#include "Widgets/SOverlay.h"
|
|
#include "Widgets/Images/SImage.h"
|
|
#include "Widgets/Text/SRichTextBlock.h"
|
|
#include "Widgets/Text/STextBlock.h"
|
|
#include "Widgets/Input/SButton.h"
|
|
#include "Widgets/Input/SCheckBox.h"
|
|
#include "Widgets/Input/SHyperlink.h"
|
|
#include "Widgets/Layout/SBox.h"
|
|
#include "Widgets/Layout/SScrollBox.h"
|
|
#include "EditorStyleSet.h"
|
|
#include "SecureHash.h"
|
|
#include "PlatformFilemanager.h"
|
|
#include "Interfaces/IAndroidDeviceDetectionModule.h"
|
|
#include "Interfaces/IAndroidDeviceDetection.h"
|
|
#include "Interfaces/IMainFrameModule.h"
|
|
|
|
#include "AndroidRuntimeSettings.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "AndroidLicenseDialog"
|
|
|
|
void SAndroidLicenseDialog::Construct(const FArguments& InArgs)
|
|
{
|
|
bLicenseValid = false;
|
|
|
|
// from Android SDK Tools 26.1.1
|
|
FString LicenseFilename = FPaths::EngineDir() + TEXT("Source/ThirdParty/Android/package.xml");
|
|
FString LicenseText = "Unable to read " + LicenseFilename;
|
|
|
|
// Create file reader
|
|
TUniquePtr<FArchive> FileReader(IFileManager::Get().CreateFileReader(*LicenseFilename));
|
|
if (FileReader)
|
|
{
|
|
// Create buffer for file input
|
|
uint32 BufferSize = FileReader->TotalSize();
|
|
uint8* Buffer = (uint8*)FMemory::Malloc(BufferSize);
|
|
FileReader->Serialize(Buffer, BufferSize);
|
|
|
|
LicenseText = "Invalid license!";
|
|
|
|
uint8 StartPattern[] = "<license id=\"android-sdk-license\" type=\"text\">";
|
|
int32 StartPatternLength = strlen((char *)StartPattern);
|
|
|
|
uint8* LicenseStart = Buffer;
|
|
uint8* BufferEnd = Buffer + BufferSize - StartPatternLength;
|
|
while (LicenseStart < BufferEnd)
|
|
{
|
|
if (!memcmp(LicenseStart, StartPattern, StartPatternLength))
|
|
{
|
|
break;
|
|
}
|
|
LicenseStart++;
|
|
}
|
|
|
|
if (LicenseStart < BufferEnd)
|
|
{
|
|
LicenseStart += StartPatternLength;
|
|
|
|
uint8 EndPattern[] = "</license>";
|
|
int32 EndPatternLength = strlen((char *)EndPattern);
|
|
|
|
uint8* LicenseEnd = LicenseStart;
|
|
BufferEnd = Buffer + BufferSize - EndPatternLength;
|
|
while (LicenseEnd < BufferEnd)
|
|
{
|
|
if (!memcmp(LicenseEnd, EndPattern, EndPatternLength))
|
|
{
|
|
break;
|
|
}
|
|
LicenseEnd++;
|
|
}
|
|
|
|
if (LicenseEnd < BufferEnd)
|
|
{
|
|
int32 LicenseLength = LicenseEnd - LicenseStart;
|
|
|
|
int32 ConvertedLength = FUTF8ToTCHAR_Convert::ConvertedLength((ANSICHAR*)LicenseStart, LicenseLength);
|
|
TCHAR* ConvertedBuffer = (TCHAR*)FMemory::Malloc((ConvertedLength + 1) * sizeof(TCHAR));
|
|
FUTF8ToTCHAR_Convert::Convert(ConvertedBuffer, ConvertedLength, (ANSICHAR*)LicenseStart, LicenseLength);
|
|
ConvertedBuffer[ConvertedLength] = 0;
|
|
LicenseText = FString(ConvertedBuffer);
|
|
FMemory::Free(ConvertedBuffer);
|
|
|
|
FSHA1::HashBuffer(LicenseStart, LicenseLength, LicenseHash.Hash);
|
|
|
|
bLicenseValid = true;
|
|
}
|
|
}
|
|
FMemory::Free(Buffer);
|
|
}
|
|
|
|
ChildSlot
|
|
[
|
|
SNew(SVerticalBox)
|
|
+ SVerticalBox::Slot()
|
|
[
|
|
SAssignNew(ScrollBox, SScrollBox)
|
|
.Style(FEditorStyle::Get(), "ScrollBox")
|
|
|
|
+ SScrollBox::Slot()
|
|
[
|
|
SNew(SVerticalBox)
|
|
|
|
+ SVerticalBox::Slot()
|
|
.FillHeight(1.0f)
|
|
[
|
|
SNew(SRichTextBlock)
|
|
.Text(FText::FromString(LicenseText))
|
|
.DecoratorStyleSet(&FEditorStyle::Get())
|
|
.AutoWrapText(true)
|
|
.Justification(ETextJustify::Left)
|
|
]
|
|
]
|
|
]
|
|
|
|
+ SVerticalBox::Slot()
|
|
.VAlign(VAlign_Bottom)
|
|
.HAlign(HAlign_Center)
|
|
.AutoHeight()
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+ SHorizontalBox::Slot()
|
|
.Padding(20, 5, 20, 5)
|
|
.AutoWidth()
|
|
[
|
|
SNew(SButton)
|
|
.IsEnabled(bLicenseValid)
|
|
.OnClicked(this, &SAndroidLicenseDialog::OnAgree)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(LOCTEXT("AndroidLicenseAgreement_Agree", "Agree"))
|
|
.ColorAndOpacity(FSlateColor::UseForeground())
|
|
]
|
|
]
|
|
|
|
+ SHorizontalBox::Slot()
|
|
.Padding(20, 5, 20, 5)
|
|
.AutoWidth()
|
|
[
|
|
SNew(SButton)
|
|
.OnClicked(this, &SAndroidLicenseDialog::OnCancel)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(LOCTEXT("AndroidLicenseAgreement_Cancel", "Cancel"))
|
|
.ColorAndOpacity(FSlateColor::UseForeground())
|
|
]
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
static FString GetLicensePath()
|
|
{
|
|
auto &AndroidDeviceDetection = FModuleManager::LoadModuleChecked<IAndroidDeviceDetectionModule>("AndroidDeviceDetection");
|
|
IAndroidDeviceDetection* DeviceDetection = AndroidDeviceDetection.GetAndroidDeviceDetection();
|
|
FString ADBPath = DeviceDetection->GetADBPath();
|
|
|
|
if (!FPaths::FileExists(*ADBPath))
|
|
{
|
|
return TEXT("");
|
|
}
|
|
|
|
// strip off the adb.exe part
|
|
FString PlatformToolsPath;
|
|
FString Filename;
|
|
FString Extension;
|
|
FPaths::Split(ADBPath, PlatformToolsPath, Filename, Extension);
|
|
|
|
// remove the platform-tools part and point to licenses
|
|
FPaths::NormalizeDirectoryName(PlatformToolsPath);
|
|
FString LicensePath = PlatformToolsPath + "/../licenses";
|
|
FPaths::CollapseRelativeDirectories(LicensePath);
|
|
|
|
return LicensePath;
|
|
}
|
|
|
|
bool SAndroidLicenseDialog::HasLicense()
|
|
{
|
|
FString LicensePath = GetLicensePath();
|
|
|
|
if (LicensePath.IsEmpty())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// directory must exist
|
|
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
|
|
if (!PlatformFile.DirectoryExists(*LicensePath))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// license file must exist
|
|
FString LicenseFilename = LicensePath + "/android-sdk-license";
|
|
if (!PlatformFile.FileExists(*LicenseFilename))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// contents must match hash of license text
|
|
FString FileData = "";
|
|
FFileHelper::LoadFileToString(FileData, *LicenseFilename);
|
|
TArray<FString> lines;
|
|
int32 lineCount = FileData.ParseIntoArray(lines, TEXT("\n"), true);
|
|
|
|
FString LicenseString = LicenseHash.ToString().ToLower();
|
|
for (FString &line : lines)
|
|
{
|
|
if (line.TrimStartAndEnd().Equals(LicenseString))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// doesn't match
|
|
return false;
|
|
}
|
|
|
|
void SAndroidLicenseDialog::SetLicenseAcceptedCallback(const FSimpleDelegate& InOnLicenseAccepted)
|
|
{
|
|
OnLicenseAccepted = InOnLicenseAccepted;
|
|
}
|
|
|
|
FReply SAndroidLicenseDialog::OnAgree()
|
|
{
|
|
FString LicensePath = GetLicensePath();
|
|
|
|
if (!LicensePath.IsEmpty())
|
|
{
|
|
// create licenses directory if doesn't exist
|
|
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
|
|
if (!PlatformFile.DirectoryExists(*LicensePath))
|
|
{
|
|
PlatformFile.CreateDirectory(*LicensePath);
|
|
}
|
|
|
|
FString LicenseFilename = LicensePath + "/android-sdk-license";
|
|
IFileHandle* FileHandle = PlatformFile.OpenWrite(*LicenseFilename);
|
|
if (FileHandle)
|
|
{
|
|
FString HashText = TEXT("\015\012") + LicenseHash.ToString().ToLower();
|
|
FileHandle->Write((const uint8*)TCHAR_TO_ANSI(*HashText), HashText.Len());
|
|
delete FileHandle;
|
|
}
|
|
}
|
|
|
|
OnLicenseAccepted.ExecuteIfBound();
|
|
|
|
TSharedRef<SWindow> ParentWindow = FSlateApplication::Get().FindWidgetWindow(AsShared()).ToSharedRef();
|
|
FSlateApplication::Get().RequestDestroyWindow(ParentWindow);
|
|
return FReply::Handled();
|
|
}
|
|
|
|
FReply SAndroidLicenseDialog::OnCancel()
|
|
{
|
|
// turn off Gradle checkbox
|
|
GetMutableDefault<UAndroidRuntimeSettings>()->bEnableGradle = false;
|
|
|
|
TSharedRef<SWindow> ParentWindow = FSlateApplication::Get().FindWidgetWindow(AsShared()).ToSharedRef();
|
|
FSlateApplication::Get().RequestDestroyWindow(ParentWindow);
|
|
return FReply::Handled();
|
|
}
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|