Skip to content

Commit

Permalink
v1.3.1 - remove Steam Overlay workaround
Browse files Browse the repository at this point in the history
Unfortunately the Steam Overlay workaround had too many issues that seemed infeasible to resolve (see: Scirra/Construct-bugs#8328), so it is now being removed for the time being. Steam will use fallbacks instead, such as showing the actual Steam window. The addon version is updated to v1.3.1.
  • Loading branch information
AshleyScirra committed Dec 6, 2024
1 parent 95515a3 commit 47febc9
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 77 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ The Construct plugin requires 3 DLLs, each in the x86 (32-bit) and x64 (64-bit)

- **Steam_x86.ext.dll** / **Steam_x64.ext.dll** - the wrapper extension DLL, built from the *wrapper-extension* files
- **steam_api.dll** / **steam_api64.dll** - the Steamworks API DLLs from the Steamworks SDK
- **D3D11Overlay_x86.ext.dll** / **D3D11Overlay_x64.ext.dll** - an optional wrapper extension used to display a D3D11 surface over the application, solely so the Steam Overlay can render in to it, as bugs and limitations in the Steam Overlay make it impossible to display over the WebView2 control directly. (If missing the in-game Steam Overlay will not be supported, but Steam will revert to fallbacks and everything else will still work.)

For convenience these DLLs are provided in this repository. However if you make changes you may want to replace some of these DLLs.

Expand Down
Binary file removed construct-plugin/D3D11Overlay_x64.ext.dll
Binary file not shown.
Binary file removed construct-plugin/D3D11Overlay_x86.ext.dll
Binary file not shown.
2 changes: 2 additions & 0 deletions construct-plugin/aces.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
"scriptName": "IsRunningOnSteamDeck"
}, {
"id": "on-overlay-shown",
"isDeprecated": true,
"scriptName": "OnGameOverlayShown",
"isTrigger": true
}, {
"id": "on-overlay-hidden",
"isDeprecated": true,
"scriptName": "OnGameOverlayHidden",
"isTrigger": true
}
Expand Down
4 changes: 1 addition & 3 deletions construct-plugin/addon.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"id": "Steamworks_Ext",
"sdk-version": 2,
"min-construct-version": "r407.2",
"version": "1.3.0.0",
"version": "1.3.1.0",
"author": "Scirra",
"website": "https://www.construct.net",
"documentation": "https://www.construct.net",
Expand All @@ -33,8 +33,6 @@
"instance.js",
"plugin.js",
"type.js",
"D3D11Overlay_x86.ext.dll",
"D3D11Overlay_x64.ext.dll",
"Steam_x86.ext.dll",
"Steam_x64.ext.dll",
"steam_api.dll",
Expand Down
23 changes: 3 additions & 20 deletions construct-plugin/c3runtime/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ C3.Plugins.Steamworks_Ext.Instance = class Steamworks_ExtInstance extends global
this._currentGameLanguage = "";
this._availableGameLanguages = "";
let isDevelopmentMode = false;
this._isOverlayEnabled = false;

this._dlcSet = new Set();

Expand All @@ -40,10 +39,11 @@ C3.Plugins.Steamworks_Ext.Instance = class Steamworks_ExtInstance extends global
// Read the optional app ID, development mode and overlay properties for initialization.
initAppIdStr = properties[0].trim();
isDevelopmentMode = properties[1];
this._isOverlayEnabled = properties[2];
}

// Listen for overlay shown/hidden events from the extension.
// NOTE: this is implemented but currently non-functional as the Steam overlay currently will always use
// its fallback mode, which does not fire overlay events.
this._addWrapperExtensionMessageHandler("on-game-overlay-activated", e => this._onGameOverlayActivated(e));

this._addWrapperExtensionMessageHandler("on-dlc-installed", e => this._onDlcInstalled(e));
Expand Down Expand Up @@ -86,18 +86,6 @@ C3.Plugins.Steamworks_Ext.Instance = class Steamworks_ExtInstance extends global
this._steamUILanguage = result["steamUILanguage"];
this._currentGameLanguage = result["currentGameLanguage"];
this._availableGameLanguages = result["availableGameLanguages"];

