首页 > 其他分享 >deviceProfile相关

deviceProfile相关

时间:2023-06-07 16:48:40浏览次数:49  
标签:deviceProfile Log TEXT ProfileName LogAndroid 相关 FString LOG

deviceManager的get

UDeviceProfileManager& UDeviceProfileManager::Get(bool bFromPostCDOContruct)
{
    if (DeviceProfileManagerSingleton == nullptr)
    {
        static bool bEntered = false;
        if (bEntered && bFromPostCDOContruct)
        {
            return *(UDeviceProfileManager*)0x3; // we know that the return value is never used, linux hates null here, which would be less weird. 
        }
        bEntered = true;
        DeviceProfileManagerSingleton = NewObject<UDeviceProfileManager>();

        DeviceProfileManagerSingleton->AddToRoot();
        if (!FPlatformProperties::RequiresCookedData())
        {
            DeviceProfileManagerSingleton->LoadProfiles();
        }

        // always start with an active profile, even if we create it on the spot
        UDeviceProfile* ActiveProfile = DeviceProfileManagerSingleton->FindProfile(GetPlatformDeviceProfileName());
        DeviceProfileManagerSingleton->SetActiveDeviceProfile(ActiveProfile);

        // now we allow the cvar changes to be acknowledged
        CVarDeviceProfileOverride.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* Variable)
        {
            UDeviceProfileManager::Get().HandleDeviceProfileOverrideChange();
        }));

        IConsoleManager::Get().RegisterConsoleCommand(
            TEXT("dp.Override.Restore"),
            TEXT("Restores any cvars set by dp.Override to their previous value"),
            FConsoleCommandDelegate::CreateLambda([]()
            {
                UDeviceProfileManager::Get().HandleDeviceProfileOverridePop();
            }),
            ECVF_Default
        );

        InitializeSharedSamplerStates();
    }
    return *DeviceProfileManagerSingleton;
}

 

const FString UDeviceProfileManager::GetPlatformDeviceProfileName()
const FString UDeviceProfileManager::GetPlatformDeviceProfileName()
{
    FString ActiveProfileName = FPlatformProperties::PlatformName();

    // look for a commandline override (never even calls into the selector plugin)
    FString OverrideProfileName;
    if (FParse::Value(FCommandLine::Get(), TEXT("DeviceProfile="), OverrideProfileName) || FParse::Value(FCommandLine::Get(), TEXT("DP="), OverrideProfileName))
    {
        return OverrideProfileName;
    }

    // look for cvar override
    OverrideProfileName = CVarDeviceProfileOverride.GetValueOnGameThread();
    if (OverrideProfileName.Len() > 0)
    {
        return OverrideProfileName;
    }


    FString DeviceProfileSelectionModule;
    if (GConfig->GetString(TEXT("DeviceProfileManager"), TEXT("DeviceProfileSelectionModule"), DeviceProfileSelectionModule, GEngineIni))
    {
        if (IDeviceProfileSelectorModule* DPSelectorModule = FModuleManager::LoadModulePtr<IDeviceProfileSelectorModule>(*DeviceProfileSelectionModule))
        {
            ActiveProfileName = DPSelectorModule->GetRuntimeDeviceProfileName();
        }
    }

#if WITH_EDITOR
    if (FPIEPreviewDeviceModule::IsRequestingPreviewDevice())
    {
        IDeviceProfileSelectorModule* PIEPreviewDeviceProfileSelectorModule = FModuleManager::LoadModulePtr<IDeviceProfileSelectorModule>("PIEPreviewDeviceProfileSelector");
        if (PIEPreviewDeviceProfileSelectorModule)
        {
            FString PIEProfileName = PIEPreviewDeviceProfileSelectorModule->GetRuntimeDeviceProfileName();
            if (!PIEProfileName.IsEmpty())
            {
                ActiveProfileName = PIEProfileName;
            }
        }
    }
#endif
    return ActiveProfileName;
}

在UDeviceProfileManager::GetActiveDeviceProfileName()里也会调用到const FString UDeviceProfileManager::GetPlatformDeviceProfileName()函数。

