r5sdk/r5dev/codecs/bink/bink_impl.cpp
Kawe Mazidjatari 144d5f62e1 IDetour: code refactor
Utilize the new IDetour::DetourSetup() code, IDetour::Attach and IDetour::Detach have been removed in favor of this (significantly reduces chance of user error). Since the template check happens in the idetour header, it is much more aggressive on type mismatches, such as a difference in parameter types, between the function and detour, will now raise a compile time error. As a result, some type mismatches have been fixed in this commit as well.
2024-04-05 16:41:09 +02:00

27 lines
885 B
C++

#include "core/stdafx.h"
#include "codecs/bink/bink_impl.h"
//-----------------------------------------------------------------------------
// Purpose: opens bik video by handle, and logs any error caused during loading
// Input : hBinkFile -
// nFlags -
// Output : pointer to bik video structure, null if failed
//-----------------------------------------------------------------------------
void* BinkOpen(HANDLE hBinkFile, UINT32 nFlags)
{
void* pHandle = v_BinkOpen(hBinkFile, nFlags);
if (!pHandle)
{
// Retrieve BinkOpen error using the DLL's exported function "BinkGetError()".
Error(eDLL_T::VIDEO, NO_ERROR, "%s: %s\n", __FUNCTION__, v_BinkGetError());
}
return pHandle;
}
///////////////////////////////////////////////////////////////////////////////
void BinkCore::Detour(const bool bAttach) const
{
DetourSetup(&v_BinkOpen, &BinkOpen, bAttach);
}