sdvx: re-enable landscape mode (#847)

## Link to GitHub Issue or related Pull Request, if one exists
n/a

## Description of change
Un-deprecate SDVX landscape mode. The game calls `GetViewport` to figure
out the camera position, so if we return a sane value the game goes back
to rendering correctly.

## Testing
Tested nabla only
This commit is contained in:
bicarus
2026-08-02 00:50:04 -07:00
committed by GitHub
parent 3012139028
commit cc0899290e
4 changed files with 43 additions and 19 deletions
@@ -1239,7 +1239,36 @@ HRESULT STDMETHODCALLTYPE WrappedIDirect3DDevice9::GetViewport(
D3DVIEWPORT9 *pViewport)
{
WRAP_DEBUG;
CHECK_RESULT(pReal->GetViewport(pViewport));
const auto result = pReal->GetViewport(pViewport);
// SDVX landscape mode
// without this, the game calculates the camera angle incorrectly and
// ends up with zoomed out view of the lanes
const auto landscape_width = GRAPHICS_FS_CUSTOM_RESOLUTION.has_value() ?
GRAPHICS_FS_CUSTOM_RESOLUTION.value().first : GRAPHICS_FS_ORIGINAL_HEIGHT;
const auto landscape_height = GRAPHICS_FS_CUSTOM_RESOLUTION.has_value() ?
GRAPHICS_FS_CUSTOM_RESOLUTION.value().second : GRAPHICS_FS_ORIGINAL_WIDTH;
if (SUCCEEDED(result) &&
GRAPHICS_FS_ORIENTATION_SWAP &&
avs::game::is_model("KFC") &&
pViewport != nullptr &&
pViewport->Width == landscape_width &&
pViewport->Height == landscape_height) {
static std::once_flag log_once;
std::call_once(log_once, [pViewport]() {
log_info(
"graphics::d3d9",
"SDVX landscape viewport fix: {}x{} => {}x{}",
pViewport->Width,
pViewport->Height,
pViewport->Height,
pViewport->Width);
});
std::swap(pViewport->Width, pViewport->Height);
}
return result;
}
HRESULT STDMETHODCALLTYPE WrappedIDirect3DDevice9::SetMaterial(