Skip to content

Commit 4b68adf

Browse files
committed
Initial commit
0 parents  commit 4b68adf

20 files changed

Lines changed: 2572 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Build
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v1
12+
13+
- name: Install toolchain
14+
uses: actions-rs/toolchain@v1
15+
with:
16+
toolchain: stable
17+
default: true
18+
override: true
19+
20+
- name: Test
21+
run: cargo test
22+
- name: Build
23+
run: cargo build --all --release

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target
2+
*/target
3+
Cargo.lock

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[workspace]
2+
members = ["xal", "smartglass", "gamestreaming", "client"]

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# XCloud / SmartGlass - New API in RUST
2+
3+
## Building
4+
5+
```text
6+
git clone --recursive https://github.com/OpenXbox/xcloud-rs.git
7+
cd xcloud-rs
8+
cargo build
9+
cargo test
10+
```
11+
12+
## Usage
13+
14+
```text
15+
cargo run
16+
```

client/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "client"
3+
version = "0.1.0"
4+
authors = ["tuxuser <462620+tuxuser@users.noreply.github.com>"]
5+
edition = "2018"
6+
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
9+
[dependencies]

client/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("Hello, world!");
3+
}

gamestreaming/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "gamestreaming"
3+
version = "0.1.0"
4+
authors = ["tuxuser <462620+tuxuser@users.noreply.github.com>"]
5+
edition = "2018"
6+
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
9+
[dependencies]
10+
reqwest = { version = "0.10", features = ["json"] }
11+
serde = { version = "1.0.117", features = ["derive"] }
12+
serde_json = "1.0.59"
13+
correlation_vector = { git = "https://github.com/tuxuser/CorrelationVector-Rust.git", branch = "master" }
14+
uuid = { version = "0.8.1", features = ["v4"] }
15+
xal = { path = "../xal" }

gamestreaming/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pub mod models;
2+
3+
#[cfg(test)]
4+
mod tests {
5+
#[test]
6+
fn it_works() {
7+
assert_eq!(2 + 2, 4);
8+
}
9+
}

