void USoundWave::PostLoad() { Super::PostLoad(); if (GetOutermost()->HasAnyPackageFlags(PKG_ReloadingForCooker)) { return; } // Compress to whatever formats the active target platforms want // static here as an optimization ITargetPlatformManagerModule* TPM = GetTargetPlatformManager(); if (TPM) { const TArray<ITargetPlatform*>& Platforms = TPM->GetActiveTargetPlatforms(); for (int32 Index = 0; Index < Platforms.Num(); Index++) { GetCompressedData(Platforms[Index]->GetWaveFormat(this)); } } // We don't precache default objects and we don't precache in the Editor as the latter will // most likely cause us to run out of memory. if (!GIsEditor && !IsTemplate( RF_ClassDefaultObject ) && GEngine) { FAudioDevice* AudioDevice = GEngine->GetMainAudioDevice(); if (AudioDevice && AudioDevice->AreStartupSoundsPreCached()) { // Upload the data to the hardware, but only if we've precached startup sounds already AudioDevice->Precache(this); } // remove bulk data if no AudioDevice is used and no sounds were initialized else if(IsRunningGame()) { RawData.RemoveBulkData(); } } // Only add this streaming sound if we're not a dedicated server or if there is an audio device manager if (IsStreaming() && !IsRunningDedicatedServer() && GEngine && GEngine->GetAudioDeviceManager()) { #if WITH_EDITORONLY_DATA FinishCachePlatformData(); #endif // #if WITH_EDITORONLY_DATA IStreamingManager::Get().GetAudioStreamingManager().AddStreamingSoundWave(this); } #if WITH_EDITORONLY_DATA if (!SourceFilePath_DEPRECATED.IsEmpty() && AssetImportData) { FAssetImportInfo Info; Info.Insert(FAssetImportInfo::FSourceFile(SourceFilePath_DEPRECATED)); AssetImportData->SourceData = MoveTemp(Info); } #endif // #if WITH_EDITORONLY_DATA INC_FLOAT_STAT_BY( STAT_AudioBufferTime, Duration ); INC_FLOAT_STAT_BY( STAT_AudioBufferTimeChannels, NumChannels * Duration ); }
void FWindowsCursor::UpdateClipping() { if (ClipRect.left == -1 && ClipRect.right == -1 && ClipRect.top == -1 && ClipRect.bottom == -1) { // Unlock the cursor ::ClipCursor(nullptr); } else if (bIsVisible) { // Lock the cursor ::ClipCursor(&ClipRect); } else { // If the cursor is not visible, assume we're in game where mouse is controlling the camera and lock it to the center of the widget. // This is a workaround for a problem in borderless window mode with round window corners where the cursor in the corner is in fact outside of the window area. if( IsRunningGame() ) // We never want to teleport the cursor back to the center unless we're in a game, otherwise it can interfere with how Simulate mode works { RECT Center; Center.left = ClipRect.left + (ClipRect.right - ClipRect.left) / 2; Center.right = Center.left + 1; Center.top = ClipRect.top + (ClipRect.bottom - ClipRect.top) / 2; Center.bottom = Center.top + 1; ::ClipCursor(&Center); } } }
void USoundWave::PostLoad() { Super::PostLoad(); if (GetOutermost()->PackageFlags & PKG_ReloadingForCooker) { return; } // Compress to whatever formats the active target platforms want // static here as an optimization ITargetPlatformManagerModule* TPM = GetTargetPlatformManager(); if (TPM) { const TArray<ITargetPlatform*>& Platforms = TPM->GetActiveTargetPlatforms(); for (int32 Index = 0; Index < Platforms.Num(); Index++) { GetCompressedData(Platforms[Index]->GetWaveFormat(this)); } } // We don't precache default objects and we don't precache in the Editor as the latter will // most likely cause us to run out of memory. if( !GIsEditor && !IsTemplate( RF_ClassDefaultObject ) && GEngine ) { FAudioDevice* AudioDevice = GEngine->GetAudioDevice(); if( AudioDevice && AudioDevice->bStartupSoundsPreCached) { // Upload the data to the hardware, but only if we've precached startup sounds already AudioDevice->Precache( this ); } // remove bulk data if no AudioDevice is used and no sounds were initialized else if( IsRunningGame() ) { RawData.RemoveBulkData(); } } if (IsStreaming()) { #if WITH_EDITORONLY_DATA FinishCachePlatformData(); #endif // #if WITH_EDITORONLY_DATA IStreamingManager::Get().GetAudioStreamingManager().AddStreamingSoundWave(this); } INC_FLOAT_STAT_BY( STAT_AudioBufferTime, Duration ); INC_FLOAT_STAT_BY( STAT_AudioBufferTimeChannels, NumChannels * Duration ); }
bool FOnlineSubsystemAmazon::IsEnabled(void) { // Check the ini for disabling Amazon bool bEnableAmazon = true; if (GConfig->GetBool(TEXT("OnlineSubsystemAmazon"), TEXT("bEnabled"), bEnableAmazon, GEngineIni) && bEnableAmazon) { // Check the commandline for disabling Amazon bEnableAmazon = !FParse::Param(FCommandLine::Get(),TEXT("NOAMAZON")); #if UE_EDITOR if (bEnableAmazon) { bEnableAmazon = IsRunningDedicatedServer() || IsRunningGame(); } #endif } return bEnableAmazon; }
void UOnlineHotfixManager::StartHotfixProcess() { // Patching the editor this way seems like a bad idea if (!IsRunningGame()) { UE_LOG(LogHotfixManager, Warning, TEXT("Hotfixing skipped due to IsRunningGame() == false")); TriggerHotfixComplete(EHotfixResult::SuccessNoChange); return; } Init(); // Kick off an enumeration of the files that are available to download if (OnlineTitleFile.IsValid()) { OnlineTitleFile->EnumerateFiles(); } else { UE_LOG(LogHotfixManager, Error, TEXT("Failed to start the hotfixing process due to no OnlineTitleInterface present for OSS(%s)"), *OSSName); TriggerHotfixComplete(EHotfixResult::Failed); } }
bool FOnlineSubsystemSteam::IsEnabled() { if (bSteamworksClientInitialized || bSteamworksGameServerInitialized) { return true; } // Check the ini for disabling Steam bool bEnableSteam = true; GConfig->GetBool(TEXT("OnlineSubsystemSteam"), TEXT("bEnabled"), bEnableSteam, GEngineIni); if (bEnableSteam) { // Steam doesn't support running both the server and client on the same machine bEnableSteam = !FParse::Param(FCommandLine::Get(),TEXT("MultiprocessOSS")); #if UE_EDITOR if (bEnableSteam) { bEnableSteam = IsRunningDedicatedServer() || IsRunningGame(); } #endif } return bEnableSteam; }
void FAutomationTestFramework::GetValidTestNames( TArray<FAutomationTestInfo>& TestInfo ) const { TestInfo.Empty(); // Determine required application type (Editor, Game, or Commandlet) const bool bRunningEditor = GIsEditor && !IsRunningCommandlet(); const bool bRunningGame = !GIsEditor || IsRunningGame(); const bool bRunningCommandlet = IsRunningCommandlet(); //application flags uint32 ApplicationSupportFlags = 0; if ( bRunningEditor ) { ApplicationSupportFlags |= EAutomationTestFlags::EditorContext; } if ( bRunningGame ) { ApplicationSupportFlags |= EAutomationTestFlags::ClientContext; } if ( bRunningCommandlet ) { ApplicationSupportFlags |= EAutomationTestFlags::CommandletContext; } //Feature support - assume valid RHI until told otherwise uint32 FeatureSupportFlags = EAutomationTestFlags::FeatureMask; // @todo: Handle this correctly. GIsUsingNullRHI is defined at Engine-level, so it can't be used directly here in Core. // For now, assume Null RHI is only used for commandlets, servers, and when the command line specifies to use it. if (FPlatformProperties::SupportsWindowedMode()) { bool bUsingNullRHI = FParse::Param( FCommandLine::Get(), TEXT("nullrhi") ) || IsRunningCommandlet() || IsRunningDedicatedServer(); if (bUsingNullRHI) { FeatureSupportFlags &= (~EAutomationTestFlags::NonNullRHI); } } if (FApp::IsUnattended()) { FeatureSupportFlags &= (~EAutomationTestFlags::RequiresUser); } for ( TMap<FString, FAutomationTestBase*>::TConstIterator TestIter( AutomationTestClassNameToInstanceMap ); TestIter; ++TestIter ) { const FAutomationTestBase* CurTest = TestIter.Value(); check( CurTest ); uint32 CurTestFlags = CurTest->GetTestFlags(); //filter out full tests when running smoke tests const bool bPassesFilterRequirement = ((CurTestFlags & RequestedTestFilter) != 0); //Application Tests uint32 CurTestApplicationFlags = (CurTestFlags & EAutomationTestFlags::ApplicationContextMask); const bool bPassesApplicationRequirements = (CurTestApplicationFlags == 0) || (CurTestApplicationFlags & ApplicationSupportFlags); //Feature Tests uint32 CurTestFeatureFlags = (CurTestFlags & EAutomationTestFlags::FeatureMask); const bool bPassesFeatureRequirements = (CurTestFeatureFlags == 0) || (CurTestFeatureFlags & FeatureSupportFlags); const bool bEnabled = (CurTestFlags & EAutomationTestFlags::Disabled) == 0; if (bEnabled && bPassesApplicationRequirements && bPassesFeatureRequirements && bPassesFilterRequirement) { CurTest->GenerateTestNames(TestInfo); } } }
void FEngineService::SendPong( const IMessageContextRef& Context ) { if (MessageEndpoint.IsValid()) { FEngineServicePong* Message = new FEngineServicePong(); Message->EngineVersion = GEngineNetVersion; Message->InstanceId = FApp::GetInstanceId(); Message->SessionId = FApp::GetSessionId(); if (GEngine == NULL) { Message->InstanceType = TEXT("Unknown"); } else if (IsRunningDedicatedServer()) { Message->InstanceType = TEXT("Server"); } else if (IsRunningCommandlet()) { Message->InstanceType = TEXT("Commandlet"); } else if (GEngine->IsEditor()) { Message->InstanceType = TEXT("Editor"); } else if ( IsRunningGame() ) { Message->InstanceType = TEXT("Game"); } else { Message->InstanceType = TEXT("Other"); } FWorldContext const* ContextToUse = NULL; // TODO: Should we be iterating here and sending a message for each context? // We're going to look through the WorldContexts and pull any Game context we find // If there isn't a Game context, we'll take the first PIE we find // and if none of those we'll use an Editor for (const FWorldContext& WorldContext : GEngine->GetWorldContexts()) { if (WorldContext.WorldType == EWorldType::Game) { ContextToUse = &WorldContext; break; } else if (WorldContext.WorldType == EWorldType::PIE && (ContextToUse == NULL || ContextToUse->WorldType != EWorldType::PIE)) { ContextToUse = &WorldContext; } else if (WorldContext.WorldType == EWorldType::Editor && ContextToUse == NULL) { ContextToUse = &WorldContext; } } if (ContextToUse != NULL && ContextToUse->World() != NULL) { Message->CurrentLevel = ContextToUse->World()->GetMapName(); Message->HasBegunPlay = ContextToUse->World()->HasBegunPlay(); Message->WorldTimeSeconds = ContextToUse->World()->TimeSeconds; } MessageEndpoint->Send(Message, Context->GetSender()); } }