// Steam initialized OK. If the overlay is enabled, tell the D3D11Overlay extension to create its overlay
// for Steam to render its overlay in to. If the overlay is disabled Steam appears to fail to create
// its overlay as it doesn't support WebView2, but it does have fallbacks, and the setting allows using
// those fallbacks if preferable for any reason.
if (this._isOverlayEnabled)
{
this.runtime.sdk.sendWrapperExtensionMessage("d3d11-overlay", "create-overlay", [
false, // isTransparent - use opaque overlay as Steam overlay doesn't work with alpha
false // initiallyShowing - start off hidden and only show when overlay activated
]);
}
}
}

Expand All @@ -124,16 +112,11 @@ C3.Plugins.Steamworks_Ext.Instance = class Steamworks_ExtInstance extends global
this._sendWrapperExtensionMessage("run-callbacks");
}

// NOTE: implemented but currently non-functional
_onGameOverlayActivated(e)
{
const isShowing = e["isShowing"];

if (this._isOverlayEnabled)
{
// Tell the D3D11Overlay extension to show/hide its overlay according to the visibility of the Steam Overlay.
this.runtime.sdk.sendWrapperExtensionMessage("d3d11-overlay", "set-showing", [isShowing]);
}

// Dispatch scripting event and fire appropriate trigger
const overlayActivatedEvent = new C3.Event("overlay-activated", false);
overlayActivatedEvent.isShowing = isShowing;
Expand Down
24 changes: 3 additions & 21 deletions construct-plugin/c3runtime/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class Steamworks_ExtInstance extends globalThis.ISDKInstanceBase
_currentGameLanguage: string;
_availableGameLanguages: string;

_isOverlayEnabled: boolean;
_loadingTimerId: number;
_triggerAchievement: string;

Expand All @@ -41,7 +40,6 @@ class Steamworks_ExtInstance extends globalThis.ISDKInstanceBase
this._currentGameLanguage = "";
this._availableGameLanguages = "";
let isDevelopmentMode = false;
this._isOverlayEnabled = false;

this._dlcSet = new Set();

Expand All @@ -58,10 +56,11 @@ class Steamworks_ExtInstance extends globalThis.ISDKInstanceBase
// Read the optional app ID, development mode and overlay properties for initialization.
initAppIdStr = (properties[0] as string).trim();
isDevelopmentMode = properties[1] as boolean;
this._isOverlayEnabled = properties[2] as boolean;
}

// Listen for overlay shown/hidden events from the extension.
// NOTE: this is implemented but currently non-functional as the Steam overlay currently will always use
// its fallback mode, which does not fire overlay events.
this._addWrapperExtensionMessageHandler("on-game-overlay-activated", e => this._onGameOverlayActivated(e as JSONObject));

this._addWrapperExtensionMessageHandler("on-dlc-installed", e => this._onDlcInstalled(e as JSONObject));
Expand Down Expand Up @@ -106,18 +105,6 @@ class Steamworks_ExtInstance extends globalThis.ISDKInstanceBase
this._steamUILanguage = result["steamUILanguage"] as string;
this._currentGameLanguage = result["currentGameLanguage"] as string;
this._availableGameLanguages = result["availableGameLanguages"] as string;

// Steam initialized OK. If the overlay is enabled, tell the D3D11Overlay extension to create its overlay
// for Steam to render its overlay in to. If the overlay is disabled Steam appears to fail to create
// its overlay as it doesn't support WebView2, but it does have fallbacks, and the setting allows using
// those fallbacks if preferable for any reason.
if (this._isOverlayEnabled)
{
this.runtime.sdk.sendWrapperExtensionMessage("d3d11-overlay", "create-overlay", [
false, // isTransparent - use opaque overlay as Steam overlay doesn't work with alpha
false // initiallyShowing - start off hidden and only show when overlay activated
]);
}
}
}

Expand All @@ -144,16 +131,11 @@ class Steamworks_ExtInstance extends globalThis.ISDKInstanceBase
this._sendWrapperExtensionMessage("run-callbacks");
}

