gitadora: add native dual fullscreen for Arena (#846)

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

Fixed https://github.com/spice2x/spice2x.github.io/issues/740

## Description of change

- Enable native D3D9 adapter-group dual fullscreen for the GITADORA
Arena model when the two-screen MAIN + SMALL configuration is selected
without windowed mode.
- Present MAIN and SMALL on their respective monitor heads while keeping
the invisible LEFT and RIGHT targets offscreen.
- Scope the new fake-swap-chain query behavior to the hidden GITADORA
two-head targets, preserving existing behavior for other games and
configurations.

The existing borderless-windowed two-screen path could not consistently
keep input and game timing synchronized and also reduced rendering
performance. Native dual fullscreen avoids that windowed composition
path.

## Testing

- Manually tested GITADORA Arena with separate MAIN and SMALL monitors
in fullscreen mode. Windowed mode still works if the user chooses to use
that.
- Confirmed both displays render correctly, touch input works on the
SMALL screen, gameplay input stays synchronized, and gameplay holds a
steady 60 FPS.
- Built `spicetools_spice64` at commit `e4a98e9` with the repository
Docker toolchain.
- Confirmed no new compiler warnings.
- Confirmed the forbidden static DLL import check passes.
- Confirmed the Windows 7 DLL compatibility check reports `All DLLs
OK!`.

---------

Co-authored-by: vgod <428979+vgod@users.noreply.github.com>
This commit is contained in:
Tsung-Hsiang Chang
2026-08-02 00:03:36 -07:00
committed by GitHub
parent c590b87cff
commit 3012139028
16 changed files with 1870 additions and 103 deletions
@@ -59,7 +59,12 @@ HRESULT STDMETHODCALLTYPE FakeIDirect3DSwapChain9::Present(const RECT *pSourceRe
log_misc("graphics::d3d9", "FakeIDirect3DSwapChain9::Present");
});
return D3DERR_INVALIDCALL;
if (!is_hidden) {
return D3DERR_INVALIDCALL;
}
present_count.fetch_add(1, std::memory_order_relaxed);
return D3D_OK;
}
HRESULT STDMETHODCALLTYPE FakeIDirect3DSwapChain9::GetFrontBufferData(IDirect3DSurface9 *pDestSurface) {
WRAP_VERBOSE;
@@ -86,11 +91,32 @@ HRESULT STDMETHODCALLTYPE FakeIDirect3DSwapChain9::GetBackBuffer(UINT iBackBuffe
}
HRESULT STDMETHODCALLTYPE FakeIDirect3DSwapChain9::GetRasterStatus(D3DRASTER_STATUS *pRasterStatus) {
WRAP_VERBOSE;
return D3DERR_INVALIDCALL;
if (!is_hidden) {
return D3DERR_INVALIDCALL;
}
if (pRasterStatus == nullptr) {
return D3DERR_INVALIDCALL;
}
*pRasterStatus = {};
return D3D_OK;
}
HRESULT STDMETHODCALLTYPE FakeIDirect3DSwapChain9::GetDisplayMode(D3DDISPLAYMODE *pMode) {
WRAP_VERBOSE;
return D3DERR_INVALIDCALL;
if (!is_hidden) {
return D3DERR_INVALIDCALL;
}
if (pMode == nullptr) {
return D3DERR_INVALIDCALL;
}
pMode->Width = present_params.BackBufferWidth;
pMode->Height = present_params.BackBufferHeight;
pMode->RefreshRate = present_params.FullScreen_RefreshRateInHz;
pMode->Format = present_params.BackBufferFormat;
return D3D_OK;
}
HRESULT STDMETHODCALLTYPE FakeIDirect3DSwapChain9::GetDevice(IDirect3DDevice9 **ppDevice) {
WRAP_VERBOSE;
@@ -108,17 +134,46 @@ HRESULT STDMETHODCALLTYPE FakeIDirect3DSwapChain9::GetPresentParameters(
D3DPRESENT_PARAMETERS *pPresentationParameters)
{
WRAP_VERBOSE;
return D3DERR_INVALIDCALL;
if (!is_hidden) {
return D3DERR_INVALIDCALL;
}
if (pPresentationParameters == nullptr) {
return D3DERR_INVALIDCALL;
}
*pPresentationParameters = present_params;
return D3D_OK;
}
// IDirect3DSwapChain9Ex
HRESULT STDMETHODCALLTYPE FakeIDirect3DSwapChain9::GetLastPresentCount(UINT *pLastPresentCount) {
assert(is_d3d9ex);
return D3DERR_INVALIDCALL;
if (!is_hidden) {
return D3DERR_INVALIDCALL;
}
if (pLastPresentCount == nullptr) {
return D3DERR_INVALIDCALL;
}
*pLastPresentCount = present_count.load(std::memory_order_relaxed);
return D3D_OK;
}
HRESULT STDMETHODCALLTYPE FakeIDirect3DSwapChain9::GetPresentStats(D3DPRESENTSTATS *pPresentationStatistics) {
assert(is_d3d9ex);
return D3DERR_INVALIDCALL;
if (!is_hidden) {
return D3DERR_INVALIDCALL;
}
if (pPresentationStatistics == nullptr) {
return D3DERR_INVALIDCALL;
}
*pPresentationStatistics = {};
pPresentationStatistics->PresentCount =
present_count.load(std::memory_order_relaxed);
return D3D_OK;
}
HRESULT STDMETHODCALLTYPE FakeIDirect3DSwapChain9::GetDisplayModeEx(D3DDISPLAYMODEEX *pMode,
D3DDISPLAYROTATION *pRotation)
@@ -126,5 +181,22 @@ HRESULT STDMETHODCALLTYPE FakeIDirect3DSwapChain9::GetDisplayModeEx(D3DDISPLAYMO
WRAP_VERBOSE;
assert(is_d3d9ex);
return D3DERR_INVALIDCALL;
if (!is_hidden) {
return D3DERR_INVALIDCALL;
}
if (pMode == nullptr) {
return D3DERR_INVALIDCALL;
}
pMode->Size = sizeof(*pMode);
pMode->Width = present_params.BackBufferWidth;
pMode->Height = present_params.BackBufferHeight;
pMode->RefreshRate = present_params.FullScreen_RefreshRateInHz;
pMode->Format = present_params.BackBufferFormat;
pMode->ScanLineOrdering = D3DSCANLINEORDERING_PROGRESSIVE;
if (pRotation != nullptr) {
*pRotation = D3DDISPLAYROTATION_IDENTITY;
}
return D3D_OK;
}