mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add logging hook for Bink Video error output
Hook BinkOpen, and retrieve error message from exported function BinkGetError if BinkOpen failed.
This commit is contained in:
parent
6fbf78a4eb
commit
4de66e7866
24
r5dev/codecs/bink_impl.cpp
Normal file
24
r5dev/codecs/bink_impl.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "core/stdafx.h"
|
||||||
|
#include "codecs/bink_impl.h"
|
||||||
|
|
||||||
|
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 BinkImpl_Attach()
|
||||||
|
{
|
||||||
|
DetourAttach(&v_BinkOpen, &BinkOpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BinkImpl_Detach()
|
||||||
|
{
|
||||||
|
DetourDetach(&v_BinkOpen, &BinkOpen);
|
||||||
|
}
|
41
r5dev/codecs/bink_impl.h
Normal file
41
r5dev/codecs/bink_impl.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
inline CMemory p_BinkOpen;
|
||||||
|
inline auto v_BinkOpen = p_BinkOpen.RCast<void*(*)(HANDLE hBinkFile, UINT32 nFlags)>();
|
||||||
|
|
||||||
|
inline CMemory p_BinkClose;
|
||||||
|
inline auto v_BinkClose = p_BinkClose.RCast<void(*)(HANDLE hBinkFile)>();
|
||||||
|
|
||||||
|
inline CMemory p_BinkGetError;
|
||||||
|
inline auto v_BinkGetError = p_BinkGetError.RCast<const char*(*)(void)>();
|
||||||
|
|
||||||
|
void BinkImpl_Attach();
|
||||||
|
void BinkImpl_Detach();
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
class BinkCore : public IDetour
|
||||||
|
{
|
||||||
|
virtual void GetAdr(void) const
|
||||||
|
{
|
||||||
|
spdlog::debug("| FUN: BinkOpen : {:#18x} |\n", p_BinkOpen.GetPtr());
|
||||||
|
spdlog::debug("| FUN: BinkClose : {:#18x} |\n", p_BinkClose.GetPtr());
|
||||||
|
spdlog::debug("| FUN: BinkGetError : {:#18x} |\n", p_BinkGetError.GetPtr());
|
||||||
|
spdlog::debug("+----------------------------------------------------------------+\n");
|
||||||
|
}
|
||||||
|
virtual void GetFun(void) const
|
||||||
|
{
|
||||||
|
p_BinkOpen = g_RadVideoToolsDll.GetExportedFunction("BinkOpen");
|
||||||
|
v_BinkOpen = p_BinkOpen.RCast<void*(*)(HANDLE, UINT32)>();
|
||||||
|
p_BinkClose = g_RadVideoToolsDll.GetExportedFunction("BinkClose");
|
||||||
|
v_BinkClose = p_BinkClose.RCast<void(*)(HANDLE)>();
|
||||||
|
p_BinkGetError = g_RadVideoToolsDll.GetExportedFunction("BinkGetError");
|
||||||
|
v_BinkGetError = p_BinkGetError.RCast<const char* (*)(void)>();
|
||||||
|
}
|
||||||
|
virtual void GetVar(void) const { }
|
||||||
|
virtual void GetCon(void) const { }
|
||||||
|
virtual void Attach(void) const { }
|
||||||
|
virtual void Detach(void) const { }
|
||||||
|
};
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
REGISTER(BinkCore);
|
@ -36,6 +36,7 @@
|
|||||||
#ifndef DEDICATED
|
#ifndef DEDICATED
|
||||||
#include "milessdk/shared/core.h"
|
#include "milessdk/shared/core.h"
|
||||||
#include "milessdk/win64_rrthreads.h"
|
#include "milessdk/win64_rrthreads.h"
|
||||||
|
#include "codecs/bink_impl.h"
|
||||||
#endif // !DEDICATED
|
#endif // !DEDICATED
|
||||||
#include "vphysics/QHull.h"
|
#include "vphysics/QHull.h"
|
||||||
#include "bsplib/bsplib.h"
|
#include "bsplib/bsplib.h"
|
||||||
@ -167,6 +168,8 @@ void Systems_Init()
|
|||||||
|
|
||||||
#ifndef DEDICATED
|
#ifndef DEDICATED
|
||||||
MilesCore_Attach();
|
MilesCore_Attach();
|
||||||
|
BinkImpl_Attach();
|
||||||
|
|
||||||
CMaterialSystem_Attach();
|
CMaterialSystem_Attach();
|
||||||
#endif // !DEDICATED
|
#endif // !DEDICATED
|
||||||
|
|
||||||
@ -303,6 +306,8 @@ void Systems_Shutdown()
|
|||||||
|
|
||||||
#ifndef DEDICATED
|
#ifndef DEDICATED
|
||||||
MilesCore_Detach();
|
MilesCore_Detach();
|
||||||
|
BinkImpl_Detach();
|
||||||
|
|
||||||
CMaterialSystem_Detach();
|
CMaterialSystem_Detach();
|
||||||
#endif // !DEDICATED
|
#endif // !DEDICATED
|
||||||
|
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
namespace
|
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/* ==== ------- ========================================================================================================================================================= */
|
|
||||||
}
|
|
||||||
|
|
||||||
void SDK_Init();
|
void SDK_Init();
|
||||||
void SDK_Shutdown();
|
void SDK_Shutdown();
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
<ClCompile Include="..\bsplib\bsplib.cpp" />
|
<ClCompile Include="..\bsplib\bsplib.cpp" />
|
||||||
<ClCompile Include="..\client\cdll_engine_int.cpp" />
|
<ClCompile Include="..\client\cdll_engine_int.cpp" />
|
||||||
<ClCompile Include="..\client\vengineclient_impl.cpp" />
|
<ClCompile Include="..\client\vengineclient_impl.cpp" />
|
||||||
|
<ClCompile Include="..\codecs\bink_impl.cpp" />
|
||||||
<ClCompile Include="..\common\netmessages.cpp" />
|
<ClCompile Include="..\common\netmessages.cpp" />
|
||||||
<ClCompile Include="..\common\opcodes.cpp" />
|
<ClCompile Include="..\common\opcodes.cpp" />
|
||||||
<ClCompile Include="..\core\dllmain.cpp" />
|
<ClCompile Include="..\core\dllmain.cpp" />
|
||||||
@ -156,6 +157,7 @@
|
|||||||
<ClInclude Include="..\bsplib\bsplib.h" />
|
<ClInclude Include="..\bsplib\bsplib.h" />
|
||||||
<ClInclude Include="..\client\cdll_engine_int.h" />
|
<ClInclude Include="..\client\cdll_engine_int.h" />
|
||||||
<ClInclude Include="..\client\vengineclient_impl.h" />
|
<ClInclude Include="..\client\vengineclient_impl.h" />
|
||||||
|
<ClInclude Include="..\codecs\bink_impl.h" />
|
||||||
<ClInclude Include="..\common\igameserverdata.h" />
|
<ClInclude Include="..\common\igameserverdata.h" />
|
||||||
<ClInclude Include="..\common\netmessages.h" />
|
<ClInclude Include="..\common\netmessages.h" />
|
||||||
<ClInclude Include="..\common\opcodes.h" />
|
<ClInclude Include="..\common\opcodes.h" />
|
||||||
|
@ -235,6 +235,9 @@
|
|||||||
<Filter Include="sdk\milessdk\shared">
|
<Filter Include="sdk\milessdk\shared">
|
||||||
<UniqueIdentifier>{7823b9d7-9d02-4936-b326-4b6351df0c7e}</UniqueIdentifier>
|
<UniqueIdentifier>{7823b9d7-9d02-4936-b326-4b6351df0c7e}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="sdk\codecs">
|
||||||
|
<UniqueIdentifier>{3b14367c-17f1-43d8-b8f5-a55506ac961f}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\client\cdll_engine_int.cpp">
|
<ClCompile Include="..\client\cdll_engine_int.cpp">
|
||||||
@ -624,6 +627,9 @@
|
|||||||
<ClCompile Include="..\milessdk\shared\core.cpp">
|
<ClCompile Include="..\milessdk\shared\core.cpp">
|
||||||
<Filter>sdk\milessdk\shared</Filter>
|
<Filter>sdk\milessdk\shared</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\codecs\bink_impl.cpp">
|
||||||
|
<Filter>sdk\codecs</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\client\cdll_engine_int.h">
|
<ClInclude Include="..\client\cdll_engine_int.h">
|
||||||
@ -1829,6 +1835,9 @@
|
|||||||
<ClInclude Include="..\milessdk\shared\core.h">
|
<ClInclude Include="..\milessdk\shared\core.h">
|
||||||
<Filter>sdk\milessdk\shared</Filter>
|
<Filter>sdk\milessdk\shared</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\codecs\bink_impl.h">
|
||||||
|
<Filter>sdk\codecs</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="..\shared\resource\lockedserver.png">
|
<Image Include="..\shared\resource\lockedserver.png">
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
<ClCompile Include="..\bsplib\bsplib.cpp" />
|
<ClCompile Include="..\bsplib\bsplib.cpp" />
|
||||||
<ClCompile Include="..\client\cdll_engine_int.cpp" />
|
<ClCompile Include="..\client\cdll_engine_int.cpp" />
|
||||||
<ClCompile Include="..\client\vengineclient_impl.cpp" />
|
<ClCompile Include="..\client\vengineclient_impl.cpp" />
|
||||||
|
<ClCompile Include="..\codecs\bink_impl.cpp" />
|
||||||
<ClCompile Include="..\common\netmessages.cpp" />
|
<ClCompile Include="..\common\netmessages.cpp" />
|
||||||
<ClCompile Include="..\common\opcodes.cpp" />
|
<ClCompile Include="..\common\opcodes.cpp" />
|
||||||
<ClCompile Include="..\core\dllmain.cpp" />
|
<ClCompile Include="..\core\dllmain.cpp" />
|
||||||
@ -167,6 +168,7 @@
|
|||||||
<ClInclude Include="..\bsplib\bsplib.h" />
|
<ClInclude Include="..\bsplib\bsplib.h" />
|
||||||
<ClInclude Include="..\client\cdll_engine_int.h" />
|
<ClInclude Include="..\client\cdll_engine_int.h" />
|
||||||
<ClInclude Include="..\client\vengineclient_impl.h" />
|
<ClInclude Include="..\client\vengineclient_impl.h" />
|
||||||
|
<ClInclude Include="..\codecs\bink_impl.h" />
|
||||||
<ClInclude Include="..\common\igameserverdata.h" />
|
<ClInclude Include="..\common\igameserverdata.h" />
|
||||||
<ClInclude Include="..\common\netmessages.h" />
|
<ClInclude Include="..\common\netmessages.h" />
|
||||||
<ClInclude Include="..\common\opcodes.h" />
|
<ClInclude Include="..\common\opcodes.h" />
|
||||||
|
@ -244,6 +244,9 @@
|
|||||||
<Filter Include="sdk\milessdk\shared">
|
<Filter Include="sdk\milessdk\shared">
|
||||||
<UniqueIdentifier>{14049eac-0367-4235-b555-c4815be3e905}</UniqueIdentifier>
|
<UniqueIdentifier>{14049eac-0367-4235-b555-c4815be3e905}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="sdk\codecs">
|
||||||
|
<UniqueIdentifier>{389ac126-74f8-456a-93f3-aae243804dcc}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\client\vengineclient_impl.cpp">
|
<ClCompile Include="..\client\vengineclient_impl.cpp">
|
||||||
@ -666,6 +669,9 @@
|
|||||||
<ClCompile Include="..\milessdk\shared\core.cpp">
|
<ClCompile Include="..\milessdk\shared\core.cpp">
|
||||||
<Filter>sdk\milessdk\shared</Filter>
|
<Filter>sdk\milessdk\shared</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\codecs\bink_impl.cpp">
|
||||||
|
<Filter>sdk\codecs</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\client\cdll_engine_int.h">
|
<ClInclude Include="..\client\cdll_engine_int.h">
|
||||||
@ -1925,6 +1931,9 @@
|
|||||||
<ClInclude Include="..\milessdk\shared\core.h">
|
<ClInclude Include="..\milessdk\shared\core.h">
|
||||||
<Filter>sdk\milessdk\shared</Filter>
|
<Filter>sdk\milessdk\shared</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\codecs\bink_impl.h">
|
||||||
|
<Filter>sdk\codecs</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="..\shared\resource\lockedserver.png">
|
<Image Include="..\shared\resource\lockedserver.png">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user