// NOTE: implemented but currently non-functional
_onGameOverlayActivated(e: JSONObject)
{
const isShowing = e["isShowing"] as boolean;

if (this._isOverlayEnabled)
{
// Tell the D3D11Overlay extension to show/hide its overlay according to the visibility of the Steam Overlay.
this.runtime.sdk.sendWrapperExtensionMessage("d3d11-overlay", "set-showing", [isShowing]);
}

// Dispatch scripting event and fire appropriate trigger
// TypeScript note: cast to 'any' to add custom properties
const overlayActivatedEvent = new C3.Event("overlay-activated", false) as any;
Expand Down
4 changes: 0 additions & 4 deletions construct-plugin/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
"development-mode": {
"name": "Development mode",
"desc": "Check to enable development mode, which sets the app ID and disables automatic restarting. Turn off for release."
},
"enable-overlay": {
"name": "Enable overlay",
"desc": "Enable the Steam Overlay (using workaround). Disabling causes Steam to revert to fallbacks."
}
},
"aceCategories": {
Expand Down
15 changes: 1 addition & 14 deletions construct-plugin/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ const PLUGIN_CLASS = SDK.Plugins.Steamworks_Ext = class Steamworks_Ext extends S

this._info.SetProperties([
new SDK.PluginProperty("text", "app-id"),
new SDK.PluginProperty("check", "development-mode", true),
new SDK.PluginProperty("check", "enable-overlay", true)
new SDK.PluginProperty("check", "development-mode", true)
]);

SDK.Lang.PopContext(); // .properties
Expand All @@ -55,12 +54,6 @@ const PLUGIN_CLASS = SDK.Plugins.Steamworks_Ext = class Steamworks_Ext extends S
platform: "windows-x86"
});

this._info.AddFileDependency({
filename: "D3D11Overlay_x86.ext.dll",
type: "wrapper-extension",
platform: "windows-x86"
});

this._info.AddFileDependency({
filename: "Steam_x64.ext.dll",
type: "wrapper-extension",
Expand All @@ -72,12 +65,6 @@ const PLUGIN_CLASS = SDK.Plugins.Steamworks_Ext = class Steamworks_Ext extends S
type: "wrapper-extension",
platform: "windows-x64"
});

this._info.AddFileDependency({
filename: "D3D11Overlay_x64.ext.dll",
type: "wrapper-extension",
platform: "windows-x64"
});

this._info.AddFileDependency({
filename: "steamworks.ext.dylib",
Expand Down
15 changes: 1 addition & 14 deletions construct-plugin/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ const PLUGIN_CLASS = SDK.Plugins.Steamworks_Ext = class Steamworks_Ext extends S

this._info.SetProperties([
new SDK.PluginProperty("text", "app-id"),
new SDK.PluginProperty("check", "development-mode", true),
new SDK.PluginProperty("check", "enable-overlay", true)
new SDK.PluginProperty("check", "development-mode", true)
]);

SDK.Lang.PopContext(); // .properties
Expand All @@ -55,12 +54,6 @@ const PLUGIN_CLASS = SDK.Plugins.Steamworks_Ext = class Steamworks_Ext extends S
platform: "windows-x86"
});

this._info.AddFileDependency({
filename: "D3D11Overlay_x86.ext.dll",
type: "wrapper-extension",
platform: "windows-x86"
});

this._info.AddFileDependency({
filename: "Steam_x64.ext.dll",
type: "wrapper-extension",
Expand All @@ -72,12 +65,6 @@ const PLUGIN_CLASS = SDK.Plugins.Steamworks_Ext = class Steamworks_Ext extends S
type: "wrapper-extension",
platform: "windows-x64"
});

this._info.AddFileDependency({
filename: "D3D11Overlay_x64.ext.dll",
type: "wrapper-extension",
platform: "windows-x64"
});

this._info.AddFileDependency({
filename: "steamworks.ext.dylib",
Expand Down

0 comments on commit 47febc9

Please sign in to comment.