Kir-Antipov / cubes-without-borders

A mod that allows you to play Minecraft in a borderless fullscreen window
MIT License
18 stars 8 forks source link

Borderless windowed not recognized by OBS game capture #16

Closed Scubakay closed 4 months ago

Scubakay commented 5 months ago

When using Game Capture in OBS Studio, OBS is not able to recognize Cubes Without Borders borderless as full screen. I used to use BorderlessMining but since it hasn't received any attention since January my eye is on Cubes Without Borders to replace it. OBS is able to recognize BorderlessMining borderless as a game capture.

It would be awesome if Cubes Without Borders would be recognized, just like BorderlessMining is! Not sure if you want to go through the trouble to support this, but I use OBS to record Minecraft footage. I tried Streamlabs too, but that doesn't recognize anything, so I wouldn't even bother looking into that haha

Kir-Antipov commented 5 months ago

I assume you are referring to v1.0.0 here, as v1.1.0 should behave similarly to BorderlessMining. v1.0.0 forcefully keeps the window from entering the exclusive fullscreen mode, because it just works much better on Windows. However, it seems OBS doesn't handle this well for some reason. I'll look into it.

Kir-Antipov commented 5 months ago

https://obsproject.com/forum/threads/use-game-capture-when-playing-in-windowed-borderless-mode-d.47032/

you can manually choose the .exe on Game Capture properties if it doesn't.

If borderless takes up the size of the whole screen then it'll be detected with the "use any full screen" option of game capture. The option just detects windows that take up the size of the whole screen, not just actual fullscreen-mode games.

Does anything from here work for you?

Kir-Antipov commented 5 months ago

This is why it doesn't work:

if (rect.left == mi.rcMonitor.left &&
    rect.right == mi.rcMonitor.right &&
    rect.bottom == mi.rcMonitor.bottom &&
    rect.top == mi.rcMonitor.top) {
    setup_window(gc, window);
} else {
    gc->wait_for_target_startup = true;
}

OBS uses a strict comparison to identify fullscreen windows, but in our case, we need something more like height >= monitorHeight && width >= monitorWidth.

I'm gonna submit a PR there, but no promises that it will be merged tho.

Kir-Antipov commented 5 months ago

You can download a freshly built version of OBS with my patch applied from here: https://github.com/obsproject/obs-studio/actions/runs/9570314634

You don't need to reinstall the whole thing. Instead, you should be able to grab obs-studio-windows-x64-7b3e69604.zip/obs-studio-30.2.0-beta3-7b3e69604-windows-x64.zip/obs-plugins/64bit/win-capture.* and simply replace the win-capture plugin, which is responsible for Game Capture, locally.

Kir-Antipov commented 5 months ago

Just to recap, the outcome of this issue fully depends on what happens on the OBS side:

With the solution I'm going forward on my end, it's up to OBS Game Capture to properly detect a fullscreen window as such. There are no APIs I can hook into from the game itself to circumvent the issue - only hardcoded checks that don't work in our scenario. Thus, at the end of the day, this is an OBS bug.

Kir-Antipov commented 4 months ago

Good news, everyone! I won the war against flickering and other fun stuff on Windows, so the proper borderless fullscreen mode is coming back in v2.1.0 (and it is recognized by OBS Game Capture).