Esempio n. 1
0
//-----------------------------------------------------------------------------
/// Shutdown the LayerManager by detaching hooks and destroying instances.
/// \returns True if the LayerManager was destroyed fully and successfully.
//-----------------------------------------------------------------------------
bool DX12LayerManager::ShutdownLayerManager()
{
    bool bShutdownSuccess = false;

    DeinitCommunication();

    // Try to shutdown the DX12Interceptor if it was created during initialization.
    if (mInterceptor != nullptr)
    {
        if ((bShutdownSuccess = mInterceptor->Shutdown()) == false)
        {
            Log(logERROR, "Failed to clean up the DX12Interceptor during shutdown.\n");
        }

        SAFE_DELETE(mInterceptor);
    }

    bool bUnhookSuccessful = mModuleHook.UnhookInterceptor();

    if (!bUnhookSuccessful)
    {
        Log(logERROR, "Failed to unhook intercepted D3D12 entrypoints during shutdown.\n");
    }

    if ((bShutdownSuccess = OnDestroy(DX12_DEVICE, nullptr)) == false)
    {
        Log(logERROR, "Failed to destroy the DX12LayerManager during shutdown.\n");
    }

    return bShutdownSuccess;
}
//--------------------------------------------------------------------------
/// 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;
}
//--------------------------------------------------------------------------
/// Shutdown the LayerManager by detaching hooks and destroying instances.
/// \returns True if the LayerManager was destroyed fully and successfully.
//--------------------------------------------------------------------------
bool DX12LayerManager::ShutdownLayerManager()
{
    bool bShutdownSuccess = false;

    DeinitCommunication();

    // Try to shutdown the DX12Interceptor if it was created during initialization.
    if (mInterceptor != NULL)
    {
        if ((bShutdownSuccess = mInterceptor->Shutdown()) == false)
        {
            Log(logERROR, "Failed to clean up the DX12Interceptor during shutdown.\n");
        }

        SAFE_DELETE(mInterceptor);
    }

    if ((bShutdownSuccess = OnDestroy(DX12_DEVICE, NULL)) == false)
    {
        Log(logERROR, "Failed to destroy the DX12LayerManager during shutdown.\n");
    }

    return bShutdownSuccess;
}