Port the rest of the code

This commit is contained in:
redphx
2024-04-23 17:55:52 +07:00
parent 27a277309b
commit be0cbff344
30 changed files with 4338 additions and 234 deletions

60
src/types/index.d.ts vendored
View File

@@ -6,6 +6,12 @@ interface Window {
BX_FLAGS?: BxFlags;
BX_CE: (elmName: string, props: {[index: string]: any}={}) => HTMLElement;
BX_EXPOSED: any;
BX_VIBRATION_INTENSITY: number;
BX_ENABLE_CONTROLLER_VIBRATION: boolean;
BX_ENABLE_DEVICE_VIBRATION: boolean;
BX_REMOTE_PLAY_CONFIG: BxStates.remotePlay.config;
}
interface NavigatorBattery extends Navigator {
@@ -15,33 +21,41 @@ interface NavigatorBattery extends Navigator {
}>,
}
type RTCBasicStat = {
address: string,
bytesReceived: number,
clockRate: number,
codecId: string,
framesDecoded: number,
id: string,
kind: string,
mimeType: string,
packetsReceived: number,
profile: string,
remoteCandidateId: string,
sdpFmtpLine: string,
state: string,
timestamp: number,
totalDecodeTime: number,
type: string,
}
type BxStates = {
isPlaying: boolean;
appContext: any | null;
serverRegions: any;
hasTouchSupport: boolean;
currentStream: Partial<{
titleId: string;
xboxTitleId: string;
productId: string;
$video: HTMLVideoElement | null;
$screenshotCanvas: HTMLCanvasElement | null;
peerConnection: RTCPeerConnection;
audioContext: AudioContext | null;
audioGainNode: GainNode | null;
}>;
remotePlay: Partial<{
isPlaying: boolean;
server: string;
config: {
serverId: string;
};
}>;
}
type DualEnum = {[index: string]: number} & {[index: number]: string};
declare var window: Window & typeof globalThis;
declare var AppInterface: any;
declare var STREAM_WEBRTC: RTCPeerConnection;
declare var States: BxStates;
declare const window: Window & typeof globalThis;
declare const AppInterface: any;
declare const STREAM_WEBRTC: RTCPeerConnection;
declare let States: BxStates;
declare const NATIVE_FETCH: typeof window.fetch;
declare const SCRIPT_VERSION: string;
declare const SCRIPT_HOME: string;
declare var LOCALE: number;

View File

@@ -1,7 +1,7 @@
export type PreferenceSetting = {
default: any;
options?: {[index: string]: string};
multiple_options?: {[index: string]: string};
multiplOptions?: {[index: string]: string};
unsupported?: string | boolean;
note?: string | HTMLElement;
type?: SettingElementType;

18
src/types/stream-stats.d.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
type RTCBasicStat = {
address: string,
bytesReceived: number,
clockRate: number,
codecId: string,
framesDecoded: number,
id: string,
kind: string,
mimeType: string,
packetsReceived: number,
profile: string,
remoteCandidateId: string,
sdpFmtpLine: string,
state: string,
timestamp: number,
totalDecodeTime: number,
type: string,
}

25
src/types/titles-info.d.ts vendored Normal file
View File

@@ -0,0 +1,25 @@
type TitleInfo = {
titleId?: string;
xboxTitleId?: string;
hasTouchSupport?: boolean;
imageHero?: string;
};
type ApiTitleInfo = {
titleId: string;
details: {
xboxTitleId: string;
productId: string;
supportedInputTypes: string[];
};
};
type ApiCatalogInfo = {
StoreId: string;
Image_Hero: {
URL: string;
};
Image_Tile: {
URL: string;
};
};