diff --git a/Source/Editor/Cooker/Platform/UWP/UWPPlatformTools.cpp b/Source/Editor/Cooker/Platform/UWP/UWPPlatformTools.cpp index c8f9e45a7..7a6d6ad84 100644 --- a/Source/Editor/Cooker/Platform/UWP/UWPPlatformTools.cpp +++ b/Source/Editor/Cooker/Platform/UWP/UWPPlatformTools.cpp @@ -43,7 +43,7 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) const auto uwpDataPath = platformDataPath / (isXboxOne ? TEXT("XboxOne") : TEXT("UWP")) / TEXT("Binaries"); const auto gameSettings = GameSettings::Get(); const auto platformSettings = UWPPlatformSettings::Get(); - Array fileTemplate; + StringAnsi fileTemplate; // Copy binaries const auto binPath = data.GetGameBinariesPath(); @@ -149,12 +149,11 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) if (!FileSystem::FileExists(dstAssemblyInfoPath)) { // Get template - if (File::ReadAllBytes(srcAssemblyInfoPath, fileTemplate)) + if (File::ReadAllText(srcAssemblyInfoPath, fileTemplate)) { data.Error(TEXT("Failed to load AssemblyInfo.cs template.")); return true; } - fileTemplate[fileTemplate.Count() - 1] = 0; // Write data to file auto file = FileWriteStream::Open(dstAssemblyInfoPath); @@ -163,7 +162,7 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) { auto now = DateTime::Now(); file->WriteTextFormatted( - (char*)fileTemplate.Get() + fileTemplate.Get() , gameSettings->ProductName.ToStringAnsi() , gameSettings->CompanyName.ToStringAnsi() , now.GetYear() @@ -182,12 +181,11 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) if (!FileSystem::FileExists(dstAppPath)) { // Get template - if (File::ReadAllBytes(srcAppPath, fileTemplate)) + if (File::ReadAllText(srcAppPath, fileTemplate)) { data.Error(TEXT("Failed to load App.cs template.")); return true; } - fileTemplate[fileTemplate.Count() - 1] = 0; // Write data to file auto file = FileWriteStream::Open(dstAppPath); @@ -195,7 +193,7 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) if (file) { file->WriteTextFormatted( - (char*)fileTemplate.Get() + fileTemplate.Get() , defaultNamespace.ToStringAnsi() // {0} Default Namespace ); hasError = file->HasError(); @@ -211,12 +209,11 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) const auto srcFlaxGeneratedPath = uwpDataPath / TEXT("FlaxGenerated.cs"); { // Get template - if (File::ReadAllBytes(srcFlaxGeneratedPath, fileTemplate)) + if (File::ReadAllText(srcFlaxGeneratedPath, fileTemplate)) { data.Error(TEXT("Failed to load FlaxGenerated.cs template.")); return true; } - fileTemplate[fileTemplate.Count() - 1] = 0; // Prepare StringAnsi autoRotationPreferences; @@ -252,7 +249,7 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) if (file) { file->WriteTextFormatted( - (char*)fileTemplate.Get() + fileTemplate.Get() , autoRotationPreferences.Get() , preferredLaunchWindowingMode.Get() ); @@ -272,12 +269,11 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) if (!FileSystem::FileExists(dstSolutionPath)) { // Get template - if (File::ReadAllBytes(srcSolutionPath, fileTemplate)) + if (File::ReadAllText(srcSolutionPath, fileTemplate)) { data.Error(TEXT("Failed to load Solution.sln template.")); return true; } - fileTemplate[fileTemplate.Count() - 1] = 0; // Write data to file auto file = FileWriteStream::Open(dstSolutionPath); @@ -285,7 +281,7 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) if (file) { file->WriteTextFormatted( - (char*)fileTemplate.Get() + fileTemplate.Get() , projectName.ToStringAnsi() // {0} Project Name , mode // {1} Platform Mode , projectGuid.ToStringAnsi() // {2} Project ID @@ -305,12 +301,11 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) const auto srcProjectPath = uwpDataPath / TEXT("Project.csproj"); { // Get template - if (File::ReadAllBytes(srcProjectPath, fileTemplate)) + if (File::ReadAllText(srcProjectPath, fileTemplate)) { data.Error(TEXT("Failed to load Project.csproj template.")); return true; } - fileTemplate[fileTemplate.Count() - 1] = 0; // Build included files data StringBuilder filesInclude(2048); @@ -334,7 +329,7 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) if (file) { file->WriteTextFormatted( - (char*)fileTemplate.Get() + fileTemplate.Get() , projectName.ToStringAnsi() // {0} Project Name , mode // {1} Platform Mode , projectGuid.Get() // {2} Project ID @@ -357,12 +352,11 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) if (!FileSystem::FileExists(dstManifestPath)) { // Get template - if (File::ReadAllBytes(srcManifestPath, fileTemplate)) + if (File::ReadAllText(srcManifestPath, fileTemplate)) { data.Error(TEXT("Failed to load Package.appxmanifest template.")); return true; } - fileTemplate[fileTemplate.Count() - 1] = 0; // Build included files data StringBuilder filesInclude(2048); @@ -385,7 +379,7 @@ bool UWPPlatformTools::OnDeployBinaries(CookingData& data) if (file) { file->WriteTextFormatted( - (char*)fileTemplate.Get() + fileTemplate.Get() , projectName.ToStringAnsi() // {0} Display Name , gameSettings->CompanyName.ToStringAnsi() // {1} Company Name , productId.ToStringAnsi() // {2} Product ID diff --git a/Source/Engine/Main/UWP/main.cpp b/Source/Engine/Main/UWP/main.cpp index 08d9cc422..e615a2b38 100644 --- a/Source/Engine/Main/UWP/main.cpp +++ b/Source/Engine/Main/UWP/main.cpp @@ -65,22 +65,6 @@ void Game::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs void Game::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) { - /* - // Save app state asynchronously after requesting a deferral. Holding a deferral - // indicates that the application is busy performing suspending operations. Be - // aware that a deferral may not be held indefinitely. After about five seconds, - // the app will be forced to exit. - SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral(); - - create_task([this, deferral]() - { - m_deviceResources->Trim(); - - m_main->Suspend(); - - deferral->Complete(); - }); - */ } void Game::OnResuming(Platform::Object^ sender, Platform::Object^ args) @@ -396,9 +380,10 @@ int PlatformImpl::GetSpecialFolderPath(const SpecialFolder type, wchar_t* buffer path = Windows::Storage::ApplicationData::Current->LocalFolder->Path; break; case SpecialFolder::ProgramData: + path = Windows::Storage::ApplicationData::Current->RoamingFolder->Path; break; - //case SpecialFolder::Temporary: path = Windows::Storage::ApplicationData::Current->TemporaryFolder->Path; break; case SpecialFolder::Temporary: + //path = Windows::Storage::ApplicationData::Current->TemporaryFolder->Path; path = Windows::Storage::ApplicationData::Current->LocalFolder->Path; break; } @@ -409,7 +394,7 @@ int PlatformImpl::GetSpecialFolderPath(const SpecialFolder type, wchar_t* buffer if (length >= bufferLength) length = bufferLength - 1; const wchar_t* data = path->Data(); - for (int i = 0; i Designer + {3} @@ -70,7 +71,7 @@ - + diff --git a/Source/Platforms/XboxOne/Binaries/Project.csproj b/Source/Platforms/XboxOne/Binaries/Project.csproj index c6c48c200..1895423a0 100644 --- a/Source/Platforms/XboxOne/Binaries/Project.csproj +++ b/Source/Platforms/XboxOne/Binaries/Project.csproj @@ -54,6 +54,7 @@ Designer + {3} @@ -70,7 +71,7 @@ - + diff --git a/Source/Tools/Flax.Build/Platforms/UWP/UWPToolchain.cs b/Source/Tools/Flax.Build/Platforms/UWP/UWPToolchain.cs index 7a76d642d..237026b32 100644 --- a/Source/Tools/Flax.Build/Platforms/UWP/UWPToolchain.cs +++ b/Source/Tools/Flax.Build/Platforms/UWP/UWPToolchain.cs @@ -67,10 +67,10 @@ namespace Flax.Build.Platforms options.CompileEnv.PreprocessorDefinitions.Add("PLATFORM_UWP"); options.CompileEnv.PreprocessorDefinitions.Add("WINAPI_FAMILY=WINAPI_FAMILY_PC_APP"); options.CompileEnv.PreprocessorDefinitions.Add("_WINRT_DLL"); + options.CompileEnv.PreprocessorDefinitions.Add("_WINDLL"); options.CompileEnv.PreprocessorDefinitions.Add("__WRL_NO_DEFAULT_LIB__"); options.LinkEnv.InputLibraries.Add("WindowsApp.lib"); - options.LinkEnv.InputLibraries.Add("dloadhelper.lib"); } } } diff --git a/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchainBase.cs b/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchainBase.cs index 38446ee17..b59bcae39 100644 --- a/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchainBase.cs +++ b/Source/Tools/Flax.Build/Platforms/Windows/WindowsToolchainBase.cs @@ -680,6 +680,8 @@ namespace Flax.Build.Platforms args.Add("/WINMD"); args.Add(string.Format("/WINMDFILE:\"{0}\"", Path.ChangeExtension(outputFilePath, "winmd"))); args.Add("/APPCONTAINER"); + if (linkEnvironment.Output == LinkerOutput.SharedLibrary) + args.Add("/DYNAMICBASE"); } if (linkEnvironment.LinkTimeCodeGeneration) @@ -937,7 +939,7 @@ namespace Flax.Build.Platforms xmlTextWriter.WriteStartElement("Properties"); // TODO: better logo handling - var logoSrcPath = Path.Combine(Environment.CurrentDirectory, "Source", "Logo.png"); + var logoSrcPath = Path.Combine(Globals.EngineRoot, "Source", "Logo.png"); var logoDstPath = Path.Combine(options.IntermediateFolder, "Logo.png"); if (!File.Exists(logoDstPath)) Utilities.FileCopy(logoSrcPath, logoDstPath);