调用到子类:
FString const FAndroidDeviceProfileSelectorRuntimeModule::GetRuntimeDeviceProfileName()
{
    static FString ProfileName;

#if PLATFORM_LUMIN
    if (ProfileName.IsEmpty())
    {
        // Fallback profiles in case we do not match any rules
        ProfileName = FPlatformMisc::GetDefaultDeviceProfileName();
        if (ProfileName.IsEmpty())
        {
            ProfileName = FPlatformProperties::PlatformName();
        }
    }

    // @todo Lumin: when removing this, also remove Lumin from the .uplugin
    UE_LOG(LogAndroid, Log, TEXT("Selected Device Profile: [%s]"), *ProfileName);
    return ProfileName;
#endif
    
    if (ProfileName.IsEmpty())
    {
        // Fallback profiles in case we do not match any rules
        ProfileName = FPlatformMisc::GetDefaultDeviceProfileName();
        if (ProfileName.IsEmpty())
        {
            ProfileName = FPlatformProperties::PlatformName();
        }

        FString GPUFamily = FAndroidMisc::GetGPUFamily();
        FString GLVersion = FAndroidMisc::GetGLVersion();

        FString VulkanVersion = FAndroidMisc::GetVulkanVersion();
        FString VulkanAvailable = FAndroidMisc::IsVulkanAvailable() ? TEXT("true") : TEXT("false");
        FString AndroidVersion = FAndroidMisc::GetAndroidVersion();
        FString DeviceMake = FAndroidMisc::GetDeviceMake();
        FString DeviceModel = FAndroidMisc::GetDeviceModel();
        FString DeviceBuildNumber = FAndroidMisc::GetDeviceBuildNumber();
        
        FString Hardware = FString(TEXT("unknown"));
        FString Chipset = FString(TEXT("unknown"));
        FString *HardwareLookup = FAndroidMisc::GetConfigRulesVariable(TEXT("hardware"));
        if (HardwareLookup != nullptr)
        {
            Hardware = *HardwareLookup;
        }
        FString *ChipsetLookup = FAndroidMisc::GetConfigRulesVariable(TEXT("chipset"));
        if (ChipsetLookup != nullptr)
        {
            Chipset = *ChipsetLookup;
        }

#if !(PLATFORM_ANDROID_X86 || PLATFORM_ANDROID_X64)
        // Not running an Intel libUE4.so with Houdini library present means we're emulated
        bool bUsingHoudini = (access("/system/lib/libhoudini.so", F_OK) != -1);
#else
        bool bUsingHoudini = false;
#endif
        FString UsingHoudini = bUsingHoudini ? TEXT("true") : TEXT("false");

        UE_LOG(LogAndroid, Log, TEXT("Checking %d rules from DeviceProfile ini file."), FAndroidDeviceProfileSelector::GetNumProfiles() );
        UE_LOG(LogAndroid, Log, TEXT("  Default profile: %s"), * ProfileName);
        UE_LOG(LogAndroid, Log, TEXT("  GpuFamily: %s"), *GPUFamily);
        UE_LOG(LogAndroid, Log, TEXT("  GlVersion: %s"), *GLVersion);
        UE_LOG(LogAndroid, Log, TEXT("  VulkanAvailable: %s"), *VulkanAvailable);
        UE_LOG(LogAndroid, Log, TEXT("  VulkanVersion: %s"), *VulkanVersion);
        UE_LOG(LogAndroid, Log, TEXT("  AndroidVersion: %s"), *AndroidVersion);
        UE_LOG(LogAndroid, Log, TEXT("  DeviceMake: %s"), *DeviceMake);
        UE_LOG(LogAndroid, Log, TEXT("  DeviceModel: %s"), *DeviceModel);
        UE_LOG(LogAndroid, Log, TEXT("  DeviceBuildNumber: %s"), *DeviceBuildNumber);
        UE_LOG(LogAndroid, Log, TEXT("  UsingHoudini: %s"), *UsingHoudini);
        UE_LOG(LogAndroid, Log, TEXT("  Hardware: %s"), *Hardware);
        UE_LOG(LogAndroid, Log, TEXT("  Chipset: %s"), *Chipset);

        CheckForJavaSurfaceViewWorkaround(DeviceMake, DeviceModel);

        // Use override from ConfigRules if set
        FString* ConfigProfile = FAndroidMisc::GetConfigRulesVariable(TEXT("Profile"));
        if (ConfigProfile != nullptr)
        {
            ProfileName = *ConfigProfile;
            UE_LOG(LogAndroid, Log, TEXT("Using ConfigRules Profile: [%s]"), *ProfileName);
        }
        else
        {
            // Find a match with the DeviceProfiles matching rules
            ProfileName = FAndroidDeviceProfileSelector::FindMatchingProfile(GPUFamily, GLVersion, AndroidVersion, DeviceMake, DeviceModel, DeviceBuildNumber, VulkanAvailable, VulkanVersion, UsingHoudini, Hardware, Chipset, ProfileName);
            UE_LOG(LogAndroid, Log, TEXT("Selected Device Profile: [%s]"), *ProfileName);
        }
    }

    return ProfileName;
}

 

 

getDeviceProfileName()函数:CheckAndroidDeviceProfileCommandlet.cpp里,测试这个。

