//-------------------------------------------------------------------------- /// Initialize the DX12Server plugin. /// \returns True if initialization was successful, false if it failed. //-------------------------------------------------------------------------- bool InitPlugin() { LogHeader(); if (InitCommunication(GetShortDescription(), ProcessRequest) == false) { DeinitCommunication(); return false; } Log(logTRACE, "DX12Server2's InitPlugin success.\n"); return true; }
//----------------------------------------------------------------------------- /// Initialize the LayerManager. /// \return True if the LayerManager was initialized successfully. //----------------------------------------------------------------------------- bool DX12LayerManager::InitializeLayerManager() { // Initialize all of the layers that the plugin requires. They'll be pushed on first use. bool bLayerManagerInitialized = OnCreate(DX12_DEVICE, nullptr); if (bLayerManagerInitialized) { bool bPluginRegistered = RegisterActivePlugin(GetShortDescription()); if (!bPluginRegistered) { Log(logERROR, "Failed to register DX12Server plugin.\n"); } else { // If the LayerManager was initialized successfully, attempt to initialize the interceptor. mInterceptor = new DX12Interceptor(); #ifdef DLL_REPLACEMENT // Pass the handle to the system's D3D12 dll to the Hook_D3D12 module so that the real // functions can be obtained later. mModuleHook.SetRealDllHandle(s_hRealD3D12); #endif // Hook the entrypoints we'd like to intercept. bLayerManagerInitialized = mModuleHook.HookInterceptor(); if (!bLayerManagerInitialized) { Log(logERROR, "Failed to hook D3D12 entrypoints.\n"); } } } else { Log(logERROR, "Failed to initialize DX12Server plugin.\n"); } mbIsInitialized = bLayerManagerInitialized; return bLayerManagerInitialized; }
//-------------------------------------------------------------------------- /// Initialize the LayerManager. /// \return True if the LayerManager was initialized successfully. //-------------------------------------------------------------------------- bool DX12LayerManager::InitializeLayerManager() { // Keep the TimeControlLayer to the bottom of the stack; m_AvailableLayers.push_back(TimeControlLayer::Instance()); // Initialize all of the layers that the plugin requires. They'll be pushed on first use. bool bLayerManagerInitialized = OnCreate(DX12_DEVICE, NULL); if (bLayerManagerInitialized) { bool bPluginRegistered = RegisterActivePlugin(GetShortDescription()); if (!bPluginRegistered) { Log(logERROR, "Failed to register DX12Server plugin.\n"); } else { // If the LayerManager was initialized successfully, attempt to initialize the interceptor. mInterceptor = new DX12Interceptor(); #ifdef DLL_REPLACEMENT // Pass the handle to the real D3D12 dll to the DX12Interceptor so that the real // functions can be obtained later mInterceptor->SetRealDllHandle(s_hRealD3D12); #endif bLayerManagerInitialized = mInterceptor->Initialize(); } } else { Log(logERROR, "Failed to initialize DX12Server plugin.\n"); } mbIsInitialized = bLayerManagerInitialized; return bLayerManagerInitialized; }