r5sdk/r5dev/codecs/bink/bink_impl.h
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

36 lines
1.2 KiB
C++

#pragma once
inline CMemory p_BinkOpen;
inline void*(*v_BinkOpen)(HANDLE hBinkFile, UINT32 nFlags);
inline CMemory p_BinkClose;
inline void(*v_BinkClose)(HANDLE hBinkFile);
inline CMemory p_BinkGetError;
inline const char*(*v_BinkGetError)(void);
///////////////////////////////////////////////////////////////////////////////
class BinkCore : public IDetour
{
virtual void GetAdr(void) const
{
LogFunAdr("BinkOpen", p_BinkOpen.GetPtr());
LogFunAdr("BinkClose", p_BinkClose.GetPtr());
LogFunAdr("BinkGetError", p_BinkGetError.GetPtr());
}
virtual void GetFun(void) const
{
p_BinkOpen = g_RadVideoToolsDll.GetExportedSymbol("BinkOpen");
v_BinkOpen = p_BinkOpen.RCast<void*(*)(HANDLE, UINT32)>();
p_BinkClose = g_RadVideoToolsDll.GetExportedSymbol("BinkClose");
v_BinkClose = p_BinkClose.RCast<void(*)(HANDLE)>();
p_BinkGetError = g_RadVideoToolsDll.GetExportedSymbol("BinkGetError");
v_BinkGetError = p_BinkGetError.RCast<const char* (*)(void)>();
}
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Detour(const bool bAttach) const;
};
///////////////////////////////////////////////////////////////////////////////