在baseDeviceProfiles.ini文件里,有所有的profile名和其对应的类型:

[DeviceProfiles]
+DeviceProfileNameAndTypes=Windows,Windows
+DeviceProfileNameAndTypes=WindowsNoEditor,Windows
+DeviceProfileNameAndTypes=WindowsServer,Windows
+DeviceProfileNameAndTypes=WindowsClient,Windows
+DeviceProfileNameAndTypes=IOS,IOS
+DeviceProfileNameAndTypes=iPadAir,IOS

 

 

标签:deviceProfile,Log,TEXT,ProfileName,LogAndroid,相关,FString,LOG
From: https://www.cnblogs.com/Shaojunping/p/17463802.html

相关文章

  • 一次简单的蓝牙相关安卓代码逆向记录
    前言本来工作方面和安卓根本没任何交集,把这个过程记录下来,只是一个小总结。涉及到的知识点有,安卓逆向,Smali修改,安卓apk签名,蓝牙连接,ADB。基本需求手里有一个设备,是支持双模蓝牙的。也就是经典蓝牙使用的名称和MAC地址,和低功耗蓝牙使用的是一样的。之前其他人开发过一个......
  • Financial - IRS相关概念(DV01, DVBP, 关键利率久期 KRD, Bucket Risk, )
     一、DVBP,DV01是一个概念以下几个概念,相等: •基点美元价值(dollarvalueofabasispoint,DVBP) •基点价值(pricevalueofabasispoint,PVBP) •基点美元值(dollarvalueofall01,DV01)【定义】其含义是相对于初始价格,如果市场要求收益率上、下波动1个基点时,债券价格......
  • nginx代理webSocket 和eventSource 相关配置
    文章转载自: https://blog.csdn.net/Embrace924/article/details/92649471nginx代理webSocket和eventSource请求超时连接不通但是本地可以nginx代理出了问题不能普通代理一样要先发起普通请求代理然后通过一些属性再次转换#常用配置location/api/{    proxy_pas......
  • (转)常见日志收集方案及相关组件
    原文:https://www.cnblogs.com/hujinzhong/p/15005523.html一、常见日志收集方案1.1、EFK​在Kubernetes集群上运行多个服务和应用程序时,日志收集系统可以帮助你快速分类和分析由Pod生成的大量日志数据。Kubernetes中比较流行的日志收集解决方案是Elasticsearch、Fluentd和Kiba......
  • 基本常用命令--集合相关
    集合的创建显式创建(了解)db.createCollection(name)参数说明:name:要创建的集合名称例如:创建一个名为mycollection的普通集合。db.createCollection("mycollection")查看当前库中的表:showcollections或showtables隐式创建(推荐)当向一个集合中插入一个文档的时候,如果......
  • 基本常用命令--数据库相关
    查看有权限查看的所有的数据库showdbs或showdatabases注意:在MongoDB中,集合只有在内容插入后才会创建!就是说,创建集合(数据表)后要再插入一个文档(记录),集合才会真正创建。查看当前正在使用的数据库dbMongoDB中默认的数据库为test,如果你没有选择数据库,集合将存放在......
  • linux 查看防火墙相关命令
    1.查看防火墙状态systemctlstatusfirewalld2.启动防火墙systemctlstart/restartfirewalld3.停止防火墙 临时停用,重启后失效systemctlstopfirewalld4.永久停止防火墙systemctldisablefirewalld5.开机启动systemctlenablefirewalld6.查看防火请端口......
  • Spring boot2 项目相关
    1、首先通过Idea创建一个Maven项目,参考IDEAMaven父子项目操作(不是微服务架构,所以参考子项目的创建即可). 2、修改pom.xml导入springboot2相关的依赖(1)、引入springboot2框架 <parent><groupId>org.springframework.boot</groupId><artifactId>spring-bo......
  • DC 相关理解 (一)
    参考IC_learner1.DC做了什么对读入的设计(verilog/vhdl/systemverilog)进行翻译,得到统一的格式GTECH。施加各种约束,接近实际电路,这样在库中才能选择更准确地映射器件;对时序和面积进行优化。选择合适工艺库中的器件一一映射。2.做完综合可以得到什么?.ddc包括映射......
  • AMBA2 AHB 相关理解 (一)
    一、AHB总线协议概述1.AHB总线部件主机主机给地址(选通不同slave)以及控制信息(读写方向、数据量、数据大小等)发起读写操作。从机从机在仲裁器给过来的HREADY为高电平时采样HSELx、地址以及控制信号。从机会返回两个信号(HREADYOUT/HRESP)给主机,前者为是否需要主机等待信号......