Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,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)* <br>Tag *(string)* <br> |
| Add screenshot to library | Adds an existing screenshot file to the Steam screenshot library. Returns the handle of the screenshot. | Filename *(string)* <br>Thumbnail Filename *(string)* <br>Width *(number)* <br>Height *(number)* <br>Tag *(string)* <br> |
| Check DLC is installed | Checks if the user owns and has installed a specific DLC | DLC App ID *(number)* <br>Tag *(string)* <br> |
| 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)* <br>Line Mode *(combo)* <br>Description *(string)* <br>Max Characters *(number)* <br>Existing Text *(string)* <br>Tag *(string)* <br> |
| Show floating gamepad text input | Shows the Steam floating gamepad text input. Returns true if shown, otherwise false. | Keyboard Mode *(combo)* <br>X *(number)* <br>Y *(number)* <br>Width *(number)* <br>Height *(number)* <br>Tag *(string)* <br> |
| Create workshop item | Creates a new workshop item for the specified Steam App ID and returns its ID | App ID *(number)* <br>Tag *(string)* <br> |
| Update workshop item | Updates content and metadata of a workshop item. Use the update flags to control which fields are updated. | App ID *(number)* <br>Item ID *(string)* <br>Update Title *(boolean)* <br>Title *(string)* <br>Update Description *(boolean)* <br>Description *(string)* <br>Update Content *(boolean)* <br>Content Folder Path *(string)* <br>Change Note *(string)* <br>Update Preview *(boolean)* <br>Preview Image Path *(string)* <br>Update Tags *(boolean)* <br>Tags *(string)* <br>Update Visibility *(boolean)* <br>Visibility *(combo)* <br>Tag *(string)* <br> |
| Get subscribed items with metadata | Gets all subscribed workshop items with their metadata and install info | Tag *(string)* <br> |
Expand Down Expand Up @@ -359,6 +361,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)* <br> |
| 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)* <br> |
| 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)* <br> |
| 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)* <br> |
| 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)* <br> |
| 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)* <br> |
| 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)* <br> |
Expand Down Expand Up @@ -539,6 +549,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 | |
Expand Down
111 changes: 111 additions & 0 deletions src/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -2614,6 +2614,93 @@ function getInstanceJs(parentClass, addonTriggers, C3) {
}
}, this.unsupportedEngine)

// Steam Gamepad Text Input
_ShowGamepadTextInputBase = this.wrap(super._ShowGamepadTextInput, async (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_ShowGamepadTextInputBase = this.wrap(super._ShowGamepadTextInput, async (
_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<import('@pipelab/core').SteamRaw<'input', 'showGamepadTextInput'>, '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)
_ShowGamepadTextInput = this._ShowGamepadTextInputBase
_ShowGamepadTextInputSync = this._ShowGamepadTextInputBase
Comment on lines +2658 to +2659
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_ShowGamepadTextInput = this._ShowGamepadTextInputBase
_ShowGamepadTextInputSync = this._ShowGamepadTextInputBase


_ShowFloatingGamepadTextInputBase = this.wrap(super._ShowFloatingGamepadTextInput, async (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_ShowFloatingGamepadTextInputBase = this.wrap(super._ShowFloatingGamepadTextInput, async (
_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<import('@pipelab/core').SteamRaw<'input', 'showFloatingGamepadTextInput'>, '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)
_ShowFloatingGamepadTextInput = this._ShowFloatingGamepadTextInputBase
_ShowFloatingGamepadTextInputSync = this._ShowFloatingGamepadTextInputBase
Comment on lines +2701 to +2702
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_ShowFloatingGamepadTextInput = this._ShowFloatingGamepadTextInputBase
_ShowFloatingGamepadTextInputSync = this._ShowFloatingGamepadTextInputBase


// Steam Workshop
/** @type {Map<string, any>} */
_workshopItemsMap = new Map()
Expand Down Expand Up @@ -3851,6 +3938,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)
Expand Down Expand Up @@ -4507,6 +4604,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
Expand Down
110 changes: 110 additions & 0 deletions src/pluginConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't "Default value" a more standard label ?

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",
Expand Down Expand Up @@ -1951,6 +2055,8 @@ const Config = /** @type {const} */({
...SaveScreenshotFromURL.actions,
...AddScreenshotToLibrary.actions,
...CheckDLCIsInstalled.actions,
...ShowGamepadTextInput.actions,
...ShowFloatingGamepadTextInput.actions,
...CreateWorkshopItem.actions,
...UpdateWorkshopItem.actions,
...GetSubscribedItemsWithMetadata.actions,
Expand Down Expand Up @@ -2049,6 +2155,8 @@ const Config = /** @type {const} */({
...SaveScreenshotFromURL.conditions,
...AddScreenshotToLibrary.conditions,
...CheckDLCIsInstalled.conditions,
...ShowGamepadTextInput.conditions,
...ShowFloatingGamepadTextInput.conditions,
...CreateWorkshopItem.conditions,
...UpdateWorkshopItem.conditions,
...GetSubscribedItemsWithMetadata.conditions,
Expand Down Expand Up @@ -2213,6 +2321,8 @@ const Config = /** @type {const} */({
...SaveScreenshotFromURL.expressions,
...AddScreenshotToLibrary.expressions,
...CheckDLCIsInstalled.expressions,
...ShowGamepadTextInput.expressions,
...ShowFloatingGamepadTextInput.expressions,
...CreateWorkshopItem.expressions,
...UpdateWorkshopItem.expressions,
...GetSubscribedItemsWithMetadata.expressions,
Expand Down