The adapter records everything the client draws (state, transforms, lights, fog, textures and buffers) as a command stream, sent in chunks through the shared memory channel, while IMVU's Direct3D renderer still draws the whole view. The renderer process draws it with Diligent, with shaders reproducing IMVU's Direct3D 9 fixed-function setup, over the right half of the 3D view to compare. It skips to the newest frame when it falls behind, and logs its errors and frame times. Co-Authored-By: Claude Opus 5.5 <[email protected]>
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
#include "pixmap.hpp"
|
|
|
|
#include <windows.h>
|
|
|
|
namespace t5de {
|
|
|
|
namespace {
|
|
|
|
using Getter = unsigned(__thiscall*)(const imvu::Pixmap*);
|
|
using PixelsGetter = std::uint32_t*(__thiscall*)(const imvu::Pixmap*);
|
|
|
|
struct Methods {
|
|
Getter width = nullptr;
|
|
Getter height = nullptr;
|
|
Getter rowBytes = nullptr;
|
|
PixelsGetter pixels = nullptr;
|
|
};
|
|
|
|
const Methods& methods()
|
|
{
|
|
static const Methods methods = [] {
|
|
Methods found;
|
|
if (HMODULE module = GetModuleHandleW(L"pixmap.dll")) {
|
|
found.width = reinterpret_cast<Getter>(GetProcAddress(module, "?width@Pixmap@@QBEIXZ"));
|
|
found.height = reinterpret_cast<Getter>(GetProcAddress(module, "?height@Pixmap@@QBEIXZ"));
|
|
found.rowBytes = reinterpret_cast<Getter>(GetProcAddress(module, "?rowBytes@Pixmap@@QBEIXZ"));
|
|
found.pixels = reinterpret_cast<PixelsGetter>(GetProcAddress(module, "?pixels@Pixmap@@QBEPAIXZ"));
|
|
}
|
|
return found;
|
|
}();
|
|
return methods;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
std::optional<PixmapPixels> pixmap_pixels(const imvu::Pixmap& pixmap)
|
|
{
|
|
const Methods& m = methods();
|
|
if (m.width == nullptr || m.height == nullptr || m.rowBytes == nullptr || m.pixels == nullptr) {
|
|
return std::nullopt;
|
|
}
|
|
return PixmapPixels{m.width(&pixmap), m.height(&pixmap), m.rowBytes(&pixmap), m.pixels(&pixmap)};
|
|
}
|
|
|
|
} // namespace t5de
|