So I'm having a problem when I minimize the game and maximizing it again, the game crashes or sticks.
I know that it destroys the scene and recreates it when I do and I have to use the ResetHook. But I do the ResetHook and it's still crashing. IDK what I'm doing wrong
***UPDATE**
nvm.. i forgot about LostDevice
I know that it destroys the scene and recreates it when I do and I have to use the ResetHook. But I do the ResetHook and it's still crashing. IDK what I'm doing wrong
C++:
void ReFont(LPDIRECT3DDEVICE9 pDevice)
{
if (g_pDevice != pDevice)
{
g_pDevice = pDevice;
try
{
if (dMenu.pFont != 0)
dMenu.pFont->Release();
}
catch (...) {}
dMenu.pFont = 0;
D3DXCreateFontA(pDevice, 14, 0, FW_BOLD, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &dMenu.pFont);
}
}
HRESULT __stdcall Hooked_Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
{
if (dMenu.pFont)
{
dMenu.pFont->Release();
dMenu.pFont = NULL;
}
return dMenu.oReset(pDevice, pPresentationParameters);
}
HRESULT __stdcall Hooked_EndScene(IDirect3DDevice9 * pDevice)
{
ReFont(pDevice);
dMenu.BuildMenu((char*)"Menu", 0, 0, 180, 200, RED, BLACK, GREEN, pDevice);
TestThread();
return dMenu.oEndScene(pDevice);
}
DWORD WINAPI MainThread(LPVOID param)
{
while (!dMenu.pDevice)
dMenu.pDevice = **(DWORD**)(FindPattern("shaderapidx9.dll", "A1 ?? ?? ?? ?? 50 8B 08 FF 51 0C") + 0x1);
void ** pVTable = *reinterpret_cast<void***>(dMenu.pDevice);
dMenu.oEndScene = (f_EndScene)DetourFunction((PBYTE)pVTable[42], (PBYTE)Hooked_EndScene);
dMenu.oReset = (Reset_t)DetourFunction((PBYTE)pVTable[16], (PBYTE)Hooked_Reset);
return false;
}
***UPDATE**
nvm.. i forgot about LostDevice
Last edited: