Advertisement

Incorrect initialization of the Steam Overlay

Started by February 27, 2025 11:23 AM
2 comments, last by wookie 6 days, 4 hours ago

Hey,

I have a use case where the Steam Overlay would sometimes get initialized incorrectly. Before the game starts, I'm showing a splash screen that's closed when the game is fully loaded and main menu is ready to be shown. The problem is that Steam will sometimes hook into the splash screen and initialize the overlay for it, so the overlay will be broken when opened in game (the resolution will be wrong, you won't be able to close it, as it's not processing input anymore).

The way it goes is
> Show splash screen
> Call SteamAPI_Init
> Create game window (hidden in the beginning)
> Initialize the main menu
> Show game window
> Close splash screen

What I found is that the overlay will fix itself if change the resolution in-game, this triggers the swapchain resize, but before I code it, I'd like to know if there's some clear info on how the injection process works? I haven't been able to find it the docs.

This behavior is documented in the Steamworks SDK:

"As such you'll need to make sure to call SteamAPI_Init prior to initializing the OpenGL/D3D device, otherwise it won't be able to hook the device creation."

So make sure your splash screen does not create a DirectX or OpenGL context. And once the splash screen has finished displaying, close it, then initialize the SteamAPI, and subsequently create the main game window with its rendering context.

our project: classroom 76

Advertisement

@Greeny109 I don't have that much control over the splash screen. It's using WinForm and I was trying everything to make it behave in a way that Steam will not hook into it. All without success. The only consistent thing that works is the swapchain resize

Advertisement