rodecomp/Source/Render/DX7/BackBufferDX7.cpp
ragnarok-clanker 283441e5b4 Decompile 2 functions in Source/Render/DX7/BackBufferDX7.cpp, Source/Render/DX7/DeviceOwnerDX7.h, ...
Batch #11039 by dori: 2 byte-identical, 0 confirmed by peer review.

- fn_45504 DeviceOwnerDX7::CaptureBackBufferImpl: byte-identical
- fn_45505 DeviceOwnerDX7::RestoreBackBufferImpl: byte-identical

Merged automatically: every function is byte-identical to the original.
2026-11-04 18:54:31 +00:00

65 lines
1.9 KiB
C++

#include "Render/DX7/DeviceOwnerDX7.h"
#include "Render/RendererDX7.h"
// OFFSET: 0x00549570
// FUNCTION: fn_45504
void DeviceOwnerDX7::CaptureBackBufferImpl() {
if (this->captureSurface && this->renderTarget) {
if (FAILED(this->captureSurface->Blt(nullptr, this->renderTarget, nullptr, DDBLT_ASYNC, nullptr))) {
this->captureSurface->Blt(nullptr, this->renderTarget, nullptr, DDBLT_WAIT, nullptr);
}
}
}
// OFFSET: 0x0055A080
// FUNCTION: fn_02075
void DeviceOwnerDX7::CaptureBackBuffer() {
DeviceOwnerDX7* owner = g_deviceOwnerDX7;
if (owner) {
owner->CaptureBackBufferImpl();
}
}
// OFFSET: 0x0054AEB0
// FUNCTION: fn_45505
void DeviceOwnerDX7::RestoreBackBufferImpl() {
if (this->renderTarget && this->captureSurface) {
if (FAILED(this->renderTarget->Blt(nullptr, this->captureSurface, nullptr, DDBLT_ASYNC, nullptr))) {
this->renderTarget->Blt(nullptr, this->captureSurface, nullptr, DDBLT_WAIT, nullptr);
}
}
}
// OFFSET: 0x0055D850
// FUNCTION: fn_02108
void DeviceOwnerDX7::RestoreBackBuffer() {
DeviceOwnerDX7* owner = g_deviceOwnerDX7;
if (owner) {
owner->RestoreBackBufferImpl();
}
}
// OFFSET: 0x0055D3E0
// FUNCTION: fn_02103
bool CRendererDX7::LockBackBuffer() {
DDSURFACEDESC2 description{};
description.dwSize = sizeof(description);
IDirectDrawSurface7* renderTarget = g_deviceOwnerDX7 ? g_deviceOwnerDX7->renderTarget : nullptr;
if (FAILED(renderTarget->Lock(nullptr, &description, DDLOCK_WAIT, nullptr))) {
return false;
}
this->backBuffer.pixels = description.lpSurface;
this->backBuffer.bitsPerPixel = description.ddpfPixelFormat.dwRGBBitCount;
this->backBuffer.pitch = description.lPitch;
return true;
}
// OFFSET: 0x0055FBB0
// FUNCTION: fn_02122
HRESULT CRendererDX7::UnlockBackBuffer() {
IDirectDrawSurface7* renderTarget = g_deviceOwnerDX7 ? g_deviceOwnerDX7->renderTarget : nullptr;
return renderTarget->Unlock(nullptr);
}