diff --git a/README.md b/README.md index 55dd1da..84efcfa 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ The main files you may want to look at would be instance.js | Show dev tools | Show or hide the dev tools. | Show *(combo)*
Tag *(string)*
| | Unmaximize | Unmaximize the window | Tag *(string)*
| | Set Fullscreen | Change fullscreen state | Fullscreen *(combo)*
Tag *(string)*
| +| Set ignore mouse events | Set whether to ignore mouse events on the window, optionally forwarding them. | Ignore *(boolean)*
Forward *(boolean)*
Tag *(string)*
| | Activate achievement | Activate a steam achievement | Achievement *(string)*
Tag *(string)*
| | Clear achievement | Clear a steam achievement | Achievement *(string)*
Tag *(string)*
| | Check achievement activation state | Check the activation state of a steam achievement | Achievement *(string)*
Tag *(string)*
| @@ -110,6 +111,8 @@ When Download type is Around the user, the offsets are the amount of entries aro | Save screenshot from URL | Saves an image from a URL as a Steam screenshot. The image will be loaded, converted to base64, and its dimensions calculated automatically. | URL *(string)*
Tag *(string)*
| | Add screenshot to library | Adds an existing screenshot file to the Steam screenshot library. Returns the handle of the screenshot. | Filename *(string)*
Thumbnail Filename *(string)*
Width *(number)*
Height *(number)*
Tag *(string)*
| | Check DLC is installed | Checks if the user owns and has installed a specific DLC | DLC App ID *(number)*
Tag *(string)*
| +| Show gamepad text input | Shows the Steam gamepad text input dialog. Returns the entered text, or null if cancelled or could not show. | Input Mode *(combo)*
Line Mode *(combo)*
Description *(string)*
Max Characters *(number)*
Existing Text *(string)*
Tag *(string)*
| +| Show floating gamepad text input | Shows the Steam floating gamepad text input. Returns true if shown, otherwise false. | Keyboard Mode *(combo)*
X *(number)*
Y *(number)*
Width *(number)*
Height *(number)*
Tag *(string)*
| | Create workshop item | Creates a new workshop item for the specified Steam App ID and returns its ID | App ID *(number)*
Tag *(string)*
| | Update workshop item | Updates content and metadata of a workshop item. Use the update flags to control which fields are updated. | App ID *(number)*
Item ID *(string)*
Update Title *(boolean)*
Title *(string)*
Update Description *(boolean)*
Description *(string)*
Update Content *(boolean)*
Content Folder Path *(string)*
Change Note *(string)*
Update Preview *(boolean)*
Preview Image Path *(string)*
Update Tags *(boolean)*
Tags *(string)*
Update Visibility *(boolean)*
Visibility *(combo)*
Tag *(string)*
| | Get subscribed items with metadata | Gets all subscribed workshop items with their metadata and install info | Tag *(string)*
| @@ -281,6 +284,10 @@ When Download type is Around the user, the offsets are the amount of entries aro | On any "SetFullscreen" success | Trigger when any of the "SetFullscreen" are executed with success. | | | On "SetFullscreen" error | Trigger when the "SetFullscreen" failed to execute. | Tag *(string)*
| | On any "SetFullscreen" error | Trigger when any of the "SetFullscreen" failed to execute. | | +| On "SetIgnoreMouseEvents" success | Trigger when the "SetIgnoreMouseEvents" is executed with success. | Tag *(string)*
| +| On any "SetIgnoreMouseEvents" success | Trigger when any of the "SetIgnoreMouseEvents" are executed with success. | | +| On "SetIgnoreMouseEvents" error | Trigger when the "SetIgnoreMouseEvents" failed to execute. | Tag *(string)*
| +| On any "SetIgnoreMouseEvents" error | Trigger when any of the "SetIgnoreMouseEvents" failed to execute. | | | On "ActivateAchievement" success | Trigger when the "ActivateAchievement" is executed with success. | Tag *(string)*
| | On any "ActivateAchievement" success | Trigger when any of the "ActivateAchievement" are executed with success. | | | On "ActivateAchievement" error | Trigger when the "ActivateAchievement" failed to execute. | Tag *(string)*
| @@ -359,6 +366,14 @@ When Download type is Around the user, the offsets are the amount of entries aro | On any "CheckDLCIsInstalled" success | Trigger when any of the "CheckDLCIsInstalled" are executed with success. | | | On "CheckDLCIsInstalled" error | Trigger when the "CheckDLCIsInstalled" failed to execute. | Tag *(string)*
| | On any "CheckDLCIsInstalled" error | Trigger when any of the "CheckDLCIsInstalled" failed to execute. | | +| On "ShowGamepadTextInput" success | Trigger when the "ShowGamepadTextInput" is executed with success. | Tag *(string)*
| +| On any "ShowGamepadTextInput" success | Trigger when any of the "ShowGamepadTextInput" are executed with success. | | +| On "ShowGamepadTextInput" error | Trigger when the "ShowGamepadTextInput" failed to execute. | Tag *(string)*
| +| On any "ShowGamepadTextInput" error | Trigger when any of the "ShowGamepadTextInput" failed to execute. | | +| On "ShowFloatingGamepadTextInput" success | Trigger when the "ShowFloatingGamepadTextInput" is executed with success. | Tag *(string)*
| +| On any "ShowFloatingGamepadTextInput" success | Trigger when any of the "ShowFloatingGamepadTextInput" are executed with success. | | +| On "ShowFloatingGamepadTextInput" error | Trigger when the "ShowFloatingGamepadTextInput" failed to execute. | Tag *(string)*
| +| On any "ShowFloatingGamepadTextInput" error | Trigger when any of the "ShowFloatingGamepadTextInput" failed to execute. | | | On "CreateWorkshopItem" success | Trigger when the "CreateWorkshopItem" is executed with success. | Tag *(string)*
| | On any "CreateWorkshopItem" success | Trigger when any of the "CreateWorkshopItem" are executed with success. | | | On "CreateWorkshopItem" error | Trigger when the "CreateWorkshopItem" failed to execute. | Tag *(string)*
| @@ -505,6 +520,8 @@ When Download type is Around the user, the offsets are the amount of entries aro | UnmaximizeResult | The result of the "Unmaximize last call" | string | | | SetFullscreenError | The error of the "SetFullscreen last call" | string | | | SetFullscreenResult | The result of the "SetFullscreen last call" | string | | +| SetIgnoreMouseEventsError | The error of the "SetIgnoreMouseEvents last call" | string | | +| SetIgnoreMouseEventsResult | The result of the "SetIgnoreMouseEvents last call" | string | | | ActivateAchievementError | The error of the "ActivateAchievement last call" | string | | | ActivateAchievementResult | The result of the "ActivateAchievement last call" | string | | | ClearAchievementError | The error of the "ClearAchievement last call" | string | | @@ -539,6 +556,10 @@ When Download type is Around the user, the offsets are the amount of entries aro | AddScreenshotToLibraryResult | The result of the "AddScreenshotToLibrary last call" | string | | | CheckDLCIsInstalledError | The error of the "CheckDLCIsInstalled last call" | string | | | CheckDLCIsInstalledResult | The result of the "CheckDLCIsInstalled last call" | string | | +| ShowGamepadTextInputError | The error of the "ShowGamepadTextInput last call" | string | | +| ShowGamepadTextInputResult | The result of the "ShowGamepadTextInput last call" | string | | +| ShowFloatingGamepadTextInputError | The error of the "ShowFloatingGamepadTextInput last call" | string | | +| ShowFloatingGamepadTextInputResult | The result of the "ShowFloatingGamepadTextInput last call" | string | | | CreateWorkshopItemError | The error of the "CreateWorkshopItem last call" | string | | | CreateWorkshopItemResult | The result of the "CreateWorkshopItem last call" | string | | | UpdateWorkshopItemError | The error of the "UpdateWorkshopItem last call" | string | | diff --git a/src/instance.js b/src/instance.js index a3544df..5160569 100644 --- a/src/instance.js +++ b/src/instance.js @@ -1128,6 +1128,18 @@ function getInstanceJs(parentClass, addonTriggers, C3) { } }) + _SetIgnoreMouseEvents = this.wrap(super._SetIgnoreMouseEvents, async (/** @type {boolean} */ ignore, /** @type {boolean} */ forward) => { + const order = { + url: '/window/set-ignore-mouse-events', + body: { + ignore, + forward, + } + } + + await this.ws?.sendAndWaitForResponse(order) + }, this.unsupportedEngine) + _Unmaximize = this.wrap(super._Unmaximize, async () => { /** @type {import('@pipelab/core').MakeInputOutput} */ const order = { @@ -2614,6 +2626,89 @@ function getInstanceJs(parentClass, addonTriggers, C3) { } }, this.unsupportedEngine) + // Steam Gamepad Text Input + _ShowGamepadTextInput = this.wrap(super._ShowGamepadTextInput, async ( + /** @type {number} */ inputMode, + /** @type {number} */ inputLineMode, + /** @type {string} */ description, + /** @type {number} */ maxCharacters, + /** @type {string} */ existingText, + /** @type {Tag} */ tag + ) => { + try { + /** @type {import('@pipelab/core').MakeInputOutput, 'input'>} */ + const order = { + url: '/steam/raw', + body: { + namespace: 'utils', + method: 'showGamepadTextInput', + args: [inputMode, inputLineMode, description, maxCharacters, existingText || undefined], + }, + }; + const answer = await this.ws?.sendAndWaitForResponse(order); + if (answer?.body.success === false) { + throw new Error('Failed') + } + this._ShowGamepadTextInputResultValue = answer?.body.data ?? null + this._ShowGamepadTextInputErrorValue = '' + + await this.trigger(tag, [ + C3.Plugins.pipelabv2.Cnds.OnShowGamepadTextInputSuccess, + C3.Plugins.pipelabv2.Cnds.OnAnyShowGamepadTextInputSuccess + ]) + } catch (e) { + if (e instanceof Error) { + this._ShowGamepadTextInputErrorValue = e.message + this._ShowGamepadTextInputResultValue = null + await this.trigger(tag, [ + C3.Plugins.pipelabv2.Cnds.OnShowGamepadTextInputError, + C3.Plugins.pipelabv2.Cnds.OnAnyShowGamepadTextInputError + ]) + } + } + }, this.unsupportedEngine) + + _ShowFloatingGamepadTextInput = this.wrap(super._ShowFloatingGamepadTextInput, async ( + /** @type {number} */ keyboardMode, + /** @type {number} */ x, + /** @type {number} */ y, + /** @type {number} */ width, + /** @type {number} */ height, + /** @type {Tag} */ tag + ) => { + try { + /** @type {import('@pipelab/core').MakeInputOutput, 'input'>} */ + const order = { + url: '/steam/raw', + body: { + namespace: 'utils', + method: 'showFloatingGamepadTextInput', + args: [keyboardMode, x, y, width, height], + }, + }; + const answer = await this.ws?.sendAndWaitForResponse(order); + if (answer?.body.success === false) { + throw new Error('Failed') + } + this._ShowFloatingGamepadTextInputResultValue = answer?.body.data ? 1 : 0 + this._ShowFloatingGamepadTextInputErrorValue = '' + + await this.trigger(tag, [ + C3.Plugins.pipelabv2.Cnds.OnShowFloatingGamepadTextInputSuccess, + C3.Plugins.pipelabv2.Cnds.OnAnyShowFloatingGamepadTextInputSuccess + ]) + } catch (e) { + if (e instanceof Error) { + this._ShowFloatingGamepadTextInputErrorValue = e.message + this._ShowFloatingGamepadTextInputResultValue = 0 + await this.trigger(tag, [ + C3.Plugins.pipelabv2.Cnds.OnShowFloatingGamepadTextInputError, + C3.Plugins.pipelabv2.Cnds.OnAnyShowFloatingGamepadTextInputError + ]) + } + } + }, this.unsupportedEngine) + // Steam Workshop /** @type {Map} */ _workshopItemsMap = new Map() @@ -3732,6 +3827,15 @@ function getInstanceJs(parentClass, addonTriggers, C3) { return true }) + _OnSetIgnoreMouseEventsSuccess = this.wrap(super._OnSetIgnoreMouseEventsSuccess, (/** @type {Tag} */ tag) => this._currentTag === tag) + _OnAnySetIgnoreMouseEventsSuccess = this.wrap(super._OnAnySetIgnoreMouseEventsSuccess, () => { + return true + }) + _OnSetIgnoreMouseEventsError = this.wrap(super._OnSetIgnoreMouseEventsError, (/** @type {Tag} */ tag) => this._currentTag === tag) + _OnAnySetIgnoreMouseEventsError = this.wrap(super._OnAnySetIgnoreMouseEventsError, () => { + return true + }) + _OnActivateAchievementSuccess = this.wrap(super._OnActivateAchievementSuccess, (/** @type {Tag} */ tag) => this._currentTag === tag) _OnAnyActivateAchievementSuccess = this.wrap(super._OnAnyActivateAchievementSuccess, () => true) _OnActivateAchievementError = this.wrap(super._OnActivateAchievementError, (/** @type {Tag} */ tag) => this._currentTag === tag) @@ -3851,6 +3955,16 @@ function getInstanceJs(parentClass, addonTriggers, C3) { _OnGetFriendNameError = this.wrap(super._OnGetFriendNameError, (/** @type {Tag} */ tag) => this._currentTag === tag) _OnAnyGetFriendNameError = this.wrap(super._OnAnyGetFriendNameError, () => true) + _OnShowGamepadTextInputSuccess = this.wrap(super._OnShowGamepadTextInputSuccess, (/** @type {Tag} */ tag) => this._currentTag === tag) + _OnAnyShowGamepadTextInputSuccess = this.wrap(super._OnAnyShowGamepadTextInputSuccess, () => true) + _OnShowGamepadTextInputError = this.wrap(super._OnShowGamepadTextInputError, (/** @type {Tag} */ tag) => this._currentTag === tag) + _OnAnyShowGamepadTextInputError = this.wrap(super._OnAnyShowGamepadTextInputError, () => true) + + _OnShowFloatingGamepadTextInputSuccess = this.wrap(super._OnShowFloatingGamepadTextInputSuccess, (/** @type {Tag} */ tag) => this._currentTag === tag) + _OnAnyShowFloatingGamepadTextInputSuccess = this.wrap(super._OnAnyShowFloatingGamepadTextInputSuccess, () => true) + _OnShowFloatingGamepadTextInputError = this.wrap(super._OnShowFloatingGamepadTextInputError, (/** @type {Tag} */ tag) => this._currentTag === tag) + _OnAnyShowFloatingGamepadTextInputError = this.wrap(super._OnAnyShowFloatingGamepadTextInputError, () => true) + _OnCreateWorkshopItemSuccess = this.wrap(super._OnCreateWorkshopItemSuccess, (/** @type {Tag} */ tag) => this._currentTag === tag) _OnAnyCreateWorkshopItemSuccess = this.wrap(super._OnAnyCreateWorkshopItemSuccess, () => true) _OnCreateWorkshopItemError = this.wrap(super._OnCreateWorkshopItemError, (/** @type {Tag} */ tag) => this._currentTag === tag) @@ -4378,6 +4492,12 @@ function getInstanceJs(parentClass, addonTriggers, C3) { _SetFullscreenResult = this.exprs(super._SetFullscreenResult, () => { return this._SetFullscreenResultValue }) + _SetIgnoreMouseEventsError = this.exprs(super._SetIgnoreMouseEventsError, () => { + return this._SetIgnoreMouseEventsErrorValue + }) + _SetIgnoreMouseEventsResult = this.exprs(super._SetIgnoreMouseEventsResult, () => { + return this._SetIgnoreMouseEventsResultValue + }) _ActivateAchievementError = this.exprs(super._ActivateAchievementError, () => { return this._ActivateAchievementErrorValue }) @@ -4507,6 +4627,20 @@ function getInstanceJs(parentClass, addonTriggers, C3) { return this._GetFriendNameResultValue }) + _ShowGamepadTextInputError = this.exprs(super._ShowGamepadTextInputError, () => { + return this._ShowGamepadTextInputErrorValue + }) + _ShowGamepadTextInputResult = this.exprs(super._ShowGamepadTextInputResult, () => { + return this._ShowGamepadTextInputResultValue ?? '' + }) + + _ShowFloatingGamepadTextInputError = this.exprs(super._ShowFloatingGamepadTextInputError, () => { + return this._ShowFloatingGamepadTextInputErrorValue + }) + _ShowFloatingGamepadTextInputResult = this.exprs(super._ShowFloatingGamepadTextInputResult, () => { + return this._ShowFloatingGamepadTextInputResultValue ?? 0 + }) + // Workshop expressions _CreateWorkshopItemError = this.exprs(super._CreateWorkshopItemError, () => { return this._CreateWorkshopItemErrorValue diff --git a/src/pluginConfig.js b/src/pluginConfig.js index 678b5f8..8c0e0bf 100644 --- a/src/pluginConfig.js +++ b/src/pluginConfig.js @@ -913,6 +913,31 @@ const SetFullscreen = ACEGenerator("SetFullscreen", /** @type {const} */({ description: "Change fullscreen state", })) +const SetIgnoreMouseEvents = ACEGenerator("SetIgnoreMouseEvents", /** @type {const} */({ + category: "window", + highlight: false, + deprecated: false, + params: [ + { + id: 'ignore', + desc: "Whether to ignore mouse events on the window.", + name: "Ignore", + type: 'boolean', + initialValue: 'false', + }, + { + id: 'forward', + desc: "When mouse events are ignored, whether to still forward mouse move events to the window.", + name: "Forward", + type: 'boolean', + initialValue: 'false', + }, + ], + listName: "Set ignore mouse events", + displayText: "Set ignore mouse events to {0} (forward: {1})", + description: "Set whether to ignore mouse events on the window, optionally forwarding them.", +})) + // steam const ActivateAchievement = ACEGenerator("ActivateAchievement", /** @type {const} */({ category: "steam", @@ -1397,6 +1422,110 @@ const CheckDLCIsInstalled = ACEGenerator("CheckDLCIsInstalled", /** @type {const description: "Checks if the user owns and has installed a specific DLC", })) +// Steam Gamepad Text Input +const ShowGamepadTextInput = ACEGenerator("ShowGamepadTextInput", /** @type {const} */({ + category: "steam", + highlight: false, + deprecated: false, + params: [ + { + id: 'inputMode', + desc: "The input mode for the text entry", + name: "Input Mode", + type: 'combo', + items: [ + { "normal": "Normal" }, + { "password": "Password" }, + ] + }, + { + id: 'inputLineMode', + desc: "Whether to use single-line or multi-line input", + name: "Line Mode", + type: 'combo', + items: [ + { "singleLine": "Single Line" }, + { "multipleLines": "Multiple Lines" }, + ] + }, + { + id: 'description', + desc: "The description text to display to the user", + name: "Description", + type: 'string', + initialValue: "\"\"", + }, + { + id: 'maxCharacters', + desc: "The maximum number of characters allowed", + name: "Max Characters", + type: 'number', + initialValue: "256", + }, + { + id: 'existingText', + desc: "Optional existing text to pre-fill in the input (leave empty for none)", + name: "Existing Text", + type: 'string', + initialValue: "\"\"", + } + ], + listName: "Show gamepad text input", + displayText: "Show gamepad text input (mode: {0}, line: {1}, desc: [b]{2}[/b], max: {3}, existing: {4})", + description: "Shows the Steam gamepad text input dialog. Returns the entered text, or null if cancelled or could not show.", +})) + +const ShowFloatingGamepadTextInput = ACEGenerator("ShowFloatingGamepadTextInput", /** @type {const} */({ + category: "steam", + highlight: false, + deprecated: false, + params: [ + { + id: 'keyboardMode', + desc: "The keyboard mode to display", + name: "Keyboard Mode", + type: 'combo', + items: [ + { "singleLine": "Single Line" }, + { "multipleLines": "Multiple Lines" }, + { "email": "Email" }, + { "numeric": "Numeric" }, + ] + }, + { + id: 'x', + desc: "The X position of the floating keyboard", + name: "X", + type: 'number', + initialValue: "0", + }, + { + id: 'y', + desc: "The Y position of the floating keyboard", + name: "Y", + type: 'number', + initialValue: "0", + }, + { + id: 'width', + desc: "The width of the floating keyboard", + name: "Width", + type: 'number', + initialValue: "800", + }, + { + id: 'height', + desc: "The height of the floating keyboard", + name: "Height", + type: 'number', + initialValue: "600", + } + ], + listName: "Show floating gamepad text input", + displayText: "Show floating gamepad text input (mode: {0}, x: {1}, y: {2}, size: {3}x{4})", + description: "Shows the Steam floating gamepad text input. Returns true if shown, otherwise false.", +})) + // Steam Workshop const CreateWorkshopItem = ACEGenerator("CreateWorkshopItem", /** @type {const} */({ category: "steam-workshop", @@ -1934,6 +2063,7 @@ const Config = /** @type {const} */({ ...ShowDevTools.actions, ...Unmaximize.actions, ...SetFullscreen.actions, + ...SetIgnoreMouseEvents.actions, ...ActivateAchievement.actions, ...ClearAchievement.actions, ...CheckAchievementActivationState.actions, @@ -1951,6 +2081,8 @@ const Config = /** @type {const} */({ ...SaveScreenshotFromURL.actions, ...AddScreenshotToLibrary.actions, ...CheckDLCIsInstalled.actions, + ...ShowGamepadTextInput.actions, + ...ShowFloatingGamepadTextInput.actions, ...CreateWorkshopItem.actions, ...UpdateWorkshopItem.actions, ...GetSubscribedItemsWithMetadata.actions, @@ -2008,6 +2140,7 @@ const Config = /** @type {const} */({ ...ShowDevTools.conditions, ...Unmaximize.conditions, ...SetFullscreen.conditions, + ...SetIgnoreMouseEvents.conditions, ...ActivateAchievement.conditions, ...ClearAchievement.conditions, ...CheckAchievementActivationState.conditions, @@ -2049,6 +2182,8 @@ const Config = /** @type {const} */({ ...SaveScreenshotFromURL.conditions, ...AddScreenshotToLibrary.conditions, ...CheckDLCIsInstalled.conditions, + ...ShowGamepadTextInput.conditions, + ...ShowFloatingGamepadTextInput.conditions, ...CreateWorkshopItem.conditions, ...UpdateWorkshopItem.conditions, ...GetSubscribedItemsWithMetadata.conditions, @@ -2196,6 +2331,7 @@ const Config = /** @type {const} */({ ...ShowDevTools.expressions, ...Unmaximize.expressions, ...SetFullscreen.expressions, + ...SetIgnoreMouseEvents.expressions, ...ActivateAchievement.expressions, ...ClearAchievement.expressions, ...CheckAchievementActivationState.expressions, @@ -2213,6 +2349,8 @@ const Config = /** @type {const} */({ ...SaveScreenshotFromURL.expressions, ...AddScreenshotToLibrary.expressions, ...CheckDLCIsInstalled.expressions, + ...ShowGamepadTextInput.expressions, + ...ShowFloatingGamepadTextInput.expressions, ...CreateWorkshopItem.expressions, ...UpdateWorkshopItem.expressions, ...GetSubscribedItemsWithMetadata.expressions,