gamestreaming/src/models.rs

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
use serde::{Deserialize, Serialize};
2+
3+
#[derive(Deserialize, Serialize, Debug, Clone)]
4+
pub enum StreamSetupState {
5+
WaitingForResources,
6+
ReadyToConnect,
7+
Provisioning,
8+
Provisioned,
9+
}
10+
11+
pub mod common_request {
12+
use super::{Deserialize, Serialize};
13+
14+
#[derive(Deserialize, Serialize, Debug, Clone)]
15+
#[serde(rename_all = "camelCase")]
16+
pub struct StreamSettings {
17+
enable_text_to_speech: bool,
18+
locale: String,
19+
nano_version: String,
20+
timezone_offset_minutes: i64,
21+
use_ice_connection: bool,
22+
}
23+
24+
#[derive(Deserialize, Serialize, Debug, Clone)]
25+
#[serde(rename_all = "camelCase")]
26+
pub struct StartStreamRequest {
27+
fallback_region_names: Vec<String>,
28+
server_id: String,
29+
settings: StreamSettings,
30+
system_update_group: String,
31+
title_id: String,
32+
}
33+
}
34+
35+
pub mod common_response {
36+
use super::{Deserialize, Serialize, StreamSetupState};
37+
38+
#[derive(Deserialize, Serialize, Debug, Clone)]
39+
#[serde(rename_all = "camelCase")]
40+
pub struct RegionCloudServer {
41+
name: String,
42+
base_uri: String,
43+
network_test_hostname: String,
44+
is_default: bool,
45+
pool_ids: Option<String>,
46+
system_update_groups: Option<String>,
47+
fallback_priority: i32,
48+
}
49+
50+
#[derive(Deserialize, Serialize, Debug, Clone)]
51+
#[serde(rename_all = "PascalCase")]
52+
pub struct CloudEnvironment {
53+
name: String,
54+
auth_base_uri: Option<String>,
55+
}
56+
57+
#[derive(Deserialize, Serialize, Debug, Clone)]
58+
#[serde(rename_all = "PascalCase")]
59+
pub struct ClientCloudSettings {
60+
environments: Vec<CloudEnvironment>,
61+
}
62+
63+
#[derive(Deserialize, Serialize, Debug, Clone)]
64+
#[serde(rename_all = "camelCase")]
65+
pub struct OfferingSettings {
66+
allow_region_selection: bool,
67+
regions: Vec<RegionCloudServer>,
68+
client_cloud_settings: ClientCloudSettings,
69+
}
70+
71+
#[derive(Deserialize, Serialize, Debug, Clone)]
72+
#[serde(rename_all = "camelCase")]
73+
pub struct StreamLoginResponse {
74+
offering_settings: OfferingSettings,
75+
market: String,
76+
gs_token: String,
77+
token_type: String,
78+
duration_in_seconds: i32,
79+
}
80+
81+
#[derive(Deserialize, Serialize, Debug, Clone)]
82+
#[serde(rename_all = "camelCase")]
83+
pub struct StreamSessionResponse {
84+
session_id: Option<String>,
85+
session_path: String,
86+
state: Option<StreamSetupState>,
87+
}
88+
89+
#[derive(Deserialize, Serialize, Debug, Clone)]
90+
#[serde(rename_all = "camelCase")]
91+
pub struct StreamErrorDetails {
92+
code: Option<String>,
93+
message: Option<String>,
94+
}
95+
96+
#[derive(Deserialize, Serialize, Debug, Clone)]
97+
#[serde(rename_all = "camelCase")]
98+
pub struct StreamStateResponse {
99+
state: StreamSetupState,
100+
detailed_session_state: Option<i32>,
101+
error_details: Option<StreamErrorDetails>,
102+
transfer_uri: Option<String>,
103+
}
104+
105+
#[derive(Deserialize, Serialize, Debug, Clone)]
106+
#[serde(rename_all = "camelCase")]
107+
pub struct StreamSRtpData {
108+
key: String,
109+
}
110+
111+
#[derive(Deserialize, Serialize, Debug, Clone)]
112+
#[serde(rename_all = "camelCase")]
113+
pub struct StreamServerDetails {
114+
ip_address: String,
115+
port: u16,
116+
ip_v4_address: Option<String>,
117+
ip_v4_port: u16,
118+
ip_v6_address: Option<String>,
119+
ip_v6_port: u16,
120+
ice_exchange_path: Option<String>,
121+
stun_server_address: Option<String>,
122+
srtp: StreamSRtpData,
123+
}
124+
125+
#[derive(Deserialize, Serialize, Debug, Clone)]
126+
#[serde(rename_all = "camelCase")]
127+
pub struct StreamConfig {
128+
keep_alive_pulse_in_seconds: i32,
129+
server_details: StreamServerDetails,
130+
}
131+
132+
#[derive(Deserialize, Serialize, Debug, Clone)]
133+
#[serde(rename_all = "camelCase")]
134+
pub struct StreamICEConfig {
135+
candidates: String,
136+
}
137+
}
138+
139+
pub mod xcloud_response {
140+
use super::{Deserialize, Serialize};
141+
142+
#[derive(Deserialize, Serialize, Debug, Clone)]
143+
#[serde(rename_all = "camelCase")]
144+
pub struct TitleSupportedTab {
145+
id: String,
146+
tab_version: String,
147+
layout_version: String,
148+
manifest_version: String,
149+
}
150+
151+
#[derive(Deserialize, Serialize, Debug, Clone)]
152+
#[serde(rename_all = "camelCase")]
153+
pub struct CloudGameTitleDetails {
154+
product_id: String,
155+
xbox_title_id: Option<u32>,
156+
has_entitlement: bool,
157+
blocked_by_family_safety: bool,
158+
supports_in_app_purchases: bool,
159+
supported_tabs: Option<Vec<TitleSupportedTab>>,
160+
native_touch: bool,
161+
}
162+
163+
#[derive(Deserialize, Serialize, Debug, Clone)]
164+
#[serde(rename_all = "camelCase")]
165+
pub struct CloudGameTitle {
166+
title_id: String,
167+
details: CloudGameTitleDetails,
168+
}
169+
170+
#[derive(Deserialize, Serialize, Debug, Clone)]
171+
#[serde(rename_all = "camelCase")]
172+
pub struct TitlesResponse {
173+
total_items: Option<i32>,
174+
results: Vec<CloudGameTitle>,
175+
continuation_token: Option<String>,
176+
}
177+
178+
#[derive(Deserialize, Serialize, Debug, Clone)]
179+
#[serde(rename_all = "camelCase")]
180+
pub struct TitleWaitTimeResponse {
181+
estimated_provisioning_time_in_seconds: i32,
182+
estimated_allocation_time_in_seconds: i32,
183+
estimated_total_wait_time_in_seconds: i32,
184+
}
185+
}

smartglass/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "smartglass"
3+
version = "0.1.0"
4+
authors = ["tuxuser <462620+tuxuser@users.noreply.github.com>"]
5+
edition = "2018"
6+
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
9+
[dependencies]
10+
reqwest = { version = "0.10", features = ["json"] }
11+
serde = { version = "1.0.117", features = ["derive"] }
12+
serde_json = "1.0.59"
13+
correlation_vector = { git = "https://github.com/tuxuser/CorrelationVector-Rust.git", branch = "master" }
14+
uuid = { version = "0.8.1", features = ["v4"] }
15+
xal = { path = "../xal" }

0 commit comments

Comments
 (0)