Skip to content

Commit

Permalink
docs(SteamClient): document more interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ricewind012 committed Jun 13, 2024
1 parent f81d6a6 commit 340f0a4
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 51 deletions.
1 change: 1 addition & 0 deletions src/deck-components/steam-client/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ export interface Apps {

/**
* @todo returns undefined (now)?
* @todo does not exist on Steam Version: 1718064497
*/
RegisterForLocalizationChanges(callback: (data: ArrayBuffer) => void): Unregisterable | any;

Expand Down
1 change: 0 additions & 1 deletion src/deck-components/steam-client/Downloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export interface Downloads {
* Sets an app to launch when its download is complete.
* @param {number} appId - The ID of the application to set.
* @returns {void}
* @todo: unsure if this toggles though
*/
SetLaunchOnUpdateComplete(appId: number): void;

Expand Down
19 changes: 15 additions & 4 deletions src/deck-components/steam-client/Friends.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Unregisterable } from "./index";

/**
* Represents functions related to managing friends in Steam.
*/
Expand All @@ -9,10 +11,13 @@ export interface Friends {
*/
AddFriend(steamId: string): Promise<boolean>;

/**
* @returns a list of players you recently played with.
*/
GetCoplayData(): Promise<CoplayData>;

//(e.ConvertTo64BitString(), t.steamidTarget)
InviteUserToCurrentGame(param0: any, param1: any): any;
InviteUserToCurrentGame(steam64Id: string, param1: any): any;

/**
* Invites a user to a specific game.
Expand All @@ -24,12 +29,12 @@ export interface Friends {
InviteUserToGame(steamId: string, appId: number, connectString: string): Promise<boolean>;

//(e.ConvertTo64BitString(), t.steamidTarget)
InviteUserToLobby(param0: any, param1: any): any;
InviteUserToLobby(steam64Id: string, param1: any): any;

//(e.ConvertTo64BitString())
InviteUserToRemotePlayTogetherCurrentGame(param0: any): any;
InviteUserToRemotePlayTogetherCurrentGame(steam64Id: string): any;

RegisterForVoiceChatStatus(callback: (status: any) => void): any;
RegisterForVoiceChatStatus(callback: (status: VoiceChatStatus) => void): Unregisterable | any;

/**
* Removes a user from the friend list.
Expand All @@ -48,4 +53,10 @@ export interface CoplayUser {
accountid: number;
rtTimePlayed: number;
appid: number;
}

export interface VoiceChatStatus {
bVoiceChatActive: boolean;
bMicMuted: boolean;
bOutputMuted: boolean;
}
25 changes: 22 additions & 3 deletions src/deck-components/steam-client/OpenVR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface OpenVR {

RegisterForButtonPress: Unregisterable | any;

RegisterForHMDActivityLevelChanged(callback: (m_eHMDActivityLevel: any) => void): Unregisterable | any;
RegisterForHMDActivityLevelChanged(callback: (m_eHMDActivityLevel: EHMDActivityLevel) => void): Unregisterable | any;

RegisterForInstallDialog: Unregisterable | any;

Expand Down Expand Up @@ -60,7 +60,10 @@ export interface DeviceProperties {
export interface Keyboard {
Hide(): any;

RegisterForStatus(callback: (m_bIsKeyboardOpen: boolean, m_eKeyboardFlags: any, m_sInitialKeyboardText: string) => void): Unregisterable | any;
/**
* {@link EKeyboardFlags} could be useful here
*/
RegisterForStatus(callback: (m_bIsKeyboardOpen: boolean, m_eKeyboardFlags: number, m_sInitialKeyboardText: string) => void): Unregisterable | any;

SendDone(): any;

Expand Down Expand Up @@ -100,4 +103,20 @@ export interface VROverlay {
ShowDashboard: any;

SwitchToDashboardOverlay(param0: string): void;
}
}

export enum EHMDActivityLevel {
Unknown = -1,
Idle,
UserInteraction,
UserInteraction_Timeout,
Standby,
Idle_Timeout,
}

export enum EKeyboardFlags {
Minimal = 1 << 0,
Modal = 1 << 1,
ShowArrowKeys = 1 << 2,
HideDoneKey = 1 << 3,
}
10 changes: 5 additions & 5 deletions src/deck-components/steam-client/Settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {CompatibilityToolInfo} from "./App";
import {JsPbMessage, Unregisterable} from "./index";
import {JsPbMessage, OperationResponse, Unregisterable} from "./index";

export interface Settings {
AddClientBeta(name: string, password: string): void;
Expand Down Expand Up @@ -91,19 +91,19 @@ export interface Settings {
*/
SetSaveAccountCredentials(value: boolean): void;

SetSetting: any;
SetSetting(serializedBase64: string): any;

SetSteamPlayEnabled(value: boolean): void;

SetTimeZone(timezoneId: string): void; // You can get valid timezoneIds from GetAvailableTimeZones()
SetUseNintendoButtonLayout: any;

SetUseNintendoButtonLayout(controllerIndex: number, value: boolean): void;

SetWindowed(value: boolean): void;

SpecifyGlobalCompatTool(strToolName: string): void;

// "{"result":2,"message":""}"
ToggleSteamInstall(): any;
ToggleSteamInstall(): Promise<OperationResponse>;
}

export interface AccountSettings {
Expand Down
27 changes: 22 additions & 5 deletions src/deck-components/steam-client/UI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ export interface UI {

RegisterDesiredSteamUIWindowsChanged(callback: () => void): Unregisterable | any;

RegisterForClientConVar: any;
/**
* Registers a callback function to be called when a convar's value gets changed.
*
* Hard crashes if such a convar does not exist or if you can't set it.
*
* @param convar The ConVar to watch.
* @param callback The callback function to be called.
*/
RegisterForClientConVar(convar: string, callback: (value: string) => void): Unregisterable | any;

RegisterForErrorCondition(callback: (param0: number, param1: number) => void): Unregisterable | any;

Expand All @@ -42,6 +50,18 @@ export interface UI {
SetUIMode(mode: UIMode): void;
}

export enum EWindowType {
MainGamepadUI,
OverlayGamepadUI,
Keyboard,
ControllerConfigurator,
VR,
MainDesktopUI,
DesktopLogin,
OverlayDesktopUI,
SteamChinaReviewLauncher,
}

export interface OSEndOfLifeInfo {
bOSWillBeUnsupported: boolean;
osType: OSType;
Expand All @@ -54,10 +74,7 @@ export interface SteamWindow {
strAppName: string;
unID: number;
unPID: number;
/**
* @todo enum
*/
windowType: number;
windowType: EWindowType;
x: number;
y: number;
}
9 changes: 6 additions & 3 deletions src/deck-components/steam-client/WebChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export interface WebChat {
RegisterForFriendPostMessage(callback: (data: FriendChatDialogData) => void): Unregisterable | any;

/**
* To unregister, use {@link UnregisterForMouseXButtonDown}.
* @returns {void}
* @todo To unregister, use WebChat.UnregisterForMouseXButtonDown() ?
*/
RegisterForMouseXButtonDown(callback: any): void;

Expand Down Expand Up @@ -120,7 +120,10 @@ export interface WebChat {
*/
ShowFriendChatDialog(steamid: string): void;

UnregisterForMouseXButtonDown(): void;
/**
* @todo does this take any args at all lol
*/
UnregisterForMouseXButtonDown(callback: any): void;
}

export enum ComputerActiveState {
Expand Down Expand Up @@ -148,7 +151,7 @@ export interface PushToTalkInfo {
bPushToMute: boolean;
/**
* Push-to-talk hotkey.
* @todo enum?
* @todo enum? this is not EHIDKeyboardKey
*/
vkHotKey: number;
/** Push-to-talk hotkey name. */
Expand Down
11 changes: 10 additions & 1 deletion src/deck-components/steam-client/WebUITransport.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { OperationResponse } from "./index";

export interface WebUITransport {
GetTransportInfo(): Promise<TransportInfo>;

NotifyTransportFailure: any;
/**
* *Possibly* notifies websocket of failure and tries to reconnect to it.
*
* The responsible message for this is `CMsgWebUITransportFailure`.
*
* @param serializedBase64 Serialized ProtoBuf message.
*/
NotifyTransportFailure(serializedBase64: string): Promise<OperationResponse>;
}

export interface TransportInfo {
Expand Down
82 changes: 53 additions & 29 deletions src/deck-components/steam-client/Window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,49 @@ import {UIComposition} from "./Overlay";

/**
* Represents functionality for managing Steam's windows.
* Note that methods here have to be called from the window you want to use.
*
* "Restore details" here refers to a string that is similiar to
* `1&x=604&y=257&w=1010&h=600`, which is usable with certain
* `window.open()` parameters and methods from here.
*
* Note that methods here have to be called from the
* window you want to use (not SharedJSContext).
*/
export interface Window {
BringToFront(forceOS?: WindowBringToFront): any;
BringToFront(forceOS?: WindowBringToFront): void;

/**
* @todo Shuts down Steam too?
* Closes the window.
*/
Close(): any;
Close(): void;

/**
* Is the Steam window fullscreen?
* @param {function} callback - The callback function to be called to receive the fullscreen state.
* @returns {void}
* @returns the window's fullscreen state.
*/
DefaultMonitorHasFullscreenWindow(callback: (fullscreen: boolean) => void): void;
DefaultMonitorHasFullscreenWindow(): Promise<boolean>;

/**
* Flashes the window in the taskbar.
* @returns {void}
*/
FlashWindow(): void;

GetDefaultMonitorDimensions(): Promise<MonitorDimensions>;

/**
* @todo Returns 0?
* @returns the mouse position's restore details.
*/
GetDefaultMonitorDimensions(callback: (param0: number) => void): void;

GetMousePositionDetails(callback: (details: string) => void): void;
GetMousePositionDetails(): Promise<string>;

/**
* Gets the window X position.
* @param {function} callback - The callback function to be called to receive the X position.
* @returns {void}
* @returns the window's dimensions.
*/
GetWindowDimensions(callback: (x: number) => void): void;
GetWindowDimensions(): Promise<WindowDimensions>;

GetWindowRestoreDetails(callback: (details: string) => void): void;
/**
* @returns the window's restore details.
*/
GetWindowRestoreDetails(): Promise<string>;

/**
* Hides the window.
Expand All @@ -48,18 +53,14 @@ export interface Window {
HideWindow(): void;

/**
* Is the window maximized?
* @param {function} callback - The callback function to be called to receive the maximized state.
* @returns {void}
* @returns the window's maximized state.
*/
IsWindowMaximized(callback: (maximized: boolean) => void): void;
IsWindowMaximized(): Promise<boolean>;

/**
* Is the window minimized?
* @param {function} callback - The callback function to be called to receive the minimized state.
* @returns {void}
* @returns the window's minimized state.
*/
IsWindowMinimized(callback: (minimized: boolean) => void): void;
IsWindowMinimized(): Promise<boolean>;

MarkLastFocused(): void;

Expand Down Expand Up @@ -88,7 +89,7 @@ export interface Window {

/**
* Moves the window relatively to given details.
* @param {string} details - Window details string from `Window.GetWindowRestoreDetails`.
* @param {string} details - Window restore details string from {@link GetWindowRestoreDetails}.
* @param {number} x - Window X position.
* @param {number} y - Window Y position.
* @param {number} width - Window width.
Expand Down Expand Up @@ -126,7 +127,7 @@ export interface Window {

SetAutoDisplayScale(value: boolean): void;

SetComposition(uiComposition: UIComposition, appIds: number[], windowId: number): any;
SetComposition(mode: UIComposition, appIdCompositionQueue: number[], windowId: number): void;

/**
* Makes the window hide, but not close on pressing the close button.
Expand Down Expand Up @@ -159,7 +160,7 @@ export interface Window {

/**
* Sets the window's resize grip size.
* The window has to be created with the resize grip flag.
* The window has to be created with the resizable flag for this to take any effect.
* @param {number} width - Resize grip width.
* @param {number} height - Resize grip height.
* @returns {void}
Expand Down Expand Up @@ -212,4 +213,27 @@ export type WindowLocation =
| 'upper-right'
| 'lower-right';

export type WindowIcon = 'steam' | 'messages' | 'voice';
export type WindowIcon = 'steam' | 'messages' | 'voice';

/**
* "Usable" here refers to space that is not taken by the taskbar.
*/
export interface MonitorDimensions {
flHorizontalScale: number;
flVerticalScale: number;
nFullHeight: number;
nFullLeft: number;
nFullTop: number;
nFullWidth: number;
nUsableHeight: number;
nUsableLeft: number;
nUsableTop: number;
nUsableWidth: number;
}

export interface WindowDimensions {
x: number;
y: number;
width: number;
height: number;
}

0 comments on commit 340f0a4

Please sign in to comment.