Merge branch 'main' into cpack_installer
This commit is contained in:
@@ -1,402 +0,0 @@
|
||||
<!--
|
||||
= Platform names =
|
||||
(case insensitive)
|
||||
"ANDROID"
|
||||
"PROVO"
|
||||
"PC"
|
||||
"LINUX"
|
||||
"MAC"
|
||||
|
||||
= Basic Layout =
|
||||
<ThreadConfig>
|
||||
<Platform name="XXX">
|
||||
<ThreadDefault Affinity="XX" Priority="XX" StackSizeKB="XX">
|
||||
<Thread name ="A" Affinity="XX" Priority="XX" StackSizeKB="XX">
|
||||
<Thread name ="B" Affinity="XX" >
|
||||
...
|
||||
</Platform>
|
||||
|
||||
<Platform name="YYY">
|
||||
...
|
||||
</Platform>
|
||||
</ThreadConfig>
|
||||
|
||||
= Parser Order for Platform =
|
||||
1. PlatformName_Common (valid for all potential platform configurations. Can be overridden by concert platform configuration)
|
||||
2. PlatformName or PlatformName_X (for platforms with unknown CPU count where X is the number of potential cores. The equal or next lower matching configuration for the identified core count at runtime will be taken)
|
||||
|
||||
Note: Overriding of thread configuration by later parsed configuration allowed.
|
||||
|
||||
= <ThreadDefault> and <Thread> XML attributes =
|
||||
|
||||
!!!
|
||||
Note: Use "ignore" as value if you do not want the thread system to set the value specifically!
|
||||
If a value is not defines the <ThreadDefault> value of the parameter will be used.
|
||||
This is useful when dealing with 3rdParty threads where you are not in control of the parameter setup.
|
||||
!!!
|
||||
|
||||
Name:
|
||||
"x" (string) : Name of thread
|
||||
"x*y" (string) : Name of thread with wildcard character
|
||||
|
||||
Affinity:
|
||||
"-1" : Put SW thread affinity in the hands of the scheduler - (default) -
|
||||
"x" : Run thread on specified core
|
||||
"x, y, ..." : Run thread on specified cores
|
||||
|
||||
Priority:
|
||||
"idle" : Hint to CryEngine to run thread with pre-set priority
|
||||
"below_normal" : Hint to CryEngine to run thread with pre-set priority
|
||||
"normal" : Hint to CryEngine to run thread with pre-set priority - (default) -
|
||||
"above_normal" : Hint to CryEngine to run thread with pre-set priority
|
||||
"highest" : Hint to CryEngine to run thread with pre-set priority
|
||||
"time_critical" : Hint to CryEngine to run thread with pre-set priority
|
||||
|
||||
"x" (number) : User defined thread priority number
|
||||
|
||||
StackSizeKB:
|
||||
"0" : Let platform decide on the stack size - (default) -
|
||||
"x" : Create thread with "x" KB of stack size
|
||||
|
||||
DisablePriorityBoost:
|
||||
"true" : Disable priority boosting - (default) -
|
||||
"false" : Enable priority boosting
|
||||
-->
|
||||
|
||||
|
||||
<ThreadConfig>
|
||||
<!-- ============= -->
|
||||
<!-- === PROVO === -->
|
||||
<!-- ============= -->
|
||||
<Platform name="Provo">
|
||||
<ThreadDefault Affinity="-1" Priority="Normal" StackSizeKB="64"/>
|
||||
|
||||
<!-- [PROCESS] -->
|
||||
<Thread name ="Main" Affinity="0" Priority="Above_Normal"/>
|
||||
|
||||
<!-- [RenderDLL] -->
|
||||
<Thread name ="RenderThread" Affinity="2" Priority="Highest" StackSizeKB="128"/>
|
||||
<Thread name ="RenderLoadingThread" Affinity="1" Priority="Above_Normal" StackSizeKB="72"/>
|
||||
<Thread name ="ShaderCompile"/>
|
||||
|
||||
<!-- [SYSTEM] -->
|
||||
<Thread name ="GFxMeshCacheReset"/>
|
||||
<Thread name ="MTrace NetPump" Priority="25"/>
|
||||
<Thread name ="NotificationNetwork"/>
|
||||
<Thread name ="ReplayRecord"/>
|
||||
<Thread name ="ResourceActivator"/>
|
||||
<Thread name ="StatoscopeDataWriter"/>
|
||||
<Thread name ="RemoteCommandClient"/>
|
||||
<Thread name ="RemoteCommandServer"/>
|
||||
<Thread name ="ServiceNetwork"/>
|
||||
<Thread name ="SysCrashTestOnThread"/>
|
||||
|
||||
<!-- [SYSTEM] - JobSystem -->
|
||||
<Thread name ="JobSystem_Worker_0(Blocking)" Affinity="1"/>
|
||||
|
||||
<Thread name ="JobSystem_Worker_0(Regular)" Affinity="1" StackSizeKB="256"/>
|
||||
<Thread name ="JobSystem_Worker_1(Regular)" Affinity="3" StackSizeKB="256"/>
|
||||
<Thread name ="JobSystem_Worker_2(Regular)" Affinity="4" StackSizeKB="256"/>
|
||||
<Thread name ="JobSystem_Worker_3(Regular)" Affinity="5" StackSizeKB="256"/>
|
||||
|
||||
<!-- [SYSTEM] - Physics -->
|
||||
<Thread name ="Physics" StackSizeKB="128"/>
|
||||
<Thread name ="PhysicsWorkerThread_*" StackSizeKB="128"/>
|
||||
|
||||
<!-- [SYSTEM] - Streaming -->
|
||||
<Thread name ="Streaming File IO HDD" Priority="Above_Normal" Affinity="1"/>
|
||||
<Thread name ="Streaming File IO Optical" Priority="Above_Normal" Affinity="1"/>
|
||||
<Thread name ="Streaming File IO InMemory" Priority="Above_Normal" Affinity="1"/>
|
||||
|
||||
<Thread name ="Streaming AsyncCallback" Affinity="5"/>
|
||||
<Thread name ="Streaming AsyncCallback Pak 0" Affinity="5"/>
|
||||
|
||||
<!-- [SYSTEM] - Console -->
|
||||
<Thread name ="RemoteConsoleServer"/>
|
||||
<Thread name ="RemoteConsoleClient"/>
|
||||
|
||||
<!-- [NETWORK] -->
|
||||
<Thread name ="Network"/>
|
||||
<Thread name ="ServerProbe"/>
|
||||
<Thread name ="NetworkDebugKit"/>
|
||||
<Thread name ="NetFileDownload"/>
|
||||
<Thread name ="NetworkWatchdog"/>
|
||||
<Thread name ="NetAddressSolver"/>
|
||||
|
||||
<!-- [AI] -->
|
||||
<Thread name ="NavigationSystemBackgroundUpdate"/>
|
||||
|
||||
<!-- [AUDIO] -->
|
||||
<Thread name ="MainAudioThread" Affinity="1,3,4,5" Priority="below_normal" StackSize="ignore"/>
|
||||
|
||||
<Thread name ="Wwise_Device" Affinity="5" Priority="ignore" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_BankManager" Affinity="5" Priority="ignore" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_LEngine" Affinity="5" Priority="ignore" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_Monitor" Affinity="5" Priority="ignore" StackSize="ignore"/>
|
||||
|
||||
<!-- [ACTION] -->
|
||||
<Thread name ="NetworkStallTicker"/>
|
||||
<Thread name ="ZLibCompressor" Priority="Normal"/>
|
||||
|
||||
<!-- [INPUT] -->
|
||||
<Thread name ="InputWorker"/>
|
||||
<Thread name ="Synergy"/>
|
||||
|
||||
<!-- [LIVE_CREATE]-->
|
||||
<Thread name ="LiveCreate_Server"/>
|
||||
<Thread name ="LiveCreate_FileSync"/>
|
||||
<Thread name ="LiveCreatePlatformService"/>
|
||||
<Thread name ="LiveCreateUtilityService"/>
|
||||
|
||||
<!-- [SCALEFORM][3rd Party] -->
|
||||
<Thread name ="GFxVideo_SoundUpdate" Affinity="5" Priority="time_critical" DisablePriorityBoost="ignore" StackSizeKB="ignore"/>
|
||||
<Thread name ="GFxVideo_Decoder" Affinity="4" Priority="highest" DisablePriorityBoost="ignore" StackSizeKB="ignore"/>
|
||||
<Thread name ="GFxVideo_Reader" Affinity="5" Priority="highest" DisablePriorityBoost="ignore" StackSizeKB="ignore"/>
|
||||
</Platform>
|
||||
|
||||
<!-- ============ -->
|
||||
<!-- === PC_Common === -->
|
||||
<!-- ============ -->
|
||||
<Platform name="PC_Common">
|
||||
<ThreadDefault Affinity="-1" Priority="Normal" StackSizeKB="32"/>
|
||||
|
||||
<!-- [PROCESS] -->
|
||||
<Thread name ="Main" Affinity="-1" Priority="Normal"/>
|
||||
|
||||
<!-- [SYSTEM] - JobSystem -->
|
||||
<Thread name ="JobSystem_Worker_*(Blocking)" StackSizeKB="32"/>
|
||||
<Thread name ="JobSystem_Worker_*(Regular)" StackSizeKB="256"/>
|
||||
|
||||
<!-- [SYSTEM] - Physics -->
|
||||
<Thread name ="Physics" StackSizeKB="128"/>
|
||||
<Thread name ="PhysicsWorkerThread_*" StackSizeKB="128"/>
|
||||
|
||||
<!-- [RenderDLL] -->
|
||||
<Thread name ="RenderThread" StackSizeKB="128"/>
|
||||
<Thread name ="RenderLoadingThread" Priority="Above_Normal" StackSizeKB="72"/>
|
||||
<Thread name ="ShaderCompile"/>
|
||||
|
||||
<!-- [SYSTEM] -->
|
||||
<Thread name ="GFxMeshCacheReset"/>
|
||||
<Thread name ="MTrace NetPump" Priority="25" StackSizeKB="64"/>
|
||||
<Thread name ="NotificationNetwork"/>
|
||||
<Thread name ="ReplayRecord"/>
|
||||
<Thread name ="ResourceActivator"/>
|
||||
<Thread name ="StatoscopeDataWriter"/>
|
||||
<Thread name ="RemoteCommandClient"/>
|
||||
<Thread name ="RemoteCommandServer"/>
|
||||
<Thread name ="ServiceNetwork"/>
|
||||
<Thread name ="SysCrashTestOnThread"/>
|
||||
|
||||
<!-- [SYSTEM] - Streaming -->
|
||||
<Thread name ="Streaming File IO HDD" Priority="Above_Normal"/>
|
||||
<Thread name ="Streaming File IO Optical" Priority="Above_Normal"/>
|
||||
<Thread name ="Streaming File IO InMemory" Priority="Above_Normal"/>
|
||||
|
||||
<Thread name ="Streaming AsyncCallback"/>
|
||||
<Thread name ="Streaming AsyncCallback Pak 0"/>
|
||||
|
||||
<!-- [SYSTEM] - Console -->
|
||||
<Thread name ="RemoteConsoleServer"/>
|
||||
<Thread name ="RemoteConsoleClient"/>
|
||||
<Thread name ="WindowsConsoleInput"/>
|
||||
<Thread name ="UNIXConsoleInput"/>
|
||||
|
||||
<!-- [NETWORK] -->
|
||||
<Thread name ="Network"/>
|
||||
<Thread name ="ServerProbe"/>
|
||||
<Thread name ="NetworkDebugKit"/>
|
||||
<Thread name ="NetFileDownload"/>
|
||||
<Thread name ="NetworkWatchdog" StackSizeKB="8"/>
|
||||
<Thread name ="NetAddressSolver" StackSizeKB="16"/>
|
||||
|
||||
<!-- [AUDIO] -->
|
||||
<Thread name ="MainAudioThread" Affinity="ignore" Priority="below_normal" StackSize="ignore"/>
|
||||
|
||||
<Thread name ="Wwise_Device" Affinity="ignore" Priority="ignore" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_BankManager" Affinity="ignore" Priority="ignore" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_LEngine" Affinity="ignore" Priority="ignore" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_Monitor" Affinity="ignore" Priority="ignore" StackSize="ignore"/>
|
||||
|
||||
<!-- [AI] -->
|
||||
<Thread name ="NavigationSystemBackgroundUpdate"/>
|
||||
|
||||
<!-- [ACTION] -->
|
||||
<Thread name ="NetworkStallTicker"/>
|
||||
<Thread name ="ZLibCompressor" Priority="Normal" StackSizeKB="32"/>
|
||||
|
||||
<!-- [INPUT] -->
|
||||
<Thread name ="InputWorker"/>
|
||||
<Thread name ="Synergy"/>
|
||||
|
||||
<!-- [LIVE_CREATE]-->
|
||||
<Thread name ="LiveCreate_Server"/>
|
||||
<Thread name ="LiveCreate_FileSync"/>
|
||||
<Thread name ="LiveCreatePlatformService"/>
|
||||
<Thread name ="LiveCreateUtilityService"/>
|
||||
|
||||
<!-- [SCALEFORM][3rd Party] -->
|
||||
<Thread name ="GFxVideo_SoundUpdate" Affinity="ignore" Priority="highest" DisablePriorityBoost="ignore" StackSizeKB="16"/>
|
||||
|
||||
<!-- Special case, to add additional decoder threads add a threads with an increase incremental number. "GFxVideo_Decoder_0" sets thread priority for all other decoder threads-->
|
||||
<Thread name ="GFxVideo_Decoder_0" Affinity="ignore" Priority="normal" DisablePriorityBoost="ignore" StackSizeKB="ignore"/>
|
||||
<Thread name ="GFxVideo_Decoder_1" Affinity="ignore" Priority="normal" DisablePriorityBoost="ignore" StackSizeKB="ignore"/>
|
||||
</Platform>
|
||||
|
||||
<!-- ============ -->
|
||||
<!-- === PC_8 === -->
|
||||
<!-- ============ -->
|
||||
<Platform name="PC_8">
|
||||
<!-- Empty Example - Extend for 8 core specific machines. May override Common settings -->
|
||||
</Platform>
|
||||
|
||||
<!-- ============ -->
|
||||
<!-- === MAC_Common === -->
|
||||
<!-- ============ -->
|
||||
<Platform name="MAC_Common">
|
||||
<ThreadDefault Affinity="-1" Priority="Normal" StackSizeKB="32"/>
|
||||
</Platform>
|
||||
|
||||
<!-- ============ -->
|
||||
<!-- === LINUX_Common === -->
|
||||
<!-- ============ -->
|
||||
<Platform name="LINUX_Common">
|
||||
<ThreadDefault Affinity="-1" Priority="Normal" StackSizeKB="64"/>
|
||||
|
||||
<!-- [PROCESS] -->
|
||||
<Thread name ="Main" Affinity="-1" Priority="Above_Normal"/>
|
||||
|
||||
<!-- [SYSTEM] - JobSystem -->
|
||||
<Thread name ="JobSystem_Worker_*(Blocking)" StackSizeKB="32"/>
|
||||
<Thread name ="JobSystem_Worker_*(Regular)" StackSizeKB="256"/>
|
||||
|
||||
<!-- [SYSTEM] - Physics -->
|
||||
<Thread name ="Physics" StackSizeKB="128"/>
|
||||
<Thread name ="PhysicsWorkerThread_*" StackSizeKB="128"/>
|
||||
|
||||
<!-- [RenderDLL] -->
|
||||
<Thread name ="RenderThread" Priority="Above_Normal" StackSizeKB="128"/>
|
||||
<Thread name ="RenderLoadingThread" Priority="Above_Normal" StackSizeKB="72"/>
|
||||
<Thread name ="ShaderCompile"/>
|
||||
|
||||
<!-- [SYSTEM] -->
|
||||
<Thread name ="GFxMeshCacheReset"/>
|
||||
<Thread name ="MTrace NetPump" Priority="25" StackSizeKB="64"/>
|
||||
<Thread name ="NotificationNetwork"/>
|
||||
<Thread name ="ReplayRecord"/>
|
||||
<Thread name ="ResourceActivator"/>
|
||||
<Thread name ="StatoscopeDataWriter"/>
|
||||
<Thread name ="RemoteCommandClient"/>
|
||||
<Thread name ="RemoteCommandServer"/>
|
||||
<Thread name ="ServiceNetwork"/>
|
||||
<Thread name ="SysCrashTestOnThread"/>
|
||||
|
||||
<!-- [SYSTEM] - Streaming -->
|
||||
<Thread name ="Streaming File IO HDD" Priority="Above_Normal"/>
|
||||
<Thread name ="Streaming File IO Optical" Priority="Above_Normal"/>
|
||||
<Thread name ="Streaming File IO InMemory" Priority="Above_Normal"/>
|
||||
|
||||
<Thread name ="Streaming AsyncCallback"/>
|
||||
<Thread name ="Streaming AsyncCallback Pak 0"/>
|
||||
|
||||
<!-- [SYSTEM] - Console -->
|
||||
<Thread name ="RemoteConsoleServer"/>
|
||||
<Thread name ="RemoteConsoleClient"/>
|
||||
<Thread name ="UNIXConsoleInput"/>
|
||||
|
||||
<!-- [NETWORK] -->
|
||||
<Thread name ="Network"/>
|
||||
<Thread name ="ServerProbe"/>
|
||||
<Thread name ="NetworkDebugKit"/>
|
||||
<Thread name ="NetFileDownload"/>
|
||||
<Thread name ="NetworkWatchdog" StackSizeKB="8"/>
|
||||
<Thread name ="NetAddressSolver"/>
|
||||
|
||||
<!-- [AUDIO] -->
|
||||
<Thread name ="MainAudioThread" Affinity="ignore" Priority="below_normal" StackSize="ignore"/>
|
||||
|
||||
<Thread name ="Wwise_Device" Affinity="ignore" Priority="99" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_BankManager" Affinity="ignore" Priority="50" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_LEngine" Affinity="ignore" Priority="99" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_Monitor" Affinity="ignore" Priority="99" StackSize="ignore"/>
|
||||
|
||||
<!-- [AI] -->
|
||||
<Thread name ="NavigationSystemBackgroundUpdate"/>
|
||||
|
||||
<!-- [ACTION] -->
|
||||
<Thread name ="NetworkStallTicker"/>
|
||||
<Thread name ="ZLibCompressor" Priority="Normal" StackSizeKB="32"/>
|
||||
|
||||
<!-- [INPUT] -->
|
||||
<Thread name ="InputWorker"/>
|
||||
<Thread name ="Synergy"/>
|
||||
|
||||
</Platform>
|
||||
|
||||
<!-- ============ -->
|
||||
<!-- === ANDROID_Common === -->
|
||||
<!-- ============ -->
|
||||
<Platform name="ANDROID_Common">
|
||||
<ThreadDefault Affinity="-1" Priority="Normal" StackSizeKB="32"/>
|
||||
|
||||
<!-- [PROCESS] -->
|
||||
<Thread name ="Main" Priority="Above_Normal"/>
|
||||
|
||||
<!-- [SYSTEM] - JobSystem -->
|
||||
<Thread name ="JobSystem_Worker_*(Blocking)" StackSizeKB="32"/>
|
||||
<Thread name ="JobSystem_Worker_*(Regular)" StackSizeKB="256"/>
|
||||
|
||||
<!-- [SYSTEM] - Physics -->
|
||||
<Thread name ="Physics" StackSizeKB="128"/>
|
||||
<Thread name ="PhysicsWorkerThread_*" StackSizeKB="128"/>
|
||||
|
||||
<!-- [RenderDLL] -->
|
||||
<Thread name ="RenderThread" Affinity="ignore" Priority="Above_Normal" StackSizeKB="128"/>
|
||||
<Thread name ="RenderLoadingThread" Affinity="ignore" Priority="Above_Normal" StackSizeKB="72"/>
|
||||
<Thread name ="ShaderCompile"/>
|
||||
|
||||
<!-- [SYSTEM] -->
|
||||
<Thread name ="GFxMeshCacheReset"/>
|
||||
<Thread name ="MTrace NetPump" Priority="25" StackSizeKB="64"/>
|
||||
<Thread name ="NotificationNetwork"/>
|
||||
<Thread name ="ReplayRecord"/>
|
||||
<Thread name ="ResourceActivator"/>
|
||||
<Thread name ="StatoscopeDataWriter"/>
|
||||
<Thread name ="RemoteCommandClient"/>
|
||||
<Thread name ="RemoteCommandServer"/>
|
||||
<Thread name ="ServiceNetwork"/>
|
||||
<Thread name ="SysCrashTestOnThread"/>
|
||||
|
||||
<!-- [AUDIO] -->
|
||||
<Thread name ="MainAudioThread" Affinity="ignore" Priority="below_normal" StackSize="ignore"/>
|
||||
|
||||
<Thread name ="Wwise_Device" Affinity="ignore" Priority="99" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_BankManager" Affinity="ignore" Priority="50" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_LEngine" Affinity="ignore" Priority="99" StackSize="ignore"/>
|
||||
<Thread name ="Wwise_Monitor" Affinity="ignore" Priority="99" StackSize="ignore"/>
|
||||
|
||||
<!-- [SYSTEM] - Streaming -->
|
||||
<Thread name ="Streaming File IO HDD" Priority="Above_Normal"/>
|
||||
<Thread name ="Streaming File IO Optical" Priority="Above_Normal"/>
|
||||
<Thread name ="Streaming File IO InMemory" Priority="Above_Normal"/>
|
||||
|
||||
<Thread name ="Streaming AsyncCallback"/>
|
||||
<Thread name ="Streaming AsyncCallback Pak 0"/>
|
||||
|
||||
<!-- [SYSTEM] - Console -->
|
||||
<Thread name ="RemoteConsoleServer"/>
|
||||
|
||||
<!-- [NETWORK] -->
|
||||
<Thread name ="Network"/>
|
||||
<Thread name ="ServerProbe"/>
|
||||
<Thread name ="NetworkDebugKit"/>
|
||||
<Thread name ="NetFileDownload"/>
|
||||
<Thread name ="NetworkWatchdog" StackSizeKB="8"/>
|
||||
<Thread name ="NetAddressSolver" StackSizeKB="16"/>
|
||||
|
||||
<!-- [ACTION] -->
|
||||
<Thread name ="NetworkStallTicker"/>
|
||||
<Thread name ="ZLibCompressor" Affinity="ignore" Priority="Above_Normal" StackSizeKB="32"/>
|
||||
</Platform>
|
||||
|
||||
</ThreadConfig>
|
||||
@@ -1,128 +0,0 @@
|
||||
<!--
|
||||
= Platform names =
|
||||
(case insensitive)
|
||||
"ANDROID"
|
||||
"PROVO"
|
||||
"PC"
|
||||
"MAC"
|
||||
|
||||
= Basic Layout =
|
||||
<ThreadConfig>
|
||||
<Platform name="XXX">
|
||||
<ThreadDefault Affinity="XX" Priority="XX" StackSizeKB="XX">
|
||||
<Thread name ="A" Affinity="XX" Priority="XX" StackSizeKB="XX">
|
||||
<Thread name ="B" Affinity="XX" >
|
||||
...
|
||||
</Platform>
|
||||
|
||||
<Platform name="YYY">
|
||||
...
|
||||
</Platform>
|
||||
</ThreadConfig>
|
||||
|
||||
= Parser Order for Platform =
|
||||
1. PlatformName_Common (valid for all potential platform configurations. Can be overridden by concert platform configuration)
|
||||
2. PlatformName or PlatformName_X (for platforms with unknown CPU count where X is the number of potential cores. The equal or next lower matching configuration for the identified core count at runtime will be taken)
|
||||
|
||||
Note: Overriding of thread configuration by later parsed configuration allowed.
|
||||
|
||||
= <ThreadDefault> and <Thread> XML attributes =
|
||||
|
||||
!!!
|
||||
Note: Use "ignore" as value if you do not want the thread system to set the value specifically!
|
||||
If a value is not defines the <ThreadDefault> value of the parameter will be used.
|
||||
This is useful when dealing with 3rdParty threads where you are not in control of the parameter setup.
|
||||
!!!
|
||||
|
||||
Name:
|
||||
"x" (string) : Name of thread
|
||||
"x*y" (string) : Name of thread with wildcard character
|
||||
|
||||
Affinity:
|
||||
"-1" : Put SW thread affinity in the hands of the scheduler - (default) -
|
||||
"x" : Run thread on specified core
|
||||
"x, y, ..." : Run thread on specified cores
|
||||
|
||||
Priority:
|
||||
"idle" : Hint to CryEngine to run thread with pre-set priority
|
||||
"below_normal" : Hint to CryEngine to run thread with pre-set priority
|
||||
"normal" : Hint to CryEngine to run thread with pre-set priority - (default) -
|
||||
"above_normal" : Hint to CryEngine to run thread with pre-set priority
|
||||
"highest" : Hint to CryEngine to run thread with pre-set priority
|
||||
"time_critical" : Hint to CryEngine to run thread with pre-set priority
|
||||
|
||||
"x" (number) : User defined thread priority number
|
||||
|
||||
StackSizeKB:
|
||||
"0" : Let platform decide on the stack size - (default) -
|
||||
"x" : Create thread with "x" KB of stack size
|
||||
|
||||
DisablePriorityBoost:
|
||||
"true" : Disable priority boosting - (default) -
|
||||
"false" : Enable priority boosting
|
||||
-->
|
||||
|
||||
|
||||
<ThreadConfig>
|
||||
<!-- ============ -->
|
||||
<!-- === PC_Common === -->
|
||||
<!-- ============ -->
|
||||
<Platform name="PC_Common">
|
||||
<ThreadDefault Affinity="-1" Priority="Normal" StackSizeKB="32"/>
|
||||
|
||||
<!-- [SANDBOX] -->
|
||||
<Thread name ="TextureViewer"/>
|
||||
<Thread name ="TextureDatabaseCreator"/>
|
||||
|
||||
<Thread name ="MaterialFilesScanning"/>
|
||||
<Thread name ="FileChangeMonitor"/>
|
||||
|
||||
<Thread name ="FileSystemSearcher"/>
|
||||
<Thread name ="BackgroundTask_IO"/>
|
||||
<Thread name ="BackgroundTask_*"/>
|
||||
|
||||
<!-- [SANDBOX] - Dialogues -->
|
||||
<Thread name ="ResourceCompilerDialog"/>
|
||||
|
||||
<!-- [SANDBOX] - Telemetry -->
|
||||
<Thread name ="TelemetryPipeThread"/>
|
||||
|
||||
<!-- [SANDBOX] - Asset Browser -->
|
||||
<Thread name ="AssetMetaDataFileDB_CachingInfo"/>
|
||||
<Thread name ="AssetMetaDataFileDB_LoadAndUpdate"/>
|
||||
|
||||
<!-- [SANDBOX] - Console -->
|
||||
<Thread name ="ConsoleHotUpdate"/>
|
||||
<Thread name ="Console Synchronization"/>
|
||||
|
||||
<!-- [SANDBOX] - LiveCreate -->
|
||||
<Thread name ="LiveCreate_PeerComm"/>
|
||||
<Thread name ="LiveCreate_SyncFiles"/>
|
||||
<Thread name ="LiveCreate_CheckPowerOn"/>
|
||||
|
||||
<!-- [SANDBOX] - Plug-ins -->
|
||||
<Thread name ="PerforcePlugin"/>
|
||||
|
||||
<!-- [SANDBOX] - Utility -->
|
||||
<Thread name ="FileIndexing"/>
|
||||
<Thread name ="LODChainGenerateThread"/>
|
||||
<Thread name ="VisualChangeCalculatorView"/>
|
||||
|
||||
<!-- [SANDBOX] - Segmented World -->
|
||||
<Thread name ="SegWorld_MapUpdater"/>
|
||||
<Thread name ="SegWorld_WorldUpdater"/>
|
||||
<Thread name ="SegWorld_ExportSurfaceTexture_*"/>
|
||||
|
||||
<!-- [SANDBOX] - Indirect Lighting -->
|
||||
<Thread name ="SHLighting_*" StackSizeKB="1024"/>
|
||||
<Thread name ="SHLighting_TriRaster" StackSizeKB="1024"/>
|
||||
|
||||
</Platform>
|
||||
|
||||
<!-- ============ -->
|
||||
<!-- === PC_8 === -->
|
||||
<!-- ============ -->
|
||||
<Platform name="PC_8">
|
||||
<!-- Empty Example - Extend for 8 core specific machines. May override Common settings -->
|
||||
</Platform>
|
||||
</ThreadConfig>
|
||||
@@ -68,7 +68,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
TEST_SUITE periodic
|
||||
TEST_SERIAL
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/scripting/TestSuite_Active.py
|
||||
TIMEOUT 3000
|
||||
TIMEOUT 1500
|
||||
RUNTIME_DEPENDENCIES
|
||||
Legacy::Editor
|
||||
AZ::AssetProcessor
|
||||
@@ -123,6 +123,21 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
)
|
||||
endif()
|
||||
|
||||
## Prefab ##
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
ly_add_pytest(
|
||||
NAME AutomatedTesting::PrefabTests
|
||||
TEST_SUITE main
|
||||
TEST_SERIAL
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/prefab/TestSuite_Main.py
|
||||
TIMEOUT 1500
|
||||
RUNTIME_DEPENDENCIES
|
||||
Legacy::Editor
|
||||
AZ::AssetProcessor
|
||||
AutomatedTesting.Assets
|
||||
)
|
||||
endif()
|
||||
|
||||
## Editor Python Bindings ##
|
||||
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
|
||||
ly_add_pytest(
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""
|
||||
|
||||
# fmt:off
|
||||
class Tests():
|
||||
find_empty_entity = ("Entity: 'EmptyEntity' found", "Entity: 'EmptyEntity' *not* found in level")
|
||||
empty_entity_pos = ("'EmptyEntity' position is at the expected position", "'EmptyEntity' position is *not* at the expected position")
|
||||
find_pxentity = ("Entity: 'EntityWithPxCollider' found", "Entity: 'EntityWithPxCollider' *not* found in level")
|
||||
pxentity_component = ("Entity: 'EntityWithPxCollider' has a Physx Collider", "Entity: 'EntityWithPxCollider' does *not* have a Physx Collider")
|
||||
|
||||
# fmt:on
|
||||
|
||||
def PrefabLevel_OpensLevelWithEntities():
|
||||
"""
|
||||
Opens the level that contains 2 entities, "EmptyEntity" and "EntityWithPxCollider".
|
||||
This test makes sure that both entities exist after opening the level and that:
|
||||
- EmptyEntity is at Position: (10, 20, 30)
|
||||
- EntityWithPxCollider has a PhysXCollider component
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
|
||||
import azlmbr.entity as entity
|
||||
import azlmbr.bus as bus
|
||||
from azlmbr.math import Vector3
|
||||
|
||||
EXPECTED_EMPTY_ENTITY_POS = Vector3(10.00, 20.0, 30.0)
|
||||
|
||||
helper.init_idle()
|
||||
helper.open_level("prefab", "PrefabLevel_OpensLevelWithEntities")
|
||||
|
||||
def find_entity(entity_name):
|
||||
searchFilter = entity.SearchFilter()
|
||||
searchFilter.names = [entity_name]
|
||||
entityIds = entity.SearchBus(bus.Broadcast, 'SearchEntities', searchFilter)
|
||||
if entityIds[0].IsValid():
|
||||
return entityIds[0]
|
||||
return None
|
||||
#Checks for an entity called "EmptyEntity"
|
||||
helper.wait_for_condition(lambda: find_entity("EmptyEntity").IsValid(), 5.0)
|
||||
empty_entity_id = find_entity("EmptyEntity")
|
||||
Report.result(Tests.find_empty_entity, empty_entity_id.IsValid())
|
||||
|
||||
# Checks if the EmptyEntity is in the correct position and if it fails, it will provide the expected postion and the actual postion of the entity in the Editor log
|
||||
empty_entity_pos = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldTranslation", empty_entity_id)
|
||||
is_at_position = empty_entity_pos.IsClose(EXPECTED_EMPTY_ENTITY_POS)
|
||||
Report.result(Tests.empty_entity_pos, is_at_position)
|
||||
if not is_at_position:
|
||||
Report.info(f'Expected position: {EXPECTED_EMPTY_ENTITY_POS.ToString()}, actual position: {empty_entity_pos.ToString()}')
|
||||
|
||||
#Checks for an entity called "EntityWithPxCollider" and if it has the PhysX Collider component
|
||||
pxentity = find_entity("EntityWithPxCollider")
|
||||
Report.result(Tests.find_pxentity, pxentity.IsValid())
|
||||
|
||||
pxcollider_id = hydra.get_component_type_id("PhysX Collider")
|
||||
hasComponent = azlmbr.editor.EditorComponentAPIBus(azlmbr.bus.Broadcast, 'HasComponentOfType', pxentity, pxcollider_id)
|
||||
Report.result(Tests.pxentity_component, hasComponent)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test (PrefabLevel_OpensLevelWithEntities)
|
||||
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
"""
|
||||
|
||||
# This suite consists of all test cases that are passing and have been verified.
|
||||
|
||||
import pytest
|
||||
import os
|
||||
import sys
|
||||
|
||||
from ly_test_tools import LAUNCHERS
|
||||
|
||||
sys.path.append (os.path.dirname (os.path.abspath (__file__)) + '/../automatedtesting_shared')
|
||||
|
||||
from base import TestAutomationBase
|
||||
|
||||
@pytest.mark.SUITE_main
|
||||
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
|
||||
@pytest.mark.parametrize("project", ["AutomatedTesting"])
|
||||
class TestAutomation(TestAutomationBase):
|
||||
|
||||
def _run_prefab_test(self, request, workspace, editor, test_module):
|
||||
self._run_test(request, workspace, editor, test_module, ["--regset=/Amazon/Preferences/EnablePrefabSystem=true"])
|
||||
|
||||
def test_PrefabLevel_OpensLevelWithEntities(self, request, workspace, editor, launcher_platform):
|
||||
from . import PrefabLevel_OpensLevelWithEntities as test_module
|
||||
self._run_prefab_test(request, workspace, editor, test_module)
|
||||
@@ -0,0 +1,10 @@
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""
|
||||
+4
-9
@@ -7,10 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
|
||||
Test case ID: T92568856
|
||||
Test Case Title: Multiple Entities can be targeted in the Debugger tool
|
||||
"""
|
||||
|
||||
|
||||
@@ -25,20 +21,20 @@ class Tests():
|
||||
GENERAL_WAIT = 0.5 # seconds
|
||||
|
||||
|
||||
def Debugging_TargetMultipleEntities():
|
||||
def Debugger_HappyPath_TargetMultipleEntities():
|
||||
"""
|
||||
Summary:
|
||||
Multiple Entities can be targeted in the Debugger tool
|
||||
|
||||
Expected Behavior:
|
||||
Selected files can be checked for logging.
|
||||
Multiple selected files can be checked for logging.
|
||||
Upon checking, checkboxes of the parent folders change to either full or partial check.
|
||||
|
||||
Test Steps:
|
||||
1) Create temp level
|
||||
2) Create two entities with scriptcanvas components
|
||||
3) Set values for scriptcanvas
|
||||
4) Open Script Canvas window and get sc opbject
|
||||
4) Open Script Canvas window and get sc object
|
||||
5) Open Debugging(Logging) window
|
||||
6) Click on Entities tab in logging window
|
||||
7) Verify if the scriptcanvas exist under entities
|
||||
@@ -53,7 +49,6 @@ def Debugging_TargetMultipleEntities():
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
from PySide2 import QtWidgets
|
||||
from PySide2.QtCore import Qt
|
||||
import azlmbr.legacy.general as general
|
||||
@@ -140,4 +135,4 @@ if __name__ == "__main__":
|
||||
imports.init()
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(Debugging_TargetMultipleEntities)
|
||||
Report.start_test(Debugger_HappyPath_TargetMultipleEntities)
|
||||
+4
-10
@@ -7,29 +7,25 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
|
||||
Test case ID: T92569137
|
||||
Test Case Title: Multiple Graphs can be targeted in the Debugger tool
|
||||
"""
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
select_multiple_targets = ("Multiple targets are selected", "Multiple targets are not selected")
|
||||
select_multiple_targets = ("Multiple targets are selected", "Multiple targets are not selected")
|
||||
# fmt: on
|
||||
|
||||
|
||||
GENERAL_WAIT = 0.5 # seconds
|
||||
|
||||
|
||||
def Debugging_TargetMultipleGraphs():
|
||||
def Debugger_HappyPath_TargetMultipleGraphs():
|
||||
"""
|
||||
Summary:
|
||||
Multiple Graphs can be targeted in the Debugger tool
|
||||
|
||||
Expected Behavior:
|
||||
Selected files can be checked for logging.
|
||||
Multiple elected files can be checked for logging.
|
||||
Upon checking, checkboxes of the parent folders change to either full or partial check.
|
||||
|
||||
Test Steps:
|
||||
@@ -49,7 +45,6 @@ def Debugging_TargetMultipleGraphs():
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
from PySide2 import QtWidgets
|
||||
from PySide2.QtCore import Qt
|
||||
import azlmbr.legacy.general as general
|
||||
@@ -106,7 +101,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(Debugging_TargetMultipleGraphs)
|
||||
Report.start_test(Debugger_HappyPath_TargetMultipleGraphs)
|
||||
+7
-15
@@ -7,12 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
|
||||
Test case ID: T92569049
|
||||
Test Case Title: Edit > Undo undoes the last action
|
||||
Test case ID: T92569051
|
||||
Test Case Title: Edit > Redo redoes the last undone action
|
||||
"""
|
||||
|
||||
|
||||
@@ -24,7 +18,7 @@ class Tests():
|
||||
# fmt: on
|
||||
|
||||
|
||||
def EditMenu_UndoRedo():
|
||||
def EditMenu_Default_UndoRedo():
|
||||
"""
|
||||
Summary:
|
||||
Edit > Undo undoes the last action
|
||||
@@ -33,8 +27,8 @@ def EditMenu_UndoRedo():
|
||||
redo it and verify if the variable is created again.
|
||||
|
||||
Expected Behavior:
|
||||
The last action is undone.
|
||||
The last undone action is redone.
|
||||
The last action is undone upon selecting Undo.
|
||||
The last undone action is redone upon selecting Redo.
|
||||
|
||||
Test Steps:
|
||||
1) Open Script Canvas window (Tools > Script Canvas)
|
||||
@@ -44,7 +38,7 @@ def EditMenu_UndoRedo():
|
||||
5) Create new variable
|
||||
6) Verify if the variable is created initially
|
||||
7) Trigger Undo action and verify if variable is removed in Variable Manager
|
||||
8) Trigger Redo action and verify if variable is readded in Variable Manager
|
||||
8) Trigger Redo action and verify if variable is re-added in Variable Manager
|
||||
9) Close SC window
|
||||
|
||||
Note:
|
||||
@@ -54,13 +48,12 @@ def EditMenu_UndoRedo():
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
from PySide2 import QtWidgets, QtCore
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
import pyside_utils
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
# 1) Open Script Canvas window
|
||||
general.idle_enable(True)
|
||||
general.open_pane("Script Canvas")
|
||||
@@ -115,7 +108,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(EditMenu_UndoRedo)
|
||||
Report.start_test(EditMenu_Default_UndoRedo)
|
||||
+4
-8
@@ -7,9 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92562978
|
||||
Test Case Title: Script Canvas Component can be added to an entity
|
||||
"""
|
||||
|
||||
|
||||
@@ -23,13 +20,13 @@ class Tests():
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Entity_AddScriptCanvasComponent():
|
||||
def Entity_HappyPath_AddScriptCanvasComponent():
|
||||
"""
|
||||
Summary:
|
||||
verify if Script Canvas component can be added to Entity without any issue
|
||||
Script Canvas Component can be added to an entity
|
||||
|
||||
Expected Behavior:
|
||||
Script Canvas Component is added to the entity successfully without issue.
|
||||
Script Canvas Component is added to the entity successfully without issue
|
||||
|
||||
Test Steps:
|
||||
1) Create temp level
|
||||
@@ -46,7 +43,6 @@ def Entity_AddScriptCanvasComponent():
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
from utils import TestHelper as helper
|
||||
from utils import Tracer
|
||||
from editor_entity_utils import EditorEntity
|
||||
@@ -84,4 +80,4 @@ if __name__ == "__main__":
|
||||
imports.init()
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(Entity_AddScriptCanvasComponent)
|
||||
Report.start_test(Entity_HappyPath_AddScriptCanvasComponent)
|
||||
+7
-13
@@ -7,22 +7,15 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
|
||||
Test case ID: T92569037
|
||||
Test Case Title: File > New Script creates a new script
|
||||
Test case ID: T92569039
|
||||
Test Case Title: File > Open opens the Open... dialog
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from PySide2 import QtWidgets
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
import editor_python_test_tools.pyside_utils as pyside_utils
|
||||
from editor_python_test_tools.utils import Report
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
new_action = "File->New action working as expected"
|
||||
@@ -33,10 +26,11 @@ class Tests():
|
||||
GENERAL_WAIT = 0.5 # seconds
|
||||
|
||||
|
||||
class TestFileMenuNewOpen:
|
||||
class TestFileMenuDefaultNewOpen:
|
||||
"""
|
||||
Summary:
|
||||
When clicked on File->New, new script opens and File->Open should open the FileBrowser
|
||||
When clicked on File->New, new script opens
|
||||
File->Open should open the FileBrowser
|
||||
|
||||
Expected Behavior:
|
||||
New and Open actions should work as expected.
|
||||
@@ -92,5 +86,5 @@ class TestFileMenuNewOpen:
|
||||
general.close_pane("Script Canvas")
|
||||
|
||||
|
||||
test = TestFileMenuNewOpen()
|
||||
test = TestFileMenuDefaultNewOpen()
|
||||
test.run_test()
|
||||
+7
-13
@@ -7,24 +7,17 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
|
||||
Test case ID: T92563070
|
||||
Test Case Title: Graphs can be closed by clicking X on the Graph name tab
|
||||
Test case ID: T92563068
|
||||
Test Case Title: Save Prompt: User is prompted to save a graph on close after
|
||||
creating a new graph
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from PySide2 import QtWidgets
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
import editor_python_test_tools.pyside_utils as pyside_utils
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
from editor_python_test_tools.utils import Report
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
new_graph = "New graph created"
|
||||
@@ -36,14 +29,15 @@ class Tests():
|
||||
GENERAL_WAIT = 0.5 # seconds
|
||||
|
||||
|
||||
class TestGraphCloseSavePrompt:
|
||||
class TestGraphClose_Default_SavePrompt:
|
||||
"""
|
||||
Summary:
|
||||
The graph is closed when x button is clicked.
|
||||
Save Prompt is opened before closing.
|
||||
|
||||
Expected Behavior:
|
||||
New and Open actions should work as expected.
|
||||
The Graph is closed.
|
||||
Upon closing the graph, User is prompted whether or not to save changes.
|
||||
|
||||
Test Steps:
|
||||
1) Open Script Canvas window (Tools > Script Canvas)
|
||||
@@ -104,5 +98,5 @@ class TestGraphCloseSavePrompt:
|
||||
general.close_pane("Script Canvas")
|
||||
|
||||
|
||||
test = TestGraphCloseSavePrompt()
|
||||
test = TestGraphClose_Default_SavePrompt()
|
||||
test.run_test()
|
||||
+4
-11
@@ -7,12 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
|
||||
Test case ID: T92569079
|
||||
Test Case Title: View > Zoom In zooms the graph in
|
||||
Test case ID: T92569081
|
||||
Test Case Title: View > Zoom In zooms the graph out
|
||||
"""
|
||||
|
||||
|
||||
@@ -26,7 +20,7 @@ class Tests():
|
||||
GENERAL_WAIT = 0.5 # seconds
|
||||
|
||||
|
||||
def Graph_ZoomInZoomOut():
|
||||
def Graph_HappyPath_ZoomInZoomOut():
|
||||
"""
|
||||
Summary:
|
||||
The graph can be zoomed in and zoomed out.
|
||||
@@ -91,7 +85,7 @@ def Graph_ZoomInZoomOut():
|
||||
zin = pyside_utils.find_child_by_pattern(sc_main, {"objectName": "action_ZoomIn", "type": QtWidgets.QAction})
|
||||
zin.trigger()
|
||||
result = helper.wait_for_condition(
|
||||
lambda: curr_m11 < graphics_view.transform().m11() and curr_m22 < graphics_view.transform().m22(), GENERAL_WAIT,
|
||||
lambda: curr_m11 < graphics_view.transform().m11() and curr_m22 < graphics_view.transform().m22(), GENERAL_WAIT
|
||||
)
|
||||
Report.result(Tests.zoom_in, result)
|
||||
|
||||
@@ -100,7 +94,7 @@ def Graph_ZoomInZoomOut():
|
||||
zout = pyside_utils.find_child_by_pattern(sc_main, {"objectName": "action_ZoomOut", "type": QtWidgets.QAction})
|
||||
zout.trigger()
|
||||
result = helper.wait_for_condition(
|
||||
lambda: curr_m11 > graphics_view.transform().m11() and curr_m22 > graphics_view.transform().m22(), GENERAL_WAIT,
|
||||
lambda: curr_m11 > graphics_view.transform().m11() and curr_m22 > graphics_view.transform().m22(), GENERAL_WAIT
|
||||
)
|
||||
Report.result(Tests.zoom_out, result)
|
||||
|
||||
@@ -112,7 +106,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(Graph_ZoomInZoomOut)
|
||||
Report.start_test(Graph_HappyPath_ZoomInZoomOut)
|
||||
@@ -13,5 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
def init():
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../EditorPythonTestTools/editor_python_test_tools')
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../automatedtesting_shared")
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../EditorPythonTestTools/editor_python_test_tools")
|
||||
|
||||
+2
-8
@@ -7,11 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
|
||||
Test case ID: T92568942
|
||||
Test Case Title: Clicking the "+" button and selecting "New Script Event" opens the
|
||||
Asset Editor with a new Script Event asset
|
||||
"""
|
||||
|
||||
from PySide2 import QtWidgets
|
||||
@@ -35,11 +30,10 @@ GENERAL_WAIT = 0.5 # seconds
|
||||
class TestAssetEditor_NewScriptEvent:
|
||||
"""
|
||||
Summary:
|
||||
Clicking the "+" button in Node Palette and creating New Script Event opens Asset Editor
|
||||
Verifying logic flow of the "+" button on the Script Canvas pane's Node Palette is as expected
|
||||
|
||||
Expected Behavior:
|
||||
Clicking the "+" button and selecting "New Script Event" opens the Asset Editor with a
|
||||
new Script Event asset
|
||||
Clicking the "+" button and selecting "New Script Event" opens the Asset Editor with a new Script Event asset
|
||||
|
||||
Test Steps:
|
||||
1) Open Script Canvas window (Tools > Script Canvas)
|
||||
@@ -7,9 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92562988
|
||||
Test Case Title: Left-click/double click expands and collapses node categories
|
||||
"""
|
||||
|
||||
|
||||
@@ -123,6 +120,8 @@ def NodeCategory_ExpandOnClick():
|
||||
|
||||
if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(NodeCategory_ExpandOnClick)
|
||||
|
||||
+6
-11
@@ -7,9 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92568982
|
||||
Test Case Title: Renaming variables in the Node Inspector
|
||||
"""
|
||||
|
||||
|
||||
@@ -24,7 +21,7 @@ class Tests():
|
||||
GENERAL_WAIT = 0.5 # seconds
|
||||
|
||||
|
||||
def NodeInspector_RenameVariable():
|
||||
def NodeInspector_HappyPath_VariableRenames():
|
||||
"""
|
||||
Summary:
|
||||
Renaming variables in the Node Inspector, renames the actual variable.
|
||||
@@ -50,16 +47,16 @@ def NodeInspector_RenameVariable():
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
TEST_NAME = "test name"
|
||||
|
||||
from PySide2 import QtWidgets, QtCore, QtTest
|
||||
from PySide2.QtCore import Qt
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
import pyside_utils
|
||||
from utils import TestHelper as helper
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
TEST_NAME = "test name"
|
||||
|
||||
def open_tool(sc, dock_widget_name, pane_name):
|
||||
if sc.findChild(QtWidgets.QDockWidget, dock_widget_name) is None:
|
||||
action = pyside_utils.find_child_by_pattern(sc, {"text": pane_name, "type": QtWidgets.QAction})
|
||||
@@ -120,12 +117,10 @@ def NodeInspector_RenameVariable():
|
||||
general.close_pane("Script Canvas")
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(NodeInspector_RenameVariable)
|
||||
Report.start_test(NodeInspector_HappyPath_VariableRenames)
|
||||
+8
-11
@@ -7,30 +7,27 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
|
||||
Test case ID: T92568940
|
||||
Test Case Title: Categories and Nodes can be selected
|
||||
"""
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
category_selected = ("Category can be selected", "Category cannot be selected")
|
||||
node_selected = ("Node can be selected", "Node cannot be selected")
|
||||
category_selected = ("Category can be selected", "Category cannot be selected")
|
||||
node_selected = ("Node can be selected", "Node cannot be selected")
|
||||
# fmt: on
|
||||
|
||||
|
||||
GENERAL_WAIT = 0.5 # seconds
|
||||
|
||||
|
||||
def NodePalette_SelectNode():
|
||||
def NodePalette_HappyPath_CanSelectNode():
|
||||
"""
|
||||
Summary:
|
||||
Categories and Nodes can be selected
|
||||
|
||||
Expected Behavior:
|
||||
When clicked on Node Palette, nodes and categories can be selected.
|
||||
A category can be selected inside the Node Palette
|
||||
A Node can be selected inside the Node Palette
|
||||
|
||||
Test Steps:
|
||||
1) Open Script Canvas window (Tools > Script Canvas)
|
||||
@@ -53,11 +50,12 @@ def NodePalette_SelectNode():
|
||||
NODE = "Find Path To Entity"
|
||||
|
||||
from PySide2 import QtWidgets
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
import pyside_utils
|
||||
from utils import TestHelper as helper
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
# 1) Open Script Canvas window (Tools > Script Canvas)
|
||||
general.idle_enable(True)
|
||||
general.open_pane("Script Canvas")
|
||||
@@ -97,7 +95,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(NodePalette_SelectNode)
|
||||
Report.start_test(NodePalette_HappyPath_CanSelectNode)
|
||||
+6
-11
@@ -7,9 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92562993
|
||||
Test Case Title: Clicking the X button on the Search Box clears the currently entered string
|
||||
"""
|
||||
|
||||
|
||||
@@ -20,14 +17,14 @@ class Tests():
|
||||
# fmt: on
|
||||
|
||||
|
||||
def NodePalette_ClearSelection():
|
||||
def NodePalette_HappyPath_ClearSelection():
|
||||
"""
|
||||
Summary:
|
||||
We enter some string in the Node Palette Search box, and click on the X button to verify if the
|
||||
search string got cleared.
|
||||
Clicking the X button on the Search Box clears the currently entered string
|
||||
|
||||
Expected Behavior:
|
||||
Clicking the X button on the Search Box clears the currently entered string
|
||||
After entering a string value into the Node Palette's search box and click on
|
||||
the X button, the search box should be cleared
|
||||
|
||||
Test Steps:
|
||||
1) Open Script Canvas window (Tools > Script Canvas)
|
||||
@@ -44,15 +41,13 @@ def NodePalette_ClearSelection():
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
from PySide2 import QtWidgets
|
||||
|
||||
import pyside_utils
|
||||
from utils import TestHelper as helper
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
import pyside_utils
|
||||
|
||||
TEST_STRING = "Test String"
|
||||
|
||||
# 1) Open Script Canvas window (Tools > Script Canvas)
|
||||
@@ -90,4 +85,4 @@ if __name__ == "__main__":
|
||||
imports.init()
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(NodePalette_ClearSelection)
|
||||
Report.start_test(NodePalette_HappyPath_ClearSelection)
|
||||
@@ -0,0 +1,117 @@
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
node_duplicated = ("Successfully duplicated node", "Failed to duplicate the node")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Node_HappyPath_DuplicateNode():
|
||||
"""
|
||||
Summary:
|
||||
Duplicating node in graph
|
||||
|
||||
Expected Behavior:
|
||||
Upon selecting a node and pressing Ctrl+D, the node will be duplicated
|
||||
|
||||
Test Steps:
|
||||
1) Open Script Canvas window (Tools > Script Canvas)
|
||||
2) Open a new graph
|
||||
3) Add node to graph
|
||||
4) Duplicate node
|
||||
5) Verify the node was duplicated6) Verify the node was duplicated
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine Editor command terminal
|
||||
- Any passed and failed tests are written to the Editor.log file.
|
||||
Parsing the file or running a log_monitor are required to observe the test results.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
from PySide2 import QtWidgets, QtTest
|
||||
from PySide2.QtCore import Qt
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
import editor_python_test_tools.pyside_utils as pyside_utils
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
WAIT_FRAMES = 200
|
||||
|
||||
NODE_NAME = "Print"
|
||||
NODE_CATEGORY = "Debug"
|
||||
EXPECTED_STRING = f"{NODE_NAME} - {NODE_CATEGORY} (2 Selected)"
|
||||
|
||||
def command_line_input(command_str):
|
||||
cmd_action = pyside_utils.find_child_by_pattern(
|
||||
sc_main, {"objectName": "action_ViewCommandLine", "type": QtWidgets.QAction}
|
||||
)
|
||||
cmd_action.trigger()
|
||||
textbox = sc.findChild(QtWidgets.QLineEdit, "commandText")
|
||||
QtTest.QTest.keyClicks(textbox, command_str)
|
||||
QtTest.QTest.keyClick(textbox, Qt.Key_Enter, Qt.NoModifier)
|
||||
|
||||
def grab_title_text():
|
||||
scroll_area = node_inspector.findChild(QtWidgets.QScrollArea, "")
|
||||
QtTest.QTest.keyClick(graph, "a", Qt.ControlModifier, WAIT_FRAMES)
|
||||
background = scroll_area.findChild(QtWidgets.QFrame, "Background")
|
||||
title = background.findChild(QtWidgets.QLabel, "Title")
|
||||
text = title.findChild(QtWidgets.QLabel, "Title")
|
||||
return text.text()
|
||||
|
||||
# 1) Open Script Canvas window (Tools > Script Canvas)
|
||||
general.idle_enable(True)
|
||||
general.open_pane("Script Canvas")
|
||||
helper.wait_for_condition(lambda: general.is_pane_visible("Script Canvas"), 5.0)
|
||||
|
||||
# 2) Open a new graph
|
||||
editor_window = pyside_utils.get_editor_main_window()
|
||||
sc = editor_window.findChild(QtWidgets.QDockWidget, "Script Canvas")
|
||||
sc_main = sc.findChild(QtWidgets.QMainWindow)
|
||||
create_new_graph = pyside_utils.find_child_by_pattern(
|
||||
sc_main, {"objectName": "action_New_Script", "type": QtWidgets.QAction}
|
||||
)
|
||||
if sc.findChild(QtWidgets.QDockWidget, "NodeInspector") is None:
|
||||
action = pyside_utils.find_child_by_pattern(sc, {"text": "Node Inspector", "type": QtWidgets.QAction})
|
||||
action.trigger()
|
||||
node_inspector = sc.findChild(QtWidgets.QDockWidget, "NodeInspector")
|
||||
create_new_graph.trigger()
|
||||
|
||||
# 3) Add node
|
||||
command_line_input("add_node Print")
|
||||
|
||||
# 4) Duplicate node
|
||||
graph_view = sc.findChild(QtWidgets.QFrame, "graphicsViewFrame")
|
||||
graph = graph_view.findChild(QtWidgets.QWidget, "")
|
||||
# There are currently no utilities available to directly duplicate the node,
|
||||
# therefore the node is selected using CTRL+A on the graph to select
|
||||
# it and then CTRL+D to duplicate
|
||||
sc_main.activateWindow()
|
||||
QtTest.QTest.keyClick(graph, "a", Qt.ControlModifier, WAIT_FRAMES)
|
||||
QtTest.QTest.keyClick(graph, "d", Qt.ControlModifier, WAIT_FRAMES)
|
||||
|
||||
# 5) Verify the node was duplicated
|
||||
# As direct interaction with node is not available the text on the label
|
||||
# inside the Node Inspector is validated showing two nodes exist
|
||||
after_dup = grab_title_text()
|
||||
Report.result(Tests.node_duplicated, after_dup == EXPECTED_STRING)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
from editor_python_test_tools.utils import Report
|
||||
|
||||
Report.start_test(Node_HappyPath_DuplicateNode)
|
||||
+18
-23
@@ -7,33 +7,30 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: C1702821 // C1702832
|
||||
Test Case Title: Retain visibility, size and location upon Script Canvas restart
|
||||
"""
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
relaunch_sc = ("Script Canvas window is relaunched", "Failed to relaunch Script Canvas window")
|
||||
test_panes_visible = ("All the test panes are opened", "Failed to open one or more test panes")
|
||||
close_pane_1 = ("Test pane 1 is closed", "Failed to close test pane 1")
|
||||
visiblity_retained = ("Test pane retained its visiblity on SC restart", "Failed to retain visiblity of test pane on SC restart")
|
||||
resize_pane_3 = ("Test pane 3 resized successfully", "Failed to resize Test pane 3")
|
||||
size_retained = ("Test pane retained its size on SC restart", "Failed to retain size of test pane on SC restart")
|
||||
location_changed = ("Location of test pane 2 changed successfully", "Failed to change locatio of test pane 2")
|
||||
location_retained = ("Test pane retained its location on SC restart", "Failed to retain location of test pane on SC restart")
|
||||
relaunch_sc = ("Script Canvas window is relaunched", "Failed to relaunch Script Canvas window")
|
||||
test_panes_visible = ("All the test panes are opened", "Failed to open one or more test panes")
|
||||
close_pane_1 = ("Test pane 1 is closed", "Failed to close test pane 1")
|
||||
visibility_retained = ("Test pane retained its visibility on SC restart", "Failed to retain visibility of test pane on SC restart")
|
||||
resize_pane_3 = ("Test pane 3 resized successfully", "Failed to resize Test pane 3")
|
||||
size_retained = ("Test pane retained its size on SC restart", "Failed to retain size of test pane on SC restart")
|
||||
location_changed = ("Location of test pane 2 changed successfully", "Failed to change location of test pane 2")
|
||||
location_retained = ("Test pane retained its location on SC restart", "Failed to retain location of test pane on SC restart")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Pane_RetainOnSCRestart():
|
||||
def Pane_Default_RetainOnSCRestart():
|
||||
"""
|
||||
Summary:
|
||||
The Script Canvas window is opened to verify if Script canvas panes can retain its visibility, size and location
|
||||
upon ScriptCanvas restart.
|
||||
|
||||
Expected Behavior:
|
||||
The ScriptCanvas pane retain it's visiblity, size and location upon ScriptCanvas restart.
|
||||
The ScriptCanvas pane retain it's visibility, size and location upon ScriptCanvas restart.
|
||||
|
||||
Test Steps:
|
||||
1) Open Script Canvas window (Tools > Script Canvas)
|
||||
@@ -42,7 +39,7 @@ def Pane_RetainOnSCRestart():
|
||||
4) Change dock location of test pane 2
|
||||
5) Resize test pane 3
|
||||
6) Relaunch Script Canvas
|
||||
7) Verify if test pane 1 retain its visiblity
|
||||
7) Verify if test pane 1 retain its visibility
|
||||
8) Verify if location of test pane 2 is retained
|
||||
9) Verify if size of test pane 3 is retained
|
||||
10) Restore default layout and close SC window
|
||||
@@ -55,6 +52,10 @@ def Pane_RetainOnSCRestart():
|
||||
:return: None
|
||||
"""
|
||||
|
||||
# Pyside imports
|
||||
from PySide2 import QtCore, QtWidgets
|
||||
from PySide2.QtCore import Qt
|
||||
|
||||
# Helper imports
|
||||
from utils import Report
|
||||
from utils import TestHelper as helper
|
||||
@@ -63,11 +64,6 @@ def Pane_RetainOnSCRestart():
|
||||
# Open 3D Engine Imports
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
# Pyside imports
|
||||
from PySide2 import QtCore, QtWidgets
|
||||
from PySide2.QtCore import Qt
|
||||
|
||||
# Constants
|
||||
TEST_PANE_1 = "NodePalette" # test visibility
|
||||
TEST_PANE_2 = "VariableManager" # test location
|
||||
TEST_PANE_3 = "NodeInspector" # test size
|
||||
@@ -128,10 +124,10 @@ def Pane_RetainOnSCRestart():
|
||||
sc_visible = helper.wait_for_condition(lambda: general.is_pane_visible("Script Canvas"), 5.0)
|
||||
Report.result(Tests.relaunch_sc, sc_visible)
|
||||
|
||||
# 7) Verify if test pane 1 retain its visiblity
|
||||
# 7) Verify if test pane 1 retain its visibility
|
||||
editor_window = pyside_utils.get_editor_main_window()
|
||||
sc = editor_window.findChild(QtWidgets.QDockWidget, "Script Canvas")
|
||||
Report.result(Tests.visiblity_retained, not find_pane(sc, TEST_PANE_1).isVisible())
|
||||
Report.result(Tests.visibility_retained, not find_pane(sc, TEST_PANE_1).isVisible())
|
||||
|
||||
# 8) Verify if location of test pane 2 is retained
|
||||
sc_main = sc.findChild(QtWidgets.QMainWindow)
|
||||
@@ -156,7 +152,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(Pane_RetainOnSCRestart)
|
||||
Report.start_test(Pane_Default_RetainOnSCRestart)
|
||||
Executable → Regular
+6
-16
@@ -7,24 +7,21 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: C1702824
|
||||
Test Case Title: Docking
|
||||
"""
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
pane_opened = ("Pane is opened successfully", "Failed to open pane")
|
||||
dock_pane = ("Pane is docked successfully", "Failed to dock Pane into one or more allowed area")
|
||||
pane_opened = ("Pane is opened successfully", "Failed to open pane")
|
||||
dock_pane = ("Pane is docked successfully", "Failed to dock Pane into one or more allowed area")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Docking_Pane():
|
||||
def Pane_HappyPath_DocksProperly():
|
||||
"""
|
||||
Summary:
|
||||
The Script Canvas window is opened to verify if Script canvas panes can be docked into
|
||||
every possible area of Script Canvas main window.
|
||||
The Script Canvas window is opened to verify if Script canvas panes can be docked into every
|
||||
possible area of Script Canvas main window. (top, bottom, right and left sides of the window)
|
||||
|
||||
Expected Behavior:
|
||||
The pane docks successfully.
|
||||
@@ -43,12 +40,6 @@ def Docking_Pane():
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
# Helper imports
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
import editor_python_test_tools.pyside_utils as pyside_utils
|
||||
@@ -110,7 +101,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
|
||||
Report.start_test(Docking_Pane)
|
||||
Report.start_test(Pane_HappyPath_DocksProperly)
|
||||
Executable → Regular
+4
-8
@@ -7,9 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: C1702834 // C1702823
|
||||
Test Case Title: Opening pane // Closing pane
|
||||
"""
|
||||
|
||||
|
||||
@@ -21,13 +18,13 @@ class Tests():
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Opening_Closing_Pane():
|
||||
def Pane_HappyPath_OpenCloseSuccessfully():
|
||||
"""
|
||||
Summary:
|
||||
The Script Canvas window is opened to verify if Script canvas panes can be opened and closed.
|
||||
The Script Canvas window is opened to verify if Script Canvas panes can be opened and closed.
|
||||
|
||||
Expected Behavior:
|
||||
The pane opens and closes successfully.
|
||||
The panes open and close successfully.
|
||||
|
||||
Test Steps:
|
||||
1) Open Script Canvas window (Tools > Script Canvas)
|
||||
@@ -113,7 +110,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
|
||||
Report.start_test(Opening_Closing_Pane)
|
||||
Report.start_test(Pane_HappyPath_OpenCloseSuccessfully)
|
||||
Executable → Regular
+7
-11
@@ -7,9 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: C1702829
|
||||
Test Case Title: Resizing pane
|
||||
"""
|
||||
|
||||
|
||||
@@ -20,10 +17,10 @@ class Tests():
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Resizing_Pane():
|
||||
def Pane_HappyPath_ResizesProperly():
|
||||
"""
|
||||
Summary:
|
||||
The Script Canvas window is opened to verify if Script canvas panes can be resized and scaled
|
||||
The Script Canvas window is opened to verify if Script Canvas panes can be resized and scaled
|
||||
|
||||
Expected Behavior:
|
||||
The pane is resized and scaled appropriately.
|
||||
@@ -32,7 +29,7 @@ def Resizing_Pane():
|
||||
1) Open Script Canvas window (Tools > Script Canvas)
|
||||
2) Restore default layout
|
||||
3) Make sure pane is opened
|
||||
4) Resize pane
|
||||
4) Resize pane and verify change
|
||||
5) Restore default layout
|
||||
6) Close Script Canvas window
|
||||
|
||||
@@ -44,6 +41,8 @@ def Resizing_Pane():
|
||||
:return: None
|
||||
"""
|
||||
|
||||
from PySide2 import QtWidgets
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
import editor_python_test_tools.pyside_utils as pyside_utils
|
||||
@@ -51,9 +50,6 @@ def Resizing_Pane():
|
||||
# Open 3D Engine imports
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
# Pyside imports
|
||||
from PySide2 import QtWidgets
|
||||
|
||||
PANE_WIDGET = "NodePalette"
|
||||
SCALE_INT = 10
|
||||
|
||||
@@ -86,7 +82,7 @@ def Resizing_Pane():
|
||||
|
||||
Report.result(Tests.open_pane, pane.isVisible())
|
||||
|
||||
# 4) Resize pane
|
||||
# 4) Resize pane and verify change
|
||||
initial_size = pane.frameSize()
|
||||
pane.resize(initial_size.width() + SCALE_INT, initial_size.height() + SCALE_INT)
|
||||
new_size = pane.frameSize()
|
||||
@@ -109,4 +105,4 @@ if __name__ == "__main__":
|
||||
imports.init()
|
||||
from editor_python_test_tools.utils import Report
|
||||
|
||||
Report.start_test(Resizing_Pane)
|
||||
Report.start_test(Pane_HappyPath_ResizesProperly)
|
||||
+4
-9
@@ -7,9 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: C1702825 // C1702831
|
||||
Test Case Title: Undocking // Closing script canvas with the pane floating
|
||||
"""
|
||||
|
||||
|
||||
@@ -21,7 +18,7 @@ class Tests():
|
||||
# fmt: on
|
||||
|
||||
|
||||
def UnDockedPane_CloseSCWindow():
|
||||
def Pane_Undocked_ClosesSuccessfully():
|
||||
"""
|
||||
Summary:
|
||||
The Script Canvas window is opened with one of the pane undocked.
|
||||
@@ -45,6 +42,8 @@ def UnDockedPane_CloseSCWindow():
|
||||
:return: None
|
||||
"""
|
||||
|
||||
from PySide2 import QtWidgets
|
||||
|
||||
# Helper imports
|
||||
from utils import Report
|
||||
from utils import TestHelper as helper
|
||||
@@ -53,9 +52,6 @@ def UnDockedPane_CloseSCWindow():
|
||||
# Open 3D Engine imports
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
# Pyside imports
|
||||
from PySide2 import QtWidgets
|
||||
|
||||
TEST_PANE = "NodePalette" # Chosen most commonly used pane
|
||||
|
||||
def click_menu_option(window, option_text):
|
||||
@@ -120,7 +116,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(UnDockedPane_CloseSCWindow)
|
||||
Report.start_test(Pane_Undocked_ClosesSuccessfully)
|
||||
+35
-26
@@ -7,29 +7,26 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92569253 // T92569254
|
||||
Test Case Title: On Entity Activated // On Entity Deactivated
|
||||
"""
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
level_created = ("Successfully created temp level", "Failed to create temp level")
|
||||
controller_exists = ("Successfully found controller entity", "Failed to find controller entity")
|
||||
activated_exists = ("Successfully found activated entity", "Failed to find activated entity")
|
||||
deactivated_exists = ("Successfully found deactivated entity","Failed to find deactivated entity")
|
||||
start_states_correct = ("Start states set up successfully", "Start states set up incorrectly")
|
||||
game_mode_entered = ("Successfully entered game mode" "Failed to enter game mode")
|
||||
lines_found = ("Successfully found expected prints", "Failed to find expected prints")
|
||||
game_mode_exited = ("Successfully exited game mode" "Failed to exit game mode")
|
||||
level_created = ("Successfully created temp level", "Failed to create temp level")
|
||||
controller_exists = ("Successfully found controller entity", "Failed to find controller entity")
|
||||
activated_exists = ("Successfully found activated entity", "Failed to find activated entity")
|
||||
deactivated_exists = ("Successfully found deactivated entity", "Failed to find deactivated entity")
|
||||
start_states_correct = ("Start states set up successfully", "Start states set up incorrectly")
|
||||
game_mode_entered = ("Successfully entered game mode" "Failed to enter game mode")
|
||||
lines_found = ("Successfully found expected prints", "Failed to find expected prints")
|
||||
game_mode_exited = ("Successfully exited game mode" "Failed to exit game mode")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def OnEntityActivatedDeactivated_PrintMessage():
|
||||
def ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage():
|
||||
"""
|
||||
Summary:
|
||||
Verify that the On Entity Activation node is working as expected
|
||||
Verify that the On Entity Activated/On Entity Deactivated nodes are working as expected
|
||||
|
||||
Expected Behavior:
|
||||
Upon entering game mode, the Controller entity will wait 1 second and then activate the ActivationTest
|
||||
@@ -54,9 +51,9 @@ def OnEntityActivatedDeactivated_PrintMessage():
|
||||
"""
|
||||
import os
|
||||
|
||||
from utils import TestHelper as helper
|
||||
from editor_entity_utils import EditorEntity as Entity
|
||||
from utils import Report
|
||||
from utils import TestHelper as helper
|
||||
from utils import Tracer
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
@@ -68,33 +65,45 @@ def OnEntityActivatedDeactivated_PrintMessage():
|
||||
controller_dict = {
|
||||
"name": "Controller",
|
||||
"status": "active",
|
||||
"path": os.path.join("ScriptCanvas", "OnEntityActivatedScripts", "controller.scriptcanvas")
|
||||
"path": os.path.join("ScriptCanvas", "OnEntityActivatedScripts", "controller.scriptcanvas"),
|
||||
}
|
||||
activated_dict = {
|
||||
"name": "ActivationTest",
|
||||
"status": "inactive",
|
||||
"path": os.path.join("ScriptCanvas", "OnEntityActivatedScripts", "activator.scriptcanvas")
|
||||
"path": os.path.join("ScriptCanvas", "OnEntityActivatedScripts", "activator.scriptcanvas"),
|
||||
}
|
||||
deactivated_dict = {
|
||||
"name": "DeactivationTest",
|
||||
"status": "active",
|
||||
"path": os.path.join("ScriptCanvas", "OnEntityActivatedScripts", "deactivator.scriptcanvas")
|
||||
"path": os.path.join("ScriptCanvas", "OnEntityActivatedScripts", "deactivator.scriptcanvas"),
|
||||
}
|
||||
|
||||
def get_asset(asset_path):
|
||||
return azlmbr.asset.AssetCatalogRequestBus(azlmbr.bus.Broadcast, "GetAssetIdByPath", asset_path, azlmbr.math.Uuid(), False)
|
||||
return azlmbr.asset.AssetCatalogRequestBus(
|
||||
azlmbr.bus.Broadcast, "GetAssetIdByPath", asset_path, azlmbr.math.Uuid(), False
|
||||
)
|
||||
|
||||
def setup_level():
|
||||
def create_editor_entity(entity_dict:dict, entity_to_activate:EditorEntity=None, entity_to_deactivate:EditorEntity=None) -> EditorEntity:
|
||||
def create_editor_entity(
|
||||
entity_dict: dict, entity_to_activate: EditorEntity = None, entity_to_deactivate: EditorEntity = None
|
||||
) -> EditorEntity:
|
||||
entity = Entity.create_editor_entity(entity_dict["name"])
|
||||
entity.set_start_status(entity_dict["status"])
|
||||
sc_component = entity.add_component("Script Canvas")
|
||||
sc_component.set_component_property_value("Script Canvas Asset|Script Canvas Asset", get_asset(entity_dict["path"]))
|
||||
sc_component.set_component_property_value(
|
||||
"Script Canvas Asset|Script Canvas Asset", get_asset(entity_dict["path"])
|
||||
)
|
||||
|
||||
if entity_dict["name"] == "Controller":
|
||||
sc_component.get_property_tree()
|
||||
sc_component.set_component_property_value("Properties|Variable Fields|Variables|[0]|Name,Value|Datum|Datum|EntityToActivate", entity_to_activate.id)
|
||||
sc_component.set_component_property_value("Properties|Variable Fields|Variables|[1]|Name,Value|Datum|Datum|EntityToDeactivate", entity_to_deactivate.id)
|
||||
sc_component.set_component_property_value(
|
||||
"Properties|Variable Fields|Variables|[0]|Name,Value|Datum|Datum|EntityToActivate",
|
||||
entity_to_activate.id,
|
||||
)
|
||||
sc_component.set_component_property_value(
|
||||
"Properties|Variable Fields|Variables|[1]|Name,Value|Datum|Datum|EntityToDeactivate",
|
||||
entity_to_deactivate.id,
|
||||
)
|
||||
return entity
|
||||
|
||||
activated = create_editor_entity(activated_dict)
|
||||
@@ -110,7 +119,7 @@ def OnEntityActivatedDeactivated_PrintMessage():
|
||||
Report.critical_result(test_tuple, entity.id.IsValid())
|
||||
return entity
|
||||
|
||||
def validate_start_state(entity:EditorEntity, expected_state:str):
|
||||
def validate_start_state(entity: EditorEntity, expected_state: str):
|
||||
"""
|
||||
Validate that the starting state of the entity is correct, if it isn't then attempt to rectify and recheck.
|
||||
:return: bool: Whether state is set as expected
|
||||
@@ -176,8 +185,8 @@ def OnEntityActivatedDeactivated_PrintMessage():
|
||||
|
||||
if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
imports.init()
|
||||
|
||||
imports.init()
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(OnEntityActivatedDeactivated_PrintMessage)
|
||||
|
||||
Report.start_test(ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage)
|
||||
+4
-12
@@ -7,12 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: C92569165, C92569167, C92569168, C92569170
|
||||
Test Case Title: Tools > Node Palette toggles the Node Palette
|
||||
Tools > Node Inspector toggles the Node Inspector
|
||||
Tools > Bookmarks toggles the Bookmarks
|
||||
Tools > Variable Manager toggles the Variable Manager
|
||||
"""
|
||||
|
||||
|
||||
@@ -33,7 +27,7 @@ class Tests():
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Toggle_ScriptCanvasTools():
|
||||
def ScriptCanvasTools_Toggle_OpenCloseSuccess():
|
||||
"""
|
||||
Summary:
|
||||
Toggle Node Palette, Node Inspector, Bookmarks and Variable Manager in Script Canvas.
|
||||
@@ -58,6 +52,8 @@ def Toggle_ScriptCanvasTools():
|
||||
:return: None
|
||||
"""
|
||||
|
||||
from PySide2 import QtWidgets
|
||||
|
||||
from utils import Report
|
||||
from utils import TestHelper as helper
|
||||
import pyside_utils
|
||||
@@ -65,9 +61,6 @@ def Toggle_ScriptCanvasTools():
|
||||
# Open 3D Engine imports
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
# Pyside imports
|
||||
from PySide2 import QtWidgets
|
||||
|
||||
def click_menu_option(window, option_text):
|
||||
action = pyside_utils.find_child_by_pattern(window, {"text": option_text, "type": QtWidgets.QAction})
|
||||
action.trigger()
|
||||
@@ -126,7 +119,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(Toggle_ScriptCanvasTools)
|
||||
Report.start_test(ScriptCanvasTools_Toggle_OpenCloseSuccess)
|
||||
+2
-8
@@ -7,10 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92562986
|
||||
Test Case Title: Changing the assigned Script Canvas Asset on an entity properly updates
|
||||
level functionality
|
||||
"""
|
||||
|
||||
|
||||
@@ -24,7 +20,7 @@ class Tests():
|
||||
# fmt: on
|
||||
|
||||
|
||||
def ScriptCanvas_ChangingAssets():
|
||||
def ScriptCanvas_ChangingAssets_ComponentStable():
|
||||
"""
|
||||
Summary:
|
||||
Changing the assigned Script Canvas Asset on an entity properly updates level functionality
|
||||
@@ -57,7 +53,6 @@ def ScriptCanvas_ChangingAssets():
|
||||
import azlmbr.math as math
|
||||
import azlmbr.asset as asset
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.paths as paths
|
||||
|
||||
LEVEL_NAME = "tmp_level"
|
||||
ASSET_1 = os.path.join("scriptcanvas", "ScriptCanvas_TwoComponents0.scriptcanvas")
|
||||
@@ -83,7 +78,6 @@ def ScriptCanvas_ChangingAssets():
|
||||
Report.result(Tests.found_lines, find_expected_line(EXP_LINE))
|
||||
helper.exit_game_mode(Tests.game_mode_exited)
|
||||
|
||||
|
||||
# 1) Create temp level
|
||||
general.idle_enable(True)
|
||||
result = general.create_level_no_prompt(LEVEL_NAME, 128, 1, 512, True)
|
||||
@@ -112,4 +106,4 @@ if __name__ == "__main__":
|
||||
imports.init()
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(ScriptCanvas_ChangingAssets)
|
||||
Report.start_test(ScriptCanvas_ChangingAssets_ComponentStable)
|
||||
+3
-6
@@ -7,9 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92563190
|
||||
Test Case Title: A single Entity with two Script Canvas components works properly
|
||||
"""
|
||||
|
||||
|
||||
@@ -26,7 +23,7 @@ class LogLines:
|
||||
expected_lines = ["Greetings from the first script", "Greetings from the second script"]
|
||||
|
||||
|
||||
def ScriptCanvas_TwoComponents():
|
||||
def ScriptCanvas_TwoComponents_InteractSuccessfully():
|
||||
"""
|
||||
Summary:
|
||||
A test entity contains two Script Canvas components with different unique script canvas files.
|
||||
@@ -57,6 +54,7 @@ def ScriptCanvas_TwoComponents():
|
||||
import hydra_editor_utils as hydra
|
||||
from utils import Report
|
||||
from utils import Tracer
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.math as math
|
||||
import azlmbr.asset as asset
|
||||
@@ -111,7 +109,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(ScriptCanvas_TwoComponents)
|
||||
Report.start_test(ScriptCanvas_TwoComponents_InteractSuccessfully)
|
||||
+6
-8
@@ -7,26 +7,23 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92563191
|
||||
Test Case Title: Two Entities can use the same Graph asset successfully at RunTime
|
||||
"""
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
level_created = ("New level created", "New level not created")
|
||||
level_created = ("New level created successfully", "New level failed to create")
|
||||
game_mode_entered = ("Game Mode successfully entered", "Game mode failed to enter")
|
||||
game_mode_exited = ("Game Mode successfully exited", "Game mode failed to exited")
|
||||
found_lines = ("Expected log lines were found", "Expected log lines were not found")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def ScriptCanvas_TwoEntities():
|
||||
def ScriptCanvas_TwoEntities_UseSimultaneously():
|
||||
"""
|
||||
Summary:
|
||||
Two Entities can use the same Graph asset successfully at RunTime. The script canvas asset
|
||||
attached to the enties will print the respective entity names.
|
||||
attached to the entities will print the respective entity names.
|
||||
|
||||
Expected Behavior:
|
||||
When game mode is entered, respective strings of different entities should be printed.
|
||||
@@ -48,9 +45,10 @@ def ScriptCanvas_TwoEntities():
|
||||
|
||||
import os
|
||||
|
||||
import hydra_editor_utils as hydra
|
||||
from utils import TestHelper as helper
|
||||
from utils import Tracer
|
||||
import hydra_editor_utils as hydra
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.math as math
|
||||
import azlmbr.asset as asset
|
||||
@@ -103,4 +101,4 @@ if __name__ == "__main__":
|
||||
imports.init()
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(ScriptCanvas_TwoEntities)
|
||||
Report.start_test(ScriptCanvas_TwoEntities_UseSimultaneously)
|
||||
-4
@@ -7,9 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92569013
|
||||
Test Case Title: Script Event file can be created
|
||||
"""
|
||||
|
||||
|
||||
@@ -117,7 +114,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(CreateScriptEventFile)
|
||||
+2
-6
@@ -7,9 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92567320
|
||||
Test Case Title: Script Events: Can send and receive a script event successfully
|
||||
"""
|
||||
|
||||
|
||||
@@ -23,7 +20,7 @@ class Tests():
|
||||
# fmt: on
|
||||
|
||||
|
||||
def ScriptEvents_SendReceiveSuccessfully():
|
||||
def ScriptEvents_Default_SendReceiveSuccessfully():
|
||||
"""
|
||||
Summary:
|
||||
An entity exists in the level that contains a Script Canvas component. In the graph is both a Send Event
|
||||
@@ -103,7 +100,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(ScriptEvents_SendReceiveSuccessfully)
|
||||
Report.start_test(ScriptEvents_Default_SendReceiveSuccessfully)
|
||||
+11
-14
@@ -7,9 +7,6 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92567321
|
||||
Test Case Title: Script Events: Can send and receive a script event across multiple entities successfully
|
||||
"""
|
||||
|
||||
|
||||
@@ -24,10 +21,11 @@ class Tests():
|
||||
# fmt: on
|
||||
|
||||
|
||||
def ScriptEvents_SendReceiveAcrossMultiple():
|
||||
def ScriptEvents_HappyPath_SendReceiveAcrossMultiple():
|
||||
"""
|
||||
Summary:
|
||||
EntityA and EntityB will be created in a level. Attached to both will be a Script Canvas component. The Script Event created for the test will be sent from EntityA to EntityB.
|
||||
EntityA and EntityB will be created in a level. Attached to both will be a Script Canvas component.
|
||||
The Script Event created for the test will be sent from EntityA to EntityB.
|
||||
|
||||
Expected Behavior:
|
||||
The output of the Script Event should be printed to the console
|
||||
@@ -49,7 +47,7 @@ def ScriptEvents_SendReceiveAcrossMultiple():
|
||||
:return: None
|
||||
"""
|
||||
import os
|
||||
|
||||
|
||||
from editor_entity_utils import EditorEntity as Entity
|
||||
from utils import Report
|
||||
from utils import TestHelper as helper
|
||||
@@ -65,20 +63,19 @@ def ScriptEvents_SendReceiveAcrossMultiple():
|
||||
"assetA": os.path.join("ScriptCanvas", f"{ASSET_PREFIX}A.scriptcanvas"),
|
||||
"assetB": os.path.join("ScriptCanvas", f"{ASSET_PREFIX}B.scriptcanvas"),
|
||||
}
|
||||
sc_for_entities = {
|
||||
"EntityA": asset_paths["assetA"],
|
||||
"EntityB": asset_paths["assetB"]
|
||||
}
|
||||
sc_for_entities = {"EntityA": asset_paths["assetA"], "EntityB": asset_paths["assetB"]}
|
||||
EXPECTED_LINES = ["Incoming Message Received"]
|
||||
|
||||
def get_asset(asset_path):
|
||||
return azlmbr.asset.AssetCatalogRequestBus(azlmbr.bus.Broadcast, "GetAssetIdByPath", asset_path, azlmbr.math.Uuid(), False)
|
||||
return azlmbr.asset.AssetCatalogRequestBus(
|
||||
azlmbr.bus.Broadcast, "GetAssetIdByPath", asset_path, azlmbr.math.Uuid(), False
|
||||
)
|
||||
|
||||
def create_editor_entity(name, sc_asset):
|
||||
entity = Entity.create_editor_entity(name)
|
||||
sc_comp = entity.add_component("Script Canvas")
|
||||
sc_comp.set_component_property_value("Script Canvas Asset|Script Canvas Asset", get_asset(sc_asset))
|
||||
Report.critical_result(Tests.__dict__[name.lower()+"_created"], entity.id.isValid())
|
||||
Report.critical_result(Tests.__dict__[name.lower() + "_created"], entity.id.isValid())
|
||||
|
||||
def locate_expected_lines(line_list: list):
|
||||
found_lines = [printInfo.message.strip() for printInfo in section_tracer.prints]
|
||||
@@ -112,8 +109,8 @@ def ScriptEvents_SendReceiveAcrossMultiple():
|
||||
|
||||
if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
imports.init()
|
||||
|
||||
imports.init()
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(ScriptEvents_SendReceiveAcrossMultiple)
|
||||
Report.start_test(ScriptEvents_HappyPath_SendReceiveAcrossMultiple)
|
||||
@@ -106,7 +106,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(ScriptEvents_ReturnSetType_Successfully)
|
||||
|
||||
@@ -29,79 +29,73 @@ TEST_DIRECTORY = os.path.dirname(__file__)
|
||||
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
|
||||
@pytest.mark.parametrize("project", ["AutomatedTesting"])
|
||||
class TestAutomation(TestAutomationBase):
|
||||
@pytest.mark.test_case_id("C1702834", "C1702823")
|
||||
def test_Opening_Closing_Pane(self, request, workspace, editor, launcher_platform):
|
||||
from . import Opening_Closing_Pane as test_module
|
||||
def test_Pane_HappyPath_OpenCloseSuccessfully(self, request, workspace, editor, launcher_platform):
|
||||
from . import Pane_HappyPath_OpenCloseSuccessfully as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("C1702824")
|
||||
def test_Docking_Pane(self, request, workspace, editor, launcher_platform):
|
||||
from . import Docking_Pane as test_module
|
||||
def test_Pane_HappyPath_DocksProperly(self, request, workspace, editor, launcher_platform):
|
||||
from . import Pane_HappyPath_DocksProperly as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("C1702829")
|
||||
def test_Resizing_Pane(self, request, workspace, editor, launcher_platform):
|
||||
from . import Resizing_Pane as test_module
|
||||
def test_Pane_HappyPath_ResizesProperly(self, request, workspace, editor, launcher_platform):
|
||||
from . import Pane_HappyPath_ResizesProperly as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92563190")
|
||||
@pytest.mark.parametrize("level", ["tmp_level"])
|
||||
def test_ScriptCanvas_TwoComponents(self, request, workspace, editor, launcher_platform, level):
|
||||
def test_ScriptCanvas_TwoComponents_InteractSuccessfully(self, request, workspace, editor, launcher_platform, level):
|
||||
def teardown():
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
request.addfinalizer(teardown)
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
from . import ScriptCanvas_TwoComponents as test_module
|
||||
from . import ScriptCanvas_TwoComponents_InteractSuccessfully as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92562986")
|
||||
@pytest.mark.parametrize("level", ["tmp_level"])
|
||||
def test_ScriptCanvas_ChangingAssets(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def test_ScriptCanvas_ChangingAssets_ComponentStable(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def teardown():
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
request.addfinalizer(teardown)
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
from . import ScriptCanvas_ChangingAssets as test_module
|
||||
from . import ScriptCanvas_ChangingAssets_ComponentStable as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92569079", "T92569081")
|
||||
def test_Graph_ZoomInZoomOut(self, request, workspace, editor, launcher_platform):
|
||||
from . import Graph_ZoomInZoomOut as test_module
|
||||
def test_Graph_HappyPath_ZoomInZoomOut(self, request, workspace, editor, launcher_platform):
|
||||
from . import Graph_HappyPath_ZoomInZoomOut as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92568940")
|
||||
def test_NodePalette_SelectNode(self, request, workspace, editor, launcher_platform):
|
||||
from . import NodePalette_SelectNode as test_module
|
||||
def test_NodePalette_HappyPath_CanSelectNode(self, request, workspace, editor, launcher_platform):
|
||||
from . import NodePalette_HappyPath_CanSelectNode as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92569253")
|
||||
@pytest.mark.test_case_id("T92569254")
|
||||
@pytest.mark.parametrize("level", ["tmp_level"])
|
||||
def test_OnEntityActivatedDeactivated_PrintMessage(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def test_ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def teardown():
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
request.addfinalizer(teardown)
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
from . import OnEntityActivatedDeactivated_PrintMessage as test_module
|
||||
from . import ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
|
||||
<<<<<<< HEAD
|
||||
def test_NodePalette_HappyPath_ClearSelection(self, request, workspace, editor, launcher_platform, project):
|
||||
from . import NodePalette_HappyPath_ClearSelection as test_module
|
||||
=======
|
||||
@pytest.mark.test_case_id("T92562993")
|
||||
def test_NodePalette_ClearSelection(self, request, workspace, editor, launcher_platform, project):
|
||||
from . import NodePalette_ClearSelection as test_module
|
||||
>>>>>>> main
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92563191")
|
||||
@pytest.mark.parametrize("level", ["tmp_level"])
|
||||
def test_ScriptCanvas_TwoEntities(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def test_ScriptCanvas_TwoEntities_UseSimultaneously(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def teardown():
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
request.addfinalizer(teardown)
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
from . import ScriptCanvas_TwoEntities as test_module
|
||||
from . import ScriptCanvas_TwoEntities_UseSimultaneously as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92569013")
|
||||
def test_AssetEditor_CreateScriptEventFile(self, request, workspace, editor, launcher_platform, project):
|
||||
def test_ScriptEvent_HappyPath_CreatedWithoutError(self, request, workspace, editor, launcher_platform, project):
|
||||
def teardown():
|
||||
file_system.delete(
|
||||
[os.path.join(workspace.paths.project(), "ScriptCanvas", "test_file.scriptevent")], True, True
|
||||
@@ -110,77 +104,72 @@ class TestAutomation(TestAutomationBase):
|
||||
file_system.delete(
|
||||
[os.path.join(workspace.paths.project(), "ScriptCanvas", "test_file.scriptevent")], True, True
|
||||
)
|
||||
from . import AssetEditor_CreateScriptEventFile as test_module
|
||||
from . import ScriptEvent_HappyPath_CreatedWithoutError as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92569165", "T92569167", "T92569168", "T92569170")
|
||||
def test_Toggle_ScriptCanvasTools(self, request, workspace, editor, launcher_platform):
|
||||
from . import Toggle_ScriptCanvasTools as test_module
|
||||
def test_ScriptCanvasTools_Toggle_OpenCloseSuccess(self, request, workspace, editor, launcher_platform):
|
||||
from . import ScriptCanvasTools_Toggle_OpenCloseSuccess as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92568982")
|
||||
def test_NodeInspector_RenameVariable(self, request, workspace, editor, launcher_platform, project):
|
||||
from . import NodeInspector_RenameVariable as test_module
|
||||
def test_NodeInspector_HappyPath_VariableRenames(self, request, workspace, editor, launcher_platform, project):
|
||||
from . import NodeInspector_HappyPath_VariableRenames as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
|
||||
def test_Debugger_HappyPath_TargetMultipleGraphs(self, request, workspace, editor, launcher_platform, project):
|
||||
from . import Debugger_HappyPath_TargetMultipleGraphs as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92569137")
|
||||
def test_Debugging_TargetMultipleGraphs(self, request, workspace, editor, launcher_platform, project):
|
||||
from . import Debugging_TargetMultipleGraphs as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92568856")
|
||||
@pytest.mark.parametrize("level", ["tmp_level"])
|
||||
def test_Debugging_TargetMultipleEntities(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def test_Debugger_HappyPath_TargetMultipleEntities(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def teardown():
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
request.addfinalizer(teardown)
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
from . import Debugging_TargetMultipleEntities as test_module
|
||||
from . import Debugger_HappyPath_TargetMultipleEntities as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92569049", "T92569051")
|
||||
def test_EditMenu_UndoRedo(self, request, workspace, editor, launcher_platform, project):
|
||||
from . import EditMenu_UndoRedo as test_module
|
||||
def test_EditMenu_Default_UndoRedo(self, request, workspace, editor, launcher_platform, project):
|
||||
from . import EditMenu_Default_UndoRedo as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("C1702825", "C1702831")
|
||||
def test_UnDockedPane_CloseSCWindow(self, request, workspace, editor, launcher_platform):
|
||||
from . import UnDockedPane_CloseSCWindow as test_module
|
||||
def test_Pane_Undocked_ClosesSuccessfully(self, request, workspace, editor, launcher_platform):
|
||||
from . import Pane_Undocked_ClosesSuccessfully as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92562978")
|
||||
@pytest.mark.parametrize("level", ["tmp_level"])
|
||||
def test_Entity_AddScriptCanvasComponent(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def test_Entity_HappyPath_AddScriptCanvasComponent(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def teardown():
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
request.addfinalizer(teardown)
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
from . import Entity_AddScriptCanvasComponent as test_module
|
||||
from . import Entity_HappyPath_AddScriptCanvasComponent as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("C1702821", "C1702832")
|
||||
def test_Pane_RetainOnSCRestart(self, request, workspace, editor, launcher_platform):
|
||||
from . import Pane_RetainOnSCRestart as test_module
|
||||
def test_Pane_Default_RetainOnSCRestart(self, request, workspace, editor, launcher_platform):
|
||||
from . import Pane_Default_RetainOnSCRestart as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92567321")
|
||||
@pytest.mark.parametrize("level", ["tmp_level"])
|
||||
def test_ScriptEvents_SendReceiveAcrossMultiple(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def test_ScriptEvents_HappyPath_SendReceiveAcrossMultiple(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def teardown():
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
request.addfinalizer(teardown)
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
from . import ScriptEvents_SendReceiveAcrossMultiple as test_module
|
||||
from . import ScriptEvents_HappyPath_SendReceiveAcrossMultiple as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.test_case_id("T92567320")
|
||||
@pytest.mark.parametrize("level", ["tmp_level"])
|
||||
def test_ScriptEvents_SendReceiveSuccessfully(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def test_ScriptEvents_Default_SendReceiveSuccessfully(self, request, workspace, editor, launcher_platform, project, level):
|
||||
def teardown():
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
request.addfinalizer(teardown)
|
||||
file_system.delete([os.path.join(workspace.paths.project(), "Levels", level)], True, True)
|
||||
from . import ScriptEvents_SendReceiveSuccessfully as test_module
|
||||
from . import ScriptEvents_Default_SendReceiveSuccessfully as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
@pytest.mark.parametrize("level", ["tmp_level"])
|
||||
@@ -195,7 +184,7 @@ class TestAutomation(TestAutomationBase):
|
||||
def test_NodeCategory_ExpandOnClick(self, request, workspace, editor, launcher_platform):
|
||||
from . import NodeCategory_ExpandOnClick as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
|
||||
def test_NodePalette_SearchText_Deletion(self, request, workspace, editor, launcher_platform):
|
||||
from . import NodePalette_SearchText_Deletion as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
@@ -204,6 +193,10 @@ class TestAutomation(TestAutomationBase):
|
||||
from . import VariableManager_UnpinVariableType_Works as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_Node_HappyPath_DuplicateNode(self, request, workspace, editor, launcher_platform):
|
||||
from . import Node_HappyPath_DuplicateNode as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
# NOTE: We had to use hydra_test_utils.py, as TestAutomationBase run_test method
|
||||
# fails because of pyside_utils import
|
||||
@pytest.mark.SUITE_periodic
|
||||
@@ -214,18 +207,16 @@ class TestScriptCanvasTests(object):
|
||||
The following tests use hydra_test_utils.py to launch the editor and validate the results.
|
||||
"""
|
||||
|
||||
@pytest.mark.test_case_id("T92569037", "T92569039")
|
||||
def test_FileMenu_New_Open(self, request, editor, launcher_platform):
|
||||
def test_FileMenu_Default_NewAndOpen(self, request, editor, launcher_platform):
|
||||
expected_lines = [
|
||||
"File->New action working as expected: True",
|
||||
"File->Open action working as expected: True",
|
||||
]
|
||||
hydra.launch_and_validate_results(
|
||||
request, TEST_DIRECTORY, editor, "FileMenu_New_Open.py", expected_lines, auto_test_mode=False, timeout=60,
|
||||
request, TEST_DIRECTORY, editor, "FileMenu_Default_NewAndOpen.py", expected_lines, auto_test_mode=False, timeout=60,
|
||||
)
|
||||
|
||||
@pytest.mark.test_case_id("T92568942")
|
||||
def test_AssetEditor_NewScriptEvent(self, request, editor, launcher_platform):
|
||||
def test_NewScriptEventButton_HappyPath_ContainsSCCategory(self, request, editor, launcher_platform):
|
||||
expected_lines = [
|
||||
"New Script event action found: True",
|
||||
"Asset Editor opened: True",
|
||||
@@ -236,14 +227,13 @@ class TestScriptCanvasTests(object):
|
||||
request,
|
||||
TEST_DIRECTORY,
|
||||
editor,
|
||||
"AssetEditor_NewScriptEvent.py",
|
||||
"NewScriptEventButton_HappyPath_ContainsSCCategory.py",
|
||||
expected_lines,
|
||||
auto_test_mode=False,
|
||||
timeout=60,
|
||||
)
|
||||
|
||||
@pytest.mark.test_case_id("T92563068", "T92563070")
|
||||
def test_GraphClose_SavePrompt(self, request, editor, launcher_platform):
|
||||
def test_GraphClose_Default_SavePrompt(self, request, editor, launcher_platform):
|
||||
expected_lines = [
|
||||
"New graph created: True",
|
||||
"Save prompt opened as expected: True",
|
||||
@@ -253,14 +243,13 @@ class TestScriptCanvasTests(object):
|
||||
request,
|
||||
TEST_DIRECTORY,
|
||||
editor,
|
||||
"GraphClose_SavePrompt.py",
|
||||
"GraphClose_Default_SavePrompt.py",
|
||||
expected_lines,
|
||||
auto_test_mode=False,
|
||||
timeout=60,
|
||||
)
|
||||
|
||||
@pytest.mark.test_case_id("T92564789", "T92568873")
|
||||
def test_VariableManager_CreateDeleteVars(self, request, editor, launcher_platform):
|
||||
def test_VariableManager_Default_CreateDeleteVars(self, request, editor, launcher_platform):
|
||||
var_types = ["Boolean", "Color", "EntityID", "Number", "String", "Transform", "Vector2", "Vector3", "Vector4"]
|
||||
expected_lines = [f"Success: {var_type} variable is created" for var_type in var_types]
|
||||
expected_lines.extend([f"Success: {var_type} variable is deleted" for var_type in var_types])
|
||||
@@ -268,7 +257,7 @@ class TestScriptCanvasTests(object):
|
||||
request,
|
||||
TEST_DIRECTORY,
|
||||
editor,
|
||||
"VariableManager_CreateDeleteVars.py",
|
||||
"VariableManager_Default_CreateDeleteVars.py",
|
||||
expected_lines,
|
||||
auto_test_mode=False,
|
||||
timeout=60,
|
||||
|
||||
+4
-11
@@ -7,18 +7,13 @@ distribution (the "License"). All use of this software is governed by the Licens
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
Test case ID: T92564789
|
||||
Test Case Title: Each Variable type can be created
|
||||
Test case ID: T92568873
|
||||
Test Case Title: Each Variable type can be deleted
|
||||
"""
|
||||
|
||||
|
||||
def VariableManager_CreateDeleteVars():
|
||||
def VariableManager_Default_CreateDeleteVars():
|
||||
"""
|
||||
Summary:
|
||||
Each variable type can be created and deleted in variable manager.
|
||||
Creating and deleting each type of variable in the Variable Manager pane
|
||||
|
||||
Expected Behavior:
|
||||
Each variable type can be created and deleted in variable manager.
|
||||
@@ -41,15 +36,13 @@ def VariableManager_CreateDeleteVars():
|
||||
"""
|
||||
|
||||
from PySide2 import QtWidgets, QtCore, QtTest
|
||||
|
||||
from PySide2.QtCore import Qt
|
||||
|
||||
from utils import TestHelper as helper
|
||||
import pyside_utils
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
import pyside_utils
|
||||
|
||||
def generate_test_tuple(var_type, action):
|
||||
return (f"{var_type} variable is {action}d", f"{var_type} variable is not {action}d")
|
||||
|
||||
@@ -118,4 +111,4 @@ if __name__ == "__main__":
|
||||
imports.init()
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(VariableManager_CreateDeleteVars)
|
||||
Report.start_test(VariableManager_Default_CreateDeleteVars)
|
||||
@@ -115,7 +115,6 @@ if __name__ == "__main__":
|
||||
import ImportPathHelper as imports
|
||||
|
||||
imports.init()
|
||||
|
||||
from utils import Report
|
||||
|
||||
Report.start_test(VariableManager_UnpinVariableType_Works)
|
||||
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
{
|
||||
"Source": "Levels/PrefabLevel_OpensLevelWithEntities/PrefabLevel_OpensLevelWithEntities.prefab",
|
||||
"ContainerEntity": {
|
||||
"Id": "Entity_[403811863694]",
|
||||
"Name": "Level",
|
||||
"Components": {
|
||||
"Component_[10582285743525614098]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 10582285743525614098
|
||||
},
|
||||
"Component_[12253783095375428046]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 12253783095375428046
|
||||
},
|
||||
"Component_[13764860261821571747]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 13764860261821571747,
|
||||
"Parent Entity": ""
|
||||
},
|
||||
"Component_[15844324401733835865]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 15844324401733835865
|
||||
},
|
||||
"Component_[1605854641405361768]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 1605854641405361768
|
||||
},
|
||||
"Component_[17698173984524983803]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 17698173984524983803
|
||||
},
|
||||
"Component_[3444251662966224826]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 3444251662966224826
|
||||
},
|
||||
"Component_[4231768881195179982]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 4231768881195179982
|
||||
},
|
||||
"Component_[4722360315410084479]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 4722360315410084479
|
||||
},
|
||||
"Component_[7614719100624882952]": {
|
||||
"$type": "EditorPrefabComponent",
|
||||
"Id": 7614719100624882952
|
||||
},
|
||||
"Component_[9585901769691795481]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 9585901769691795481
|
||||
}
|
||||
},
|
||||
"IsDependencyReady": true
|
||||
},
|
||||
"Entities": {
|
||||
"Entity_[438171602062]": {
|
||||
"Id": "Entity_[438171602062]",
|
||||
"Name": "EntityWithPxCollider",
|
||||
"Components": {
|
||||
"Component_[11161653124805884473]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 11161653124805884473
|
||||
},
|
||||
"Component_[13116773315299882093]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 13116773315299882093
|
||||
},
|
||||
"Component_[15820915681461536711]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 15820915681461536711
|
||||
},
|
||||
"Component_[2222061938345834243]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 2222061938345834243
|
||||
},
|
||||
"Component_[3861913165076405600]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 3861913165076405600
|
||||
},
|
||||
"Component_[7118587015611303204]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 7118587015611303204
|
||||
},
|
||||
"Component_[7751174327125555504]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 7751174327125555504
|
||||
},
|
||||
"Component_[8304730147756374057]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 8304730147756374057,
|
||||
"Parent Entity": "Entity_[403811863694]",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
0.0,
|
||||
20.0,
|
||||
34.0
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[8866353210615920259]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 8866353210615920259
|
||||
},
|
||||
"Component_[8988181228601932779]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 8988181228601932779
|
||||
},
|
||||
"Component_[7103333782129541775]": {
|
||||
"$type": "EditorColliderComponent",
|
||||
"Id": 7103333782129541775
|
||||
}
|
||||
},
|
||||
"IsDependencyReady": true
|
||||
},
|
||||
"Entity_[532660882574]": {
|
||||
"Id": "Entity_[532660882574]",
|
||||
"Name": "EmptyEntity",
|
||||
"Components": {
|
||||
"Component_[16437814751543997955]": {
|
||||
"$type": "EditorEntitySortComponent",
|
||||
"Id": 16437814751543997955
|
||||
},
|
||||
"Component_[16751517102089557119]": {
|
||||
"$type": "EditorPendingCompositionComponent",
|
||||
"Id": 16751517102089557119
|
||||
},
|
||||
"Component_[16773275259304187949]": {
|
||||
"$type": "EditorInspectorComponent",
|
||||
"Id": 16773275259304187949
|
||||
},
|
||||
"Component_[17283539636910567200]": {
|
||||
"$type": "SelectionComponent",
|
||||
"Id": 17283539636910567200
|
||||
},
|
||||
"Component_[250004123617033400]": {
|
||||
"$type": "EditorLockComponent",
|
||||
"Id": 250004123617033400
|
||||
},
|
||||
"Component_[2791138963683667073]": {
|
||||
"$type": "{27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0} TransformComponent",
|
||||
"Id": 2791138963683667073,
|
||||
"Parent Entity": "Entity_[403811863694]",
|
||||
"Transform Data": {
|
||||
"Translate": [
|
||||
10.0,
|
||||
20.0,
|
||||
30.0
|
||||
]
|
||||
}
|
||||
},
|
||||
"Component_[3296942400051129145]": {
|
||||
"$type": "EditorEntityIconComponent",
|
||||
"Id": 3296942400051129145
|
||||
},
|
||||
"Component_[3422076964671342434]": {
|
||||
"$type": "EditorOnlyEntityComponent",
|
||||
"Id": 3422076964671342434
|
||||
},
|
||||
"Component_[3431895414183121731]": {
|
||||
"$type": "EditorVisibilityComponent",
|
||||
"Id": 3431895414183121731
|
||||
},
|
||||
"Component_[7072085777705148766]": {
|
||||
"$type": "EditorDisabledCompositionComponent",
|
||||
"Id": 7072085777705148766
|
||||
}
|
||||
},
|
||||
"IsDependencyReady": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#Ignore these directories
|
||||
SDKs
|
||||
|
||||
#ColinB (8/26)- I know there are depot files that this will ignore... But these files should not be
|
||||
#here, they should all be in 3rdParty... so we will ignore them until I can move them, it should
|
||||
#be OK for now because they shouldn't change at all anyway.
|
||||
@@ -9,58 +9,15 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME})
|
||||
ly_get_pal_tool_dirs(pal_tool_dirs ${CMAKE_CURRENT_LIST_DIR}/Platform)
|
||||
|
||||
ly_add_target(
|
||||
NAME CryCommon STATIC
|
||||
NAMESPACE Legacy
|
||||
FILES_CMAKE
|
||||
crycommon_files.cmake
|
||||
${pal_dir}/crycommon_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
|
||||
PLATFORM_INCLUDE_FILES
|
||||
${pal_dir}/crycommon_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
. # Lots of code without CryCommon/
|
||||
.. # Dangerous since exports CryEngine's path (client code can do CrySystem/ without depending on that target)
|
||||
${pal_dir}
|
||||
${pal_tool_dirs}
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
AZ::AzCore
|
||||
AZ::AzFramework
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
NAME CryCommon.EngineSettings.Static STATIC
|
||||
NAMESPACE Legacy
|
||||
FILES_CMAKE
|
||||
crycommon_enginesettings_files.cmake
|
||||
${pal_dir}/crycommon_enginesettings_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
.
|
||||
${pal_dir}
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
AZ::AzCore
|
||||
AZ::AzFramework
|
||||
)
|
||||
|
||||
ly_add_target(
|
||||
NAME CryCommon.EngineSettings.RC.Static STATIC
|
||||
NAMESPACE Legacy
|
||||
FILES_CMAKE
|
||||
crycommon_enginesettings_files.cmake
|
||||
${pal_dir}/crycommon_enginesettings_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
|
||||
INCLUDE_DIRECTORIES
|
||||
PUBLIC
|
||||
.
|
||||
${pal_dir}
|
||||
COMPILE_DEFINITIONS
|
||||
PRIVATE
|
||||
RESOURCE_COMPILER
|
||||
BUILD_DEPENDENCIES
|
||||
PUBLIC
|
||||
AZ::AzCore
|
||||
|
||||
@@ -31,7 +31,7 @@ void CryAssertTrace(const char* szFormat, ...)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gEnv->bIgnoreAllAsserts || gEnv->bTesting)
|
||||
if (!gEnv->bIgnoreAllAsserts)
|
||||
{
|
||||
if (szFormat == NULL)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ void CryAssertTrace(const char* szFormat, ...)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gEnv->bIgnoreAllAsserts || gEnv->bTesting)
|
||||
if (!gEnv->bIgnoreAllAsserts)
|
||||
{
|
||||
if (szFormat == NULL)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ void CryAssertTrace(const char* szFormat, ...)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gEnv->bIgnoreAllAsserts || gEnv->bTesting)
|
||||
if (!gEnv->bIgnoreAllAsserts)
|
||||
{
|
||||
if (szFormat == NULL)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ void CryAssertTrace(const char* szFormat, ...)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gEnv->bIgnoreAllAsserts || gEnv->bTesting)
|
||||
if (!gEnv->bIgnoreAllAsserts)
|
||||
{
|
||||
if (szFormat == NULL)
|
||||
{
|
||||
|
||||
@@ -305,7 +305,7 @@ void CryAssertTrace(const char* _pszFormat, ...)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!gEnv->bIgnoreAllAsserts || gEnv->bTesting)
|
||||
if (!gEnv->bIgnoreAllAsserts)
|
||||
{
|
||||
if (NULL == _pszFormat)
|
||||
{
|
||||
|
||||
@@ -49,12 +49,6 @@ public:
|
||||
//! ISystem has shut down.
|
||||
virtual void OnCrySystemPostShutdown() {}
|
||||
|
||||
//! Engine pre physics update.
|
||||
virtual void OnCrySystemPrePhysicsUpdate() {}
|
||||
|
||||
//! Engine post physics update.
|
||||
virtual void OnCrySystemPostPhysicsUpdate() {}
|
||||
|
||||
//! Sent when a new level is being created.
|
||||
virtual void OnCryEditorBeginCreate() {}
|
||||
|
||||
|
||||
@@ -37,9 +37,6 @@ enum CryLockType
|
||||
|
||||
#define CRYLOCK_HAVE_FASTLOCK 1
|
||||
|
||||
void CryThreadSetName(threadID nThreadId, const char* sThreadName);
|
||||
const char* CryThreadGetName(threadID nThreadId);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Primitive locks and conditions.
|
||||
|
||||
@@ -31,22 +31,3 @@
|
||||
#else
|
||||
// Put other platform specific includes here!
|
||||
#endif
|
||||
|
||||
#include <IThreadTask.h>
|
||||
|
||||
void CryThreadSetName(threadID dwThreadId, const char* sThreadName)
|
||||
{
|
||||
if (gEnv && gEnv->pSystem && gEnv->pSystem->GetIThreadTaskManager())
|
||||
{
|
||||
gEnv->pSystem->GetIThreadTaskManager()->SetThreadName(dwThreadId, sThreadName);
|
||||
}
|
||||
}
|
||||
|
||||
const char* CryThreadGetName(threadID dwThreadId)
|
||||
{
|
||||
if (gEnv && gEnv->pSystem && gEnv->pSystem->GetIThreadTaskManager())
|
||||
{
|
||||
return gEnv->pSystem->GetIThreadTaskManager()->GetThreadName(dwThreadId);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
//#include <IThreadTask.h>
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
@@ -249,10 +249,6 @@ public:
|
||||
void SetName(const char* Name)
|
||||
{
|
||||
m_name = Name;
|
||||
if (m_threadId)
|
||||
{
|
||||
CryThreadSetName(m_threadId, m_name);
|
||||
}
|
||||
}
|
||||
const char* GetName() { return m_name; }
|
||||
|
||||
@@ -289,11 +285,6 @@ private:
|
||||
self->m_bIsStarted = true;
|
||||
self->m_bIsRunning = true;
|
||||
|
||||
if (!self->m_name.empty())
|
||||
{
|
||||
CryThreadSetName(-1, self->m_name);
|
||||
}
|
||||
|
||||
self->m_Runnable->Run();
|
||||
self->m_bIsRunning = false;
|
||||
self->m_bCreatedThread = false;
|
||||
@@ -311,11 +302,6 @@ private:
|
||||
self->m_bIsStarted = true;
|
||||
self->m_bIsRunning = true;
|
||||
|
||||
if (!self->m_name.empty())
|
||||
{
|
||||
CryThreadSetName(-1, self->m_name);
|
||||
}
|
||||
|
||||
self->Run();
|
||||
self->m_bIsRunning = false;
|
||||
self->m_bCreatedThread = false;
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "EngineSettingsBackend.h"
|
||||
|
||||
#ifdef CRY_ENABLE_RC_HELPER
|
||||
|
||||
CEngineSettingsBackend::CEngineSettingsBackend(CEngineSettingsManager* parent, const wchar_t* moduleName)
|
||||
: m_parent(parent)
|
||||
, m_moduleName()
|
||||
{
|
||||
if (moduleName != nullptr)
|
||||
{
|
||||
m_moduleName = moduleName;
|
||||
}
|
||||
}
|
||||
|
||||
CEngineSettingsBackend::~CEngineSettingsBackend()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif // CRY_ENABLE_RC_HELPER
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_ENGINESETTINGSBACKEND_H
|
||||
#define CRYINCLUDE_CRYCOMMON_ENGINESETTINGSBACKEND_H
|
||||
#pragma once
|
||||
|
||||
#include "ProjectDefines.h"
|
||||
|
||||
#ifdef CRY_ENABLE_RC_HELPER
|
||||
|
||||
#include "SettingsManagerHelpers.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class CEngineSettingsManager;
|
||||
|
||||
class CEngineSettingsBackend
|
||||
{
|
||||
public:
|
||||
CEngineSettingsBackend(CEngineSettingsManager* parent, const wchar_t* moduleName = NULL);
|
||||
virtual ~CEngineSettingsBackend();
|
||||
|
||||
virtual std::wstring GetModuleFilePath() const = 0;
|
||||
|
||||
virtual bool GetModuleSpecificStringEntryUtf16(const char* key, SettingsManagerHelpers::CWCharBuffer wbuffer) = 0;
|
||||
virtual bool GetModuleSpecificIntEntry(const char* key, int& value) = 0;
|
||||
virtual bool GetModuleSpecificBoolEntry(const char* key, bool& value) = 0;
|
||||
|
||||
virtual bool SetModuleSpecificStringEntryUtf16(const char* key, const wchar_t* str) = 0;
|
||||
virtual bool SetModuleSpecificIntEntry(const char* key, const int& value) = 0;
|
||||
virtual bool SetModuleSpecificBoolEntry(const char* key, const bool& value) = 0;
|
||||
|
||||
virtual bool GetInstalledBuildRootPathUtf16(const int index, SettingsManagerHelpers::CWCharBuffer name, SettingsManagerHelpers::CWCharBuffer path) = 0;
|
||||
|
||||
virtual void LoadEngineSettingsFromRegistry() = 0;
|
||||
virtual bool StoreEngineSettingsToRegistry() = 0;
|
||||
|
||||
protected:
|
||||
CEngineSettingsManager* parent() const
|
||||
{
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
const std::wstring& moduleName() const
|
||||
{
|
||||
return m_moduleName;
|
||||
}
|
||||
|
||||
private:
|
||||
std::wstring m_moduleName;
|
||||
CEngineSettingsManager* m_parent;
|
||||
};
|
||||
|
||||
#endif // CRY_ENABLE_RC_HELPER
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_ENGINESETTINGSBACKEND_H
|
||||
@@ -1,486 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "EngineSettingsBackendApple.h"
|
||||
|
||||
#ifdef CRY_ENABLE_RC_HELPER
|
||||
|
||||
#include "AzCore/PlatformDef.h"
|
||||
|
||||
#if AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
|
||||
#include "EngineSettingsManager.h"
|
||||
#include "SettingsManagerHelpers.h"
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <mach-o/nlist.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <codecvt>
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
using namespace SettingsManagerHelpers;
|
||||
|
||||
static const char gDefaultRegistryLocation[] = "/EngineSettings.reg";
|
||||
|
||||
#define REG_SOFTWARE L"Software\\"
|
||||
#define REG_COMPANY_NAME L"Amazon\\"
|
||||
#define REG_PRODUCT_NAME L"Lumberyard\\"
|
||||
#define REG_SETTING L"Settings\\"
|
||||
#define REG_BASE_SETTING_KEY REG_SOFTWARE REG_COMPANY_NAME REG_PRODUCT_NAME REG_SETTING
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class SimpleRegistry
|
||||
{
|
||||
typedef std::map< std::wstring, std::wstring > WStringMap;
|
||||
std::map< std::wstring, WStringMap * > m_modules;
|
||||
|
||||
public:
|
||||
SimpleRegistry();
|
||||
~SimpleRegistry();
|
||||
|
||||
void setBoolValue(const std::wstring& module, const std::wstring& key, bool value);
|
||||
void setIntValue(const std::wstring& module, const std::wstring& key, int value);
|
||||
void setStrValue(const std::wstring& module, const std::wstring& key, const std::wstring& value);
|
||||
|
||||
bool getBoolValue(const std::wstring& module, const std::wstring& key, bool& value);
|
||||
bool getIntValue(const std::wstring& module, const std::wstring& key, int& value);
|
||||
bool getStrValue(const std::wstring& module, const std::wstring& key, std::wstring& value);
|
||||
|
||||
bool loadFromFile(const char* fileName);
|
||||
bool saveToFile(const char* fileName);
|
||||
|
||||
protected:
|
||||
void clear();
|
||||
|
||||
private:
|
||||
static const wchar_t gSimpleMagic[];
|
||||
static const size_t gMetaCharCount;
|
||||
};
|
||||
|
||||
const wchar_t SimpleRegistry::gSimpleMagic[] = L"FR0";
|
||||
const size_t SimpleRegistry::gMetaCharCount = sizeof(size_t) / sizeof(wchar_t);
|
||||
|
||||
SimpleRegistry::SimpleRegistry()
|
||||
{
|
||||
}
|
||||
|
||||
SimpleRegistry::~SimpleRegistry()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void SimpleRegistry::setBoolValue(const std::wstring& module, const std::wstring& key, bool value)
|
||||
{
|
||||
return setStrValue(module, key, value ? L"true" : L"false");
|
||||
}
|
||||
|
||||
void SimpleRegistry::setIntValue(const std::wstring& module, const std::wstring& key, int value)
|
||||
{
|
||||
return setStrValue(module, key, std::to_wstring(value));
|
||||
}
|
||||
|
||||
void SimpleRegistry::setStrValue(const std::wstring& module, const std::wstring& key, const std::wstring& value)
|
||||
{
|
||||
WStringMap *map = nullptr;
|
||||
|
||||
auto i = m_modules.find(module);
|
||||
|
||||
if (i == m_modules.end())
|
||||
{
|
||||
map = new WStringMap;
|
||||
m_modules.emplace(module, map);
|
||||
}
|
||||
else
|
||||
{
|
||||
map = i->second;
|
||||
}
|
||||
|
||||
assert(map);
|
||||
|
||||
(*map)[key] = value;
|
||||
}
|
||||
|
||||
bool SimpleRegistry::getBoolValue(const std::wstring& module, const std::wstring& key, bool& value)
|
||||
{
|
||||
std::wstring str;
|
||||
|
||||
if (!getStrValue(module, key, str))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = (0 == str.compare(L"true"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SimpleRegistry::getIntValue(const std::wstring& module, const std::wstring& key, int& value)
|
||||
{
|
||||
std::wstring str;
|
||||
|
||||
if (!getStrValue(module, key, str))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = std::stoi(str);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SimpleRegistry::getStrValue(const std::wstring& module, const std::wstring& key, std::wstring& value)
|
||||
{
|
||||
WStringMap *map = nullptr;
|
||||
|
||||
auto mi = m_modules.find(module);
|
||||
if (mi == m_modules.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
map = mi->second;
|
||||
assert(map);
|
||||
|
||||
auto ki = map->find(key);
|
||||
if (ki == map->end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = ki->second;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SimpleRegistry::loadFromFile(const char* fileName)
|
||||
{
|
||||
clear();
|
||||
|
||||
std::wifstream file(fileName, std::ios_base::in|std::ios_base::binary);
|
||||
file.imbue(std::locale(file.getloc(), new std::codecvt_utf16<wchar_t>));
|
||||
if (!file.is_open())
|
||||
{
|
||||
AZ_Warning("EngineSettings", false, "Failed to open registry settings file: %s", fileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring module;
|
||||
std::wstring key;
|
||||
std::wstring value;
|
||||
|
||||
wchar_t buffer[512];
|
||||
size_t size;
|
||||
wchar_t meta[gMetaCharCount];
|
||||
|
||||
/* magic number */
|
||||
if(!file.read(buffer, sizeof(gSimpleMagic) / sizeof(wchar_t)) ||
|
||||
wcsncmp(gSimpleMagic, buffer, sizeof(gSimpleMagic) / sizeof(wchar_t)) != 0)
|
||||
{
|
||||
file.close();
|
||||
AZ_Warning("EngineSettings", false, "Failed to load registry settings from file: %s", fileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
while (file.good())
|
||||
{
|
||||
file.read(meta, gMetaCharCount);
|
||||
if (!file.good())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy(&size, meta, sizeof(size));
|
||||
file.read(buffer, size);
|
||||
buffer[file.gcount()] = L'\0';
|
||||
module = buffer;
|
||||
|
||||
file.read(meta, gMetaCharCount);
|
||||
memcpy(&size, meta, sizeof(size));
|
||||
file.read(buffer, size);
|
||||
buffer[file.gcount()] = L'\0';
|
||||
key = buffer;
|
||||
|
||||
file.read(meta, gMetaCharCount);
|
||||
memcpy(&size, meta, sizeof(size));
|
||||
file.read(buffer, size);
|
||||
buffer[file.gcount()] = L'\0';
|
||||
value = buffer;
|
||||
|
||||
setStrValue(module, key, value);
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SimpleRegistry::saveToFile(const char* fileName)
|
||||
{
|
||||
std::wofstream file(fileName, std::ios_base::out|std::ios_base::trunc|std::ios_base::binary);
|
||||
file.imbue(std::locale(file.getloc(), new std::codecvt_utf16<wchar_t>));
|
||||
if (!file.is_open())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wstring module;
|
||||
|
||||
size_t size;
|
||||
wchar_t meta[gMetaCharCount];
|
||||
|
||||
/* magic number */
|
||||
file.write(gSimpleMagic, sizeof(gSimpleMagic) / sizeof(wchar_t));
|
||||
|
||||
for (auto j : m_modules)
|
||||
{
|
||||
module = j.first;
|
||||
|
||||
for (auto i : *j.second)
|
||||
{
|
||||
size = module.size();
|
||||
memcpy(meta, &size, sizeof(meta));
|
||||
file.write(meta, gMetaCharCount);
|
||||
file.write(module.c_str(), size);
|
||||
|
||||
size = i.first.size();
|
||||
memcpy(meta, &size, sizeof(meta));
|
||||
file.write(meta, gMetaCharCount);
|
||||
file.write(i.first.c_str(), size);
|
||||
|
||||
size = i.second.size();
|
||||
memcpy(meta, &size, sizeof(meta));
|
||||
file.write(meta, gMetaCharCount);
|
||||
file.write(i.second.c_str(), size);
|
||||
}
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SimpleRegistry::clear()
|
||||
{
|
||||
for (auto pair : m_modules)
|
||||
{
|
||||
delete pair.second;
|
||||
}
|
||||
|
||||
m_modules.clear();
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CEngineSettingsBackendApple::CEngineSettingsBackendApple(CEngineSettingsManager* parent, const wchar_t* moduleName)
|
||||
: CEngineSettingsBackend(parent, moduleName)
|
||||
, m_registry(new SimpleRegistry)
|
||||
, m_registryFilePath()
|
||||
{
|
||||
std::string rootValue = gEnv->pFileIO->GetAlias("@root@");
|
||||
if (rootValue.empty())
|
||||
{
|
||||
AZ_Warning("EngineSettings", false, "Could not get engine root.");
|
||||
return;
|
||||
}
|
||||
|
||||
rootValue.append(gDefaultRegistryLocation);
|
||||
m_registryFilePath = rootValue;
|
||||
}
|
||||
|
||||
CEngineSettingsBackendApple::~CEngineSettingsBackendApple()
|
||||
{
|
||||
delete m_registry, m_registry = nullptr;
|
||||
}
|
||||
|
||||
std::wstring CEngineSettingsBackendApple::GetModuleFilePath() const
|
||||
{
|
||||
std::string path;
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::string module = converter.to_bytes(moduleName());
|
||||
|
||||
void* handle = ::dlopen(module.c_str(), RTLD_LAZY);
|
||||
if (handle)
|
||||
{
|
||||
const int c = _dyld_image_count();
|
||||
for (int i = 0; i < c; ++i)
|
||||
{
|
||||
const char* image = _dyld_get_image_name(i);
|
||||
const void* altHandle = dlopen(image, RTLD_LAZY);
|
||||
if (handle == altHandle)
|
||||
{
|
||||
char absImage[PATH_MAX];
|
||||
realpath(image, absImage);
|
||||
char *ext = rindex(absImage, '.');
|
||||
if (ext)
|
||||
{
|
||||
*ext = '\0';
|
||||
}
|
||||
path.append(absImage);
|
||||
path.append(".ini");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return converter.from_bytes(path);
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendApple::GetModuleSpecificStringEntryUtf16(const char* key, CWCharBuffer wbuffer)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::wstring wkey = converter.from_bytes(key);
|
||||
|
||||
std::wstring str;
|
||||
if (!m_registry->getStrValue(moduleName(), wkey, str))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::wcscpy(wbuffer.getPtr(), str.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendApple::GetModuleSpecificIntEntry(const char* key, int& value)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::wstring wkey = converter.from_bytes(key);
|
||||
|
||||
return m_registry->getIntValue(moduleName(), wkey, value);
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendApple::GetModuleSpecificBoolEntry(const char* key, bool& value)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::wstring wkey = converter.from_bytes(key);
|
||||
|
||||
return m_registry->getBoolValue(moduleName(), wkey, value);
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendApple::SetModuleSpecificStringEntryUtf16(const char* key, const wchar_t* str)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::wstring wkey = converter.from_bytes(key);
|
||||
|
||||
m_registry->setStrValue(moduleName(), wkey, str);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendApple::SetModuleSpecificIntEntry(const char* key, const int& value)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::wstring wkey = converter.from_bytes(key);
|
||||
|
||||
m_registry->setIntValue(moduleName(), wkey, value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendApple::SetModuleSpecificBoolEntry(const char* key, const bool& value)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::wstring wkey = converter.from_bytes(key);
|
||||
|
||||
m_registry->setBoolValue(moduleName(), wkey, value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendApple::GetInstalledBuildRootPathUtf16(const int index, CWCharBuffer name, CWCharBuffer path)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendApple::StoreEngineSettingsToRegistry()
|
||||
{
|
||||
bool bRet = true;
|
||||
wchar_t buffer[1024];
|
||||
|
||||
// ResourceCompiler Specific
|
||||
if (parent()->GetValueByRef("RC_ShowWindow", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
const bool b = wcscmp(buffer, L"true") == 0;
|
||||
m_registry->setBoolValue(REG_BASE_SETTING_KEY, L"RC_ShowWindow", b);
|
||||
}
|
||||
|
||||
if (parent()->GetValueByRef("RC_HideCustom", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
const bool b = wcscmp(buffer, L"true") == 0;
|
||||
m_registry->setBoolValue(REG_BASE_SETTING_KEY, L"RC_HideCustom", b);
|
||||
}
|
||||
|
||||
if (parent()->GetValueByRef("RC_Parameters", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
m_registry->setStrValue(REG_BASE_SETTING_KEY, L"RC_Parameters", buffer);
|
||||
}
|
||||
|
||||
if (parent()->GetValueByRef("RC_EnableSourceControl", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
const bool b = wcscmp(buffer, L"true") == 0;
|
||||
m_registry->setBoolValue(REG_BASE_SETTING_KEY, L"RC_EnableSourceControl", b);
|
||||
}
|
||||
|
||||
bRet &= m_registry->saveToFile(m_registryFilePath.c_str());
|
||||
return bRet;
|
||||
}
|
||||
|
||||
void CEngineSettingsBackendApple::LoadEngineSettingsFromRegistry()
|
||||
{
|
||||
if (!m_registry->loadFromFile(m_registryFilePath.c_str()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring wStrResult;
|
||||
bool bResult;
|
||||
|
||||
if (m_registry->getStrValue(REG_BASE_SETTING_KEY, L"RootPath", wStrResult))
|
||||
{
|
||||
parent()->SetKey("ENG_RootPath", wStrResult.c_str());
|
||||
}
|
||||
|
||||
// Engine Specific
|
||||
if (m_registry->getStrValue(REG_BASE_SETTING_KEY, L"ENG_RootPath", wStrResult))
|
||||
{
|
||||
parent()->SetKey("ENG_RootPath", wStrResult.c_str());
|
||||
}
|
||||
|
||||
// ResourceCompiler Specific
|
||||
if (m_registry->getBoolValue(REG_BASE_SETTING_KEY, L"RC_ShowWindow", bResult))
|
||||
{
|
||||
parent()->SetKey("RC_ShowWindow", bResult);
|
||||
}
|
||||
if (m_registry->getBoolValue(REG_BASE_SETTING_KEY, L"RC_HideCustom", bResult))
|
||||
{
|
||||
parent()->SetKey("RC_HideCustom", bResult);
|
||||
}
|
||||
if (m_registry->getStrValue(REG_BASE_SETTING_KEY, L"RC_Parameters", wStrResult))
|
||||
{
|
||||
parent()->SetKey("RC_Parameters", wStrResult.c_str());
|
||||
}
|
||||
if (m_registry->getBoolValue(REG_BASE_SETTING_KEY, L"RC_EnableSourceControl", bResult))
|
||||
{
|
||||
parent()->SetKey("RC_EnableSourceControl", bResult);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
#endif // CRY_ENABLE_RC_HELPER
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_ENGINESETTINGSBACKENDAPPLE_H
|
||||
#define CRYINCLUDE_CRYCOMMON_ENGINESETTINGSBACKENDAPPLE_H
|
||||
#pragma once
|
||||
|
||||
#include "EngineSettingsBackend.h"
|
||||
|
||||
#ifdef CRY_ENABLE_RC_HELPER
|
||||
|
||||
class CEngineSettingsManager;
|
||||
class SimpleRegistry;
|
||||
|
||||
class CEngineSettingsBackendApple : public CEngineSettingsBackend
|
||||
{
|
||||
public:
|
||||
CEngineSettingsBackendApple(CEngineSettingsManager* parent, const wchar_t* moduleName = NULL);
|
||||
~CEngineSettingsBackendApple();
|
||||
|
||||
std::wstring GetModuleFilePath() const override;
|
||||
|
||||
bool GetModuleSpecificStringEntryUtf16(const char* key, SettingsManagerHelpers::CWCharBuffer wbuffer) override;
|
||||
bool GetModuleSpecificIntEntry(const char* key, int& value) override;
|
||||
bool GetModuleSpecificBoolEntry(const char* key, bool& value) override;
|
||||
|
||||
bool SetModuleSpecificStringEntryUtf16(const char* key, const wchar_t* str) override;
|
||||
bool SetModuleSpecificIntEntry(const char* key, const int& value) override;
|
||||
bool SetModuleSpecificBoolEntry(const char* key, const bool& value) override;
|
||||
|
||||
bool GetInstalledBuildRootPathUtf16(const int index, SettingsManagerHelpers::CWCharBuffer name, SettingsManagerHelpers::CWCharBuffer path) override;
|
||||
|
||||
void LoadEngineSettingsFromRegistry() override;
|
||||
bool StoreEngineSettingsToRegistry() override;
|
||||
|
||||
private:
|
||||
SimpleRegistry *m_registry;
|
||||
std::string m_registryFilePath;
|
||||
};
|
||||
|
||||
#endif // CRY_ENABLE_RC_HELPER
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_ENGINESETTINGSBACKENDAPPLE_H
|
||||
@@ -1,431 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "EngineSettingsBackendWin32.h"
|
||||
|
||||
#ifdef CRY_ENABLE_RC_HELPER
|
||||
|
||||
#include "AzCore/PlatformDef.h"
|
||||
|
||||
#ifdef AZ_PLATFORM_WINDOWS
|
||||
|
||||
#include "EngineSettingsManager.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include <windows.h>
|
||||
|
||||
#define REG_SOFTWARE L"Software\\"
|
||||
#define REG_COMPANY_NAME L"Amazon\\"
|
||||
#define REG_PRODUCT_NAME L"Open 3D Engine\\"
|
||||
#define REG_SETTING L"Settings\\"
|
||||
#define REG_BASE_SETTING_KEY REG_SOFTWARE REG_COMPANY_NAME REG_PRODUCT_NAME REG_SETTING
|
||||
|
||||
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
using namespace SettingsManagerHelpers;
|
||||
|
||||
static bool g_bWindowQuit;
|
||||
static CEngineSettingsManager* g_pThis = 0;
|
||||
static const unsigned int IDC_hEditRootPath = 100;
|
||||
static const unsigned int IDC_hBtnBrowse = 101;
|
||||
|
||||
namespace
|
||||
{
|
||||
class RegKey
|
||||
{
|
||||
public:
|
||||
RegKey(const wchar_t* key, bool writeable);
|
||||
~RegKey();
|
||||
void* pKey;
|
||||
};
|
||||
|
||||
RegKey::RegKey(const wchar_t* key, bool writeable)
|
||||
{
|
||||
HKEY hKey;
|
||||
LONG result;
|
||||
if (writeable)
|
||||
{
|
||||
result = RegCreateKeyExW(HKEY_CURRENT_USER, key, 0, 0, 0, KEY_WRITE, 0, &hKey, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = RegOpenKeyExW(HKEY_CURRENT_USER, key, 0, KEY_READ, &hKey);
|
||||
}
|
||||
pKey = hKey;
|
||||
}
|
||||
|
||||
RegKey::~RegKey()
|
||||
{
|
||||
RegCloseKey((HKEY)pKey);
|
||||
}
|
||||
}
|
||||
|
||||
CEngineSettingsBackendWin32::CEngineSettingsBackendWin32(CEngineSettingsManager* parent, const wchar_t* moduleName)
|
||||
: CEngineSettingsBackend(parent, moduleName)
|
||||
{
|
||||
}
|
||||
|
||||
std::wstring CEngineSettingsBackendWin32::GetModuleFilePath() const
|
||||
{
|
||||
wchar_t szFilename[_MAX_PATH];
|
||||
GetModuleFileNameW((HINSTANCE)&__ImageBase, szFilename, _MAX_PATH);
|
||||
wchar_t drive[_MAX_DRIVE];
|
||||
wchar_t dir[_MAX_DIR];
|
||||
wchar_t fname[_MAX_FNAME];
|
||||
wchar_t ext[1] = L"";
|
||||
_wsplitpath_s(szFilename, drive, dir, fname, ext);
|
||||
_wmakepath_s(szFilename, drive, dir, fname, L"ini");
|
||||
return szFilename;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::GetModuleSpecificStringEntryUtf16(const char* key, CWCharBuffer wbuffer)
|
||||
{
|
||||
CFixedString<wchar_t, 256> s = REG_BASE_SETTING_KEY;
|
||||
s.append(moduleName().c_str());
|
||||
RegKey superKey(s.c_str(), false);
|
||||
if (!superKey.pKey)
|
||||
{
|
||||
wbuffer[0] = 0;
|
||||
return false;
|
||||
}
|
||||
if (!GetRegValue(superKey.pKey, key, wbuffer))
|
||||
{
|
||||
wbuffer[0] = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::GetModuleSpecificIntEntry(const char* key, int& value)
|
||||
{
|
||||
CFixedString<wchar_t, 256> s = REG_BASE_SETTING_KEY;
|
||||
s.append(moduleName().c_str());
|
||||
RegKey superKey(s.c_str(), false);
|
||||
if (!superKey.pKey)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!GetRegValue(superKey.pKey, key, value))
|
||||
{
|
||||
value = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::GetModuleSpecificBoolEntry(const char* key, bool& value)
|
||||
{
|
||||
CFixedString<wchar_t, 256> s = REG_BASE_SETTING_KEY;
|
||||
s.append(moduleName().c_str());
|
||||
RegKey superKey(s.c_str(), false);
|
||||
if (!superKey.pKey)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!GetRegValue(superKey.pKey, key, value))
|
||||
{
|
||||
value = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::SetModuleSpecificStringEntryUtf16(const char* key, const wchar_t* str)
|
||||
{
|
||||
CFixedString<wchar_t, 256> s = REG_BASE_SETTING_KEY;
|
||||
s.append(moduleName().c_str());
|
||||
RegKey superKey(s.c_str(), true);
|
||||
if (superKey.pKey)
|
||||
{
|
||||
return SetRegValue(superKey.pKey, key, str);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::SetModuleSpecificIntEntry(const char* key, const int& value)
|
||||
{
|
||||
CFixedString<wchar_t, 256> s = REG_BASE_SETTING_KEY;
|
||||
s.append(moduleName().c_str());
|
||||
RegKey superKey(s.c_str(), true);
|
||||
if (superKey.pKey)
|
||||
{
|
||||
return SetRegValue(superKey.pKey, key, value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::SetModuleSpecificBoolEntry(const char* key, const bool& value)
|
||||
{
|
||||
CFixedString<wchar_t, 256> s = REG_BASE_SETTING_KEY;
|
||||
s.append(moduleName().c_str());
|
||||
RegKey superKey(s.c_str(), true);
|
||||
if (superKey.pKey)
|
||||
{
|
||||
return SetRegValue(superKey.pKey, key, value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::GetInstalledBuildRootPathUtf16(const int index, CWCharBuffer name, CWCharBuffer path)
|
||||
{
|
||||
RegKey key(REG_BASE_SETTING_KEY L"O3DEExport\\ProjectBuilds", false);
|
||||
if (key.pKey)
|
||||
{
|
||||
DWORD type;
|
||||
DWORD nameSizeInBytes = DWORD(name.getSizeInBytes());
|
||||
DWORD pathSizeInBytes = DWORD(path.getSizeInBytes());
|
||||
LONG result = RegEnumValueW((HKEY)key.pKey, index, name.getPtr(), &nameSizeInBytes, NULL, &type, (BYTE*)path.getPtr(), &pathSizeInBytes);
|
||||
if (result == ERROR_SUCCESS)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::StoreEngineSettingsToRegistry()
|
||||
{
|
||||
// make sure the path in registry exists
|
||||
{
|
||||
RegKey key0(REG_SOFTWARE REG_COMPANY_NAME, true);
|
||||
if (!key0.pKey)
|
||||
{
|
||||
RegKey software(REG_SOFTWARE, true);
|
||||
HKEY hKey;
|
||||
RegCreateKeyW((HKEY)software.pKey, REG_COMPANY_NAME, &hKey);
|
||||
if (!hKey)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
RegKey key1(REG_SOFTWARE REG_COMPANY_NAME REG_PRODUCT_NAME, true);
|
||||
if (!key1.pKey)
|
||||
{
|
||||
RegKey softwareCompany(REG_SOFTWARE REG_COMPANY_NAME, true);
|
||||
HKEY hKey;
|
||||
RegCreateKeyW((HKEY)softwareCompany.pKey, REG_COMPANY_NAME, &hKey);
|
||||
if (!hKey)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
RegKey key2(REG_BASE_SETTING_KEY, true);
|
||||
if (!key2.pKey)
|
||||
{
|
||||
RegKey softwareCompanyProduct(REG_SOFTWARE REG_COMPANY_NAME REG_PRODUCT_NAME, true);
|
||||
HKEY hKey;
|
||||
RegCreateKeyW((HKEY)key2.pKey, REG_SETTING, &hKey);
|
||||
if (!hKey)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool bRet = true;
|
||||
|
||||
RegKey key(REG_BASE_SETTING_KEY, true);
|
||||
if (!key.pKey)
|
||||
{
|
||||
bRet = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t buffer[1024];
|
||||
|
||||
// ResourceCompiler Specific
|
||||
|
||||
if (parent()->GetValueByRef("RC_ShowWindow", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
const bool b = wcscmp(buffer, L"true") == 0;
|
||||
SetRegValue(key.pKey, "RC_ShowWindow", b);
|
||||
}
|
||||
|
||||
if (parent()->GetValueByRef("RC_HideCustom", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
const bool b = wcscmp(buffer, L"true") == 0;
|
||||
SetRegValue(key.pKey, "RC_HideCustom", b);
|
||||
}
|
||||
|
||||
if (parent()->GetValueByRef("RC_Parameters", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
SetRegValue(key.pKey, "RC_Parameters", buffer);
|
||||
}
|
||||
|
||||
if (parent()->GetValueByRef("RC_EnableSourceControl", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
const bool b = wcscmp(buffer, L"true") == 0;
|
||||
SetRegValue(key.pKey, "RC_EnableSourceControl", b);
|
||||
}
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
void CEngineSettingsBackendWin32::LoadEngineSettingsFromRegistry()
|
||||
{
|
||||
wchar_t buffer[1024];
|
||||
|
||||
bool bResult;
|
||||
|
||||
// Engine Specific (Deprecated value)
|
||||
RegKey key(REG_BASE_SETTING_KEY, false);
|
||||
if (key.pKey)
|
||||
{
|
||||
if (GetRegValue(key.pKey, "RootPath", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
parent()->SetKey("ENG_RootPath", buffer);
|
||||
}
|
||||
|
||||
// Engine Specific
|
||||
if (GetRegValue(key.pKey, "ENG_RootPath", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
parent()->SetKey("ENG_RootPath", buffer);
|
||||
}
|
||||
|
||||
// ResourceCompiler Specific
|
||||
if (GetRegValue(key.pKey, "RC_ShowWindow", bResult))
|
||||
{
|
||||
parent()->SetKey("RC_ShowWindow", bResult);
|
||||
}
|
||||
if (GetRegValue(key.pKey, "RC_HideCustom", bResult))
|
||||
{
|
||||
parent()->SetKey("RC_HideCustom", bResult);
|
||||
}
|
||||
if (GetRegValue(key.pKey, "RC_Parameters", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
parent()->SetKey("RC_Parameters", buffer);
|
||||
}
|
||||
if (GetRegValue(key.pKey, "RC_EnableSourceControl", bResult))
|
||||
{
|
||||
parent()->SetKey("RC_EnableSourceControl", bResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::SetRegValue(void* key, const char* valueName, const wchar_t* value)
|
||||
{
|
||||
CFixedString<wchar_t, 256> name;
|
||||
name.appendAscii(valueName);
|
||||
|
||||
size_t const sizeInBytes = (wcslen(value) + 1) * sizeof(value[0]);
|
||||
return (ERROR_SUCCESS == RegSetValueExW((HKEY)key, name.c_str(), 0, REG_SZ, (BYTE*)value, DWORD(sizeInBytes)));
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::SetRegValue(void* key, const char* valueName, bool value)
|
||||
{
|
||||
CFixedString<wchar_t, 256> name;
|
||||
name.appendAscii(valueName);
|
||||
|
||||
DWORD dwVal = value;
|
||||
return (ERROR_SUCCESS == RegSetValueExW((HKEY)key, name.c_str(), 0, REG_DWORD, (BYTE*)&dwVal, sizeof(dwVal)));
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::SetRegValue(void* key, const char* valueName, int value)
|
||||
{
|
||||
CFixedString<wchar_t, 256> name;
|
||||
name.appendAscii(valueName);
|
||||
|
||||
DWORD dwVal = value;
|
||||
return (ERROR_SUCCESS == RegSetValueExW((HKEY)key, name.c_str(), 0, REG_DWORD, (BYTE*)&dwVal, sizeof(dwVal)));
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::GetRegValue(void* key, const char* valueName, CWCharBuffer wbuffer)
|
||||
{
|
||||
if (wbuffer.getSizeInElements() <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CFixedString<wchar_t, 256> name;
|
||||
name.appendAscii(valueName);
|
||||
|
||||
DWORD type;
|
||||
DWORD sizeInBytes = DWORD(wbuffer.getSizeInBytes());
|
||||
if (ERROR_SUCCESS != RegQueryValueExW((HKEY)key, name.c_str(), NULL, &type, (BYTE*)wbuffer.getPtr(), &sizeInBytes))
|
||||
{
|
||||
wbuffer[0] = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t sizeInElements = sizeInBytes / sizeof(wbuffer[0]);
|
||||
if (sizeInElements > wbuffer.getSizeInElements()) // paranoid check
|
||||
{
|
||||
wbuffer[0] = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// According to MSDN documentation for RegQueryValueEx(), strings returned by the function
|
||||
// are not zero-terminated sometimes, so we need to terminate them by ourselves.
|
||||
if (wbuffer[sizeInElements - 1] != 0)
|
||||
{
|
||||
if (sizeInElements >= wbuffer.getSizeInElements())
|
||||
{
|
||||
// No space left to put terminating zero character
|
||||
wbuffer[0] = 0;
|
||||
return false;
|
||||
}
|
||||
wbuffer[sizeInElements] = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::GetRegValue(void* key, const char* valueName, bool& value)
|
||||
{
|
||||
CFixedString<wchar_t, 256> name;
|
||||
name.appendAscii(valueName);
|
||||
|
||||
// Open the appropriate registry key
|
||||
DWORD type, dwVal = 0, size = sizeof(dwVal);
|
||||
bool res = (ERROR_SUCCESS == RegQueryValueExW((HKEY)key, name.c_str(), NULL, &type, (BYTE*)&dwVal, &size));
|
||||
if (res)
|
||||
{
|
||||
value = (dwVal != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t buffer[100];
|
||||
res = GetRegValue(key, valueName, CWCharBuffer(buffer, sizeof(buffer)));
|
||||
if (res)
|
||||
{
|
||||
value = (wcscmp(buffer, L"true") == 0);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool CEngineSettingsBackendWin32::GetRegValue(void* key, const char* valueName, int& value)
|
||||
{
|
||||
CFixedString<wchar_t, 256> name;
|
||||
name.appendAscii(valueName);
|
||||
|
||||
// Open the appropriate registry key
|
||||
DWORD type, dwVal = 0, size = sizeof(dwVal);
|
||||
|
||||
bool res = (ERROR_SUCCESS == RegQueryValueExW((HKEY)key, name.c_str(), NULL, &type, (BYTE*)&dwVal, &size));
|
||||
if (res)
|
||||
{
|
||||
value = dwVal;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif // AZ_PLATFORM_WINDOWS
|
||||
#endif // CRY_ENABLE_RC_HELPER
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_ENGINESETTINGSBACKENDWIN32_H
|
||||
#define CRYINCLUDE_CRYCOMMON_ENGINESETTINGSBACKENDWIN32_H
|
||||
#pragma once
|
||||
|
||||
#include "EngineSettingsBackend.h"
|
||||
|
||||
#ifdef CRY_ENABLE_RC_HELPER
|
||||
|
||||
class CEngineSettingsManager;
|
||||
|
||||
class CEngineSettingsBackendWin32 : public CEngineSettingsBackend
|
||||
{
|
||||
public:
|
||||
CEngineSettingsBackendWin32(CEngineSettingsManager* parent, const wchar_t* moduleName = NULL);
|
||||
|
||||
std::wstring GetModuleFilePath() const override;
|
||||
|
||||
bool GetModuleSpecificStringEntryUtf16(const char* key, SettingsManagerHelpers::CWCharBuffer wbuffer) override;
|
||||
bool GetModuleSpecificIntEntry(const char* key, int& value) override;
|
||||
bool GetModuleSpecificBoolEntry(const char* key, bool& value) override;
|
||||
|
||||
bool SetModuleSpecificStringEntryUtf16(const char* key, const wchar_t* str) override;
|
||||
bool SetModuleSpecificIntEntry(const char* key, const int& value) override;
|
||||
bool SetModuleSpecificBoolEntry(const char* key, const bool& value) override;
|
||||
|
||||
bool GetInstalledBuildRootPathUtf16(const int index, SettingsManagerHelpers::CWCharBuffer name, SettingsManagerHelpers::CWCharBuffer path) override;
|
||||
|
||||
void LoadEngineSettingsFromRegistry() override;
|
||||
bool StoreEngineSettingsToRegistry() override;
|
||||
|
||||
protected:
|
||||
bool SetRegValue(void* key, const char* valueName, const wchar_t* value);
|
||||
bool SetRegValue(void* key, const char* valueName, bool value);
|
||||
bool SetRegValue(void* key, const char* valueName, int value);
|
||||
bool GetRegValue(void* key, const char* valueName, SettingsManagerHelpers::CWCharBuffer wbuffer);
|
||||
bool GetRegValue(void* key, const char* valueName, bool& value);
|
||||
bool GetRegValue(void* key, const char* valueName, int& value);
|
||||
};
|
||||
|
||||
#endif // CRY_ENABLE_RC_HELPER
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_ENGINESETTINGSBACKENDWIN32_H
|
||||
@@ -1,479 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
|
||||
#include "ProjectDefines.h"
|
||||
#include "EngineSettingsManager.h"
|
||||
|
||||
#if defined(CRY_ENABLE_RC_HELPER)
|
||||
|
||||
#include <assert.h> // assert()
|
||||
#include "EngineSettingsBackend.h"
|
||||
|
||||
#include "AzCore/PlatformDef.h"
|
||||
#include "platform.h"
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
#include "EngineSettingsBackendWin32.h"
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#elif AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
#include "EngineSettingsBackendApple.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include <climits>
|
||||
#include <cstdio>
|
||||
|
||||
#define INFOTEXT L"Please specify the directory of your CryENGINE installation (RootPath):"
|
||||
|
||||
|
||||
using namespace SettingsManagerHelpers;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CEngineSettingsManager::CEngineSettingsManager(const wchar_t* moduleName, const wchar_t* iniFileName)
|
||||
: m_hWndParent(0)
|
||||
, m_backend(NULL)
|
||||
{
|
||||
m_sModuleName.clear();
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
m_backend = new CEngineSettingsBackendWin32(this, moduleName);
|
||||
#elif AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
m_backend = new CEngineSettingsBackendApple(this, moduleName);
|
||||
#endif
|
||||
assert(m_backend);
|
||||
|
||||
// std initialization
|
||||
RestoreDefaults();
|
||||
|
||||
// try to load content from INI file
|
||||
if (moduleName != NULL)
|
||||
{
|
||||
m_sModuleName = moduleName;
|
||||
|
||||
if (iniFileName == NULL)
|
||||
{
|
||||
// find INI filename located in module path
|
||||
m_sModuleFileName = m_backend->GetModuleFilePath().c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sModuleFileName = iniFileName;
|
||||
}
|
||||
|
||||
if (LoadValuesFromConfigFile(m_sModuleFileName.c_str()))
|
||||
{
|
||||
m_bGetDataFromBackend = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_bGetDataFromBackend = true;
|
||||
|
||||
// load basic content from registry
|
||||
LoadEngineSettingsFromRegistry();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CEngineSettingsManager::~CEngineSettingsManager()
|
||||
{
|
||||
delete m_backend, m_backend = NULL;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEngineSettingsManager::RestoreDefaults()
|
||||
{
|
||||
// Engine
|
||||
SetKey("ENG_RootPath", L"");
|
||||
|
||||
// RC
|
||||
SetKey("RC_ShowWindow", false);
|
||||
SetKey("RC_HideCustom", false);
|
||||
SetKey("RC_Parameters", L"");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::GetModuleSpecificStringEntryUtf16(const char* key, SettingsManagerHelpers::CWCharBuffer wbuffer)
|
||||
{
|
||||
if (wbuffer.getSizeInElements() <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_bGetDataFromBackend)
|
||||
{
|
||||
if (!HasKey(key))
|
||||
{
|
||||
wbuffer[0] = 0;
|
||||
return false;
|
||||
}
|
||||
if (!GetValueByRef(key, wbuffer))
|
||||
{
|
||||
wbuffer[0] = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(m_backend);
|
||||
return m_backend->GetModuleSpecificStringEntryUtf16(key, wbuffer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::GetModuleSpecificStringEntryUtf8(const char* key, SettingsManagerHelpers::CCharBuffer buffer)
|
||||
{
|
||||
if (buffer.getSizeInElements() <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
wchar_t wBuffer[1024];
|
||||
|
||||
if (!GetModuleSpecificStringEntryUtf16(key, SettingsManagerHelpers::CWCharBuffer(wBuffer, sizeof(wBuffer))))
|
||||
{
|
||||
buffer[0] = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
SettingsManagerHelpers::ConvertUtf16ToUtf8(wBuffer, buffer);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::GetModuleSpecificIntEntry(const char* key, int& value)
|
||||
{
|
||||
value = 0;
|
||||
|
||||
if (!m_bGetDataFromBackend)
|
||||
{
|
||||
if (!HasKey(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!GetValueByRef(key, value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(m_backend);
|
||||
return m_backend->GetModuleSpecificIntEntry(key, value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::GetModuleSpecificBoolEntry(const char* key, bool& value)
|
||||
{
|
||||
value = false;
|
||||
|
||||
if (!m_bGetDataFromBackend)
|
||||
{
|
||||
if (!HasKey(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!GetValueByRef(key, value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(m_backend);
|
||||
return m_backend->GetModuleSpecificBoolEntry(key, value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::SetModuleSpecificStringEntryUtf16(const char* key, const wchar_t* str)
|
||||
{
|
||||
SetKey(key, str);
|
||||
if (!m_bGetDataFromBackend)
|
||||
{
|
||||
return StoreData();
|
||||
}
|
||||
|
||||
assert(m_backend);
|
||||
return m_backend->SetModuleSpecificStringEntryUtf16(key, str);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::SetModuleSpecificIntEntry(const char* key, const int& value)
|
||||
{
|
||||
SetKey(key, value);
|
||||
if (!m_bGetDataFromBackend)
|
||||
{
|
||||
return StoreData();
|
||||
}
|
||||
|
||||
assert(m_backend);
|
||||
return m_backend->SetModuleSpecificIntEntry(key, value);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::SetModuleSpecificBoolEntry(const char* key, const bool& value)
|
||||
{
|
||||
SetKey(key, value);
|
||||
if (!m_bGetDataFromBackend)
|
||||
{
|
||||
return StoreData();
|
||||
}
|
||||
|
||||
assert(m_backend);
|
||||
return m_backend->SetModuleSpecificBoolEntry(key, value);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::SetModuleSpecificStringEntryUtf8(const char* key, const char* str)
|
||||
{
|
||||
wchar_t wbuffer[512];
|
||||
SettingsManagerHelpers::ConvertUtf8ToUtf16(str, SettingsManagerHelpers::CWCharBuffer(wbuffer, sizeof(wbuffer)));
|
||||
|
||||
return SetModuleSpecificStringEntryUtf16(key, wbuffer);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::HasKey(const char* key)
|
||||
{
|
||||
return m_keyValueArray.find(key) != 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEngineSettingsManager::SetKey(const char* key, const wchar_t* value)
|
||||
{
|
||||
m_keyValueArray.set(key, value);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEngineSettingsManager::SetKey(const char* key, bool value)
|
||||
{
|
||||
m_keyValueArray.set(key, (value ? L"true" : L"false"));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEngineSettingsManager::SetKey(const char* key, int value)
|
||||
{
|
||||
m_keyValueArray.set(key, std::to_wstring(value).c_str());
|
||||
}
|
||||
|
||||
bool CEngineSettingsManager::GetInstalledBuildRootPathUtf16(const int index, SettingsManagerHelpers::CWCharBuffer name, SettingsManagerHelpers::CWCharBuffer path)
|
||||
{
|
||||
assert(m_backend);
|
||||
return m_backend->GetInstalledBuildRootPathUtf16(index, name, path);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEngineSettingsManager::SetParentDialog(size_t window)
|
||||
{
|
||||
m_hWndParent = window;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::StoreData()
|
||||
{
|
||||
if (m_bGetDataFromBackend)
|
||||
{
|
||||
bool res = StoreEngineSettingsToRegistry();
|
||||
|
||||
if (!res)
|
||||
{
|
||||
#ifdef AZ_PLATFORM_WINDOWS
|
||||
MessageBoxA(reinterpret_cast<HWND>(m_hWndParent), "Could not store data to registry.", "Error", MB_OK | MB_ICONERROR);
|
||||
#endif
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// store data to INI file
|
||||
|
||||
FILE* file;
|
||||
#ifdef AZ_PLATFORM_WINDOWS
|
||||
_wfopen_s(&file, m_sModuleFileName.c_str(), L"wb");
|
||||
#else
|
||||
char fname[MAX_PATH];
|
||||
memset(fname, 0, MAX_PATH);
|
||||
wcstombs(fname, m_sModuleFileName.c_str(), MAX_PATH);
|
||||
file = fopen(fname, "wb");
|
||||
#endif
|
||||
if (file == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char buffer[2048];
|
||||
|
||||
for (size_t i = 0; i < m_keyValueArray.size(); ++i)
|
||||
{
|
||||
const SKeyValue& kv = m_keyValueArray[i];
|
||||
|
||||
fprintf_s(file, kv.key.c_str());
|
||||
fprintf_s(file, " = ");
|
||||
|
||||
if (kv.value.length() > 0)
|
||||
{
|
||||
SettingsManagerHelpers::ConvertUtf16ToUtf8(kv.value.c_str(), SettingsManagerHelpers::CCharBuffer(buffer, sizeof(buffer)));
|
||||
fprintf_s(file, "%s", buffer);
|
||||
}
|
||||
|
||||
fprintf_s(file, "\r\n");
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::LoadValuesFromConfigFile(const wchar_t* szFileName)
|
||||
{
|
||||
m_keyValueArray.clear();
|
||||
|
||||
// read file to memory
|
||||
|
||||
FILE* file;
|
||||
#ifdef AZ_PLATFORM_WINDOWS
|
||||
_wfopen_s(&file, szFileName, L"rb");
|
||||
#else
|
||||
char fname[MAX_PATH];
|
||||
memset(fname, 0, MAX_PATH);
|
||||
wcstombs(fname, szFileName, MAX_PATH);
|
||||
file = fopen(fname, "rb");
|
||||
#endif
|
||||
if (file == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
long size = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
char* data = new char[size + 1];
|
||||
fread_s(data, size, 1, size, file);
|
||||
fclose(file);
|
||||
|
||||
wchar_t wBuffer[1024];
|
||||
|
||||
// parse file for root path
|
||||
|
||||
int start = 0, end = 0;
|
||||
while (end < size)
|
||||
{
|
||||
while (end < size && data[end] != '\n')
|
||||
{
|
||||
end++;
|
||||
}
|
||||
|
||||
memcpy(data, &data[start], end - start);
|
||||
data[end - start] = 0;
|
||||
start = end = end + 1;
|
||||
|
||||
CFixedString<char, 2048> line(data);
|
||||
size_t equalsOfs;
|
||||
for (equalsOfs = 0; equalsOfs < line.length(); ++equalsOfs)
|
||||
{
|
||||
if (line[equalsOfs] == '=')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (equalsOfs < line.length())
|
||||
{
|
||||
CFixedString<char, 256> key;
|
||||
CFixedString<wchar_t, 1024> value;
|
||||
|
||||
key.appendAscii(line.c_str(), equalsOfs);
|
||||
key.trim();
|
||||
|
||||
SettingsManagerHelpers::ConvertUtf8ToUtf16(line.c_str() + equalsOfs + 1, SettingsManagerHelpers::CWCharBuffer(wBuffer, sizeof(wBuffer)));
|
||||
value.append(wBuffer);
|
||||
value.trim();
|
||||
|
||||
m_keyValueArray.set(key.c_str(), value.c_str());
|
||||
}
|
||||
}
|
||||
delete[] data;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::StoreEngineSettingsToRegistry()
|
||||
{
|
||||
assert(m_backend);
|
||||
return m_backend->StoreEngineSettingsToRegistry();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CEngineSettingsManager::LoadEngineSettingsFromRegistry()
|
||||
{
|
||||
assert(m_backend);
|
||||
m_backend->LoadEngineSettingsFromRegistry();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::GetValueByRef(const char* key, SettingsManagerHelpers::CWCharBuffer wbuffer) const
|
||||
{
|
||||
if (wbuffer.getSizeInElements() <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const SKeyValue* p = m_keyValueArray.find(key);
|
||||
if (!p || (p->value.length() + 1) > wbuffer.getSizeInElements())
|
||||
{
|
||||
wbuffer[0] = 0;
|
||||
return false;
|
||||
}
|
||||
azwcscpy(wbuffer.getPtr(), wbuffer.getSizeInElements(), p->value.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::GetValueByRef(const char* key, bool& value) const
|
||||
{
|
||||
wchar_t buffer[100];
|
||||
if (!GetValueByRef(key, SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
value = (wcscmp(buffer, L"true") == 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CEngineSettingsManager::GetValueByRef(const char* key, int& value) const
|
||||
{
|
||||
wchar_t buffer[100];
|
||||
if (!GetValueByRef(key, SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
value = wcstol(buffer, 0, 10);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif //(CRY_ENABLE_RC_HELPER)
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_ENGINESETTINGSMANAGER_H
|
||||
#define CRYINCLUDE_CRYCOMMON_ENGINESETTINGSMANAGER_H
|
||||
#pragma once
|
||||
|
||||
#include "ProjectDefines.h"
|
||||
|
||||
#if defined(CRY_ENABLE_RC_HELPER)
|
||||
|
||||
#include "SettingsManagerHelpers.h"
|
||||
|
||||
class CEngineSettingsBackend;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Manages storage and loading of all information for tools and CryENGINE, by either registry or an INI file.
|
||||
// Information can be read and set by key-to-value functions.
|
||||
// Specific information can be set by a dialog application called by this class.
|
||||
// If the engine root path is not found, a fall-back dialog is opened.
|
||||
class CEngineSettingsManager
|
||||
{
|
||||
public:
|
||||
// prepares CEngineSettingsManager to get requested information either from registry or an INI file,
|
||||
// if existent as a file with name an directory equal to the module, or from registry.
|
||||
CEngineSettingsManager(const wchar_t* moduleName = NULL, const wchar_t* iniFileName = NULL);
|
||||
~CEngineSettingsManager();
|
||||
|
||||
void RestoreDefaults();
|
||||
|
||||
// stores/loads user specific information for modules to/from registry or INI file
|
||||
bool GetModuleSpecificStringEntryUtf16(const char* key, SettingsManagerHelpers::CWCharBuffer wbuffer);
|
||||
bool GetModuleSpecificStringEntryUtf8(const char* key, SettingsManagerHelpers::CCharBuffer buffer);
|
||||
bool GetModuleSpecificIntEntry(const char* key, int& value);
|
||||
bool GetModuleSpecificBoolEntry(const char* key, bool& value);
|
||||
|
||||
bool SetModuleSpecificStringEntryUtf16(const char* key, const wchar_t* str);
|
||||
bool SetModuleSpecificStringEntryUtf8(const char* key, const char* str);
|
||||
bool SetModuleSpecificIntEntry(const char* key, const int& value);
|
||||
bool SetModuleSpecificBoolEntry(const char* key, const bool& value);
|
||||
|
||||
bool GetValueByRef(const char* key, SettingsManagerHelpers::CWCharBuffer wbuffer) const;
|
||||
bool GetValueByRef(const char* key, bool& value) const;
|
||||
bool GetValueByRef(const char* key, int& value) const;
|
||||
|
||||
void SetKey(const char* key, const wchar_t* value);
|
||||
void SetKey(const char* key, bool value);
|
||||
void SetKey(const char* key, int value);
|
||||
|
||||
bool StoreData();
|
||||
|
||||
bool GetInstalledBuildRootPathUtf16(const int index, SettingsManagerHelpers::CWCharBuffer name, SettingsManagerHelpers::CWCharBuffer path);
|
||||
|
||||
void SetParentDialog(size_t window);
|
||||
|
||||
private:
|
||||
bool HasKey(const char* key);
|
||||
|
||||
void LoadEngineSettingsFromRegistry();
|
||||
bool StoreEngineSettingsToRegistry();
|
||||
|
||||
// parses a file and stores all flags in a private key-value-map
|
||||
bool LoadValuesFromConfigFile(const wchar_t* szFileName);
|
||||
|
||||
private:
|
||||
CEngineSettingsBackend *m_backend;
|
||||
|
||||
SettingsManagerHelpers::CFixedString<wchar_t, 256> m_sModuleName; // name to store key-value pairs of modules in (registry) or to identify INI file
|
||||
SettingsManagerHelpers::CFixedString<wchar_t, 256> m_sModuleFileName; // used in case of data being loaded from INI file
|
||||
bool m_bGetDataFromBackend;
|
||||
SettingsManagerHelpers::CKeyValueArray<30> m_keyValueArray;
|
||||
|
||||
void* m_hBtnBrowse;
|
||||
size_t m_hWndParent;
|
||||
};
|
||||
|
||||
#endif // CRY_ENABLE_RC_HELPER
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_ENGINESETTINGSMANAGER_H
|
||||
@@ -1,228 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_IFLARES_H
|
||||
#define CRYINCLUDE_CRYCOMMON_IFLARES_H
|
||||
#pragma once
|
||||
|
||||
#include <IFuncVariable.h> // <> required for Interfuscator
|
||||
#include <IXml.h> // <> required for Interfuscator
|
||||
#include "smartptr.h"
|
||||
|
||||
struct IShader;
|
||||
class CCamera;
|
||||
|
||||
class __MFPA
|
||||
{
|
||||
};
|
||||
class __MFPB
|
||||
{
|
||||
};
|
||||
#define MFP_SIZE_ENFORCE : public __MFPA, public __MFPB
|
||||
|
||||
enum EFlareType
|
||||
{
|
||||
eFT__Base__,
|
||||
eFT_Root,
|
||||
eFT_Group,
|
||||
eFT_Ghost,
|
||||
eFT_MultiGhosts,
|
||||
eFT_Glow,
|
||||
eFT_ChromaticRing,
|
||||
eFT_IrisShafts,
|
||||
eFT_CameraOrbs,
|
||||
eFT_ImageSpaceShafts,
|
||||
eFT_Streaks,
|
||||
eFT_Reference,
|
||||
eFT_Proxy,
|
||||
eFT_Max
|
||||
};
|
||||
|
||||
#define FLARE_LIBS_PATH "libs/flares/"
|
||||
#define FLARE_EXPORT_FILE "LensFlareList.xml"
|
||||
#define FLARE_EXPORT_FILE_VERSION "1"
|
||||
|
||||
struct FlareInfo
|
||||
{
|
||||
EFlareType type;
|
||||
const char* name;
|
||||
#if defined(FLARES_SUPPORT_EDITING)
|
||||
const char* imagename;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(FLARES_SUPPORT_EDITING)
|
||||
# define ADD_FLARE_INFO(type, name, imagename) {type, name, imagename}
|
||||
#else
|
||||
# define ADD_FLARE_INFO(type, name, imagename) {type, name}
|
||||
#endif
|
||||
|
||||
class FlareInfoArray
|
||||
{
|
||||
public:
|
||||
struct Props
|
||||
{
|
||||
const FlareInfo* p;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
static const Props Get()
|
||||
{
|
||||
static const FlareInfo flareInfoArray[] =
|
||||
{
|
||||
ADD_FLARE_INFO(eFT__Base__, "__Base__", NULL),
|
||||
ADD_FLARE_INFO(eFT_Root, "Root", NULL),
|
||||
ADD_FLARE_INFO(eFT_Group, "Group", NULL),
|
||||
ADD_FLARE_INFO(eFT_Ghost, "Ghost", "EngineAssets/Textures/flares/icons/ghost.dds"),
|
||||
ADD_FLARE_INFO(eFT_MultiGhosts, "Multi Ghost", "EngineAssets/Textures/flares/icons/multi_ghost.dds"),
|
||||
ADD_FLARE_INFO(eFT_Glow, "Glow", "EngineAssets/Textures/flares/icons/glow.dds"),
|
||||
ADD_FLARE_INFO(eFT_ChromaticRing, "ChromaticRing", "EngineAssets/Textures/flares/icons/ring.dds"),
|
||||
ADD_FLARE_INFO(eFT_IrisShafts, "IrisShafts", "EngineAssets/Textures/flares/icons/iris_shafts.dds"),
|
||||
ADD_FLARE_INFO(eFT_CameraOrbs, "CameraOrbs", "EngineAssets/Textures/flares/icons/orbs.dds"),
|
||||
ADD_FLARE_INFO(eFT_ImageSpaceShafts, "Vol Shafts", "EngineAssets/Textures/flares/icons/vol_shafts.dds"),
|
||||
ADD_FLARE_INFO(eFT_Streaks, "Streaks", "EngineAssets/Textures/flares/icons/iris_shafts.dds")
|
||||
};
|
||||
|
||||
Props ret;
|
||||
ret.p = flareInfoArray;
|
||||
ret.size = sizeof(flareInfoArray) / sizeof(flareInfoArray[0]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private:
|
||||
FlareInfoArray();
|
||||
~FlareInfoArray();
|
||||
};
|
||||
|
||||
struct SLensFlareRenderParam
|
||||
{
|
||||
SLensFlareRenderParam()
|
||||
: pCamera(NULL)
|
||||
, pShader(NULL)
|
||||
{
|
||||
}
|
||||
~SLensFlareRenderParam(){}
|
||||
bool IsValid() const
|
||||
{
|
||||
return pCamera && pShader;
|
||||
}
|
||||
CCamera* pCamera;
|
||||
IShader* pShader;
|
||||
};
|
||||
|
||||
class ISoftOcclusionQuery
|
||||
{
|
||||
public:
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~ISoftOcclusionQuery() {}
|
||||
|
||||
virtual void AddRef() = 0;
|
||||
virtual void Release() = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
class IOpticsElementBase MFP_SIZE_ENFORCE
|
||||
{
|
||||
public:
|
||||
|
||||
IOpticsElementBase()
|
||||
: m_nRefCount(0)
|
||||
{
|
||||
}
|
||||
void AddRef()
|
||||
{
|
||||
CryInterlockedIncrement(&m_nRefCount);
|
||||
}
|
||||
void Release()
|
||||
{
|
||||
if (CryInterlockedDecrement(&m_nRefCount) <= 0)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
// <interfuscator:shuffle>
|
||||
virtual EFlareType GetType() = 0;
|
||||
virtual bool IsGroup() const = 0;
|
||||
virtual string GetName() const = 0;
|
||||
virtual void SetName(const char* ch_name) = 0;
|
||||
virtual void Load(IXmlNode* pNode) = 0;
|
||||
|
||||
virtual IOpticsElementBase* GetParent() const = 0;
|
||||
virtual ~IOpticsElementBase() {
|
||||
}
|
||||
|
||||
virtual bool IsEnabled() const = 0;
|
||||
|
||||
virtual void AddElement(IOpticsElementBase* pElement) = 0;
|
||||
virtual void InsertElement(int nPos, IOpticsElementBase* pElement) = 0;
|
||||
virtual void Remove(int i) = 0;
|
||||
virtual void RemoveAll() = 0;
|
||||
virtual int GetElementCount() const = 0;
|
||||
virtual IOpticsElementBase* GetElementAt(int i) const = 0;
|
||||
|
||||
virtual void GetMemoryUsage(ICrySizer* pSizer) const = 0;
|
||||
virtual void Invalidate() = 0;
|
||||
|
||||
virtual void Render(SLensFlareRenderParam* pParam, const Vec3& vPos) = 0;
|
||||
|
||||
virtual void SetOpticsReference([[maybe_unused]] IOpticsElementBase* pReference) {}
|
||||
virtual IOpticsElementBase* GetOpticsReference() const { return NULL; }
|
||||
// </interfuscator:shuffle>
|
||||
|
||||
#if defined(FLARES_SUPPORT_EDITING)
|
||||
virtual AZStd::vector<FuncVariableGroup> GetEditorParamGroups() = 0;
|
||||
#endif
|
||||
|
||||
///Basic Setters///////////////////////////////////////////////////////////////
|
||||
virtual void SetEnabled(bool enabled) { (void)enabled; }
|
||||
virtual void SetSize(float size) { (void)size; }
|
||||
virtual void SetPerspectiveFactor(float perspectiveFactor) { (void)perspectiveFactor; }
|
||||
virtual void SetDistanceFadingFactor(float distanceFadingFactor) { (void)distanceFadingFactor; }
|
||||
virtual void SetBrightness(float brightness) { (void)brightness; }
|
||||
virtual void SetColor(ColorF color) { (void)color; }
|
||||
virtual void SetMovement(Vec2 movement) { (void)movement; }
|
||||
virtual void SetTransform(const Matrix33& xform) { (void)xform; }
|
||||
virtual void SetOccBokehEnabled(bool occBokehEnabled) { (void)occBokehEnabled; }
|
||||
virtual void SetOrbitAngle(float orbitAngle) { (void)orbitAngle; }
|
||||
virtual void SetSensorSizeFactor(float sizeFactor) { (void)sizeFactor; }
|
||||
virtual void SetSensorBrightnessFactor(float brightnessFactor) { (void)brightnessFactor; }
|
||||
virtual void SetAutoRotation(bool autoRotation) { (void)autoRotation; }
|
||||
virtual void SetAspectRatioCorrection(bool aspectRatioCorrection) { (void)aspectRatioCorrection; }
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private:
|
||||
|
||||
volatile int m_nRefCount;
|
||||
};
|
||||
|
||||
class IOpticsManager
|
||||
{
|
||||
public:
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~IOpticsManager(){}
|
||||
virtual void Reset() = 0;
|
||||
virtual IOpticsElementBase* Create(EFlareType type) const = 0;
|
||||
virtual bool Load(const char* fullFlareName, int& nOutIndex, bool forceReload = false) = 0;
|
||||
virtual bool Load(XmlNodeRef& rootNode, int& nOutIndex) = 0;
|
||||
virtual IOpticsElementBase* GetOptics(int nIndex) = 0;
|
||||
virtual bool AddOptics(IOpticsElementBase* pOptics, const char* name, int& nOutNewIndex, bool allowReplace = false) = 0;
|
||||
virtual bool Rename(const char* fullFlareName, const char* newFullFlareName) = 0;
|
||||
virtual void GetMemoryUsage(ICrySizer* pSizer) const = 0;
|
||||
virtual void Invalidate() = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
typedef _smart_ptr<IOpticsElementBase> IOpticsElementBasePtr;
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_IFLARES_H
|
||||
@@ -1,504 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
// Description : Interface to the Material Effects System
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_IMATERIALEFFECTS_H
|
||||
#define CRYINCLUDE_CRYCOMMON_IMATERIALEFFECTS_H
|
||||
#pragma once
|
||||
|
||||
#if !defined(_RELEASE)
|
||||
#define MATERIAL_EFFECTS_DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
#include "CryFixedArray.h"
|
||||
|
||||
struct IRenderNode;
|
||||
struct ISurfaceType;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
enum EMFXPlayFlags
|
||||
{
|
||||
eMFXPF_Disable_Delay = BIT(0),
|
||||
eMFXPF_Audio = BIT(1),
|
||||
eMFXPF_Decal = BIT(2),
|
||||
eMFXPF_Particles = BIT(3),
|
||||
eMFXPF_Deprecated0 = BIT(4), // formerly eMFXPF_Flowgraph
|
||||
eMFXPF_ForceFeedback = BIT(5),
|
||||
eMFXPF_All = (eMFXPF_Audio | eMFXPF_Decal | eMFXPF_Particles | eMFXPF_Deprecated0 | eMFXPF_ForceFeedback),
|
||||
};
|
||||
|
||||
#define MFX_INVALID_ANGLE (gf_PI2 + 1)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct SMFXAudioEffectRtpc
|
||||
{
|
||||
SMFXAudioEffectRtpc()
|
||||
{
|
||||
rtpcName = "";
|
||||
rtpcValue = 0.0f;
|
||||
}
|
||||
const char* rtpcName;
|
||||
float rtpcValue;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct SMFXRunTimeEffectParams
|
||||
{
|
||||
static const int MAX_AUDIO_RTPCS = 4;
|
||||
|
||||
SMFXRunTimeEffectParams()
|
||||
: playSoundFP(false)
|
||||
, playflags(eMFXPF_All)
|
||||
, fLastTime(0.0f)
|
||||
, srcSurfaceId(0)
|
||||
, trgSurfaceId(0)
|
||||
, srcRenderNode(0)
|
||||
, trgRenderNode(0)
|
||||
, partID(0)
|
||||
, pos(ZERO)
|
||||
, decalPos(ZERO)
|
||||
, normal(0.0f, 0.0f, 1.0f)
|
||||
, angle(MFX_INVALID_ANGLE)
|
||||
, scale(1.0f)
|
||||
, audioComponentOffset(ZERO)
|
||||
, numAudioRtpcs(0)
|
||||
, fDecalPlacementTestMaxSize(1000.f)
|
||||
{
|
||||
dir[0].Set(0.0f, 0.0f, -1.0f);
|
||||
dir[1].Set(0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
bool AddAudioRtpc(const char* name, float val)
|
||||
{
|
||||
if (numAudioRtpcs < MAX_AUDIO_RTPCS)
|
||||
{
|
||||
audioRtpcs[numAudioRtpcs].rtpcName = name;
|
||||
audioRtpcs[numAudioRtpcs].rtpcValue = val;
|
||||
++numAudioRtpcs;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ResetAudioRtpcs()
|
||||
{
|
||||
numAudioRtpcs = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
uint16 playSoundFP; // Sets 1p/3p audio switch
|
||||
uint16 playflags; // See EMFXPlayFlags
|
||||
float fLastTime; // Last time this effect was played
|
||||
float fDecalPlacementTestMaxSize;
|
||||
|
||||
int srcSurfaceId;
|
||||
int trgSurfaceId;
|
||||
IRenderNode* srcRenderNode;
|
||||
IRenderNode* trgRenderNode;
|
||||
int partID;
|
||||
|
||||
Vec3 pos;
|
||||
Vec3 decalPos;
|
||||
Vec3 dir[2];
|
||||
Vec3 normal;
|
||||
float angle;
|
||||
float scale;
|
||||
|
||||
// audio related
|
||||
Vec3 audioComponentOffset; // in case of audio component, uses this offset
|
||||
|
||||
SMFXAudioEffectRtpc audioRtpcs[MAX_AUDIO_RTPCS];
|
||||
uint32 numAudioRtpcs;
|
||||
};
|
||||
|
||||
struct SMFXBreakageParams
|
||||
{
|
||||
enum EBreakageRequestFlags
|
||||
{
|
||||
eBRF_Matrix = BIT(0),
|
||||
eBRF_HitPos = BIT(1),
|
||||
eBRF_HitImpulse = BIT(2),
|
||||
eBRF_Velocity = BIT(3),
|
||||
eBRF_ExplosionImpulse = BIT(4),
|
||||
eBRF_Mass = BIT(5),
|
||||
eBFR_Entity = BIT(6),
|
||||
};
|
||||
|
||||
SMFXBreakageParams()
|
||||
: m_flags(0)
|
||||
, m_worldTM(IDENTITY)
|
||||
, m_vHitPos(ZERO)
|
||||
, m_vHitImpulse(IDENTITY)
|
||||
, m_vVelocity(ZERO)
|
||||
, m_fExplosionImpulse(1.0f)
|
||||
, m_fMass(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Matrix
|
||||
void SetMatrix(const Matrix34& worldTM)
|
||||
{
|
||||
m_worldTM = worldTM;
|
||||
SetFlag(eBRF_Matrix);
|
||||
}
|
||||
|
||||
const Matrix34& GetMatrix() const
|
||||
{
|
||||
return m_worldTM;
|
||||
}
|
||||
|
||||
// HitPos
|
||||
void SetHitPos(const Vec3& vHitPos)
|
||||
{
|
||||
m_vHitPos = vHitPos;
|
||||
SetFlag(eBRF_HitPos);
|
||||
}
|
||||
|
||||
const Vec3& GetHitPos() const
|
||||
{
|
||||
return m_vHitPos;
|
||||
}
|
||||
|
||||
// HitImpulse
|
||||
void SetHitImpulse(const Vec3& vHitImpulse)
|
||||
{
|
||||
m_vHitImpulse = vHitImpulse;
|
||||
SetFlag(eBRF_HitImpulse);
|
||||
}
|
||||
|
||||
const Vec3& GetHitImpulse() const
|
||||
{
|
||||
return m_vHitImpulse;
|
||||
}
|
||||
|
||||
// Velocity
|
||||
void SetVelocity(const Vec3& vVelocity)
|
||||
{
|
||||
m_vVelocity = vVelocity;
|
||||
SetFlag(eBRF_Velocity);
|
||||
}
|
||||
|
||||
const Vec3& GetVelocity() const
|
||||
{
|
||||
return m_vVelocity;
|
||||
}
|
||||
|
||||
// Explosion Impulse
|
||||
void SetExplosionImpulse(float fExplosionImpulse)
|
||||
{
|
||||
m_fExplosionImpulse = fExplosionImpulse;
|
||||
SetFlag(eBRF_ExplosionImpulse);
|
||||
}
|
||||
|
||||
float GetExplosionImpulse() const
|
||||
{
|
||||
return m_fExplosionImpulse;
|
||||
}
|
||||
|
||||
// Mass
|
||||
void SetMass(float fMass)
|
||||
{
|
||||
m_fMass = fMass;
|
||||
SetFlag(eBRF_Mass);
|
||||
}
|
||||
|
||||
float GetMass() const
|
||||
{
|
||||
return m_fMass;
|
||||
}
|
||||
|
||||
// Checking for flags
|
||||
bool CheckFlag(EBreakageRequestFlags flag) const
|
||||
{
|
||||
return (m_flags & flag) != 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
void SetFlag(EBreakageRequestFlags flag)
|
||||
{
|
||||
m_flags |= flag;
|
||||
}
|
||||
|
||||
void ClearFlag(EBreakageRequestFlags flag)
|
||||
{
|
||||
m_flags &= ~flag;
|
||||
}
|
||||
|
||||
uint32 m_flags;
|
||||
Matrix34 m_worldTM;
|
||||
Vec3 m_vHitPos;
|
||||
Vec3 m_vHitImpulse;
|
||||
Vec3 m_vVelocity;
|
||||
float m_fExplosionImpulse;
|
||||
float m_fMass;
|
||||
};
|
||||
|
||||
class IMFXParticleParams
|
||||
{
|
||||
public:
|
||||
IMFXParticleParams()
|
||||
: name(NULL)
|
||||
, userdata(NULL)
|
||||
, scale(1.0f)
|
||||
{
|
||||
}
|
||||
|
||||
const char* name;
|
||||
const char* userdata;
|
||||
float scale;
|
||||
};
|
||||
|
||||
class SMFXParticleListNode
|
||||
{
|
||||
public:
|
||||
static SMFXParticleListNode* Create();
|
||||
void Destroy();
|
||||
static void FreePool();
|
||||
|
||||
IMFXParticleParams m_particleParams;
|
||||
SMFXParticleListNode* pNext;
|
||||
|
||||
private:
|
||||
SMFXParticleListNode()
|
||||
{
|
||||
pNext = NULL;
|
||||
}
|
||||
~SMFXParticleListNode() {}
|
||||
};
|
||||
|
||||
class IMFXAudioParams
|
||||
{
|
||||
const static uint MAX_SWITCH_DATA_ELEMENTS = 4;
|
||||
|
||||
public:
|
||||
|
||||
struct SSwitchData
|
||||
{
|
||||
SSwitchData()
|
||||
: switchName(NULL)
|
||||
, switchStateName(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
const char* switchName;
|
||||
const char* switchStateName;
|
||||
};
|
||||
|
||||
IMFXAudioParams()
|
||||
: triggerName(NULL)
|
||||
{
|
||||
}
|
||||
const char* triggerName;
|
||||
|
||||
CryFixedArray<SSwitchData, MAX_SWITCH_DATA_ELEMENTS> triggerSwitches;
|
||||
};
|
||||
|
||||
class SMFXAudioListNode
|
||||
{
|
||||
public:
|
||||
static SMFXAudioListNode* Create();
|
||||
void Destroy();
|
||||
static void FreePool();
|
||||
|
||||
IMFXAudioParams m_audioParams;
|
||||
SMFXAudioListNode* pNext;
|
||||
|
||||
private:
|
||||
SMFXAudioListNode()
|
||||
: pNext(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
~SMFXAudioListNode()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class IMFXDecalParams
|
||||
{
|
||||
public:
|
||||
IMFXDecalParams()
|
||||
{
|
||||
filename = 0;
|
||||
material = 0;
|
||||
minscale = 1.f;
|
||||
maxscale = 1.f;
|
||||
rotation = -1.f;
|
||||
lifetime = 10.0f;
|
||||
assemble = false;
|
||||
forceedge = false;
|
||||
}
|
||||
const char* filename;
|
||||
const char* material;
|
||||
float minscale;
|
||||
float maxscale;
|
||||
float rotation;
|
||||
float lifetime;
|
||||
bool assemble;
|
||||
bool forceedge;
|
||||
};
|
||||
|
||||
class SMFXDecalListNode
|
||||
{
|
||||
public:
|
||||
static SMFXDecalListNode* Create();
|
||||
void Destroy();
|
||||
static void FreePool();
|
||||
|
||||
IMFXDecalParams m_decalParams;
|
||||
SMFXDecalListNode* pNext;
|
||||
|
||||
private:
|
||||
SMFXDecalListNode()
|
||||
{
|
||||
pNext = 0;
|
||||
}
|
||||
~SMFXDecalListNode() {}
|
||||
};
|
||||
|
||||
class IMFXForceFeedbackParams
|
||||
{
|
||||
public:
|
||||
IMFXForceFeedbackParams()
|
||||
: forceFeedbackEventName (NULL)
|
||||
, intensityFallOffMinDistanceSqr(0.0f)
|
||||
, intensityFallOffMaxDistanceSqr(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
const char* forceFeedbackEventName;
|
||||
float intensityFallOffMinDistanceSqr;
|
||||
float intensityFallOffMaxDistanceSqr;
|
||||
};
|
||||
|
||||
class SMFXForceFeedbackListNode
|
||||
{
|
||||
public:
|
||||
static SMFXForceFeedbackListNode* Create();
|
||||
void Destroy();
|
||||
static void FreePool();
|
||||
|
||||
IMFXForceFeedbackParams m_forceFeedbackParams;
|
||||
SMFXForceFeedbackListNode* pNext;
|
||||
|
||||
private:
|
||||
SMFXForceFeedbackListNode()
|
||||
: pNext(NULL)
|
||||
{
|
||||
}
|
||||
~SMFXForceFeedbackListNode() {}
|
||||
};
|
||||
|
||||
struct SMFXResourceList;
|
||||
typedef _smart_ptr<SMFXResourceList> SMFXResourceListPtr;
|
||||
|
||||
struct SMFXResourceList
|
||||
{
|
||||
public:
|
||||
SMFXParticleListNode* m_particleList;
|
||||
SMFXAudioListNode* m_audioList;
|
||||
SMFXDecalListNode* m_decalList;
|
||||
SMFXForceFeedbackListNode* m_forceFeedbackList;
|
||||
|
||||
void AddRef() { ++m_refs; }
|
||||
void Release()
|
||||
{
|
||||
if (--m_refs <= 0)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
static SMFXResourceListPtr Create();
|
||||
static void FreePool();
|
||||
|
||||
private:
|
||||
int m_refs;
|
||||
|
||||
virtual void Destroy();
|
||||
|
||||
SMFXResourceList()
|
||||
: m_refs(0)
|
||||
{
|
||||
m_particleList = 0;
|
||||
m_audioList = 0;
|
||||
m_decalList = 0;
|
||||
m_forceFeedbackList = 0;
|
||||
}
|
||||
virtual ~SMFXResourceList()
|
||||
{
|
||||
while (m_particleList != 0)
|
||||
{
|
||||
SMFXParticleListNode* next = m_particleList->pNext;
|
||||
m_particleList->Destroy();
|
||||
m_particleList = next;
|
||||
}
|
||||
while (m_audioList != 0)
|
||||
{
|
||||
SMFXAudioListNode* next = m_audioList->pNext;
|
||||
m_audioList->Destroy();
|
||||
m_audioList = next;
|
||||
}
|
||||
while (m_decalList != 0)
|
||||
{
|
||||
SMFXDecalListNode* next = m_decalList->pNext;
|
||||
m_decalList->Destroy();
|
||||
m_decalList = next;
|
||||
}
|
||||
while (m_forceFeedbackList != 0)
|
||||
{
|
||||
SMFXForceFeedbackListNode* next = m_forceFeedbackList->pNext;
|
||||
m_forceFeedbackList->Destroy();
|
||||
m_forceFeedbackList = next;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
typedef uint16 TMFXEffectId;
|
||||
static const TMFXEffectId InvalidEffectId = 0;
|
||||
|
||||
struct SMFXCustomParamValue
|
||||
{
|
||||
float fValue;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IMaterialEffects
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~IMaterialEffects(){}
|
||||
virtual void LoadFXLibraries() = 0;
|
||||
virtual void Reset(bool bCleanup) = 0;
|
||||
virtual void ClearDelayedEffects() = 0;
|
||||
virtual TMFXEffectId GetEffectIdByName(const char* libName, const char* effectName) = 0;
|
||||
virtual TMFXEffectId GetEffectId(int surfaceIndex1, int surfaceIndex2) = 0;
|
||||
virtual TMFXEffectId GetEffectId(const char* customName, int surfaceIndex2) = 0;
|
||||
virtual SMFXResourceListPtr GetResources(TMFXEffectId effectId) const = 0;
|
||||
virtual void PreLoadAssets() = 0;
|
||||
virtual bool ExecuteEffect(TMFXEffectId effectId, SMFXRunTimeEffectParams& runtimeParams) = 0;
|
||||
virtual int GetDefaultSurfaceIndex() = 0;
|
||||
virtual int GetDefaultCanopyIndex() = 0;
|
||||
|
||||
virtual bool PlayBreakageEffect(ISurfaceType* pSurfaceType, const char* breakageType, const SMFXBreakageParams& mfxBreakageParams) = 0;
|
||||
|
||||
virtual void SetCustomParameter(TMFXEffectId effectId, const char* customParameter, const SMFXCustomParamValue& customParameterValue) = 0;
|
||||
|
||||
virtual void CompleteInit() = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_IMATERIALEFFECTS_H
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_INOTIFICATIONNETWORK_H
|
||||
#define CRYINCLUDE_CRYCOMMON_INOTIFICATIONNETWORK_H
|
||||
#pragma once
|
||||
|
||||
|
||||
// Constants
|
||||
|
||||
#define NN_CHANNEL_NAME_LENGTH_MAX 16
|
||||
|
||||
struct INotificationNetworkClient;
|
||||
|
||||
// User Interfaces
|
||||
|
||||
struct INotificationNetworkListener
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~INotificationNetworkListener(){}
|
||||
// Called upon receiving data from the Channel the Listener is binded to.
|
||||
virtual void OnNotificationNetworkReceive(const void* pBuffer, size_t length) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
struct INotificationNetworkConnectionCallback
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~INotificationNetworkConnectionCallback(){}
|
||||
virtual void OnConnect(INotificationNetworkClient* pClient, bool bSucceeded) = 0;
|
||||
virtual void OnDisconnected(INotificationNetworkClient* pClient) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
// Interfaces
|
||||
|
||||
struct INotificationNetworkClient
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~INotificationNetworkClient(){}
|
||||
virtual void Release() = 0;
|
||||
|
||||
// Binds a Listener to the given Notification Channel.
|
||||
// Each Listener can be binded only to one Channel, calling the method
|
||||
// again with an already added Listener and a different Channel will rebind it.
|
||||
// The Channel name cannot exceed NN_CHANNEL_NAME_LENGTH_MAX chars.
|
||||
virtual bool ListenerBind(const char* channelName, INotificationNetworkListener* pListener) = 0;
|
||||
|
||||
// If it exist, removes the given Listener form the Notification Network.
|
||||
virtual bool ListenerRemove(INotificationNetworkListener* pListener) = 0;
|
||||
|
||||
// Sends arbitrary data to the Notification Network the Client is connected to.
|
||||
virtual bool Send(const char* channelName, const void* pBuffer, size_t length) = 0;
|
||||
|
||||
// Checks if the current client is connected.
|
||||
// Returns true if it is connected, false otherwise.
|
||||
virtual bool IsConnected() = 0;
|
||||
|
||||
// Checks if the connection attempt failed.
|
||||
// Returns true if it failed to connect by any reason (such as timeout).
|
||||
virtual bool IsFailedToConnect() const = 0;
|
||||
|
||||
// Start the connection request for this particular client.
|
||||
// Parameters:
|
||||
// address - Is the host name or ipv4 (for now) address string to which
|
||||
// we want to connect.
|
||||
// port - Is the TCP port to which we want to connect.
|
||||
// Remarks: Port 9432 is being used by the live preview already.
|
||||
virtual bool Connect(const char* address, uint16 port) = 0;
|
||||
|
||||
// Tries to register a callback listener object.
|
||||
// A callback listener object will receive events from the client element,
|
||||
// such as connection result information.
|
||||
// Parameters:
|
||||
// - pConnectionCallback - Is a pointer to an object implementing interface
|
||||
// INotificationNetworkConnectionCallback which will be called when
|
||||
// the events happen, such as connection, disconnection and failed attempt
|
||||
// to connect.
|
||||
// Return Value:
|
||||
// - It will return true if registered the callback object successfully.
|
||||
// - It will return false when there the callback object is already
|
||||
// registered.
|
||||
virtual bool RegisterCallbackListener(INotificationNetworkConnectionCallback* pConnectionCallback) = 0;
|
||||
|
||||
// Tries to unregister a callback listener object.
|
||||
// A callback listener object will receive events from the client element,
|
||||
// such as connection result information.
|
||||
// Parameters:
|
||||
// - pConnectionCallback - Is a pointer to an object implementing interface
|
||||
// INotificationNetworkConnectionCallback which will be called when
|
||||
// the events happen, such as connection, disconnection and failed attempt
|
||||
// to connect and that we want to unregister.
|
||||
// Return Value:
|
||||
// - It will return true if unregistered the callback object successfully.
|
||||
// - It will return false when no object matching the one requested is found
|
||||
// int the object.
|
||||
virtual bool UnregisterCallbackListener(INotificationNetworkConnectionCallback* pConnectionCallback) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
struct INotificationNetwork
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~INotificationNetwork(){}
|
||||
|
||||
virtual void Release() = 0;
|
||||
|
||||
// Creates a disconnected client.
|
||||
virtual INotificationNetworkClient* CreateClient() = 0;
|
||||
|
||||
// Attempts to connect to the Notification Network at the given address,
|
||||
// returns a Client interface if communication is possible.
|
||||
virtual INotificationNetworkClient* Connect(const char* address, uint16 port) = 0;
|
||||
|
||||
// Returns the Connection count of the given Channel. If NULL is passed
|
||||
// instead of a valid Channel name the total count of all Connections is
|
||||
// returned.
|
||||
virtual size_t GetConnectionCount(const char* channelName = NULL) = 0;
|
||||
|
||||
// Has to be called from the main thread to process received notifications.
|
||||
virtual void Update() = 0;
|
||||
|
||||
// Binds a Listener to the given Notification Channel.
|
||||
// Each Listener can be binded only to one Channel, calling the method
|
||||
// again with an already added Listener and a different Channel will rebind it.
|
||||
// The Channel name cannot exceed NN_CHANNEL_NAME_LENGTH_MAX chars.
|
||||
virtual bool ListenerBind(const char* channelName, INotificationNetworkListener* pListener) = 0;
|
||||
|
||||
// If it exist, removes the given Listener form the Notification Network.
|
||||
virtual bool ListenerRemove(INotificationNetworkListener* pListener) = 0;
|
||||
|
||||
// Sends arbitrary data to all the Connections listening to the given Channel.
|
||||
virtual uint32 Send(const char* channel, const void* pBuffer, size_t length) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_INOTIFICATIONNETWORK_H
|
||||
@@ -16,12 +16,12 @@
|
||||
#include "Cry_Geo.h"
|
||||
#include "Cry_Camera.h"
|
||||
#include "ITexture.h"
|
||||
#include <IFlares.h> // <> required for Interfuscator
|
||||
#include <IFuncVariable.h> // <> required for Interfuscator
|
||||
#include <IXml.h> // <> required for Interfuscator
|
||||
#include "smartptr.h"
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/std/containers/intrusive_slist.h>
|
||||
|
||||
#include "IResourceCompilerHelper.h" // for IResourceCompilerHelper::ERcCallResult
|
||||
|
||||
// forward declarations
|
||||
struct SRenderingPassInfo;
|
||||
struct SRTStack;
|
||||
@@ -95,7 +95,6 @@ struct IFFont;
|
||||
struct IFFont_RenderProxy;
|
||||
struct STextDrawContext;
|
||||
struct IRenderMesh;
|
||||
class IOpticsManager;
|
||||
struct ShadowFrustumMGPUCache;
|
||||
struct IAsyncTextureCompileListener;
|
||||
struct IClipVolume;
|
||||
@@ -955,25 +954,6 @@ protected:
|
||||
virtual ~ITextureStreamListener() {}
|
||||
};
|
||||
|
||||
#if defined(CRY_ENABLE_RC_HELPER)
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Listener for asynchronous texture compilation.
|
||||
// Connects the listener to the task-queue of pending compilation requests.
|
||||
enum ERcExitCode;
|
||||
struct IAsyncTextureCompileListener
|
||||
{
|
||||
public:
|
||||
virtual void OnCompilationStarted(const char* source, const char* target, int nPending) = 0;
|
||||
virtual void OnCompilationFinished(const char* source, const char* target, IResourceCompilerHelper::ERcCallResult nReturnCode) = 0;
|
||||
|
||||
virtual void OnCompilationQueueTriggered(int nPending) = 0;
|
||||
virtual void OnCompilationQueueDepleted() = 0;
|
||||
|
||||
protected:
|
||||
virtual ~IAsyncTextureCompileListener() {}
|
||||
};
|
||||
#endif
|
||||
|
||||
enum eDolbyVisionMode
|
||||
{
|
||||
eDVM_Disabled,
|
||||
@@ -1869,8 +1849,6 @@ struct IRenderer
|
||||
virtual SDepthTexture* CreateDepthSurface(int nWidth, int nHeight, bool shaderResourceView = false) = 0;
|
||||
virtual void DestroyDepthSurface(SDepthTexture* pDepthSurf) = 0;
|
||||
|
||||
virtual IOpticsElementBase* CreateOptics(EFlareType type) const = 0;
|
||||
|
||||
// Note:
|
||||
// Used for pausing timer related stuff.
|
||||
// Example:
|
||||
|
||||
@@ -1,378 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#include "IResourceCompilerHelper.h"
|
||||
|
||||
#include <AzCore/base.h>
|
||||
// DO NOT USE AZSTD.
|
||||
|
||||
#include <string> // std string used here.
|
||||
#include <memory>
|
||||
#include <cstring>
|
||||
|
||||
// the following block is for _mkdir on windows and mkdir on other platforms.
|
||||
#if defined(_WIN32)
|
||||
# include <direct.h>
|
||||
#else
|
||||
# include <sys/stat.h>
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
namespace RCPathUtil
|
||||
{
|
||||
const char* GetExt(const char* filepath)
|
||||
{
|
||||
const char* str = filepath;
|
||||
size_t len = strlen(filepath);
|
||||
for (const char* p = str + len - 1; p >= str; --p)
|
||||
{
|
||||
switch (*p)
|
||||
{
|
||||
case ':':
|
||||
case '/':
|
||||
case '\\':
|
||||
// we've reached a path separator - it means there's no extension in this name
|
||||
return "";
|
||||
case '.':
|
||||
// there's an extension in this file name
|
||||
return p + 1;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* GetFile(const char* filepath)
|
||||
{
|
||||
const size_t len = strlen(filepath);
|
||||
for (const char* p = filepath + len - 1; p >= filepath; --p)
|
||||
{
|
||||
switch (*p)
|
||||
{
|
||||
case ':':
|
||||
case '/':
|
||||
case '\\':
|
||||
return p + 1;
|
||||
}
|
||||
}
|
||||
return filepath;
|
||||
}
|
||||
|
||||
|
||||
//! Replace extension for given file.
|
||||
std::string RemoveExtension(const char* filepath)
|
||||
{
|
||||
std::string filepathstr = filepath;
|
||||
const char* str = filepathstr.c_str();
|
||||
for (const char* p = str + filepathstr.length() - 1; p >= str; --p)
|
||||
{
|
||||
switch (*p)
|
||||
{
|
||||
case ':':
|
||||
case '/':
|
||||
case '\\':
|
||||
// we've reached a path separator - it means there's no extension in this name
|
||||
return filepathstr;
|
||||
case '.':
|
||||
// there's an extension in this file name
|
||||
filepathstr.erase(p - str);
|
||||
return filepathstr;
|
||||
}
|
||||
}
|
||||
// it seems the file name is a pure name, without path or extension
|
||||
return filepathstr;
|
||||
}
|
||||
|
||||
std::string ReplaceExtension(const char* filepath, const char* ext)
|
||||
{
|
||||
std::string str = filepath;
|
||||
if (ext != 0)
|
||||
{
|
||||
str = RemoveExtension(str.c_str());
|
||||
if (ext[0] != 0 && ext[0] != '.')
|
||||
{
|
||||
str += ".";
|
||||
}
|
||||
str += ext;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string GetPath(const char* filepath)
|
||||
{
|
||||
std::string filepathstr = filepath;
|
||||
const char* str = filepathstr.c_str();
|
||||
for (const char* p = str + filepathstr.length() - 1; p >= str; --p)
|
||||
{
|
||||
switch (*p)
|
||||
{
|
||||
case ':':
|
||||
case '/':
|
||||
case '\\':
|
||||
// we've reached a path separator - it means there's no extension in this name
|
||||
return filepathstr.substr(0, p - str);
|
||||
}
|
||||
}
|
||||
// it seems the file name is a pure name, without path
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool IsRelativePath(const char* p)
|
||||
{
|
||||
if (!p || !p[0])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return p[0] != '/' && p[0] != '\\' && !strchr(p, ':');
|
||||
}
|
||||
}
|
||||
|
||||
const char* IResourceCompilerHelper::SourceImageFormatExts[NUM_SOURCE_IMAGE_TYPE] = { "tif", "bmp", "gif", "jpg", "jpeg", "jpe", "tga", "png" };
|
||||
const char* IResourceCompilerHelper::SourceImageFormatExtsWithDot[NUM_SOURCE_IMAGE_TYPE] = { ".tif", ".bmp", ".gif", ".jpg", ".jpeg", ".jpe", ".tga", ".png" };
|
||||
const char* IResourceCompilerHelper::EngineImageFormatExts[NUM_ENGINE_IMAGE_TYPE] = { "dds" };
|
||||
const char* IResourceCompilerHelper::EngineImageFormatExtsWithDot[NUM_ENGINE_IMAGE_TYPE] = { ".dds" };
|
||||
|
||||
|
||||
IResourceCompilerHelper::ERcCallResult IResourceCompilerHelper::ConvertResourceCompilerExitCodeToResultCode(int exitCode)
|
||||
{
|
||||
switch (exitCode)
|
||||
{
|
||||
case eRcExitCode_Success:
|
||||
case eRcExitCode_UserFixing:
|
||||
return eRcCallResult_success;
|
||||
|
||||
case eRcExitCode_Error:
|
||||
return eRcCallResult_error;
|
||||
|
||||
case eRcExitCode_FatalError:
|
||||
return eRcCallResult_error;
|
||||
case eRcExitCode_Crash:
|
||||
return eRcCallResult_crash;
|
||||
}
|
||||
return eRcCallResult_error;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const char* IResourceCompilerHelper::GetCallResultDescription(IResourceCompilerHelper::ERcCallResult result)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case eRcCallResult_success:
|
||||
return "Success.";
|
||||
case eRcCallResult_notFound:
|
||||
return "ResourceCompiler executable was not found.";
|
||||
case eRcCallResult_error:
|
||||
return "ResourceCompiler exited with an error.";
|
||||
case eRcCallResult_crash:
|
||||
return "ResourceCompiler crashed! Please report this. Include source asset and this log in the report.";
|
||||
default:
|
||||
return "Unexpected failure in ResultCompilerHelper.";
|
||||
}
|
||||
}
|
||||
|
||||
// Arguments:
|
||||
// szFilePath - could be source or destination filename
|
||||
void IResourceCompilerHelper::GetOutputFilename(const char* szFilePath, char* buffer, size_t bufferSizeInBytes)
|
||||
{
|
||||
if (IResourceCompilerHelper::IsSourceImageFormatSupported(szFilePath))
|
||||
{
|
||||
std::string newString = RCPathUtil::ReplaceExtension(szFilePath, "dds");
|
||||
azstrncpy(buffer, bufferSizeInBytes, newString.c_str(), bufferSizeInBytes - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
azstrncpy(buffer, bufferSizeInBytes, szFilePath, bufferSizeInBytes - 1);
|
||||
}
|
||||
|
||||
IResourceCompilerHelper::ERcCallResult IResourceCompilerHelper::InvokeResourceCompiler(const char* szSrcFilePath, const char* szDstFilePath, const bool bUserDialog)
|
||||
{
|
||||
|
||||
const char* szDstFileName = RCPathUtil::GetFile(szDstFilePath);
|
||||
std::string pathOnly = RCPathUtil::GetPath(szDstFilePath);
|
||||
const int maxStringSize = 512;
|
||||
char szRemoteCmdLine[maxStringSize] = { 0 };
|
||||
char szFullPathToSourceFile[maxStringSize] = { 0 };
|
||||
|
||||
if (RCPathUtil::IsRelativePath(szSrcFilePath))
|
||||
{
|
||||
azstrcat(szFullPathToSourceFile, maxStringSize, "#ENGINEROOT#");
|
||||
azstrcat(szFullPathToSourceFile, maxStringSize, "\\");
|
||||
}
|
||||
azstrcat(szFullPathToSourceFile, maxStringSize, szSrcFilePath);
|
||||
|
||||
azstrcat(szRemoteCmdLine, maxStringSize, " /targetroot=\"");
|
||||
azstrcat(szRemoteCmdLine, maxStringSize, pathOnly.c_str());
|
||||
azstrcat(szRemoteCmdLine, maxStringSize, "\"");
|
||||
|
||||
azstrcat(szRemoteCmdLine, maxStringSize, " /overwritefilename=\"");
|
||||
azstrcat(szRemoteCmdLine, maxStringSize, szDstFileName);
|
||||
azstrcat(szRemoteCmdLine, maxStringSize, "\"");
|
||||
|
||||
return CallResourceCompiler(szFullPathToSourceFile, szRemoteCmdLine, nullptr, true, false, !bUserDialog);
|
||||
}
|
||||
|
||||
unsigned int IResourceCompilerHelper::GetNumSourceImageFormats()
|
||||
{
|
||||
return NUM_SOURCE_IMAGE_TYPE;
|
||||
}
|
||||
|
||||
const char* IResourceCompilerHelper::GetSourceImageFormat(unsigned int index, bool bWithDot)
|
||||
{
|
||||
if (index >= GetNumSourceImageFormats())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (bWithDot)
|
||||
{
|
||||
return SourceImageFormatExtsWithDot[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
return SourceImageFormatExts[index];
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int IResourceCompilerHelper::GetNumEngineImageFormats()
|
||||
{
|
||||
return NUM_ENGINE_IMAGE_TYPE;
|
||||
}
|
||||
|
||||
const char* IResourceCompilerHelper::GetEngineImageFormat(unsigned int index, bool bWithDot)
|
||||
{
|
||||
if (index >= GetNumEngineImageFormats())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (bWithDot)
|
||||
{
|
||||
return EngineImageFormatExtsWithDot[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
return EngineImageFormatExts[index];
|
||||
}
|
||||
}
|
||||
|
||||
bool IResourceCompilerHelper::IsSourceImageFormatSupported(const char* szFileNameOrExtension)
|
||||
{
|
||||
if (!szFileNameOrExtension) // if this hits, might want to check the call site
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//check the string length
|
||||
size_t len = strlen(szFileNameOrExtension);
|
||||
if (len < 3)//no point in going on if the smallest valid ext is 3 characters
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//find the ext by starting at the last character and moving backward to first he first '.'
|
||||
const char* szExtension = nullptr;
|
||||
size_t cur = len - 1;
|
||||
while (cur && !szExtension)
|
||||
{
|
||||
if (szFileNameOrExtension[cur] == '.')
|
||||
{
|
||||
szExtension = &szFileNameOrExtension[cur];
|
||||
}
|
||||
cur--;
|
||||
}
|
||||
if (len - cur < 3)//no point in going on if the smallest valid ext is 3 characters
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//if we didn't find a '.' it could still be valid, they may not have
|
||||
//passed it in. i.e. "dds" instead of ".dds" which is still valid
|
||||
if (!szExtension)
|
||||
{
|
||||
//with no '.' the largest ext is currently 4 characters
|
||||
//no point in going on if it is larger
|
||||
if (len > 4)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
szExtension = szFileNameOrExtension;
|
||||
}
|
||||
|
||||
//loop over all the valid exts and see if it is one of them
|
||||
for (unsigned int i = 0; i < GetNumSourceImageFormats(); ++i)
|
||||
{
|
||||
if (!azstricmp(szExtension, GetSourceImageFormat(i, szExtension[0] == '.')))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IResourceCompilerHelper::IsGameImageFormatSupported(const char* szFileNameOrExtension)
|
||||
{
|
||||
if (!szFileNameOrExtension) // if this hits, might want to check the call site
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//check the string length
|
||||
size_t len = strlen(szFileNameOrExtension);
|
||||
if (len < 3)//no point in going on if the smallest valid ext is 3 characters
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//find the ext by starting at the last character and moving backward to first he first '.'
|
||||
const char* szExtension = nullptr;
|
||||
size_t cur = len - 1;
|
||||
while (cur && !szExtension)
|
||||
{
|
||||
if (szFileNameOrExtension[cur] == '.')
|
||||
{
|
||||
szExtension = &szFileNameOrExtension[cur];
|
||||
}
|
||||
cur--;
|
||||
}
|
||||
if (len - cur < 3)//no point in going on if the smallest valid ext is 3 characters
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//if we didn't find a '.' it could still be valid, they may not have
|
||||
//passed it in. i.e. "dds" instead of ".dds" which is still valid
|
||||
if (!szExtension)
|
||||
{
|
||||
//with no '.' the largest ext is currently 4 characters
|
||||
//no point in going on if it is larger
|
||||
if (len > 4)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
szExtension = szFileNameOrExtension;
|
||||
}
|
||||
|
||||
//loop over all the valid exts and see if it is one of them
|
||||
for (unsigned int i = 0; i < GetNumEngineImageFormats(); ++i)
|
||||
{
|
||||
if (!azstricmp(szExtension, GetEngineImageFormat(i, szExtension[0] == '.')))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_IRESOURCECOMPILERHELPER_H
|
||||
#define CRYINCLUDE_CRYCOMMON_IRESOURCECOMPILERHELPER_H
|
||||
|
||||
#pragma once
|
||||
|
||||
// DO NOT USE AZSTD
|
||||
|
||||
#include <string>
|
||||
|
||||
// IResourceCompilerHelper exists to define an interface that allows
|
||||
// remote or local compilation of resources through the "resource Compiler" executable
|
||||
// in most tools it will be implemented as a local execution. However, in the engine
|
||||
// it will be substituted for a remote RC invocation through the Asset Processor if
|
||||
// that system is enabled (via con var and define)
|
||||
|
||||
// DO NOT USE CRYSTRING or CRY ALLOCATORS HERE. This is used in maya plugins, that kind of thing.
|
||||
// the following path utils are special versions of these functions which take pains
|
||||
// to not use crystring.
|
||||
// the functions in this interface must be cross platform.
|
||||
namespace RCPathUtil
|
||||
{
|
||||
// given a full path, return the extension (it will be a pointer into the existing string)
|
||||
const char* GetExt(const char* filepath);
|
||||
|
||||
// given a full path, return the file only (it will be a pointer into the existing string)
|
||||
const char* GetFile(const char* filepath);
|
||||
|
||||
// given a filepath, get only the path.
|
||||
std::string GetPath(const char* filepath);
|
||||
std::string ReplaceExtension(const char* filepath, const char* ext);
|
||||
bool IsRelativePath(const char* p);
|
||||
}
|
||||
|
||||
class IResourceCompilerListener;
|
||||
|
||||
enum ERcExitCode
|
||||
{
|
||||
eRcExitCode_Success = 0, // must be 0
|
||||
eRcExitCode_Error = 1,
|
||||
eRcExitCode_FatalError = 100,
|
||||
eRcExitCode_Crash = 101,
|
||||
eRcExitCode_UserFixing = 200,
|
||||
eRcExitCode_Pending = 666,
|
||||
};
|
||||
|
||||
/// A pure virtual interface to the RC Helper system
|
||||
/// the RC helper system allows you to make requests to a remote process in order to process
|
||||
/// an asset for you.
|
||||
class IResourceCompilerHelper
|
||||
{
|
||||
public:
|
||||
virtual ~IResourceCompilerHelper() {}
|
||||
|
||||
// defines the result of a call via this API to the RC system
|
||||
enum ERcCallResult
|
||||
{
|
||||
eRcCallResult_success, // everything is OK
|
||||
eRcCallResult_notFound, // the RC executable is not found
|
||||
eRcCallResult_error, // the RC executable returned an error
|
||||
eRcCallResult_crash, // the RC executable did not finish
|
||||
};
|
||||
|
||||
//
|
||||
// Arguments:
|
||||
// szFileName null terminated ABSOLUTE file path or 0 can be used to test for rc.exe existence
|
||||
// relative path needs to be relative to rc_plugins directory
|
||||
// szAdditionalSettings - 0 or e.g. "/refresh" or "/refresh /xyz=56"
|
||||
//
|
||||
// this is a SYNCHRONOUS, BLOCKING call and will return once the process is complete
|
||||
virtual ERcCallResult CallResourceCompiler(
|
||||
const char* szFileName = 0,
|
||||
const char* szAdditionalSettings = 0,
|
||||
IResourceCompilerListener* listener = 0,
|
||||
bool bMayShowWindow = true,
|
||||
bool bSilent = false,
|
||||
bool bNoUserDialog = false,
|
||||
const wchar_t* szWorkingDirectory = 0,
|
||||
const wchar_t* szRootPath = 0) = 0;
|
||||
|
||||
// InvokeResourceCompiler - a utility that calls the above CallResourceCompiler function
|
||||
// but generates appropriate settings so you don't have to specify each option.
|
||||
// This is a BLOCKING call
|
||||
// the srcFile can be relative to the project root or an absolute path
|
||||
// the dstFilePath MUST be relative to the same folder as the Src File path
|
||||
// this will output dstFilePath in the same folder as srcFile.
|
||||
virtual ERcCallResult InvokeResourceCompiler(const char* szSrcFilePath, const char* szDstFilePath, const bool bUserDialog);
|
||||
|
||||
// --------------------- utility functions ---------------------------------
|
||||
|
||||
// given a RC.EXE process exit code like 101, convert it to the above ERcCallResult
|
||||
ERcCallResult ConvertResourceCompilerExitCodeToResultCode(int exitCode);
|
||||
|
||||
// given a ERcCallResult, convert it to a simple english string for debugging.
|
||||
static const char* GetCallResultDescription(ERcCallResult result);
|
||||
|
||||
// given a filename such as "blah.tif" convert it to the appropriate output name "blah.dds" for example
|
||||
static void GetOutputFilename(const char* szFilePath, char* buffer, size_t bufferSizeInBytes);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum SourceImageTypes
|
||||
{
|
||||
SOURCE_IMAGE_TYPE_TIF,
|
||||
SOURCE_IMAGE_TYPE_BMP,
|
||||
SOURCE_IMAGE_TYPE_GIF,
|
||||
SOURCE_IMAGE_TYPE_JPG,
|
||||
SOURCE_IMAGE_TYPE_JPEG,
|
||||
SOURCE_IMAGE_TYPE_JPE,
|
||||
SOURCE_IMAGE_TYPE_TGA,
|
||||
SOURCE_IMAGE_TYPE_PNG,
|
||||
NUM_SOURCE_IMAGE_TYPE
|
||||
};
|
||||
|
||||
enum EngineImageTypes
|
||||
{
|
||||
ENGINE_IMAGE_TYPE_DDS,
|
||||
NUM_ENGINE_IMAGE_TYPE
|
||||
};
|
||||
|
||||
private:
|
||||
static const char* SourceImageFormatExts[NUM_SOURCE_IMAGE_TYPE];
|
||||
static const char* SourceImageFormatExtsWithDot[NUM_SOURCE_IMAGE_TYPE];
|
||||
static const char* EngineImageFormatExts[NUM_ENGINE_IMAGE_TYPE];
|
||||
static const char* EngineImageFormatExtsWithDot[NUM_ENGINE_IMAGE_TYPE];
|
||||
|
||||
public:
|
||||
static unsigned int GetNumSourceImageFormats();
|
||||
static const char* GetSourceImageFormat(unsigned int index, bool bWithDot);
|
||||
|
||||
static unsigned int GetNumEngineImageFormats();
|
||||
static const char* GetEngineImageFormat(unsigned int index, bool bWithDot);
|
||||
|
||||
static bool IsSourceImageFormatSupported(const char* szExtension);
|
||||
static bool IsGameImageFormatSupported(const char* szExtension);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Listener for synchronous resource-compilation.
|
||||
// Connects the listener to the output of the RC process.
|
||||
class IResourceCompilerListener
|
||||
{
|
||||
public:
|
||||
// FbxImportDialog relies on this enum being in the order from most verbose to least verbose
|
||||
enum MessageSeverity
|
||||
{
|
||||
MessageSeverity_Debug = 0,
|
||||
MessageSeverity_Info,
|
||||
MessageSeverity_Warning,
|
||||
MessageSeverity_Error
|
||||
};
|
||||
|
||||
virtual void OnRCMessage(MessageSeverity /*severity*/, const char* /*text*/) {}
|
||||
virtual ~IResourceCompilerListener() {}
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_IRESOURCECOMPILERHELPER_H
|
||||
@@ -24,7 +24,9 @@
|
||||
#endif
|
||||
|
||||
#include "smartptr.h"
|
||||
#include <IFlares.h> // <> required for Interfuscator
|
||||
#include <IFuncVariable.h> // <> required for Interfuscator
|
||||
#include <IXml.h> // <> required for Interfuscator
|
||||
#include "smartptr.h"
|
||||
#include "VertexFormats.h"
|
||||
#include <Vertex.h>
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
@@ -2828,7 +2830,6 @@ struct SRenderLight
|
||||
m_ObjMatrix.SetIdentity();
|
||||
m_BaseObjMatrix.SetIdentity();
|
||||
m_sName = "";
|
||||
m_pSoftOccQuery = NULL;
|
||||
m_pLightAnim = NULL;
|
||||
m_fAreaWidth = 1;
|
||||
m_fAreaHeight = 1;
|
||||
@@ -2884,11 +2885,6 @@ struct SRenderLight
|
||||
return m_pLightImage ? m_pLightImage : NULL;
|
||||
}
|
||||
|
||||
IOpticsElementBase* GetLensOpticsElement() const
|
||||
{
|
||||
return m_pLensOpticsElement;
|
||||
}
|
||||
|
||||
void SetOpticsParams(const SOpticsInstanceParameters& params)
|
||||
{
|
||||
m_opticsParams = params;
|
||||
@@ -2899,24 +2895,6 @@ struct SRenderLight
|
||||
return m_opticsParams;
|
||||
}
|
||||
|
||||
void SetLensOpticsElement(IOpticsElementBase* pOptics)
|
||||
{
|
||||
if (m_pLensOpticsElement == pOptics)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (pOptics && pOptics->GetType() != eFT_Root)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SAFE_RELEASE(m_pLensOpticsElement);
|
||||
m_pLensOpticsElement = pOptics;
|
||||
if (m_pLensOpticsElement)
|
||||
{
|
||||
m_pLensOpticsElement->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const { /*LATER*/}
|
||||
|
||||
void AcquireResources()
|
||||
@@ -2937,14 +2915,6 @@ struct SRenderLight
|
||||
{
|
||||
m_pSpecularCubemap->AddRef();
|
||||
}
|
||||
if (m_pLensOpticsElement)
|
||||
{
|
||||
m_pLensOpticsElement->AddRef();
|
||||
}
|
||||
if (m_pSoftOccQuery)
|
||||
{
|
||||
m_pSoftOccQuery->AddRef();
|
||||
}
|
||||
if (m_pLightAnim)
|
||||
{
|
||||
m_pLightAnim->AddRef();
|
||||
@@ -2961,8 +2931,6 @@ struct SRenderLight
|
||||
SAFE_RELEASE(m_pLightImage);
|
||||
SAFE_RELEASE(m_pDiffuseCubemap);
|
||||
SAFE_RELEASE(m_pSpecularCubemap);
|
||||
SAFE_RELEASE(m_pLensOpticsElement);
|
||||
SAFE_RELEASE(m_pSoftOccQuery);
|
||||
SAFE_RELEASE(m_pLightAnim);
|
||||
SAFE_RELEASE(m_pLightAttenMap);
|
||||
}
|
||||
@@ -3046,8 +3014,6 @@ struct SRenderLight
|
||||
const char* m_sName; // Optional name of the light source.
|
||||
SShaderItem m_Shader; // Shader item
|
||||
CRenderObject* m_pObject[MAX_RECURSION_LEVELS]; // Object for light coronas and light flares.
|
||||
IOpticsElementBase* m_pLensOpticsElement; // Optics element for this shader instance
|
||||
ISoftOcclusionQuery* m_pSoftOccQuery;
|
||||
ILightAnimWrapper* m_pLightAnim;
|
||||
|
||||
Matrix34 m_BaseObjMatrix;
|
||||
@@ -3146,9 +3112,7 @@ public:
|
||||
m_fShadowSlopeBias = dl.m_fShadowSlopeBias;
|
||||
m_fShadowResolutionScale = dl.m_fShadowResolutionScale;
|
||||
m_fHDRDynamic = dl.m_fHDRDynamic;
|
||||
m_pLensOpticsElement = dl.m_pLensOpticsElement;
|
||||
m_LensOpticsFrustumAngle = dl.m_LensOpticsFrustumAngle;
|
||||
m_pSoftOccQuery = dl.m_pSoftOccQuery;
|
||||
m_fLightFrustumAngle = dl.m_fLightFrustumAngle;
|
||||
m_fProjectorNearPlane = dl.m_fProjectorNearPlane;
|
||||
m_Flags = dl.m_Flags;
|
||||
|
||||
@@ -1,276 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
// Description : Interface to manage SoftCode module loading and patching
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_ISOFTCODEMGR_H
|
||||
#define CRYINCLUDE_CRYCOMMON_ISOFTCODEMGR_H
|
||||
#pragma once
|
||||
|
||||
|
||||
// Provides the generic interface for exchanging member values between SoftCode modules,
|
||||
struct IExchangeValue
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~IExchangeValue() {}
|
||||
|
||||
// Allocates a new IExchangeValue with the underlying type
|
||||
virtual IExchangeValue* Clone() const = 0;
|
||||
// Returns the size of the underlying type (to check compatibility)
|
||||
virtual size_t GetSizeOf() const = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ExchangeValue
|
||||
: public IExchangeValue
|
||||
{
|
||||
ExchangeValue(T& value)
|
||||
: m_value(value)
|
||||
{}
|
||||
|
||||
virtual IExchangeValue* Clone() const { return new ExchangeValue(*this); }
|
||||
virtual size_t GetSizeOf() const { return sizeof(m_value); }
|
||||
|
||||
T m_value;
|
||||
};
|
||||
|
||||
template <typename T, size_t S>
|
||||
struct ExchangeArray
|
||||
: public IExchangeValue
|
||||
{
|
||||
ExchangeArray(T* pArr)
|
||||
{
|
||||
for (size_t i = 0; i < S; ++i)
|
||||
{
|
||||
m_array[i] = pArr[i];
|
||||
}
|
||||
}
|
||||
|
||||
virtual IExchangeValue* Clone() const { return new ExchangeArray(*this); }
|
||||
virtual size_t GetSizeOf() const { return sizeof(m_array); }
|
||||
|
||||
T m_array[S];
|
||||
};
|
||||
|
||||
/*
|
||||
This is a non-intrusive support function for types where default construction does no initialization.
|
||||
SoftCoding relies on default construction to initialize object state correctly.
|
||||
For most types this works as expected but for some types (typically things like vectors or matrices)
|
||||
default initialization would be too costly and is therefore not implemented.
|
||||
This function allows a specialized implementation to be used for such types that will perform
|
||||
initialization on the newly constructed instance. For example:
|
||||
|
||||
inline void DefaultInitialize(Matrix34& matrix)
|
||||
{
|
||||
matrix.SetIdentity();
|
||||
}
|
||||
*/
|
||||
template <typename T>
|
||||
void DefaultInitialize(T& t)
|
||||
{
|
||||
t = T();
|
||||
}
|
||||
|
||||
// Vector support
|
||||
template<class F>
|
||||
struct Vec2_tpl;
|
||||
template<typename T>
|
||||
struct Vec3_tpl;
|
||||
template <class F>
|
||||
void DefaultInitialize(Vec2_tpl<F>& vec) { vec.zero(); }
|
||||
template <typename T>
|
||||
void DefaultInitialize(Vec3_tpl<T>& vec) { vec.zero(); }
|
||||
|
||||
// Matrix support
|
||||
template<typename F>
|
||||
struct Matrix33_tpl;
|
||||
template<typename F>
|
||||
struct Matrix34_tpl;
|
||||
template<typename F>
|
||||
struct Matrix44_tpl;
|
||||
|
||||
template <typename F>
|
||||
void DefaultInitialize(Matrix33_tpl<F>& matrix) { matrix.SetIdentity(); }
|
||||
template <typename F>
|
||||
void DefaultInitialize(Matrix34_tpl<F>& matrix) { matrix.SetIdentity(); }
|
||||
template <typename F>
|
||||
void DefaultInitialize(Matrix44_tpl<F>& matrix) { matrix.SetIdentity(); }
|
||||
|
||||
// Quat support
|
||||
template <typename F>
|
||||
struct Quat_tpl;
|
||||
template <typename F>
|
||||
void DefaultInitialize(Quat_tpl<F>& quat) { quat.SetIdentity(); }
|
||||
|
||||
// Interface for performing an exchange of instance data
|
||||
struct IExchanger
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~IExchanger() {}
|
||||
|
||||
// True if data is being read from instance members
|
||||
virtual bool IsLoading() const = 0;
|
||||
|
||||
virtual size_t InstanceCount() const = 0;
|
||||
|
||||
virtual bool BeginInstance(void* pInstance) = 0;
|
||||
virtual bool SetValue(const char* name, IExchangeValue& value) = 0;
|
||||
virtual IExchangeValue* GetValue(const char* name, void* pTarget, size_t targetSize) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
|
||||
template <typename T>
|
||||
void Visit(const char* name, T& instance);
|
||||
|
||||
template <typename T, size_t S>
|
||||
void Visit(const char* name, T (&arr)[S]);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void IExchanger::Visit(const char* name, T& value)
|
||||
{
|
||||
if (IsLoading())
|
||||
{
|
||||
IExchangeValue* pValue = GetValue(name, &value, sizeof(value));
|
||||
if (pValue)
|
||||
{
|
||||
ExchangeValue<T>* pTypedValue = static_cast<ExchangeValue<T>*>(pValue);
|
||||
value = pTypedValue->m_value;
|
||||
}
|
||||
}
|
||||
else // Saving
|
||||
{
|
||||
// If this member is stored
|
||||
if (SetValue(name, ExchangeValue<T>(value)))
|
||||
{
|
||||
// Set the original value to the default state (to allow safe destruction)
|
||||
DefaultInitialize(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, size_t S>
|
||||
void IExchanger::Visit(const char* name, T (&arr)[S])
|
||||
{
|
||||
if (IsLoading())
|
||||
{
|
||||
IExchangeValue* pValue = GetValue(name, &arr, sizeof(arr));
|
||||
if (pValue)
|
||||
{
|
||||
ExchangeArray<T, S>* pTypedArray = static_cast<ExchangeArray<T, S>*>(pValue);
|
||||
// TODO: Accommodate array resizing? Complex however...
|
||||
for (size_t i = 0; i < S; ++i)
|
||||
{
|
||||
arr[i] = pTypedArray->m_array[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Saving
|
||||
{
|
||||
// If this member is stored
|
||||
if (SetValue(name, ExchangeArray<T, S>(arr)))
|
||||
{
|
||||
T defaultValue;
|
||||
DefaultInitialize(defaultValue);
|
||||
|
||||
// Set the original value to the default value (to allow safe destruction)
|
||||
for (size_t i = 0; i < S; ++i)
|
||||
{
|
||||
arr[i] = defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct InstanceTracker;
|
||||
|
||||
struct ITypeRegistrar
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~ITypeRegistrar() {}
|
||||
|
||||
virtual const char* GetName() const = 0;
|
||||
|
||||
// Creates an instance of the type
|
||||
virtual void* CreateInstance() = 0;
|
||||
// </interfuscator:shuffle>
|
||||
|
||||
#ifdef SOFTCODE_ENABLED
|
||||
// How many active instances exist of this type?
|
||||
virtual size_t InstanceCount() const = 0;
|
||||
// Used to remove a tracked instance from the Registrar
|
||||
virtual void RemoveInstance(InstanceTracker* pTracker) = 0;
|
||||
// Exchanges the instance state with the given exchanger data set
|
||||
virtual bool ExchangeInstances(IExchanger& exchanger) = 0;
|
||||
// Destroys all tracked instances of this type
|
||||
virtual bool DestroyInstances() = 0;
|
||||
// Returns true if pInstance is of this type (linear search)
|
||||
virtual bool HasInstance(void* pInstance) const = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct ITypeLibrary
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~ITypeLibrary() {}
|
||||
|
||||
virtual const char* GetName() = 0;
|
||||
virtual void* CreateInstanceVoid(const char* typeName) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
|
||||
#ifdef SOFTCODE_ENABLED
|
||||
virtual void SetOverride(ITypeLibrary* pOverrideLib) = 0;
|
||||
|
||||
// Fills in the supplied type list if large enough, and sets count to number of types
|
||||
virtual size_t GetTypes(ITypeRegistrar** ppRegistrar, size_t& count) const = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct ISoftCodeListener
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~ISoftCodeListener() {}
|
||||
|
||||
// Called when an instance is replaced to allow managing systems to fixup pointers
|
||||
virtual void InstanceReplaced(void* pOldInstance, void* pNewInstance) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
/// Interface for ...
|
||||
struct ISoftCodeMgr
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~ISoftCodeMgr() {}
|
||||
|
||||
// Used to register built-in libraries on first use
|
||||
virtual void RegisterLibrary(ITypeLibrary* pLib) = 0;
|
||||
|
||||
// Loads any new SoftCode modules
|
||||
virtual void LoadNewModules() = 0;
|
||||
|
||||
virtual void AddListener(const char* libraryName, ISoftCodeListener* pListener, const char* listenerName) = 0;
|
||||
virtual void RemoveListener(const char* libraryName, ISoftCodeListener* pListener) = 0;
|
||||
|
||||
// To be called regularly to poll for library updates
|
||||
virtual void PollForNewModules() = 0;
|
||||
|
||||
// Stops thread execution until a new SoftCode instance is available
|
||||
virtual void* WaitForUpdate(void* pInstance) = 0;
|
||||
|
||||
/// Frees this instance from memory
|
||||
//virtual void Release() = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_ISOFTCODEMGR_H
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#include <list>
|
||||
#include "smartptr.h"
|
||||
#include <IThreadTask.h> // <> required for Interfuscator
|
||||
#include "CryThread.h"
|
||||
|
||||
#include "IStreamEngineDefs.h"
|
||||
|
||||
@@ -49,19 +49,15 @@
|
||||
#include <ILog.h> // <> required for Interfuscator
|
||||
#include "CryVersion.h"
|
||||
#include "smartptr.h"
|
||||
#include <ISystemScheduler.h> // <> required for Interfuscator
|
||||
#include <memory> // shared_ptr
|
||||
#include <CrySystemBus.h>
|
||||
|
||||
struct ISystem;
|
||||
struct ILog;
|
||||
struct IProfileLogSystem;
|
||||
namespace AZ::IO
|
||||
{
|
||||
struct IArchive;
|
||||
}
|
||||
struct IKeyboard;
|
||||
struct IMouse;
|
||||
struct IConsole;
|
||||
struct IRemoteConsole;
|
||||
struct IRenderer;
|
||||
@@ -79,29 +75,21 @@ struct SFileVersion;
|
||||
struct INameTable;
|
||||
struct ILevelSystem;
|
||||
struct IViewSystem;
|
||||
struct IMaterialEffects;
|
||||
class IOpticsManager;
|
||||
class ICrySizer;
|
||||
class IXMLBinarySerializer;
|
||||
struct IReadWriteXMLSink;
|
||||
struct IThreadTaskManager;
|
||||
struct IResourceManager;
|
||||
struct ITextModeConsole;
|
||||
struct IAVI_Reader;
|
||||
class CPNoise3;
|
||||
struct IVisualLog;
|
||||
struct ILocalizationManager;
|
||||
struct ISoftCodeMgr;
|
||||
struct IZLibCompressor;
|
||||
struct IZLibDecompressor;
|
||||
struct ILZ4Decompressor;
|
||||
class IZStdDecompressor;
|
||||
struct IOutputPrintSink;
|
||||
struct IThreadManager;
|
||||
struct IWindowMessageHandler;
|
||||
struct IImageHandler;
|
||||
class IResourceCompilerHelper;
|
||||
class ILmbrAWS;
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
@@ -111,12 +99,6 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
class IResourceCompilerHelper;
|
||||
|
||||
namespace Serialization {
|
||||
struct IArchiveHost;
|
||||
}
|
||||
|
||||
typedef void* WIN_HWND;
|
||||
|
||||
class CCamera;
|
||||
@@ -124,39 +106,13 @@ struct CLoadingTimeProfiler;
|
||||
|
||||
class ICmdLine;
|
||||
|
||||
struct INotificationNetwork;
|
||||
class ILyShine;
|
||||
|
||||
namespace JobManager {
|
||||
struct IJobManager;
|
||||
}
|
||||
|
||||
#define PROC_MENU 1
|
||||
#define PROC_3DENGINE 2
|
||||
|
||||
// Summary:
|
||||
// IDs for script userdata typing.
|
||||
// Remarks:
|
||||
// Maybe they should be moved into the game.dll .
|
||||
//##@{
|
||||
#define USER_DATA_SOUND 1
|
||||
#define USER_DATA_TEXTURE 2
|
||||
#define USER_DATA_OBJECT 3
|
||||
#define USER_DATA_LIGHT 4
|
||||
#define USER_DATA_BONEHANDLER 5
|
||||
#define USER_DATA_POINTER 6
|
||||
//##@}
|
||||
|
||||
enum ESystemUpdateFlags
|
||||
{
|
||||
ESYSUPDATE_IGNORE_PHYSICS = 0x0002,
|
||||
// Summary:
|
||||
// Special update mode for editor.
|
||||
ESYSUPDATE_EDITOR = 0x0004,
|
||||
ESYSUPDATE_MULTIPLAYER = 0x0008,
|
||||
ESYSUPDATE_EDITOR_AI_PHYSICS = 0x0010,
|
||||
ESYSUPDATE_EDITOR_ONLY = 0x0020,
|
||||
ESYSUPDATE_UPDATE_VIEW_ONLY = 0x0040
|
||||
ESYSUPDATE_EDITOR = 0x0004
|
||||
};
|
||||
|
||||
// Description:
|
||||
@@ -189,29 +145,6 @@ enum ESystemConfigPlatform
|
||||
END_CONFIG_PLATFORM_ENUM, // MUST BE LAST VALUE. USED FOR ERROR CHECKING.
|
||||
};
|
||||
|
||||
enum ESubsystem
|
||||
{
|
||||
ESubsys_3DEngine = 0,
|
||||
ESubsys_AI = 1,
|
||||
ESubsys_Physics = 2,
|
||||
ESubsys_Renderer = 3,
|
||||
ESubsys_Script = 4
|
||||
};
|
||||
|
||||
// Summary:
|
||||
// Collates cycles taken per update.
|
||||
struct sUpdateTimes
|
||||
{
|
||||
uint32 PhysYields;
|
||||
uint64 SysUpdateTime;
|
||||
uint64 PhysStepTime;
|
||||
uint64 RenderTime;
|
||||
//extended yimes info
|
||||
uint64 physWaitTime;
|
||||
uint64 streamingWaitTime;
|
||||
uint64 animationWaitTime;
|
||||
};
|
||||
|
||||
enum ESystemGlobalState
|
||||
{
|
||||
ESYSTEM_GLOBAL_STATE_UNKNOWN,
|
||||
@@ -568,33 +501,6 @@ struct IErrorObserver
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
enum ESystemProtectedFunctions
|
||||
{
|
||||
eProtectedFunc_Save = 0,
|
||||
eProtectedFunc_Load = 1,
|
||||
eProtectedFuncsLast = 10,
|
||||
};
|
||||
|
||||
struct SCvarsDefault
|
||||
{
|
||||
SCvarsDefault()
|
||||
{
|
||||
sz_r_DriverDef = NULL;
|
||||
}
|
||||
|
||||
const char* sz_r_DriverDef;
|
||||
};
|
||||
|
||||
#if defined(CVARS_WHITELIST)
|
||||
struct ICVarsWhitelist
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~ICVarsWhitelist() {};
|
||||
virtual bool IsWhiteListed(const string& command, bool silent) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
#endif // defined(CVARS_WHITELIST)
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_3
|
||||
#include AZ_RESTRICTED_FILE(ISystem_h)
|
||||
@@ -616,9 +522,6 @@ struct SSystemInitParams
|
||||
{
|
||||
void* hInstance; //
|
||||
void* hWnd; //
|
||||
void* hWndForInputSystem; // the HWND for the input devices, distinct from the hWnd, which the rendering system overrides anyways
|
||||
|
||||
bool remoteResourceCompiler;
|
||||
|
||||
ILog* pLog; // You can specify your own ILog to be used by System.
|
||||
ILogCallback* pLogCallback; // You can specify your own ILogCallback to be added on log creation (used by Editor).
|
||||
@@ -633,33 +536,14 @@ struct SSystemInitParams
|
||||
bool bPreview; // When running in Preview mode (Minimal initialization).
|
||||
bool bTestMode; // When running in Automated testing mode.
|
||||
bool bDedicatedServer; // When running a dedicated server.
|
||||
bool bExecuteCommandLine; // can be switched of to suppress the feature or do it later during the initialization.
|
||||
bool bSkipFont; // Don't load CryFont.dll
|
||||
bool bSkipConsole; // Don't create console
|
||||
bool bSkipNetwork; // Don't create Network
|
||||
bool bSkipWebsocketServer; // Don't create the WebSocket server
|
||||
bool bMinimal; // Don't load banks
|
||||
bool bTesting; // CryUnit
|
||||
bool bNoRandom; //use fixed generator init/seed
|
||||
bool bUnattendedMode; // When running as part of a build on build-machines: Prevent popping up of any dialog
|
||||
bool bSkipMovie; // Don't load movie
|
||||
bool bSkipAnimation; // Don't load animation
|
||||
|
||||
bool bToolMode; // System is running inside a tool. Will not create USER directory or anything else that the game needs to do
|
||||
|
||||
bool bSkipPhysics; // Don't initialize CryPhysics.
|
||||
|
||||
ISystem* pSystem; // Pointer to existing ISystem interface, it will be reused if not NULL.
|
||||
|
||||
typedef void* (*ProtectedFunction)(void* param1, void* param2);
|
||||
ProtectedFunction pProtectedFunctions[eProtectedFuncsLast]; // Protected functions.
|
||||
|
||||
SCvarsDefault* pCvarsDefault; // to override the default value of some cvar
|
||||
|
||||
#if defined(CVARS_WHITELIST)
|
||||
ICVarsWhitelist* pCVarsWhitelist; // CVars whitelist callback
|
||||
#endif // defined(CVARS_WHITELIST)
|
||||
|
||||
SharedEnvironmentInstance* pSharedEnvironment;
|
||||
|
||||
// Summary:
|
||||
@@ -668,16 +552,10 @@ struct SSystemInitParams
|
||||
{
|
||||
hInstance = NULL;
|
||||
hWnd = NULL;
|
||||
hWndForInputSystem = NULL;
|
||||
|
||||
remoteResourceCompiler = false;
|
||||
|
||||
pLog = NULL;
|
||||
pLogCallback = NULL;
|
||||
pUserCallback = NULL;
|
||||
#if defined(CVARS_WHITELIST)
|
||||
pCVarsWhitelist = NULL;
|
||||
#endif // defined(CVARS_WHITELIST)
|
||||
sLogFileName = NULL;
|
||||
autoBackupLogs = true;
|
||||
pValidator = NULL;
|
||||
@@ -688,32 +566,13 @@ struct SSystemInitParams
|
||||
bPreview = false;
|
||||
bTestMode = false;
|
||||
bDedicatedServer = false;
|
||||
bExecuteCommandLine = true;
|
||||
bExecuteCommandLine = true;
|
||||
bSkipFont = false;
|
||||
bSkipConsole = false;
|
||||
bSkipNetwork = false;
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
// create websocket server by default. bear in mind that USE_HTTP_WEBSOCKETS is not defined in release.
|
||||
bSkipWebsocketServer = false;
|
||||
#else
|
||||
// CTCPStreamSocket only seems to fully support Win32 and 64
|
||||
bSkipWebsocketServer = true;
|
||||
#endif
|
||||
bMinimal = false;
|
||||
bTesting = false;
|
||||
bNoRandom = false;
|
||||
bUnattendedMode = false;
|
||||
bSkipMovie = false;
|
||||
bSkipAnimation = false;
|
||||
bToolMode = false;
|
||||
bSkipPhysics = false;
|
||||
|
||||
pSystem = NULL;
|
||||
|
||||
memset(pProtectedFunctions, 0, sizeof(pProtectedFunctions));
|
||||
pCvarsDefault = NULL;
|
||||
|
||||
pSharedEnvironment = nullptr;
|
||||
}
|
||||
};
|
||||
@@ -782,8 +641,6 @@ struct SSystemGlobalEnvironment
|
||||
{
|
||||
AZ::IO::IArchive* pCryPak;
|
||||
AZ::IO::FileIOBase* pFileIO;
|
||||
IProfileLogSystem* pProfileLogSystem;
|
||||
IOpticsManager* pOpticsManager;
|
||||
ITimer* pTimer;
|
||||
ICryFont* pCryFont;
|
||||
::IConsole* pConsole;
|
||||
@@ -791,81 +648,27 @@ struct SSystemGlobalEnvironment
|
||||
ILog* pLog;
|
||||
IMovieSystem* pMovieSystem;
|
||||
INameTable* pNameTable;
|
||||
IVisualLog* pVisualLog;
|
||||
IRenderer* pRenderer;
|
||||
IMaterialEffects* pMaterialEffects;
|
||||
ISoftCodeMgr* pSoftCodeMgr;
|
||||
ILyShine* pLyShine;
|
||||
IResourceCompilerHelper* pResourceCompilerHelper;
|
||||
SharedEnvironmentInstance* pSharedEnvironment;
|
||||
IThreadManager* pThreadManager;
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#define AZ_RESTRICTED_SECTION ISYSTEM_H_SECTION_4
|
||||
#include AZ_RESTRICTED_FILE(ISystem_h)
|
||||
#endif
|
||||
|
||||
ISystemScheduler* pSystemScheduler;
|
||||
|
||||
threadID mMainThreadId; //The main thread ID is used in multiple systems so should be stored globally
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
uint32 nMainFrameID;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const char* szCmdLine; // Startup command line.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Generic debug string which can be easily updated by any system and output by the debug handler
|
||||
enum
|
||||
{
|
||||
MAX_DEBUG_STRING_LENGTH = 128
|
||||
};
|
||||
char szDebugStatus[MAX_DEBUG_STRING_LENGTH];
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Used to tell if this is a server/multiplayer instance
|
||||
bool bServer;
|
||||
bool bMultiplayer;
|
||||
bool bHostMigrating;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Indicate Editor status.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Used by CRY_ASSERT
|
||||
bool bIgnoreAllAsserts;
|
||||
bool bNoAssertDialog;
|
||||
bool bTesting;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool bNoRandomSeed;
|
||||
|
||||
SPlatformInfo pi;
|
||||
|
||||
// Protected functions.
|
||||
SSystemInitParams::ProtectedFunction pProtectedFunctions[eProtectedFuncsLast]; // Protected functions.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Flag to able to print out of memory conditon
|
||||
bool bIsOutOfMemory;
|
||||
bool bIsOutOfVideoMemory;
|
||||
|
||||
bool bToolMode;
|
||||
|
||||
int retCode = 0;
|
||||
|
||||
ILINE const bool IsClient() const
|
||||
{
|
||||
#if defined(CONSOLE)
|
||||
return true;
|
||||
#else
|
||||
return bClient;
|
||||
#endif
|
||||
}
|
||||
|
||||
ILINE const bool IsDedicated() const
|
||||
{
|
||||
#if defined(CONSOLE)
|
||||
@@ -895,11 +698,6 @@ struct SSystemGlobalEnvironment
|
||||
{
|
||||
bDedicated = isDedicated;
|
||||
}
|
||||
|
||||
ILINE void SetIsClient(bool isClient)
|
||||
{
|
||||
bClient = isClient;
|
||||
}
|
||||
#endif
|
||||
|
||||
//this way the compiler can strip out code for consoles
|
||||
@@ -939,26 +737,6 @@ struct SSystemGlobalEnvironment
|
||||
#endif
|
||||
}
|
||||
|
||||
ILINE const bool IsFMVPlaying() const
|
||||
{
|
||||
return m_isFMVPlaying;
|
||||
}
|
||||
|
||||
ILINE void SetFMVIsPlaying(const bool isPlaying)
|
||||
{
|
||||
m_isFMVPlaying = isPlaying;
|
||||
}
|
||||
|
||||
ILINE const bool IsCutscenePlaying() const
|
||||
{
|
||||
return m_isCutscenePlaying;
|
||||
}
|
||||
|
||||
ILINE void SetCutsceneIsPlaying(const bool isPlaying)
|
||||
{
|
||||
m_isCutscenePlaying = isPlaying;
|
||||
}
|
||||
|
||||
ILINE bool IsInToolMode() const
|
||||
{
|
||||
return bToolMode;
|
||||
@@ -969,35 +747,17 @@ struct SSystemGlobalEnvironment
|
||||
bToolMode = bNewToolMode;
|
||||
}
|
||||
|
||||
ILINE void SetDynamicMergedMeshGenerationEnabled(bool mmgenEnable)
|
||||
{
|
||||
m_bDynamicMergedMeshGenerationEnabled = mmgenEnable;
|
||||
}
|
||||
|
||||
ILINE const bool IsDynamicMergedMeshGenerationEnabled() const
|
||||
{
|
||||
return m_bDynamicMergedMeshGenerationEnabled;
|
||||
}
|
||||
|
||||
#if !defined(CONSOLE)
|
||||
private:
|
||||
bool bClient;
|
||||
bool bEditor; // Engine is running under editor.
|
||||
bool bEditorGameMode; // Engine is in editor game mode.
|
||||
bool bEditorSimulationMode; // Engine is in editor simulation mode.
|
||||
bool bDedicated; // Engine is in dedicated
|
||||
#endif
|
||||
|
||||
bool m_isFMVPlaying;
|
||||
bool m_isCutscenePlaying;
|
||||
bool m_bDynamicMergedMeshGenerationEnabled;
|
||||
|
||||
public:
|
||||
SSystemGlobalEnvironment()
|
||||
: pSystemScheduler(nullptr)
|
||||
, szCmdLine("")
|
||||
, bToolMode(false)
|
||||
, m_bDynamicMergedMeshGenerationEnabled(false)
|
||||
: bToolMode(false)
|
||||
{
|
||||
};
|
||||
};
|
||||
@@ -1035,37 +795,11 @@ struct IProfilingSystem
|
||||
// Initialize and dispatch all engine's subsystems.
|
||||
struct ISystem
|
||||
{
|
||||
struct ILoadingProgressListener
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~ILoadingProgressListener() {}
|
||||
virtual void OnLoadingProgress(int steps) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
#ifndef _RELEASE
|
||||
enum LevelLoadOrigin
|
||||
{
|
||||
eLLO_Unknown,
|
||||
eLLO_NewLevel,
|
||||
eLLO_Level2Level,
|
||||
eLLO_Resumed,
|
||||
eLLO_MapCmd,
|
||||
};
|
||||
|
||||
struct ICheckpointData
|
||||
{
|
||||
int m_totalLoads;
|
||||
LevelLoadOrigin m_loadOrigin;
|
||||
};
|
||||
#endif
|
||||
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~ISystem() {}
|
||||
// Summary:
|
||||
// Releases ISystem.
|
||||
virtual void Release() = 0;
|
||||
virtual ILoadConfigurationEntrySink* GetCVarsWhiteListConfigSink() const = 0; // will return NULL if no whitelisting
|
||||
|
||||
// Summary:
|
||||
// Returns pointer to the global environment structure.
|
||||
@@ -1094,9 +828,6 @@ struct ISystem
|
||||
virtual void DoWorkDuringOcclusionChecks() = 0;
|
||||
virtual bool NeedDoWorkDuringOcclusionChecks() = 0;
|
||||
|
||||
//! Update screen and call some important tick functions during loading.
|
||||
virtual void SynchronousLoadingTick(const char* pFunc, int line) = 0;
|
||||
|
||||
// Summary:
|
||||
// Returns the current used memory.
|
||||
virtual uint32 GetUsedMemory() = 0;
|
||||
@@ -1170,7 +901,6 @@ struct ISystem
|
||||
virtual IZLibDecompressor* GetIZLibDecompressor() = 0;
|
||||
virtual ILZ4Decompressor* GetLZ4Decompressor() = 0;
|
||||
virtual IZStdDecompressor* GetZStdDecompressor() = 0;
|
||||
virtual INotificationNetwork* GetINotificationNetwork() = 0;
|
||||
virtual IViewSystem* GetIViewSystem() = 0;
|
||||
virtual ILevelSystem* GetILevelSystem() = 0;
|
||||
virtual INameTable* GetINameTable() = 0;
|
||||
@@ -1187,24 +917,10 @@ struct ISystem
|
||||
// Returns:
|
||||
// Can be NULL, because it only exists when running through the editor, not in pure game mode.
|
||||
virtual IResourceManager* GetIResourceManager() = 0;
|
||||
virtual IThreadTaskManager* GetIThreadTaskManager() = 0;
|
||||
virtual IProfilingSystem* GetIProfilingSystem() = 0;
|
||||
virtual ISystemEventDispatcher* GetISystemEventDispatcher() = 0;
|
||||
virtual IVisualLog* GetIVisualLog() = 0;
|
||||
|
||||
virtual ITimer* GetITimer() = 0;
|
||||
virtual IThreadManager* GetIThreadManager() = 0;
|
||||
|
||||
virtual void SetLoadingProgressListener(ILoadingProgressListener* pListener) = 0;
|
||||
virtual ISystem::ILoadingProgressListener* GetLoadingProgressListener() const = 0;
|
||||
|
||||
// Summary:
|
||||
// Game is created after System init, so has to be set explicitly.
|
||||
virtual void SetIMaterialEffects(IMaterialEffects* pMaterialEffects) = 0;
|
||||
virtual void SetIOpticsManager(IOpticsManager* pOpticsManager) = 0;
|
||||
virtual void SetIVisualLog(IVisualLog* pVisualLog) = 0;
|
||||
|
||||
//virtual const char *GetGamePath()=0;
|
||||
|
||||
virtual void DebugStats(bool checkpoint, bool leaks) = 0;
|
||||
virtual void DumpWinHeaps() = 0;
|
||||
@@ -1219,7 +935,6 @@ struct ISystem
|
||||
virtual bool WasInDevMode() const = 0;
|
||||
virtual bool IsDevMode() const = 0;
|
||||
virtual bool IsMODValid(const char* szMODName) const = 0;
|
||||
virtual bool IsMinimalMode() const = 0;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -1334,12 +1049,6 @@ struct ISystem
|
||||
// Detects and set optimal spec.
|
||||
virtual void AutoDetectSpec(bool detectResolution) = 0;
|
||||
|
||||
// Summary:
|
||||
// Thread management for subsystems
|
||||
// Return Value:
|
||||
// Non-0 if the state was indeed changed, 0 if already in that state.
|
||||
virtual int SetThreadState(ESubsystem subsys, bool bActive) = 0;
|
||||
|
||||
// Summary:
|
||||
// Query if system is now paused.
|
||||
// Pause flag is set when calling system update with pause mode.
|
||||
@@ -1406,14 +1115,6 @@ struct ISystem
|
||||
// Get log index of the currently running Open 3D Engine application. (0 = first instance, 1 = second instance, etc)
|
||||
virtual int GetApplicationLogInstance(const char* logFilePath) = 0;
|
||||
|
||||
// Summary:
|
||||
// Retrieves the current stats for systems to update the respective time taken
|
||||
virtual sUpdateTimes& GetCurrentUpdateTimeStats() = 0;
|
||||
|
||||
// Summary:
|
||||
// Retrieves the array of update times and the number of entries
|
||||
virtual const sUpdateTimes* GetUpdateTimeStats(uint32&, uint32&) = 0;
|
||||
|
||||
// Summary:
|
||||
// Clear all currently logged and drawn on screen error messages
|
||||
virtual void ClearErrorMessages() = 0;
|
||||
@@ -1458,17 +1159,6 @@ struct ISystem
|
||||
virtual void AsyncMemcpy(void* dst, const void* src, size_t size, int nFlags, volatile int* sync) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
|
||||
|
||||
#if defined(CVARS_WHITELIST)
|
||||
virtual ICVarsWhitelist* GetCVarsWhiteList() const = 0;
|
||||
#endif // defined(CVARS_WHITELIST)
|
||||
|
||||
#ifndef _RELEASE
|
||||
virtual void GetCheckpointData(ICheckpointData& data) = 0;
|
||||
virtual void IncreaseCheckpointLoadCount() = 0;
|
||||
virtual void SetLoadOrigin(LevelLoadOrigin origin) = 0;
|
||||
#endif
|
||||
|
||||
#if !defined(_RELEASE)
|
||||
virtual bool IsSavingResourceList() const = 0;
|
||||
#endif
|
||||
@@ -1513,11 +1203,6 @@ struct ISystem
|
||||
using CrySystemNotificationBus = AZ::EBus<CrySystemNotifications>;
|
||||
};
|
||||
|
||||
//JAT - this is a very important function for the dedicated server - it lets us run >1000 players per piece of server hardware
|
||||
//JAT - this saves us lots of money on the dedicated server hardware
|
||||
#define SYNCHRONOUS_LOADING_TICK() do { if (gEnv && gEnv->pSystem) {gEnv->pSystem->SynchronousLoadingTick(__FUNC__, __LINE__); } \
|
||||
} while (0)
|
||||
|
||||
#if defined(USE_DISK_PROFILER)
|
||||
|
||||
struct DiskOperationInfo
|
||||
@@ -1594,7 +1279,7 @@ typedef ISystem* (*PFNCREATESYSTEMINTERFACE)(SSystemInitParams& initParams);
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Global environment variable.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
extern SC_API SSystemGlobalEnvironment* gEnv;
|
||||
extern SSystemGlobalEnvironment* gEnv;
|
||||
|
||||
|
||||
// Summary:
|
||||
@@ -1613,11 +1298,6 @@ inline ISystem* GetISystem()
|
||||
}
|
||||
return systemInterface;
|
||||
};
|
||||
|
||||
inline ISystemScheduler* GetISystemScheduler(void)
|
||||
{
|
||||
return gEnv->pSystemScheduler;
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Description:
|
||||
@@ -1640,7 +1320,6 @@ void* GetDetachEnvironmentSymbol();
|
||||
|
||||
|
||||
extern bool g_bProfilerEnabled;
|
||||
extern int g_iTraceAllocations;
|
||||
|
||||
// Summary:
|
||||
// Interface of the DLL.
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_ISYSTEMSCHEDULER_H
|
||||
#define CRYINCLUDE_CRYCOMMON_ISYSTEMSCHEDULER_H
|
||||
#pragma once
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define SLICE_AND_SLEEP() do { if (GetISystemScheduler()) { GetISystemScheduler()->SliceAndSleep(__FUNC__, __LINE__); } \
|
||||
} while (0)
|
||||
#define SLICE_SCOPE_DEFINE() CSliceLoadingMonitor sliceScope
|
||||
#else
|
||||
extern void SliceAndSleep(const char* pFunc, int line);
|
||||
#define SLICE_AND_SLEEP() SliceAndSleep(__FILE__, __LINE__)
|
||||
#endif
|
||||
|
||||
struct ISystemScheduler
|
||||
{
|
||||
virtual ~ISystemScheduler(){}
|
||||
|
||||
// <interfuscator:shuffle>
|
||||
// Map load slicing functionality support
|
||||
virtual void SliceAndSleep(const char* sliceName, int line) = 0;
|
||||
virtual void SliceLoadingBegin() = 0;
|
||||
virtual void SliceLoadingEnd() = 0;
|
||||
|
||||
virtual void SchedulingSleepIfNeeded(void) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
ISystemScheduler* GetISystemScheduler(void);
|
||||
|
||||
class CSliceLoadingMonitor
|
||||
{
|
||||
public:
|
||||
CSliceLoadingMonitor()
|
||||
{
|
||||
if (GetISystemScheduler())
|
||||
{
|
||||
GetISystemScheduler()->SliceLoadingBegin();
|
||||
}
|
||||
}
|
||||
|
||||
~CSliceLoadingMonitor()
|
||||
{
|
||||
if (GetISystemScheduler())
|
||||
{
|
||||
GetISystemScheduler()->SliceLoadingEnd();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_ISYSTEMSCHEDULER_H
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#pragma once
|
||||
|
||||
class IThreadConfigManager;
|
||||
|
||||
enum EJoinMode
|
||||
{
|
||||
eJM_TryJoin,
|
||||
eJM_Join,
|
||||
};
|
||||
|
||||
class IThread
|
||||
{
|
||||
public:
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~IThread()
|
||||
{
|
||||
}
|
||||
|
||||
//! Entry functions for code executed on thread.
|
||||
virtual void ThreadEntry() = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
enum EFPE_Severity
|
||||
{
|
||||
eFPE_None, //!< No Floating Point Exceptions.
|
||||
eFPE_Basic, //!< Invalid operation, Div by 0.
|
||||
eFPE_All, //!< Invalid operation, Div by 0, Denormalized operand, Overflow, Underflow, Inexact.
|
||||
eFPE_LastEntry
|
||||
};
|
||||
|
||||
//temp disable CRY DX12
|
||||
//#define SCOPED_ENABLE_FLOAT_EXCEPTIONS(eFPESeverity) CScopedFloatingPointException scopedSetFloatExceptionMask(eFPESeverity)
|
||||
//#define SCOPED_DISABLE_FLOAT_EXCEPTIONS() CScopedFloatingPointException scopedSetFloatExceptionMask(eFPE_None)
|
||||
|
||||
struct IThreadManager
|
||||
{
|
||||
public:
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~IThreadManager()
|
||||
{
|
||||
}
|
||||
|
||||
//! Get thread config manager.
|
||||
virtual IThreadConfigManager* GetThreadConfigManager() = 0;
|
||||
|
||||
//! Spawn a new thread and apply thread config settings at thread beginning.
|
||||
virtual bool SpawnThread(IThread* pThread, const char* sThreadName, ...) = 0;
|
||||
|
||||
//! Wait on another thread to exit (Blocking).
|
||||
//! Use eJM_TryJoin if you cannot be sure that the target thread is awake.
|
||||
//! \retval true if target thread has not been started yet or has already exited.
|
||||
//! \retval false if target thread is still running and therefore not in a state to exit.
|
||||
virtual bool JoinThread(IThread* pThreadTask, EJoinMode joinStatus) = 0;
|
||||
|
||||
//! Register 3rd party thread with the thread manager.
|
||||
//! Applies thread config for thread if found.
|
||||
//! \param pThreadHandle If NULL, the current thread handle will be used.
|
||||
virtual bool RegisterThirdPartyThread(void* pThreadHandle, const char* sThreadName, ...) = 0;
|
||||
|
||||
//! Unregister 3rd party thread with the thread manager.
|
||||
virtual bool UnRegisterThirdPartyThread(const char* sThreadName, ...) = 0;
|
||||
|
||||
//! Get Thread Name.
|
||||
//! Returns "" if thread not found.
|
||||
virtual const char* GetThreadName(threadID nThreadId) = 0;
|
||||
|
||||
//! Get ThreadID.
|
||||
virtual threadID GetThreadId(const char* sThreadName, ...) = 0;
|
||||
|
||||
//! Execute function for each other thread but this one.
|
||||
typedef void (* ThreadModifFunction)(threadID nThreadId, void* pData);
|
||||
virtual void ForEachOtherThread(IThreadManager::ThreadModifFunction fpThreadModiFunction, void* pFuncData = 0) = 0;
|
||||
|
||||
virtual void EnableFloatExceptions(EFPE_Severity eFPESeverity, threadID nThreadId = 0) = 0;
|
||||
virtual void EnableFloatExceptionsForEachOtherThread(EFPE_Severity eFPESeverity) = 0;
|
||||
|
||||
virtual uint GetFloatingPointExceptionMask() = 0;
|
||||
virtual void SetFloatingPointExceptionMask(uint nMask) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
/*TEMP DISABLE CRY DX12
|
||||
class CScopedFloatingPointException
|
||||
{
|
||||
public:
|
||||
CScopedFloatingPointException(EFPE_Severity eFPESeverity)
|
||||
{
|
||||
oldMask = gEnv->pThreadManager->GetFloatingPointExceptionMask();
|
||||
gEnv->pThreadManager->EnableFloatExceptions(eFPESeverity);
|
||||
}
|
||||
~CScopedFloatingPointException()
|
||||
{
|
||||
gEnv->pThreadManager->SetFloatingPointExceptionMask(oldMask);
|
||||
}
|
||||
private:
|
||||
uint oldMask;
|
||||
};
|
||||
*/
|
||||
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "BitFiddling.h"
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_ITHREADTASK_H
|
||||
#define CRYINCLUDE_CRYCOMMON_ITHREADTASK_H
|
||||
#pragma once
|
||||
|
||||
#include <smartptr.h>
|
||||
|
||||
// forward declarations
|
||||
struct SThreadTaskInfo;
|
||||
|
||||
enum EThreadTaskFlags
|
||||
{
|
||||
THREAD_TASK_BLOCKING = BIT(0), // Blocking tasks will be allocated on their own thread.
|
||||
THREAD_TASK_ASSIGN_TO_POOL = BIT(1), // Task can be assigned to any thread in the group of threads
|
||||
};
|
||||
|
||||
class IThreadTask_Thread
|
||||
{
|
||||
public:
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~IThreadTask_Thread() {};
|
||||
virtual void AddTask(SThreadTaskInfo* pTaskInfo) = 0;
|
||||
virtual void RemoveTask(SThreadTaskInfo* pTaskInfo) = 0;
|
||||
virtual void RemoveAllTasks() = 0;
|
||||
virtual void SingleUpdate() = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
typedef int ThreadPoolHandle;
|
||||
|
||||
struct SThreadTaskParams
|
||||
{
|
||||
uint32 nFlags; // Task flags. @see ETaskFlags
|
||||
union
|
||||
{
|
||||
int nPreferedThread; // Preferred Thread index (0,1,2,3...)
|
||||
ThreadPoolHandle nThreadsGroupId; // Id of group of threads(useful only if THREAD_TASK_ASSIGN_TO_POOL is set)
|
||||
};
|
||||
int16 nPriorityOff; // If THREAD_TASK_BLOCKING, this will adjust the priority of the thread
|
||||
int16 nStackSizeKB; // If THREAD_TASK_BLOCKING, this will adjust the stack size of the thread
|
||||
const char* name; // Name for this task (thread for the blocking task will be named using this string)
|
||||
|
||||
SThreadTaskParams()
|
||||
: nFlags(0)
|
||||
, nPreferedThread(-1)
|
||||
, nPriorityOff(0)
|
||||
, name("")
|
||||
, nStackSizeKB(SIMPLE_THREAD_STACK_SIZE_KB) {}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Tasks must implement this interface.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IThreadTask
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
// The function to be called on every update for non bocking tasks.
|
||||
// Or will be called only once for the blocking threads.
|
||||
virtual void OnUpdate() = 0;
|
||||
|
||||
// Called to indicate that this task must quit.
|
||||
// Warning! can be called from different thread then OnUpdate call.
|
||||
virtual void Stop() = 0;
|
||||
|
||||
// Returns task info
|
||||
virtual struct SThreadTaskInfo* GetTaskInfo() = 0;
|
||||
|
||||
virtual ~IThreadTask() {}
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
struct SThreadTaskInfo
|
||||
: public CMultiThreadRefCount
|
||||
{
|
||||
IThreadTask_Thread* m_pThread;
|
||||
IThreadTask* m_pTask;
|
||||
SThreadTaskParams m_params;
|
||||
|
||||
SThreadTaskInfo()
|
||||
: m_pThread(NULL)
|
||||
, m_pTask(NULL) { m_params.nFlags = 0; m_params.nPreferedThread = -1; }
|
||||
};
|
||||
|
||||
// Might be changed to uint64 etc in the future
|
||||
typedef uint32 ThreadPoolAffinityMask;
|
||||
#define INVALID_AFFINITY 0
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Description of thread pool to create
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct ThreadPoolDesc
|
||||
{
|
||||
ThreadPoolAffinityMask AffinityMask; // number of bits means number of threads. affinity overlapping is prohibited
|
||||
string sPoolName;
|
||||
int32 nThreadPriority;
|
||||
int32 nThreadStackSizeKB;
|
||||
|
||||
ThreadPoolDesc()
|
||||
: AffinityMask(INVALID_AFFINITY)
|
||||
, sPoolName("UnnamedPool")
|
||||
, nThreadPriority(-1)
|
||||
, nThreadStackSizeKB(-1) { }
|
||||
|
||||
ILINE bool CreateThread(ThreadPoolAffinityMask affinityMask)
|
||||
{
|
||||
if (this->AffinityMask & affinityMask)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this->AffinityMask |= affinityMask;
|
||||
return true;
|
||||
}
|
||||
|
||||
ILINE uint32 GetThreadCount() const
|
||||
{
|
||||
return CountBits(AffinityMask);
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Task manager.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct IThreadTaskManager
|
||||
{
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~IThreadTaskManager(){}
|
||||
// Register new task to the manager.
|
||||
virtual void RegisterTask(IThreadTask* pTask, const SThreadTaskParams& options) = 0;
|
||||
virtual void UnregisterTask(IThreadTask* pTask) = 0;
|
||||
|
||||
// Limit number of threads to this amount.
|
||||
virtual void SetMaxThreadCount(int nMaxThreads) = 0;
|
||||
|
||||
// Create a pool of threads
|
||||
virtual ThreadPoolHandle CreateThreadsPool(const ThreadPoolDesc& desc) = 0;
|
||||
virtual const bool DestroyThreadsPool(const ThreadPoolHandle& handle) = 0;
|
||||
virtual const bool GetThreadsPoolDesc(const ThreadPoolHandle handle, ThreadPoolDesc* pDesc) const = 0;
|
||||
virtual const bool SetThreadsPoolAffinity(const ThreadPoolHandle handle, const ThreadPoolAffinityMask AffinityMask) = 0;
|
||||
|
||||
virtual void SetThreadName(threadID dwThreadId, const char* sThreadName) = 0;
|
||||
virtual const char* GetThreadName(threadID dwThreadId) = 0;
|
||||
|
||||
// Return thread handle by thread name
|
||||
virtual threadID GetThreadByName(const char* sThreadName) = 0;
|
||||
|
||||
// if bMark=true the calling thread will dump its stack during crashes
|
||||
virtual void MarkThisThreadForDebugging(const char* name, bool bDump) = 0;
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_ITHREADTASK_H
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include <CryMemoryManager.h>
|
||||
|
||||
class MemoryManagerMock
|
||||
: public IMemoryManager
|
||||
{
|
||||
public:
|
||||
MOCK_METHOD1(GetProcessMemInfo,
|
||||
bool(SProcessMemInfo& minfo));
|
||||
MOCK_METHOD3(TraceDefineHeap,
|
||||
HeapHandle(const char* heapName, size_t size, const void* pBase));
|
||||
MOCK_METHOD6(TraceHeapAlloc,
|
||||
void(HeapHandle heap, void* mem, size_t size, size_t blockSize, const char* sUsage, const char* sNameHint));
|
||||
MOCK_METHOD3(TraceHeapFree,
|
||||
void(HeapHandle heap, void* mem, size_t blockSize));
|
||||
MOCK_METHOD1(TraceHeapSetColor,
|
||||
void(uint32 color));
|
||||
MOCK_METHOD0(TraceHeapGetColor,
|
||||
uint32());
|
||||
MOCK_METHOD1(TraceHeapSetLabel,
|
||||
void(const char* sLabel));
|
||||
MOCK_METHOD1(CreateCustomMemoryHeapInstance,
|
||||
ICustomMemoryHeap* const (EAllocPolicy const eAllocPolicy));
|
||||
MOCK_METHOD3(CreateGeneralExpandingMemoryHeap,
|
||||
IGeneralMemoryHeap* (size_t upperLimit, size_t reserveSize, const char* sUsage));
|
||||
MOCK_METHOD3(CreateGeneralMemoryHeap,
|
||||
IGeneralMemoryHeap* (void* base, size_t sz, const char* sUsage));
|
||||
MOCK_METHOD2(ReserveAddressRange,
|
||||
IMemoryAddressRange* (size_t capacity, const char* sName));
|
||||
MOCK_METHOD2(CreatePageMappingHeap,
|
||||
IPageMappingHeap* (size_t addressSpace, const char* sName));
|
||||
};
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct NetworkMock : public INetwork
|
||||
{
|
||||
NetworkMock() : m_gridMate(nullptr)
|
||||
{
|
||||
}
|
||||
GridMate::IGridMate* m_gridMate;
|
||||
|
||||
void Release() override {}
|
||||
void GetMemoryStatistics([[maybe_unused]] ICrySizer* pSizer) override {}
|
||||
void GetBandwidthStatistics([[maybe_unused]] SBandwidthStats* const pStats) override {}
|
||||
void GetPerformanceStatistics([[maybe_unused]] SNetworkPerformance* pSizer) override {}
|
||||
void GetProfilingStatistics([[maybe_unused]] SNetworkProfilingStats* const pStats) override {}
|
||||
void SyncWithGame([[maybe_unused]] ENetworkGameSync syncType) override {}
|
||||
const char* GetHostName() override { return "testhostname"; }
|
||||
GridMate::IGridMate* GetGridMate() override
|
||||
{
|
||||
return m_gridMate;
|
||||
}
|
||||
ChannelId GetChannelIdForSessionMember([[maybe_unused]] GridMate::GridMember* member) const override { return ChannelId(); }
|
||||
ChannelId GetServerChannelId() const override { return ChannelId(); }
|
||||
ChannelId GetLocalChannelId() const override { return ChannelId(); }
|
||||
CTimeValue GetSessionTime() override { return CTimeValue(); }
|
||||
void ChangedAspects([[maybe_unused]] EntityId id, [[maybe_unused]] NetworkAspectType aspectBits) override {}
|
||||
void SetDelegatableAspectMask([[maybe_unused]] NetworkAspectType aspectBits) override {}
|
||||
void SetObjectDelegatedAspectMask([[maybe_unused]] EntityId entityId, [[maybe_unused]] NetworkAspectType aspects, [[maybe_unused]] bool set) override {}
|
||||
void DelegateAuthorityToClient([[maybe_unused]] EntityId entityId, [[maybe_unused]] ChannelId clientChannelId) override {}
|
||||
void InvokeActorRMI([[maybe_unused]] EntityId entityId, [[maybe_unused]] uint8 actorExtensionId, [[maybe_unused]] ChannelId targetChannelFilter, [[maybe_unused]] IActorRMIRep& rep) override {}
|
||||
void InvokeScriptRMI([[maybe_unused]] ISerializable* serializable, [[maybe_unused]] bool isServerRMI, [[maybe_unused]] ChannelId toChannelId = kInvalidChannelId, [[maybe_unused]] ChannelId avoidChannelId = kInvalidChannelId) override {}
|
||||
void RegisterActorRMI([[maybe_unused]] IActorRMIRep* rep) override {}
|
||||
void UnregisterActorRMI([[maybe_unused]] IActorRMIRep* rep) override {}
|
||||
EntityId LocalEntityIdToServerEntityId([[maybe_unused]] EntityId localId) const override { return EntityId(); }
|
||||
EntityId ServerEntityIdToLocalEntityId([[maybe_unused]] EntityId serverId, [[maybe_unused]] bool allowForcedEstablishment = false) const override { return EntityId(); }
|
||||
};
|
||||
@@ -585,8 +585,6 @@ public:
|
||||
SDepthTexture * (int, int, bool));
|
||||
MOCK_METHOD1(DestroyDepthSurface,
|
||||
void(SDepthTexture * pDepthSurf));
|
||||
MOCK_CONST_METHOD1(CreateOptics,
|
||||
IOpticsElementBase * (EFlareType type));
|
||||
MOCK_METHOD1(PauseTimer,
|
||||
void(bool bPause));
|
||||
MOCK_METHOD0(CreateShaderPublicParams,
|
||||
|
||||
@@ -23,8 +23,6 @@ class SystemMock
|
||||
public:
|
||||
MOCK_METHOD0(Release,
|
||||
void());
|
||||
MOCK_CONST_METHOD0(GetCVarsWhiteListConfigSink,
|
||||
ILoadConfigurationEntrySink * ());
|
||||
MOCK_METHOD0(GetGlobalEnvironment,
|
||||
SSystemGlobalEnvironment * ());
|
||||
MOCK_METHOD2(UpdatePreTickBus,
|
||||
@@ -37,8 +35,6 @@ public:
|
||||
void());
|
||||
MOCK_METHOD0(NeedDoWorkDuringOcclusionChecks,
|
||||
bool());
|
||||
MOCK_METHOD2(SynchronousLoadingTick,
|
||||
void(const char* pFunc, int line));
|
||||
MOCK_METHOD0(RenderStatistics,
|
||||
void());
|
||||
MOCK_METHOD0(GetUsedMemory,
|
||||
@@ -84,8 +80,6 @@ public:
|
||||
ILZ4Decompressor * ());
|
||||
MOCK_METHOD0(GetZStdDecompressor,
|
||||
IZStdDecompressor * ());
|
||||
MOCK_METHOD0(GetINotificationNetwork,
|
||||
INotificationNetwork * ());
|
||||
MOCK_METHOD0(GetIViewSystem,
|
||||
IViewSystem * ());
|
||||
MOCK_METHOD0(GetILevelSystem,
|
||||
@@ -116,28 +110,12 @@ public:
|
||||
IRemoteConsole * ());
|
||||
MOCK_METHOD0(GetIResourceManager,
|
||||
IResourceManager * ());
|
||||
MOCK_METHOD0(GetIThreadTaskManager,
|
||||
IThreadTaskManager * ());
|
||||
MOCK_METHOD0(GetIProfilingSystem,
|
||||
IProfilingSystem * ());
|
||||
MOCK_METHOD0(GetISystemEventDispatcher,
|
||||
ISystemEventDispatcher * ());
|
||||
MOCK_METHOD0(GetIVisualLog,
|
||||
IVisualLog * ());
|
||||
MOCK_METHOD0(GetITimer,
|
||||
ITimer * ());
|
||||
MOCK_METHOD0(GetIThreadManager,
|
||||
IThreadManager * ());
|
||||
MOCK_METHOD1(SetLoadingProgressListener,
|
||||
void(ILoadingProgressListener * pListener));
|
||||
MOCK_CONST_METHOD0(GetLoadingProgressListener,
|
||||
ISystem::ILoadingProgressListener * ());
|
||||
MOCK_METHOD1(SetIMaterialEffects,
|
||||
void(IMaterialEffects * pMaterialEffects));
|
||||
MOCK_METHOD1(SetIOpticsManager,
|
||||
void(IOpticsManager * pOpticsManager));
|
||||
MOCK_METHOD1(SetIVisualLog,
|
||||
void(IVisualLog * pVisualLog));
|
||||
MOCK_METHOD2(DebugStats,
|
||||
void(bool checkpoint, bool leaks));
|
||||
MOCK_METHOD0(DumpWinHeaps,
|
||||
@@ -154,8 +132,6 @@ public:
|
||||
bool());
|
||||
MOCK_CONST_METHOD1(IsMODValid,
|
||||
bool(const char* szMODName));
|
||||
MOCK_CONST_METHOD0(IsMinimalMode,
|
||||
bool());
|
||||
MOCK_METHOD3(CreateXmlNode,
|
||||
XmlNodeRef(const char*, bool, bool));
|
||||
MOCK_METHOD4(LoadXmlFromBuffer,
|
||||
@@ -209,8 +185,6 @@ public:
|
||||
void(ESystemConfigPlatform platform));
|
||||
MOCK_METHOD1(AutoDetectSpec,
|
||||
void(bool detectResolution));
|
||||
MOCK_METHOD2(SetThreadState,
|
||||
int(ESubsystem subsys, bool bActive));
|
||||
MOCK_CONST_METHOD0(IsPaused,
|
||||
bool());
|
||||
MOCK_METHOD0(GetLocalizationManager,
|
||||
@@ -239,10 +213,6 @@ public:
|
||||
int());
|
||||
MOCK_METHOD1(GetApplicationLogInstance,
|
||||
int(const char* logFilePath));
|
||||
MOCK_METHOD0(GetCurrentUpdateTimeStats,
|
||||
sUpdateTimes & ());
|
||||
MOCK_METHOD2(GetUpdateTimeStats,
|
||||
const sUpdateTimes * (uint32 &, uint32 &));
|
||||
MOCK_METHOD0(ClearErrorMessages,
|
||||
void());
|
||||
MOCK_METHOD2(debug_GetCallStack,
|
||||
@@ -260,20 +230,6 @@ public:
|
||||
MOCK_METHOD5(AsyncMemcpy,
|
||||
void(void* dst, const void* src, size_t size, int nFlags, volatile int* sync));
|
||||
|
||||
#if defined(CVARS_WHITELIST)
|
||||
MOCK_CONST_METHOD0(GetCVarsWhiteList,
|
||||
ICVarsWhitelist * ());
|
||||
#endif
|
||||
|
||||
#ifndef _RELEASE
|
||||
MOCK_METHOD1(GetCheckpointData,
|
||||
void(ICheckpointData & data));
|
||||
MOCK_METHOD0(IncreaseCheckpointLoadCount,
|
||||
void());
|
||||
MOCK_METHOD1(SetLoadOrigin,
|
||||
void(LevelLoadOrigin origin));
|
||||
#endif
|
||||
|
||||
#if !defined(_RELEASE)
|
||||
MOCK_CONST_METHOD0(IsSavingResourceList,
|
||||
bool());
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzTest/AzTest.h>
|
||||
|
||||
#include <CGFContent.h>
|
||||
|
||||
class MockIAssetWriter
|
||||
: public IAssetWriter
|
||||
{
|
||||
public:
|
||||
~MockIAssetWriter() override = default;
|
||||
MOCK_METHOD1(WriteCGF,
|
||||
bool(CContentCGF* content));
|
||||
MOCK_METHOD2(WriteCHR,
|
||||
bool(CContentCGF* content, IConvertContext* convertContext));
|
||||
MOCK_METHOD3(WriteSKIN,
|
||||
bool(CContentCGF* content, IConvertContext* convertContext, bool exportMorphTargets));
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
../../WinBase.cpp
|
||||
)
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
../../WinBase.cpp
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
../../EngineSettingsBackendApple.cpp
|
||||
../../EngineSettingsBackendApple.h
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
../../WinBase.cpp
|
||||
)
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
../../EngineSettingsBackendWin32.cpp
|
||||
../../EngineSettingsBackendWin32.h
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@@ -1,13 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
)
|
||||
@@ -1,11 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(FILES
|
||||
../../WinBase.cpp
|
||||
)
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_PROFILELOG_H
|
||||
#define CRYINCLUDE_CRYCOMMON_PROFILELOG_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <ISystem.h> // <> required for Interfuscator
|
||||
#include <ITimer.h> // <> required for Interfuscator
|
||||
|
||||
struct ILogElement
|
||||
{
|
||||
virtual ~ILogElement(){}
|
||||
virtual ILogElement* Log (const char* name, const char* message) = 0;
|
||||
virtual ILogElement* SetTime (float time) = 0;
|
||||
virtual void Flush (stack_string& indent) = 0;
|
||||
};
|
||||
|
||||
struct IProfileLogSystem
|
||||
{
|
||||
virtual ~IProfileLogSystem(){}
|
||||
virtual ILogElement* Log (const char* name, const char* msg) = 0;
|
||||
virtual void SetTime (ILogElement* pElement, float time) = 0;
|
||||
virtual void Release () = 0;
|
||||
};
|
||||
|
||||
struct SHierProfileLogItem
|
||||
{
|
||||
SHierProfileLogItem(const char* name, const char* msg, int inbDoLog)
|
||||
: m_pLogElement(NULL)
|
||||
, m_bDoLog(inbDoLog)
|
||||
{
|
||||
if (m_bDoLog)
|
||||
{
|
||||
m_pLogElement = gEnv->pProfileLogSystem->Log(name, msg);
|
||||
m_startTime = gEnv->pTimer->GetAsyncTime();
|
||||
}
|
||||
}
|
||||
~SHierProfileLogItem()
|
||||
{
|
||||
if (m_bDoLog)
|
||||
{
|
||||
CTimeValue endTime = gEnv->pTimer->GetAsyncTime();
|
||||
gEnv->pProfileLogSystem->SetTime(m_pLogElement, (endTime - m_startTime).GetMilliSeconds());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int m_bDoLog;
|
||||
CTimeValue m_startTime;
|
||||
ILogElement* m_pLogElement;
|
||||
};
|
||||
|
||||
#define HPROFILE_BEGIN(msg1, msg2, doLog) { SHierProfileLogItem __hier_profile_uniq_var_in_this_scope__(msg1, msg2, doLog);
|
||||
#define HPROFILE_END() }
|
||||
|
||||
#define HPROFILE(msg1, msg2, doLog) SHierProfileLogItem __hier_profile_uniq_var_in_this_scope__(msg1, msg2, doLog);
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_PROFILELOG_H
|
||||
@@ -78,9 +78,6 @@ typedef uint32 vtx_idx;
|
||||
|
||||
#if defined(WIN32) || defined(WIN64) || LOG_CONST_CVAR_ACCESS
|
||||
#define RELEASE_LOGGING
|
||||
//#if defined(_RELEASE)
|
||||
//#define CVARS_WHITELIST
|
||||
//#endif // defined(_RELEASE)
|
||||
#endif
|
||||
|
||||
#if defined(_RELEASE) && !defined(RELEASE_LOGGING)
|
||||
@@ -181,32 +178,6 @@ typedef uint32 vtx_idx;
|
||||
#define SHADER_REFLECT_TEXTURE_SLOTS 0
|
||||
#endif
|
||||
|
||||
#if (defined(WIN32) || defined(WIN64) || defined(AZ_PLATFORM_MAC)) && (!defined(AZ_MONOLITHIC_BUILD) || defined(RESOURCE_COMPILER))
|
||||
#define CRY_ENABLE_RC_HELPER 1
|
||||
#endif
|
||||
|
||||
#if !defined(_RELEASE) && PROJECTDEFINES_H_TRAIT_ENABLE_SOFTCODE_SYSTEM
|
||||
#define SOFTCODE_SYSTEM_ENABLED
|
||||
#endif
|
||||
|
||||
// Is SoftCoding enabled for this module? Usually set by the SoftCode AddIn in conjunction with a SoftCode.props file.
|
||||
#ifdef SOFTCODE_ENABLED
|
||||
|
||||
// Is this current compilation unit part of a SOFTCODE build?
|
||||
#ifdef SOFTCODE
|
||||
// Import any SC functions from the host module
|
||||
#define SC_API __declspec(dllimport)
|
||||
#else
|
||||
// Export any SC functions from the host module
|
||||
#define SC_API __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
#else // SoftCode disabled
|
||||
|
||||
#define SC_API
|
||||
|
||||
#endif
|
||||
|
||||
// these enable and disable certain net features to give compatibility between PCs and consoles / profile and performance builds
|
||||
#define PC_CONSOLE_NET_COMPATIBLE 0
|
||||
#define PROFILE_PERFORMANCE_NET_COMPATIBLE 0
|
||||
@@ -292,10 +263,6 @@ typedef uint32 vtx_idx;
|
||||
# define ENABLE_LOADING_PROFILER // requires AZ_PROFILE_TELEMETRY to also be defined
|
||||
#endif
|
||||
|
||||
#if defined(SOFTCODE_ENABLED)
|
||||
#error "SoftCode currently relies on CryMemoryManager being enabled. Either build without SoftCode support, or enable CryMemoryManager."
|
||||
#endif
|
||||
|
||||
#if PROJECTDEFINES_H_TRAIT_USE_GPU_PARTICLES && !defined(NULL_RENDERER)
|
||||
#define GPU_PARTICLES 1
|
||||
#else
|
||||
|
||||
@@ -1,639 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
|
||||
#include "ProjectDefines.h"
|
||||
|
||||
#if defined(CRY_ENABLE_RC_HELPER)
|
||||
|
||||
#include "ResourceCompilerHelper.h"
|
||||
#include "EngineSettingsManager.h"
|
||||
|
||||
// When complining CryTiffPlugin the mayaAssert.h is included that defined
|
||||
// Assert as _Assert. This wreaks havoc with AZ_Assert since under the covers
|
||||
// it calls AzCore::Debug::Trace::Assert, which gets transformed bo
|
||||
// Trace::_Assert, which does not exist. Gotta love macros. Undefine Assert
|
||||
// before we include semaphore so that it can compile correctly
|
||||
#if defined(Assert)
|
||||
#undef Assert
|
||||
#endif
|
||||
|
||||
#include <AzCore/std/parallel/semaphore.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
#include <windows.h>
|
||||
#include <shellapi.h> // ShellExecuteW()
|
||||
#endif
|
||||
|
||||
#if AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
#include "AppleSpecific.h"
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#else
|
||||
#undef RC_EXECUTABLE
|
||||
#define RC_EXECUTABLE "rc.exe"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <string> // lawsonn - we use std::string internally
|
||||
#include <sstream>
|
||||
|
||||
namespace
|
||||
{
|
||||
class LineStreamBuffer
|
||||
{
|
||||
public:
|
||||
template <typename T>
|
||||
LineStreamBuffer(T* object, void (T::* method)(const char* line))
|
||||
: m_charCount(0)
|
||||
, m_bTruncated(false)
|
||||
{
|
||||
m_target = new Target<T>(object, method);
|
||||
}
|
||||
|
||||
~LineStreamBuffer()
|
||||
{
|
||||
Flush();
|
||||
delete m_target;
|
||||
}
|
||||
|
||||
void HandleText(const char* text, int length)
|
||||
{
|
||||
const char* pos = text;
|
||||
while (pos - text < length)
|
||||
{
|
||||
const char* start = pos;
|
||||
|
||||
while (pos - text < length && *pos != '\n' && *pos != '\r')
|
||||
{
|
||||
++pos;
|
||||
}
|
||||
|
||||
size_t n = pos - start;
|
||||
if (m_charCount + n > kMaxCharCount)
|
||||
{
|
||||
n = kMaxCharCount - m_charCount;
|
||||
m_bTruncated = true;
|
||||
}
|
||||
memcpy(&m_buffer[m_charCount], start, n);
|
||||
m_charCount += n;
|
||||
|
||||
if (pos - text < length)
|
||||
{
|
||||
Flush();
|
||||
while (pos - text < length && (*pos == '\n' || *pos == '\r'))
|
||||
{
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Flush()
|
||||
{
|
||||
if (m_charCount > 0)
|
||||
{
|
||||
m_buffer[m_charCount] = 0;
|
||||
m_target->Call(m_buffer);
|
||||
m_charCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsTruncated() const
|
||||
{
|
||||
return m_bTruncated;
|
||||
}
|
||||
|
||||
private:
|
||||
struct ITarget
|
||||
{
|
||||
virtual ~ITarget() {}
|
||||
virtual void Call(const char* line) = 0;
|
||||
};
|
||||
template <typename T>
|
||||
struct Target
|
||||
: public ITarget
|
||||
{
|
||||
public:
|
||||
Target(T* object, void (T::* method)(const char* line))
|
||||
: object(object)
|
||||
, method(method) {}
|
||||
virtual void Call(const char* line)
|
||||
{
|
||||
(object->*method)(line);
|
||||
}
|
||||
private:
|
||||
T* object;
|
||||
void (T::* method)(const char* line);
|
||||
};
|
||||
|
||||
ITarget* m_target;
|
||||
size_t m_charCount;
|
||||
static const size_t kMaxCharCount = 2047;
|
||||
char m_buffer[kMaxCharCount + 1];
|
||||
bool m_bTruncated;
|
||||
};
|
||||
|
||||
#if !defined(AZ_PLATFORM_WINDOWS)
|
||||
void MessageBoxW(int, const wchar_t* header, const wchar_t* message, unsigned long)
|
||||
{
|
||||
#if AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
CFStringEncoding encoding = (CFByteOrderLittleEndian == CFByteOrderGetCurrent()) ?
|
||||
kCFStringEncodingUTF32LE : kCFStringEncodingUTF32BE;
|
||||
CFStringRef header_ref = CFStringCreateWithBytes(nullptr, reinterpret_cast<const UInt8*>(header), wcslen(header) * sizeof(wchar_t), encoding, false);
|
||||
CFStringRef message_ref = CFStringCreateWithBytes(nullptr, reinterpret_cast<const UInt8*>(message), wcslen(message) * sizeof(wchar_t), encoding, false);
|
||||
|
||||
CFOptionFlags result; //result code from the message box
|
||||
|
||||
CFUserNotificationDisplayAlert(0, kCFUserNotificationStopAlertLevel, 0, 0, 0, header_ref, message_ref, 0, 0, 0, &result);
|
||||
|
||||
CFRelease(header_ref);
|
||||
CFRelease(message_ref);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
class RcLock
|
||||
{
|
||||
public:
|
||||
RcLock()
|
||||
: m_cs(0u, 1u)
|
||||
{
|
||||
m_cs.release();
|
||||
}
|
||||
~RcLock()
|
||||
{
|
||||
}
|
||||
|
||||
void Lock()
|
||||
{
|
||||
m_cs.acquire();
|
||||
}
|
||||
void Unlock()
|
||||
{
|
||||
m_cs.release();
|
||||
}
|
||||
|
||||
private:
|
||||
AZStd::semaphore m_cs;
|
||||
};
|
||||
|
||||
|
||||
template<class LockClass>
|
||||
class RcAutoLock
|
||||
{
|
||||
public:
|
||||
RcAutoLock(LockClass& lock)
|
||||
: m_lock(lock)
|
||||
{
|
||||
m_lock.Lock();
|
||||
}
|
||||
~RcAutoLock()
|
||||
{
|
||||
m_lock.Unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
RcAutoLock();
|
||||
RcAutoLock(const RcAutoLock<LockClass>&);
|
||||
RcAutoLock<LockClass>& operator =(const RcAutoLock<LockClass>&);
|
||||
|
||||
private:
|
||||
LockClass& m_lock;
|
||||
};
|
||||
|
||||
|
||||
HANDLE s_rcProcessHandle = 0;
|
||||
RcLock s_rcProcessHandleLock;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static void ShowMessageBoxRcNotFound([[maybe_unused]] const wchar_t* const szCmdLine, [[maybe_unused]] const wchar_t* const szDir)
|
||||
{
|
||||
SettingsManagerHelpers::CFixedString<wchar_t, MAX_PATH* 4 + 150> tmp;
|
||||
|
||||
tmp.append(L"The resource compiler (RC.EXE) was not found.");
|
||||
MessageBoxW(0, tmp.c_str(), L"Error", MB_ICONERROR | MB_OK);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
namespace
|
||||
{
|
||||
class ResourceCompilerLineHandler
|
||||
{
|
||||
public:
|
||||
ResourceCompilerLineHandler(IResourceCompilerListener* listener)
|
||||
: m_listener(listener)
|
||||
{
|
||||
}
|
||||
|
||||
void HandleLine(const char* line)
|
||||
{
|
||||
if (!m_listener || !line)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// check the first three characters to see if it's a warning or error.
|
||||
bool bHasPrefix;
|
||||
IResourceCompilerListener::MessageSeverity severity;
|
||||
if ((line[0] == 'E') && (line[1] == ':') && (line[2] == ' '))
|
||||
{
|
||||
bHasPrefix = true;
|
||||
severity = IResourceCompilerListener::MessageSeverity_Error;
|
||||
line += 3; // skip the prefix
|
||||
}
|
||||
else if ((line[0] == 'W') && (line[1] == ':') && (line[2] == ' '))
|
||||
{
|
||||
bHasPrefix = true;
|
||||
severity = IResourceCompilerListener::MessageSeverity_Warning;
|
||||
line += 3; // skip the prefix
|
||||
}
|
||||
else if ((line[0] == ' ') && (line[1] == ' ') && (line[2] == ' '))
|
||||
{
|
||||
bHasPrefix = true;
|
||||
severity = IResourceCompilerListener::MessageSeverity_Info;
|
||||
line += 3; // skip the prefix
|
||||
}
|
||||
else
|
||||
{
|
||||
bHasPrefix = false;
|
||||
severity = IResourceCompilerListener::MessageSeverity_Info;
|
||||
}
|
||||
|
||||
if (bHasPrefix)
|
||||
{
|
||||
// skip thread info "%d>", if present
|
||||
{
|
||||
const char* p = line;
|
||||
while (*p == ' ')
|
||||
{
|
||||
++p;
|
||||
}
|
||||
if (isdigit(*p))
|
||||
{
|
||||
while (isdigit(*p))
|
||||
{
|
||||
++p;
|
||||
}
|
||||
if (*p == '>')
|
||||
{
|
||||
line = p + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// skip time info "%d:%d", if present
|
||||
{
|
||||
const char* p = line;
|
||||
while (*p == ' ')
|
||||
{
|
||||
++p;
|
||||
}
|
||||
if (isdigit(*p))
|
||||
{
|
||||
while (isdigit(*p))
|
||||
{
|
||||
++p;
|
||||
}
|
||||
if (*p == ':')
|
||||
{
|
||||
++p;
|
||||
if (isdigit(*p))
|
||||
{
|
||||
while (isdigit(*p))
|
||||
{
|
||||
++p;
|
||||
}
|
||||
while (*p == ' ')
|
||||
{
|
||||
++p;
|
||||
}
|
||||
line = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_listener->OnRCMessage(severity, line);
|
||||
}
|
||||
|
||||
private:
|
||||
IResourceCompilerListener* m_listener;
|
||||
};
|
||||
|
||||
// we now support macros like #ENGINEROOT# in the string:
|
||||
void replaceAllInStringInPlace(std::string& inOut, const char* findValue, const char* replaceValue)
|
||||
{
|
||||
if (!findValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!replaceValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::string::size_type pos = std::string::npos;
|
||||
std::string::size_type replaceLen = strlen(findValue);
|
||||
|
||||
while ((pos = inOut.find(findValue)) != std::string::npos)
|
||||
{
|
||||
inOut.replace(pos, replaceLen, replaceValue);
|
||||
}
|
||||
}
|
||||
|
||||
// given a string that contains macros (like #ENGINEROOT#), eliminate the macros and replace them with the real data.
|
||||
// note that in the 'remote' implementation, these macros are sent to the remote RC. It can then expand them for its own environment
|
||||
// but in a local RC, these macros are expanded by the local environment.
|
||||
void expandMacros(const char* inputString, char* outputString, std::size_t bufferSize)
|
||||
{
|
||||
if (!inputString)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!outputString)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AZStd::string_view rootFolder;
|
||||
AZ::ComponentApplicationBus::BroadcastResult(rootFolder, &AZ::ComponentApplicationRequests::GetAppRoot);
|
||||
|
||||
std::string finalString(inputString);
|
||||
const AZStd::string rootFolderStr = rootFolder.data();
|
||||
replaceAllInStringInPlace(finalString, "#ENGINEROOT#", rootFolderStr.c_str());
|
||||
// put additional replacements here.
|
||||
|
||||
azstrcpy(outputString, bufferSize, finalString.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IResourceCompilerHelper::ERcCallResult CResourceCompilerHelper::CallResourceCompiler(
|
||||
const char* szFileName,
|
||||
const char* szAdditionalSettings,
|
||||
IResourceCompilerListener* listener,
|
||||
bool bMayShowWindow,
|
||||
bool bSilent,
|
||||
bool bNoUserDialog,
|
||||
const wchar_t* szWorkingDirectory,
|
||||
[[maybe_unused]] const wchar_t* szRootPath)
|
||||
{
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
HANDLE hChildStdOutRd = INVALID_HANDLE_VALUE, hChildStdOutWr = INVALID_HANDLE_VALUE;
|
||||
HANDLE hChildStdInRd = INVALID_HANDLE_VALUE, hChildStdInWr = INVALID_HANDLE_VALUE;
|
||||
PROCESS_INFORMATION pi;
|
||||
#else
|
||||
FILE* hChildStdOutRd;
|
||||
#endif
|
||||
|
||||
{
|
||||
RcAutoLock<RcLock> lock(s_rcProcessHandleLock);
|
||||
|
||||
// make command for execution
|
||||
SettingsManagerHelpers::CFixedString<wchar_t, MAX_PATH* 3> wRemoteCmdLine;
|
||||
|
||||
|
||||
if (!szAdditionalSettings)
|
||||
{
|
||||
szAdditionalSettings = "";
|
||||
}
|
||||
|
||||
// expand the additioanl settings.
|
||||
char szActualFileName[512] = {0};
|
||||
char szActualAdditionalSettings[512] = {0};
|
||||
|
||||
expandMacros(szFileName, szActualFileName, 512);
|
||||
expandMacros(szAdditionalSettings, szActualAdditionalSettings, 512);
|
||||
|
||||
CSettingsManagerTools smTools = CSettingsManagerTools(); // moved this line to after macro expansion to avoid multiple of these existing at once.
|
||||
|
||||
AZStd::string_view exeFolderName;
|
||||
AZ::ComponentApplicationBus::BroadcastResult(exeFolderName, &AZ::ComponentApplicationRequests::GetExecutableFolder);
|
||||
|
||||
wchar_t szRegSettingsBuffer[1024];
|
||||
smTools.GetEngineSettingsManager()->GetValueByRef("RC_Parameters", SettingsManagerHelpers::CWCharBuffer(szRegSettingsBuffer, sizeof(szRegSettingsBuffer)));
|
||||
bool enableSourceControl = true;
|
||||
smTools.GetEngineSettingsManager()->GetValueByRef("RC_EnableSourceControl", enableSourceControl);
|
||||
|
||||
wRemoteCmdLine.appendAscii("\"");
|
||||
wRemoteCmdLine.appendAscii(exeFolderName.data(), exeFolderName.size());
|
||||
wRemoteCmdLine.appendAscii("/");
|
||||
wRemoteCmdLine.appendAscii(RC_EXECUTABLE);
|
||||
wRemoteCmdLine.appendAscii("\"");
|
||||
|
||||
if (!enableSourceControl)
|
||||
{
|
||||
wRemoteCmdLine.appendAscii(" -nosourcecontrol ");
|
||||
}
|
||||
|
||||
if (!szFileName)
|
||||
{
|
||||
wRemoteCmdLine.appendAscii(" -userdialog=0 ");
|
||||
wRemoteCmdLine.appendAscii(szActualAdditionalSettings);
|
||||
wRemoteCmdLine.appendAscii(" ");
|
||||
wRemoteCmdLine.append(szRegSettingsBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
wRemoteCmdLine.appendAscii(" \"");
|
||||
wRemoteCmdLine.appendAscii(szActualFileName);
|
||||
wRemoteCmdLine.appendAscii("\"");
|
||||
wRemoteCmdLine.appendAscii(bNoUserDialog ? " -userdialog=0 " : " -userdialog=1 ");
|
||||
wRemoteCmdLine.appendAscii(szActualAdditionalSettings);
|
||||
wRemoteCmdLine.appendAscii(" ");
|
||||
wRemoteCmdLine.append(szRegSettingsBuffer);
|
||||
}
|
||||
|
||||
// Create a pipe to read the stdout of the RC.
|
||||
SECURITY_ATTRIBUTES saAttr;
|
||||
if (listener)
|
||||
{
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
ZeroMemory(&saAttr, sizeof(saAttr));
|
||||
saAttr.bInheritHandle = TRUE;
|
||||
saAttr.lpSecurityDescriptor = 0;
|
||||
CreatePipe(&hChildStdOutRd, &hChildStdOutWr, &saAttr, 0);
|
||||
SetHandleInformation(hChildStdOutRd, HANDLE_FLAG_INHERIT, 0); // Need to do this according to MSDN
|
||||
CreatePipe(&hChildStdInRd, &hChildStdInWr, &saAttr, 0);
|
||||
SetHandleInformation(hChildStdInWr, HANDLE_FLAG_INHERIT, 0); // Need to do this according to MSDN
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
STARTUPINFOW si;
|
||||
ZeroMemory(&si, sizeof(si));
|
||||
si.cb = sizeof(si);
|
||||
si.dwX = 100;
|
||||
si.dwY = 100;
|
||||
if (listener)
|
||||
{
|
||||
si.hStdError = hChildStdOutWr;
|
||||
si.hStdOutput = hChildStdOutWr;
|
||||
si.hStdInput = hChildStdInRd;
|
||||
si.dwFlags = STARTF_USEPOSITION | STARTF_USESTDHANDLES;
|
||||
}
|
||||
else
|
||||
{
|
||||
si.dwFlags = STARTF_USEPOSITION;
|
||||
}
|
||||
|
||||
ZeroMemory(&pi, sizeof(pi));
|
||||
#endif
|
||||
|
||||
bool bShowWindow;
|
||||
if (bMayShowWindow)
|
||||
{
|
||||
wchar_t buffer[20];
|
||||
smTools.GetEngineSettingsManager()->GetValueByRef("ShowWindow", SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer)));
|
||||
bShowWindow = (wcscmp(buffer, L"true") == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bShowWindow = false;
|
||||
}
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
const wchar_t* szStartingDirectory = szWorkingDirectory;
|
||||
if (!szStartingDirectory)
|
||||
{
|
||||
char currentDirectory[MAX_PATH];
|
||||
AZ::Utils::GetExecutableDirectory(currentDirectory, MAX_PATH);
|
||||
SettingsManagerHelpers::CFixedString<wchar_t, MAX_PATH> wCurrentDirectory;
|
||||
wCurrentDirectory.appendAscii(currentDirectory);
|
||||
szStartingDirectory = wCurrentDirectory.c_str();
|
||||
}
|
||||
|
||||
|
||||
if (!CreateProcessW(
|
||||
NULL, // No module name (use command line).
|
||||
const_cast<wchar_t*>(wRemoteCmdLine.c_str()), // Command line.
|
||||
NULL, // Process handle not inheritable.
|
||||
NULL, // Thread handle not inheritable.
|
||||
TRUE, // Set handle inheritance to TRUE.
|
||||
bShowWindow ? 0 : CREATE_NO_WINDOW, // creation flags.
|
||||
NULL, // Use parent's environment block.
|
||||
szStartingDirectory, // Set starting directory.
|
||||
&si, // Pointer to STARTUPINFO structure.
|
||||
&pi)) // Pointer to PROCESS_INFORMATION structure.
|
||||
{
|
||||
// The following code block is commented out instead of being deleted
|
||||
// because it's good to have at hand for a debugging session.
|
||||
#if 0
|
||||
const size_t charsInMessageBuffer = 32768; // msdn about FormatMessage(): "The output buffer cannot be larger than 64K bytes."
|
||||
wchar_t szMessageBuffer[charsInMessageBuffer] = L"";
|
||||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, szMessageBuffer, charsInMessageBuffer, NULL);
|
||||
GetCurrentDirectoryW(charsInMessageBuffer, szMessageBuffer);
|
||||
#endif
|
||||
|
||||
if (!bSilent)
|
||||
{
|
||||
ShowMessageBoxRcNotFound(wRemoteCmdLine.c_str(), szStartingDirectory);
|
||||
}
|
||||
|
||||
return eRcCallResult_notFound;
|
||||
}
|
||||
|
||||
s_rcProcessHandle = pi.hProcess;
|
||||
#else
|
||||
int fd = open(".", O_RDONLY);
|
||||
char remoteCmdLineUtf8[MAX_PATH * 8];
|
||||
char workingDirectory[MAX_PATH * 8];
|
||||
ConvertUtf16ToUtf8(wRemoteCmdLine.c_str(), SettingsManagerHelpers::CCharBuffer(remoteCmdLineUtf8, MAX_PATH * 8));
|
||||
if (szWorkingDirectory)
|
||||
{
|
||||
ConvertUtf16ToUtf8(szWorkingDirectory, SettingsManagerHelpers::CCharBuffer(workingDirectory, MAX_PATH * 8));
|
||||
chdir(workingDirectory);
|
||||
}
|
||||
hChildStdOutRd = popen(remoteCmdLineUtf8, "r");
|
||||
fchdir(fd);
|
||||
if (hChildStdOutRd == nullptr)
|
||||
{
|
||||
if (!bSilent)
|
||||
{
|
||||
ShowMessageBoxRcNotFound(wRemoteCmdLine.c_str(), szWorkingDirectory);
|
||||
}
|
||||
return eRcCallResult_notFound;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool bFailedToReadOutput = false;
|
||||
|
||||
if (listener)
|
||||
{
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
// Close the pipe that writes to the child process, since we don't actually have any input for it.
|
||||
CloseHandle(hChildStdInWr);
|
||||
|
||||
// Read all the output from the child process.
|
||||
CloseHandle(hChildStdOutWr);
|
||||
#endif
|
||||
ResourceCompilerLineHandler lineHandler(listener);
|
||||
LineStreamBuffer lineBuffer(&lineHandler, &ResourceCompilerLineHandler::HandleLine);
|
||||
for (;; )
|
||||
{
|
||||
char buffer[2048];
|
||||
DWORD bytesRead;
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
if (!ReadFile(hChildStdOutRd, buffer, sizeof(buffer), &bytesRead, NULL) || (bytesRead == 0))
|
||||
#else
|
||||
if (fgets(buffer, sizeof(buffer), hChildStdOutRd) == nullptr || (bytesRead = strlen(buffer) == 0))
|
||||
#endif
|
||||
{
|
||||
break;
|
||||
}
|
||||
lineBuffer.HandleText(buffer, bytesRead);
|
||||
}
|
||||
|
||||
bFailedToReadOutput = lineBuffer.IsTruncated();
|
||||
}
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
// Wait until child process exits.
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
#else
|
||||
DWORD exitCode = pclose(hChildStdOutRd);
|
||||
#endif
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
RcAutoLock<RcLock> lock(s_rcProcessHandleLock);
|
||||
s_rcProcessHandle = 0;
|
||||
|
||||
DWORD exitCode = eRcExitCode_Error;
|
||||
if (bFailedToReadOutput || GetExitCodeProcess(pi.hProcess, &exitCode) == 0)
|
||||
{
|
||||
exitCode = eRcExitCode_Error;
|
||||
}
|
||||
|
||||
// Close process and thread handles.
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(pi.hThread);
|
||||
#endif
|
||||
|
||||
return ConvertResourceCompilerExitCodeToResultCode(exitCode);
|
||||
}
|
||||
|
||||
|
||||
#endif //(CRY_ENABLE_RC_HELPER)
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_RESOURCECOMPILERHELPER_H
|
||||
#define CRYINCLUDE_CRYCOMMON_RESOURCECOMPILERHELPER_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(CRY_ENABLE_RC_HELPER)
|
||||
|
||||
#include "IResourceCompilerHelper.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Provides settings and functions to make calls to RC.
|
||||
// calls RC locally. only works on windows, does not exist on other platforms
|
||||
// note: You shouldn't be calling this directly
|
||||
// instead, you should be calling it via the IResourceCompilerHelper interface.
|
||||
// since it may be replaced with a custom RC for your platform or a remote invocation
|
||||
class CResourceCompilerHelper
|
||||
: public IResourceCompilerHelper
|
||||
{
|
||||
public:
|
||||
virtual ERcCallResult CallResourceCompiler(
|
||||
const char* szFileName = 0,
|
||||
const char* szAdditionalSettings = 0,
|
||||
IResourceCompilerListener* listener = 0,
|
||||
bool bMayShowWindow = true,
|
||||
bool bSilent = false,
|
||||
bool bNoUserDialog = false,
|
||||
const wchar_t* szWorkingDirectory = 0,
|
||||
const wchar_t* szRootPath = 0) override;
|
||||
};
|
||||
|
||||
#endif // CRY_ENABLE_RC_HELPER
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_RESOURCECOMPILERHELPER_H
|
||||
@@ -1,325 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#include "ProjectDefines.h"
|
||||
|
||||
#if defined(CRY_ENABLE_RC_HELPER)
|
||||
|
||||
#include "SettingsManagerHelpers.h"
|
||||
#include "EngineSettingsManager.h"
|
||||
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#include <string>
|
||||
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
#include <windows.h>
|
||||
#include <shellapi.h> //ShellExecuteW()
|
||||
#pragma comment(lib, "Shell32.lib")
|
||||
#endif
|
||||
#if AZ_TRAIT_OS_PLATFORM_APPLE
|
||||
#include "AppleSpecific.h"
|
||||
#endif
|
||||
|
||||
bool SettingsManagerHelpers::Utf16ContainsAsciiOnly(const wchar_t* wstr)
|
||||
{
|
||||
while (*wstr)
|
||||
{
|
||||
if (*wstr > 127 || *wstr < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
++wstr;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void SettingsManagerHelpers::ConvertUtf16ToUtf8(const wchar_t* src, CCharBuffer dst)
|
||||
{
|
||||
if (dst.getSizeInElements() <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (src[0] == 0)
|
||||
{
|
||||
dst[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::codecvt<wchar_t, char, std::mbstate_t>& utf8Utf16Facet = std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(std::locale());
|
||||
std::mbstate_t mb{};
|
||||
const wchar_t* from_next;
|
||||
char* to_next;
|
||||
std::codecvt_base::result result = utf8Utf16Facet.out(mb, src, src + wcslen(src), from_next, dst.getPtr(), dst.getPtr() + dst.getSizeInElements(), to_next);
|
||||
if (result != std::codecvt_base::ok)
|
||||
{
|
||||
dst[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
to_next = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SettingsManagerHelpers::ConvertUtf8ToUtf16(const char* src, CWCharBuffer dst)
|
||||
{
|
||||
if (dst.getSizeInElements() <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (src[0] == 0)
|
||||
{
|
||||
dst[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::codecvt<wchar_t, char, std::mbstate_t>& utf8Utf16Facet = std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(std::locale());
|
||||
std::mbstate_t mb{};
|
||||
const char* from_next;
|
||||
wchar_t* to_next;
|
||||
std::codecvt_base::result result = utf8Utf16Facet.in(mb, src, src + strlen(src), from_next, dst.getPtr(), dst.getPtr() + dst.getSizeInElements(), to_next);
|
||||
if (result != std::codecvt_base::ok)
|
||||
{
|
||||
dst[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
to_next = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SettingsManagerHelpers::GetAsciiFilename(const wchar_t* wfilename, CCharBuffer buffer)
|
||||
{
|
||||
if (buffer.getSizeInElements() <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (wfilename[0] == 0)
|
||||
{
|
||||
buffer[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Utf16ContainsAsciiOnly(wfilename))
|
||||
{
|
||||
ConvertUtf16ToUtf8(wfilename, buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
// The path is non-ASCII unicode, so let's resort to short filenames (they are always ASCII-only, I hope)
|
||||
wchar_t shortW[MAX_PATH];
|
||||
const int bufferCharCount = sizeof(shortW) / sizeof(shortW[0]);
|
||||
const int charCount = GetShortPathNameW(wfilename, shortW, bufferCharCount);
|
||||
if (charCount <= 0 || charCount >= bufferCharCount)
|
||||
{
|
||||
buffer[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
shortW[charCount] = 0;
|
||||
if (!Utf16ContainsAsciiOnly(shortW))
|
||||
{
|
||||
buffer[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
ConvertUtf16ToUtf8(shortW, buffer);
|
||||
#else
|
||||
buffer[0] = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CSettingsManagerTools::CSettingsManagerTools(const wchar_t* szModuleName)
|
||||
{
|
||||
m_pSettingsManager = new CEngineSettingsManager(szModuleName);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CSettingsManagerTools::~CSettingsManagerTools()
|
||||
{
|
||||
delete m_pSettingsManager;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CSettingsManagerTools::GetInstalledBuildPathUtf16(const int index, SettingsManagerHelpers::CWCharBuffer name, SettingsManagerHelpers::CWCharBuffer path)
|
||||
{
|
||||
return m_pSettingsManager->GetInstalledBuildRootPathUtf16(index, name, path);
|
||||
}
|
||||
|
||||
|
||||
bool CSettingsManagerTools::GetInstalledBuildPathAscii(const int index, SettingsManagerHelpers::CCharBuffer name, SettingsManagerHelpers::CCharBuffer path)
|
||||
{
|
||||
wchar_t wName[MAX_PATH];
|
||||
wchar_t wPath[MAX_PATH];
|
||||
if (GetInstalledBuildPathUtf16(index, SettingsManagerHelpers::CWCharBuffer(wName, sizeof(wName)), SettingsManagerHelpers::CWCharBuffer(wPath, sizeof(wPath))))
|
||||
{
|
||||
SettingsManagerHelpers::GetAsciiFilename(wName, name);
|
||||
SettingsManagerHelpers::GetAsciiFilename(wPath, path);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static bool FileExists(const wchar_t* filename)
|
||||
{
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
const DWORD dwAttrib = GetFileAttributesW(filename);
|
||||
return dwAttrib != INVALID_FILE_ATTRIBUTES && !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY);
|
||||
#else
|
||||
char utf8Filename[MAX_PATH];
|
||||
SettingsManagerHelpers::ConvertUtf16ToUtf8(filename, SettingsManagerHelpers::CCharBuffer(utf8Filename, sizeof(utf8Filename)));
|
||||
struct stat buffer;
|
||||
return (stat(utf8Filename, &buffer) == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSettingsManagerTools::GetEditorExecutable(SettingsManagerHelpers::CWCharBuffer wbuffer)
|
||||
{
|
||||
if (wbuffer.getSizeInElements() <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AZStd::string_view exePath;
|
||||
AZ::ComponentApplicationBus::BroadcastResult(exePath, &AZ::ComponentApplicationRequests::GetExecutableFolder);
|
||||
|
||||
SettingsManagerHelpers::CFixedString<wchar_t, 1024> editorExe;
|
||||
editorExe = wbuffer.getPtr();
|
||||
editorExe.appendAscii(exePath.data(), exePath.size());
|
||||
|
||||
if (editorExe.length() <= 0)
|
||||
{
|
||||
wbuffer[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
bool bFound = false;
|
||||
if (Is64bitWindows())
|
||||
{
|
||||
const size_t len = editorExe.length();
|
||||
editorExe.appendAscii("/Editor.exe");
|
||||
bFound = FileExists(editorExe.c_str());
|
||||
if (!bFound)
|
||||
{
|
||||
editorExe.setLength(len);
|
||||
}
|
||||
}
|
||||
|
||||
const size_t sizeToCopy = (editorExe.length() + 1) * sizeof(wbuffer[0]);
|
||||
if (!bFound || sizeToCopy > wbuffer.getSizeInBytes())
|
||||
{
|
||||
wbuffer[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(wbuffer.getPtr(), editorExe.c_str(), sizeToCopy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CSettingsManagerTools::CallEditor(void** pEditorWindow, [[maybe_unused]] void* hParent, const char* pWindowName, const char* pFlag)
|
||||
{
|
||||
#if !defined(AZ_PLATFORM_WINDOWS)
|
||||
AZ_Assert(false, "CSettingsManagerTools::CallEditor is not supported on this platform!");
|
||||
return false;
|
||||
#else
|
||||
HWND window = ::FindWindowA(NULL, pWindowName);
|
||||
if (window)
|
||||
{
|
||||
*pEditorWindow = window;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pEditorWindow = 0;
|
||||
|
||||
wchar_t buffer[512] = { L'\0' };
|
||||
GetEditorExecutable(SettingsManagerHelpers::CWCharBuffer(buffer, sizeof(buffer)));
|
||||
|
||||
SettingsManagerHelpers::CFixedString<wchar_t, 256> wFlags;
|
||||
SettingsManagerHelpers::ConvertUtf8ToUtf16(pFlag, wFlags.getBuffer());
|
||||
wFlags.setLength(wcslen(wFlags.c_str()));
|
||||
|
||||
if (buffer[0] != '\0')
|
||||
{
|
||||
INT_PTR hIns = (INT_PTR)ShellExecuteW(NULL, L"open", buffer, wFlags.c_str(), NULL, SW_SHOWNORMAL);
|
||||
if (hIns > 32)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxA(0, "Editor.exe was not found.\n\nPlease verify CryENGINE root path.", "Error", MB_ICONERROR | MB_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Modified version of
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms684139(v=vs.85).aspx
|
||||
bool CSettingsManagerTools::Is64bitWindows()
|
||||
{
|
||||
#if defined(_WIN64)
|
||||
// 64-bit programs run only on 64-bit Windows
|
||||
return true;
|
||||
#elif !defined(AZ_PLATFORM_WINDOWS)
|
||||
return false;
|
||||
#else
|
||||
// 32-bit programs run on both 32-bit and 64-bit Windows
|
||||
static bool bWin64 = false;
|
||||
static bool bOnce = true;
|
||||
if (bOnce)
|
||||
{
|
||||
typedef BOOL (WINAPI * LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
|
||||
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandleA("kernel32"), "IsWow64Process");
|
||||
if (fnIsWow64Process != NULL)
|
||||
{
|
||||
BOOL itIsWow64Process = FALSE;
|
||||
if (fnIsWow64Process(GetCurrentProcess(), &itIsWow64Process))
|
||||
{
|
||||
bWin64 = (itIsWow64Process == TRUE);
|
||||
}
|
||||
}
|
||||
bOnce = false;
|
||||
}
|
||||
return bWin64;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // #if defined(CRY_ENABLE_RC_HELPER)
|
||||
|
||||
// eof
|
||||
@@ -1,491 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
// Original file Copyright Crytek GMBH or its affiliates, used under license.
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_SETTINGSMANAGERHELPERS_H
|
||||
#define CRYINCLUDE_CRYCOMMON_SETTINGSMANAGERHELPERS_H
|
||||
#pragma once
|
||||
|
||||
#include "ProjectDefines.h"
|
||||
#include <string.h> // memcpy
|
||||
#include <algorithm> // std::min
|
||||
|
||||
|
||||
namespace SettingsManagerHelpers
|
||||
{
|
||||
namespace Utils
|
||||
{
|
||||
inline size_t strlen(const char* p)
|
||||
{
|
||||
return p ? ::strlen(p) : 0;
|
||||
}
|
||||
|
||||
inline size_t strcmp(const char* p0, const char* p1)
|
||||
{
|
||||
return ::strcmp(p0, p1);
|
||||
}
|
||||
|
||||
|
||||
inline size_t strlen(const wchar_t* p)
|
||||
{
|
||||
return p ? ::wcslen(p) : 0;
|
||||
}
|
||||
|
||||
inline size_t strcmp(const wchar_t* p0, const wchar_t* p1)
|
||||
{
|
||||
return ::wcscmp(p0, p1);
|
||||
}
|
||||
}
|
||||
|
||||
// The function copies characters from src to dst one by one until any of
|
||||
// the following conditions is met:
|
||||
// 1) the end of the destination buffer (minus one character) is reached
|
||||
// 2) the end of the source buffer is reached
|
||||
// 3) zero character is found in the source buffer
|
||||
//
|
||||
// When any of 1), 2), 3) happens, the function writes the terminating zero
|
||||
// character to the destination buffer and return.
|
||||
//
|
||||
// The function guarantees writing the terminating zero character to the
|
||||
// destination buffer (if the buffer can fit at least one character).
|
||||
//
|
||||
// The function returns false when a null pointer is passed or when
|
||||
// clamping happened (i.e. when the end of the destination buffer is
|
||||
// reached but the source has some characters left).
|
||||
inline bool strcpy_with_clamp(char* const dst, size_t const dst_size_in_bytes, const char* const src, size_t const src_size_in_bytes = (size_t)-1)
|
||||
{
|
||||
if (!dst || dst_size_in_bytes < sizeof(char))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!src || src_size_in_bytes < sizeof(char))
|
||||
{
|
||||
dst[0] = 0;
|
||||
return src != 0; // we return true for non-null src without characters
|
||||
}
|
||||
|
||||
const size_t src_n = src_size_in_bytes;
|
||||
const size_t n = (std::min)(dst_size_in_bytes - 1, src_n);
|
||||
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
{
|
||||
dst[i] = src[i];
|
||||
if (!src[i])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
dst[n] = 0;
|
||||
return n >= src_n || src[n] == 0;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
class CBuffer
|
||||
{
|
||||
public:
|
||||
typedef T element_type;
|
||||
|
||||
private:
|
||||
element_type* m_ptr;
|
||||
size_t m_sizeInBytes;
|
||||
|
||||
public:
|
||||
CBuffer(element_type* ptr, size_t sizeInBytes)
|
||||
: m_ptr(ptr)
|
||||
, m_sizeInBytes(ptr ? sizeInBytes : 0)
|
||||
{
|
||||
}
|
||||
|
||||
const element_type* getPtr() const
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
element_type* getPtr()
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
size_t getSizeInElements() const
|
||||
{
|
||||
return m_sizeInBytes / sizeof(element_type);
|
||||
}
|
||||
|
||||
size_t getSizeInBytes() const
|
||||
{
|
||||
return m_sizeInBytes;
|
||||
}
|
||||
|
||||
const element_type& operator[](size_t pos) const
|
||||
{
|
||||
return m_ptr[pos];
|
||||
}
|
||||
|
||||
element_type& operator[](size_t pos)
|
||||
{
|
||||
return m_ptr[pos];
|
||||
}
|
||||
};
|
||||
|
||||
typedef CBuffer<char> CCharBuffer;
|
||||
typedef CBuffer<wchar_t> CWCharBuffer;
|
||||
|
||||
|
||||
template<class T, size_t CAPACITY>
|
||||
class CFixedString
|
||||
{
|
||||
public:
|
||||
typedef T char_type;
|
||||
static const size_t npos = ~size_t(0);
|
||||
private:
|
||||
size_t m_count; // # chars (not counting trailing zero)
|
||||
char_type m_buffer[CAPACITY + 1]; // '+ 1' is for trailing zero
|
||||
|
||||
public:
|
||||
CFixedString()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
CFixedString(const char_type* p)
|
||||
{
|
||||
set(p);
|
||||
}
|
||||
|
||||
CFixedString& operator=(const char_type* p)
|
||||
{
|
||||
set(p);
|
||||
return *this;
|
||||
}
|
||||
|
||||
CFixedString& operator=(const CFixedString& s)
|
||||
{
|
||||
if (&s != this)
|
||||
{
|
||||
set(s.m_buffer, s.m_count);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
CBuffer<char_type> getBuffer()
|
||||
{
|
||||
return CBuffer<char_type>(m_buffer, (CAPACITY + 1) * sizeof(char_type));
|
||||
}
|
||||
|
||||
char_type operator[](const size_t i) const
|
||||
{
|
||||
return m_buffer[i];
|
||||
}
|
||||
|
||||
const char_type* c_str() const
|
||||
{
|
||||
return &m_buffer[0];
|
||||
}
|
||||
|
||||
const size_t length() const
|
||||
{
|
||||
return m_count;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_count = 0;
|
||||
m_buffer[m_count] = 0;
|
||||
}
|
||||
|
||||
void setLength(size_t n)
|
||||
{
|
||||
m_count = (n <= CAPACITY) ? n : CAPACITY;
|
||||
m_buffer[m_count] = 0;
|
||||
}
|
||||
|
||||
char_type* ptr()
|
||||
{
|
||||
return &m_buffer[0];
|
||||
}
|
||||
|
||||
CFixedString substr(size_t pos = 0, size_t n = npos) const
|
||||
{
|
||||
CFixedString s;
|
||||
if (pos < m_count && n > 0)
|
||||
{
|
||||
if (n > m_count || pos + n > m_count)
|
||||
{
|
||||
n = m_count - pos;
|
||||
}
|
||||
s.set(&m_buffer[pos], n);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void set(const char_type* p, size_t n)
|
||||
{
|
||||
if (p == 0 || n <= 0)
|
||||
{
|
||||
m_count = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_count = (n > CAPACITY) ? CAPACITY : n;
|
||||
// memmove() is used because p may point to m_buffer
|
||||
memmove(m_buffer, p, m_count * sizeof(*p));
|
||||
}
|
||||
m_buffer[m_count] = 0;
|
||||
}
|
||||
|
||||
void set(const char_type* p)
|
||||
{
|
||||
if (p && p[0])
|
||||
{
|
||||
set(p, Utils::strlen(p));
|
||||
}
|
||||
else
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
void append(const char_type* p, size_t n)
|
||||
{
|
||||
if (p && n > 0)
|
||||
{
|
||||
if (n > CAPACITY || m_count + n > CAPACITY)
|
||||
{
|
||||
// assert(0);
|
||||
n = CAPACITY - m_count;
|
||||
}
|
||||
if (n > 0)
|
||||
{
|
||||
memcpy(&m_buffer[m_count], p, n * sizeof(*p));
|
||||
m_count += n;
|
||||
m_buffer[m_count] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void append(const char_type* p)
|
||||
{
|
||||
if (p && p[0])
|
||||
{
|
||||
append(p, Utils::strlen(p));
|
||||
}
|
||||
}
|
||||
|
||||
void appendAscii(const char* p, size_t n)
|
||||
{
|
||||
if (p && n > 0)
|
||||
{
|
||||
if (n > CAPACITY || m_count + n > CAPACITY)
|
||||
{
|
||||
// assert(0);
|
||||
n = CAPACITY - m_count;
|
||||
}
|
||||
if (n > 0)
|
||||
{
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
{
|
||||
m_buffer[m_count + i] = p[i];
|
||||
}
|
||||
m_count += n;
|
||||
m_buffer[m_count] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void appendAscii(const char* p)
|
||||
{
|
||||
if (p && p[0])
|
||||
{
|
||||
appendAscii(p, Utils::strlen(p));
|
||||
}
|
||||
}
|
||||
|
||||
bool equals(const char_type* p) const
|
||||
{
|
||||
return (p == 0 || p[0] == 0)
|
||||
? (m_count == 0)
|
||||
: (Utils::strcmp(m_buffer, p) == 0);
|
||||
}
|
||||
|
||||
void trim()
|
||||
{
|
||||
size_t begin = 0;
|
||||
while (begin < m_count && (m_buffer[begin] == ' ' || m_buffer[begin] == '\r' || m_buffer[begin] == '\t' || m_buffer[begin] == '\n'))
|
||||
{
|
||||
++begin;
|
||||
}
|
||||
|
||||
if (begin >= m_count)
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
|
||||
size_t end = m_count - 1;
|
||||
while (end > begin && (m_buffer[begin] == ' ' || m_buffer[begin] == '\r' || m_buffer[begin] == '\t' || m_buffer[begin] == '\n'))
|
||||
{
|
||||
--end;
|
||||
}
|
||||
|
||||
m_count = end + 1;
|
||||
m_buffer[m_count] = 0;
|
||||
|
||||
if (begin > 0)
|
||||
{
|
||||
set(&m_buffer[begin], m_count - begin);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct SKeyValue
|
||||
{
|
||||
CFixedString<char, 256> key;
|
||||
CFixedString<wchar_t, 256> value;
|
||||
};
|
||||
|
||||
|
||||
template<size_t CAPACITY>
|
||||
class CKeyValueArray
|
||||
{
|
||||
private:
|
||||
size_t count;
|
||||
SKeyValue data[CAPACITY];
|
||||
|
||||
public:
|
||||
CKeyValueArray()
|
||||
: count(0)
|
||||
{
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
const SKeyValue& operator[](size_t i) const
|
||||
{
|
||||
return data[i];
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
count = 0;
|
||||
}
|
||||
|
||||
const SKeyValue* find(const char* key) const
|
||||
{
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
if (data[i].key.equals(key))
|
||||
{
|
||||
return &data[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
SKeyValue* find(const char* key)
|
||||
{
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
if (data[i].key.equals(key))
|
||||
{
|
||||
return &data[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
SKeyValue* set(const char* key, const wchar_t* value)
|
||||
{
|
||||
SKeyValue* p = find(key);
|
||||
if (!p)
|
||||
{
|
||||
if (count >= CAPACITY)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
p = &data[count++];
|
||||
p->key = key;
|
||||
}
|
||||
p->value = value;
|
||||
return p;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#if defined(CRY_ENABLE_RC_HELPER)
|
||||
|
||||
bool Utf16ContainsAsciiOnly(const wchar_t* wstr);
|
||||
|
||||
void ConvertUtf16ToUtf8(const wchar_t* src, CCharBuffer dst);
|
||||
|
||||
void ConvertUtf8ToUtf16(const char* src, CWCharBuffer dst);
|
||||
|
||||
template <size_t CAPACITY>
|
||||
void AddPathSeparator(CFixedString<wchar_t, CAPACITY>& wstr)
|
||||
{
|
||||
if (wstr.length() <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (wstr[wstr.length() - 1] == L'/' || wstr[wstr.length() - 1] == L'\\')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
wstr.appendAscii("/");
|
||||
}
|
||||
|
||||
void GetAsciiFilename(const wchar_t* wfilename, CCharBuffer buffer);
|
||||
|
||||
#endif // #if defined(CRY_ENABLE_RC_HELPER)
|
||||
} // namespace SettingsManagerHelpers
|
||||
|
||||
|
||||
#if defined(CRY_ENABLE_RC_HELPER)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Provides settings and functions to make calls to RC.
|
||||
class CEngineSettingsManager;
|
||||
class CSettingsManagerTools
|
||||
{
|
||||
public:
|
||||
CSettingsManagerTools(const wchar_t* szModuleName = 0);
|
||||
~CSettingsManagerTools();
|
||||
|
||||
private:
|
||||
CEngineSettingsManager* m_pSettingsManager;
|
||||
|
||||
public:
|
||||
CEngineSettingsManager* GetEngineSettingsManager()
|
||||
{
|
||||
return m_pSettingsManager;
|
||||
}
|
||||
|
||||
bool GetInstalledBuildPathUtf16(const int index, SettingsManagerHelpers::CWCharBuffer name, SettingsManagerHelpers::CWCharBuffer path);
|
||||
bool GetInstalledBuildPathAscii(const int index, SettingsManagerHelpers::CCharBuffer name, SettingsManagerHelpers::CCharBuffer path);
|
||||
|
||||
void GetEditorExecutable(SettingsManagerHelpers::CWCharBuffer wbuffer);
|
||||
bool CallEditor(void** pEditorWindow, void* hParent, const char* pWndName, const char* pFlag);
|
||||
|
||||
static bool Is64bitWindows();
|
||||
};
|
||||
|
||||
#endif // #if defined(CRY_ENABLE_RC_HELPER)
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_SETTINGSMANAGERHELPERS_H
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Math/Aabb.h>
|
||||
|
||||
namespace Terrain
|
||||
{
|
||||
class Viewport2D
|
||||
{
|
||||
public:
|
||||
int m_topLeftX = 0;
|
||||
int m_topLeftY = 0;
|
||||
int m_width = 0;
|
||||
int m_height = 0;
|
||||
|
||||
Viewport2D() = default;
|
||||
Viewport2D(const Viewport2D&) = default;
|
||||
Viewport2D& operator=(const Viewport2D&) = default;
|
||||
|
||||
Viewport2D(int topLeftX, int topLeftY, int width, int height)
|
||||
: m_topLeftX(topLeftX)
|
||||
, m_topLeftY(topLeftY)
|
||||
, m_width(width)
|
||||
, m_height(height)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// External height map data requests
|
||||
class HeightmapDataRequestInfo
|
||||
{
|
||||
public:
|
||||
HeightmapDataRequestInfo() = default;
|
||||
HeightmapDataRequestInfo(const HeightmapDataRequestInfo& rhs) = default;
|
||||
HeightmapDataRequestInfo& operator=(const HeightmapDataRequestInfo& rhs) = default;
|
||||
|
||||
HeightmapDataRequestInfo(int viewportTopLeftX, int viewportTopLeftY, int viewportWidth, int viewportHeight, float metersPerPixel, AZ::Vector2 worldMin, AZ::Vector2 worldMax)
|
||||
: m_viewport(viewportTopLeftX, viewportTopLeftY, viewportWidth, viewportHeight)
|
||||
, m_metersPerPixel(metersPerPixel)
|
||||
, m_worldMin(worldMin)
|
||||
, m_worldMax(worldMax)
|
||||
{
|
||||
}
|
||||
|
||||
float GetMetersPerPixel() const
|
||||
{
|
||||
return m_metersPerPixel;
|
||||
}
|
||||
|
||||
AZ::Vector2 GetWorldMin() const
|
||||
{
|
||||
return m_worldMin;
|
||||
}
|
||||
|
||||
AZ::Vector2 GetWorldMax() const
|
||||
{
|
||||
return m_worldMax;
|
||||
}
|
||||
|
||||
AZ::Vector2 GetWorldWidth() const
|
||||
{
|
||||
return (m_worldMax - m_worldMin);
|
||||
}
|
||||
|
||||
Viewport2D GetViewport() const
|
||||
{
|
||||
return m_viewport;
|
||||
}
|
||||
|
||||
private:
|
||||
Viewport2D m_viewport;
|
||||
AZ::Vector2 m_worldMin = AZ::Vector2(0.0f, 0.0f);
|
||||
AZ::Vector2 m_worldMax = AZ::Vector2(0.0f, 0.0f);
|
||||
float m_metersPerPixel = 1.0f;
|
||||
};
|
||||
|
||||
class HeightmapDataNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void OnTerrainHeightDataChanged(const AZ::Aabb& dirtyRegion) = 0;
|
||||
};
|
||||
using HeightmapDataNotificationBus = AZ::EBus<HeightmapDataNotifications>;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
|
||||
class CShader;
|
||||
|
||||
namespace Terrain
|
||||
{
|
||||
class TerrainDataRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual float GetHeightSynchronous(float x, float y) = 0;
|
||||
virtual AZ::Vector3 GetNormalSynchronous(float x, float y) = 0;
|
||||
|
||||
virtual CShader* GetTerrainHeightGeneratorShader() const = 0;
|
||||
virtual CShader* GetTerrainMaterialCompositingShader() const = 0;
|
||||
};
|
||||
using TerrainDataRequestBus = AZ::EBus<TerrainDataRequests>;
|
||||
|
||||
class TerrainShaderRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EBusTraits overrides
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void RefreshShader(const AZStd::string_view name, CShader* shader) = 0;
|
||||
virtual void ReleaseShader(CShader* shader) const = 0;
|
||||
};
|
||||
using TerrainShaderRequestBus = AZ::EBus<TerrainShaderRequests>;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user