diff --git a/Source/Editor/Editor.cpp b/Source/Editor/Editor.cpp index d0bfe2765..8fd646da9 100644 --- a/Source/Editor/Editor.cpp +++ b/Source/Editor/Editor.cpp @@ -403,7 +403,7 @@ int32 Editor::LoadProduct() } // Create new project option - if (CommandLine::Options.NewProject) + if (CommandLine::Options.NewProject.IsTrue()) { Array projectFiles; FileSystem::DirectoryGetFiles(projectFiles, projectPath, TEXT("*.flaxproj"), DirectorySearchOption::TopDirectoryOnly); @@ -428,7 +428,7 @@ int32 Editor::LoadProduct() } } } - if (CommandLine::Options.NewProject) + if (CommandLine::Options.NewProject.IsTrue()) { if (projectPath.IsEmpty()) projectPath = Platform::GetWorkingDirectory(); @@ -529,7 +529,7 @@ int32 Editor::LoadProduct() if (projectPath.IsEmpty()) { #if PLATFORM_HAS_HEADLESS_MODE - if (CommandLine::Options.Headless) + if (CommandLine::Options.Headless.IsTrue()) { Platform::Fatal(TEXT("Missing project path.")); return -1; @@ -657,7 +657,7 @@ Window* Editor::CreateMainWindow() bool Editor::Init() { // Scripts project files generation from command line - if (CommandLine::Options.GenProjectFiles) + if (CommandLine::Options.GenProjectFiles.IsTrue()) { const String customArgs = TEXT("-verbose -log -logfile=\"Cache/Intermediate/ProjectFileLog.txt\""); const bool failed = ScriptsBuilder::GenerateProject(customArgs); diff --git a/Source/Editor/Windows/SplashScreen.cpp b/Source/Editor/Windows/SplashScreen.cpp index 49257d281..39f7691e7 100644 --- a/Source/Editor/Windows/SplashScreen.cpp +++ b/Source/Editor/Windows/SplashScreen.cpp @@ -147,7 +147,7 @@ SplashScreen::~SplashScreen() void SplashScreen::Show() { // Skip if already shown or in headless mode - if (IsVisible() || CommandLine::Options.Headless) + if (IsVisible() || CommandLine::Options.Headless.IsTrue()) return; LOG(Info, "Showing splash screen"); diff --git a/Source/Engine/Core/Log.cpp b/Source/Engine/Core/Log.cpp index c8cf4419e..38d591c51 100644 --- a/Source/Engine/Core/Log.cpp +++ b/Source/Engine/Core/Log.cpp @@ -119,7 +119,7 @@ void Log::Logger::Write(const StringView& msg) IsDuringLog = true; // Send message to standard process output - if (CommandLine::Options.Std) + if (CommandLine::Options.Std.IsTrue()) { #if PLATFORM_TEXT_IS_CHAR16 StringAnsi ansi(msg); diff --git a/Source/Engine/Engine/Engine.cpp b/Source/Engine/Engine/Engine.cpp index b26cbd25a..7fea9cd6d 100644 --- a/Source/Engine/Engine/Engine.cpp +++ b/Source/Engine/Engine/Engine.cpp @@ -631,9 +631,9 @@ void EngineImpl::InitPaths() FileSystem::CreateDirectory(Globals::ProjectContentFolder); if (!FileSystem::DirectoryExists(Globals::ProjectSourceFolder)) FileSystem::CreateDirectory(Globals::ProjectSourceFolder); - if (CommandLine::Options.ClearCache) + if (CommandLine::Options.ClearCache.IsTrue()) FileSystem::DeleteDirectory(Globals::ProjectCacheFolder, true); - else if (CommandLine::Options.ClearCookerCache) + else if (CommandLine::Options.ClearCookerCache.IsTrue()) FileSystem::DeleteDirectory(Globals::ProjectCacheFolder / TEXT("Cooker"), true); if (!FileSystem::DirectoryExists(Globals::ProjectCacheFolder)) FileSystem::CreateDirectory(Globals::ProjectCacheFolder); diff --git a/Source/Engine/Graphics/Graphics.cpp b/Source/Engine/Graphics/Graphics.cpp index a1640c0b4..25437d25d 100644 --- a/Source/Engine/Graphics/Graphics.cpp +++ b/Source/Engine/Graphics/Graphics.cpp @@ -104,7 +104,7 @@ bool GraphicsService::Init() GPUDevice* device = nullptr; // Null - if (!device && CommandLine::Options.Null) + if (!device && CommandLine::Options.Null.IsTrue()) { #if GRAPHICS_API_NULL device = CreateGPUDeviceNull(); @@ -114,7 +114,7 @@ bool GraphicsService::Init() } // Vulkan - if (!device && CommandLine::Options.Vulkan) + if (!device && CommandLine::Options.Vulkan.IsTrue()) { #if GRAPHICS_API_VULKAN device = CreateGPUDeviceVulkan(); @@ -124,7 +124,7 @@ bool GraphicsService::Init() } // DirectX 12 - if (!device && CommandLine::Options.D3D12) + if (!device && CommandLine::Options.D3D12.IsTrue()) { #if GRAPHICS_API_DIRECTX12 if (Platform::IsWindows10()) @@ -137,7 +137,7 @@ bool GraphicsService::Init() } // DirectX 11 and DirectX 10 - if (!device && (CommandLine::Options.D3D11 || CommandLine::Options.D3D10)) + if (!device && (CommandLine::Options.D3D11.IsTrue() || CommandLine::Options.D3D10.IsTrue())) { #if GRAPHICS_API_DIRECTX11 device = CreateGPUDeviceDX11(); @@ -193,10 +193,10 @@ bool GraphicsService::Init() // Initialize if (device->IsDebugToolAttached #if USE_EDITOR || !BUILD_RELEASE - || CommandLine::Options.ShaderProfile + || CommandLine::Options.ShaderProfile.IsTrue() #endif #if USE_EDITOR - || CommandLine::Options.ShaderDebug + || CommandLine::Options.ShaderDebug.IsTrue() #endif ) { diff --git a/Source/Engine/Graphics/Shaders/Cache/ShaderAssetBase.cpp b/Source/Engine/Graphics/Shaders/Cache/ShaderAssetBase.cpp index 6f91ff4be..acc1dc7db 100644 --- a/Source/Engine/Graphics/Shaders/Cache/ShaderAssetBase.cpp +++ b/Source/Engine/Graphics/Shaders/Cache/ShaderAssetBase.cpp @@ -249,12 +249,12 @@ bool ShaderAssetBase::LoadShaderCache(ShaderCacheResult& result) options.SourceLength = sourceLength; options.Profile = shaderProfile; options.Output = &cacheStream; - if (CommandLine::Options.ShaderDebug) + if (CommandLine::Options.ShaderDebug.IsTrue()) { options.GenerateDebugData = true; options.NoOptimize = true; } - else if (CommandLine::Options.ShaderProfile) + else if (CommandLine::Options.ShaderProfile.IsTrue()) { options.GenerateDebugData = true; } diff --git a/Source/Engine/Graphics/Shaders/Cache/ShaderCacheManager.cpp b/Source/Engine/Graphics/Shaders/Cache/ShaderCacheManager.cpp index b8adce351..112324b2c 100644 --- a/Source/Engine/Graphics/Shaders/Cache/ShaderCacheManager.cpp +++ b/Source/Engine/Graphics/Shaders/Cache/ShaderCacheManager.cpp @@ -193,8 +193,8 @@ bool ShaderCacheManagerService::Init() CacheVersion cacheVersion; const String cacheVerFile = rootDir / TEXT("CacheVersion"); #if USE_EDITOR - const bool shaderDebug = CommandLine::Options.ShaderDebug; - const bool shaderProfile = CommandLine::Options.ShaderProfile; + const bool shaderDebug = CommandLine::Options.ShaderDebug.IsTrue(); + const bool shaderProfile = CommandLine::Options.ShaderProfile.IsTrue(); #else const bool shaderDebug = false; #endif diff --git a/Source/Engine/GraphicsDevice/DirectX/DX11/GPUDeviceDX11.cpp b/Source/Engine/GraphicsDevice/DirectX/DX11/GPUDeviceDX11.cpp index 432a44ee8..724a5ea71 100644 --- a/Source/Engine/GraphicsDevice/DirectX/DX11/GPUDeviceDX11.cpp +++ b/Source/Engine/GraphicsDevice/DirectX/DX11/GPUDeviceDX11.cpp @@ -106,9 +106,9 @@ GPUDevice* GPUDeviceDX11::Create() #else D3D_FEATURE_LEVEL maxAllowedFeatureLevel = D3D_FEATURE_LEVEL_11_0; #endif - if (CommandLine::Options.D3D10) + if (CommandLine::Options.D3D10.IsTrue()) maxAllowedFeatureLevel = D3D_FEATURE_LEVEL_10_0; - else if (CommandLine::Options.D3D11) + else if (CommandLine::Options.D3D11.IsTrue()) maxAllowedFeatureLevel = D3D_FEATURE_LEVEL_11_0; #if !USE_EDITOR && PLATFORM_WINDOWS auto winSettings = WindowsPlatformSettings::Get(); @@ -209,11 +209,11 @@ GPUDevice* GPUDeviceDX11::Create() } GPUAdapterDX selectedAdapter = adapters[selectedAdapterIndex]; uint32 vendorId = 0; - if (CommandLine::Options.NVIDIA) + if (CommandLine::Options.NVIDIA.IsTrue()) vendorId = GPU_VENDOR_ID_NVIDIA; - else if (CommandLine::Options.AMD) + else if (CommandLine::Options.AMD.IsTrue()) vendorId = GPU_VENDOR_ID_AMD; - else if (CommandLine::Options.Intel) + else if (CommandLine::Options.Intel.IsTrue()) vendorId = GPU_VENDOR_ID_INTEL; if (vendorId != 0) { diff --git a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUDeviceDX12.cpp b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUDeviceDX12.cpp index a33cd8194..78c047cfc 100644 --- a/Source/Engine/GraphicsDevice/DirectX/DX12/GPUDeviceDX12.cpp +++ b/Source/Engine/GraphicsDevice/DirectX/DX12/GPUDeviceDX12.cpp @@ -161,11 +161,11 @@ GPUDevice* GPUDeviceDX12::Create() } GPUAdapterDX selectedAdapter = adapters[selectedAdapterIndex]; uint32 vendorId = 0; - if (CommandLine::Options.NVIDIA) + if (CommandLine::Options.NVIDIA.IsTrue()) vendorId = GPU_VENDOR_ID_NVIDIA; - else if (CommandLine::Options.AMD) + else if (CommandLine::Options.AMD.IsTrue()) vendorId = GPU_VENDOR_ID_AMD; - else if (CommandLine::Options.Intel) + else if (CommandLine::Options.Intel.IsTrue()) vendorId = GPU_VENDOR_ID_INTEL; if (vendorId != 0) { @@ -425,7 +425,7 @@ bool GPUDeviceDX12::Init() #if !BUILD_RELEASE // Prevent the GPU from overclocking or under-clocking to get consistent timings - if (CommandLine::Options.ShaderProfile) + if (CommandLine::Options.ShaderProfile.IsTrue()) { _device->SetStablePowerState(TRUE); } diff --git a/Source/Engine/Platform/Base/PlatformBase.cpp b/Source/Engine/Platform/Base/PlatformBase.cpp index 6efa3c8b4..93b06b821 100644 --- a/Source/Engine/Platform/Base/PlatformBase.cpp +++ b/Source/Engine/Platform/Base/PlatformBase.cpp @@ -365,7 +365,7 @@ void PlatformBase::Fatal(const Char* msg, void* context) void PlatformBase::Error(const Char* msg) { #if PLATFORM_HAS_HEADLESS_MODE - if (CommandLine::Options.Headless) + if (CommandLine::Options.Headless.IsTrue()) { #if PLATFORM_TEXT_IS_CHAR16 StringAnsi ansi(msg); @@ -385,7 +385,7 @@ void PlatformBase::Error(const Char* msg) void PlatformBase::Warning(const Char* msg) { #if PLATFORM_HAS_HEADLESS_MODE - if (CommandLine::Options.Headless) + if (CommandLine::Options.Headless.IsTrue()) { std::cout << "Warning: " << msg << std::endl; } @@ -399,7 +399,7 @@ void PlatformBase::Warning(const Char* msg) void PlatformBase::Info(const Char* msg) { #if PLATFORM_HAS_HEADLESS_MODE - if (CommandLine::Options.Headless) + if (CommandLine::Options.Headless.IsTrue()) { std::cout << "Info: " << msg << std::endl; } diff --git a/Source/Engine/Platform/Windows/WindowsPlatform.cpp b/Source/Engine/Platform/Windows/WindowsPlatform.cpp index 0f1159fc5..57d46b1f8 100644 --- a/Source/Engine/Platform/Windows/WindowsPlatform.cpp +++ b/Source/Engine/Platform/Windows/WindowsPlatform.cpp @@ -616,7 +616,7 @@ bool WindowsPlatform::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) + if (CommandLine::Options.Std.IsTrue()) { // 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]