void Engine::GameTick() { CDEBUG("gametick"); CheckKeyBindings(); DoHook(_hookTimer); ProcessEntities(); }
void Engine::Render(const std::vector<uint>& list) { CDEBUG("render"); const Point res = video->GetResolution(); if (!_isMapLoaded) { return; } tiles->UpdateAnimation(GetTime()); if (cameraTarget) { const Map::Layer* layer = map.GetLayer(cameraTarget->layerIndex); SetCamera(Point( cameraTarget->x + cameraTarget->sprite->nHotw / 2 - res.x / 2 + layer->x, cameraTarget->y + cameraTarget->sprite->nHoth / 2 - res.y / 2 + layer->y)); } // Note that we do not clear the screen here. This is intentional. for (uint i = 0; i < list.size(); i++) { uint j = list[i]; if (j < map.NumLayers()) { RenderLayer(j); RenderEntities(j); } } DoHook(_hookRetrace); }
DWORD HookThread(LPARAM lParam) { HMODULE specialModuleHandle = NULL; BOOL isHooked = FALSE; while (1) { specialModuleHandle = GetModuleHandle(TEXT("DX9_V200.dll")); if (isHooked == FALSE && specialModuleHandle != NULL) { ATLTRACE(TEXT("TVCUSACore Hook proc 0x%x"), specialModuleHandle); //MessageBoxA(NULL, "attach", "attach", MB_OK); DoHook(specialModuleHandle); } if (isHooked == TRUE && specialModuleHandle == NULL) { ATLTRACE(TEXT("TVCUSACore Hook invalid 0x%x"), specialModuleHandle); } isHooked = specialModuleHandle == NULL ? FALSE : TRUE; Sleep(100); } return 0; }
BOOL CHookedFunction::UnHookImport() { if (m_bHooked) m_bHooked = !DoHook(FALSE, m_pfnHook, m_pfnOrig); return !m_bHooked; }
BOOL CHookedFunction::HookImport() { m_bHooked = DoHook(TRUE, m_pfnOrig, m_pfnHook); return m_bHooked; }