void AMiscFunctions::execScreenshotToTCP(FFrame& Stack, RESULT_DECL) { P_GET_OBJECT(ATcpLink,tc) P_FINISH HDC screen = GetDC(NULL); HDC destDC = CreateCompatibleDC(screen); HBITMAP bmp = CreateCompatibleBitmap(screen, 1024, 768); SelectObject(destDC, bmp); SetStretchBltMode(destDC, HALFTONE); if(!StretchBlt(destDC, 0,0, 1024, 768, screen, 0,0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SRCCOPY)) { GLog->Logf(TEXT("Unable to StretchBlt.")); } if (destbuffer == NULL) destbuffer = (unsigned char*) malloc(1024*1024*1024); unsigned long destsize; fnsaveasjpeg(destDC, bmp, &destbuffer, &destsize); GLog->Logf(TEXT("Sending image through socket %d"), tc->Socket); char messagetype=0; send(tc->Socket, &messagetype, 1, 0); send(tc->Socket, (const char*)&destsize, sizeof(destsize), 0); send(tc->Socket, (const char*) destbuffer, destsize, 0); //FILE* f = fopen(fn, "wb+"); //fwrite(destbuffer, 1, destsize, f); //fclose(f); }
void CSubtitleFix::ReplacementFunc(XWindow& XWinThis, CSubtitleFix& /*Context*/, FFrame& Stack, RESULT_DECL) { P_GET_OBJECT(UClass, pNewClass); P_GET_UBOOL_OPTX(bShow, 1); P_FINISH; //Note: we don't replace CinematicWindow, which has the same quirk. Advantage: cutscenes with no subtitles won't be cropped. Disadvantage: as soon as subtitles do show up, black bar spawns/grows. //Constructor function comparison is for early-out for most windows if (pNewClass->ClassConstructor == &XModalWindow::InternalConstructor && wcscmp(pNewClass->GetFullName(), L"Class DeusEx.ConWindowActive") == 0) { UClass* const pReplacementClass = LoadClass<UObject>(nullptr, L"DeusExe.ConWindowActive2", L"DeusExe", 0, nullptr); if (pReplacementClass) { pNewClass = pReplacementClass; } } XWindow* const pNewWin = XWinThis.CreateNewWindow(pNewClass, &XWinThis, bShow); *(static_cast<XWindow** const>(Result)) = pNewWin; }