1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
use crate::ipc::sf::sm;
use crate::result::*;
use crate::ipc::sf;
use crate::ipc::client;
use crate::service;
use crate::mem;
use crate::service::dispdrv;
use crate::service::applet;
pub use crate::ipc::sf::vi::*;
pub struct ManagerDisplayService {
session: sf::Session
}
impl sf::IObject for ManagerDisplayService {
ipc_sf_object_impl_default_command_metadata!();
}
impl IManagerDisplayService for ManagerDisplayService {
fn create_managed_layer(&mut self, flags: LayerFlags, display_id: DisplayId, aruid: applet::AppletResourceUserId) -> Result<LayerId> {
ipc_client_send_request_command!([self.session.object_info; 2010] (flags, display_id, aruid) => (id: LayerId))
}
fn destroy_managed_layer(&mut self, id: LayerId) -> Result<()> {
ipc_client_send_request_command!([self.session.object_info; 2011] (id) => ())
}
}
impl client::IClientObject for ManagerDisplayService {
fn new(session: sf::Session) -> Self {
Self { session }
}
fn get_session(&mut self) -> &mut sf::Session {
&mut self.session
}
}
pub struct SystemDisplayService {
session: sf::Session
}
impl sf::IObject for SystemDisplayService {
ipc_sf_object_impl_default_command_metadata!();
}
impl ISystemDisplayService for SystemDisplayService {
fn get_z_order_count_min(&mut self, display_id: DisplayId) -> Result<i64> {
ipc_client_send_request_command!([self.session.object_info; 1200] (display_id) => (z: i64))
}
fn get_z_order_count_max(&mut self, display_id: DisplayId) -> Result<i64> {
ipc_client_send_request_command!([self.session.object_info; 1202] (display_id) => (z: i64))
}
fn set_layer_position(&mut self, x: f32, y: f32, id: LayerId) -> Result<()> {
ipc_client_send_request_command!([self.session.object_info; 2201] (x, y, id) => ())
}
fn set_layer_size(&mut self, id: LayerId, width: u64, height: u64) -> Result<()> {
ipc_client_send_request_command!([self.session.object_info; 2203] (id, width, height) => ())
}
fn set_layer_z(&mut self, id: LayerId, z: i64) -> Result<()> {
ipc_client_send_request_command!([self.session.object_info; 2205] (id, z) => ())
}
fn set_layer_visibility(&mut self, visible: bool, id: LayerId) -> Result<()> {
ipc_client_send_request_command!([self.session.object_info; 2207] (visible, id) => ())
}
}
impl client::IClientObject for SystemDisplayService {
fn new(session: sf::Session) -> Self {
Self { session }
}
fn get_session(&mut self) -> &mut sf::Session {
&mut self.session
}
}
pub struct ApplicationDisplayService {
session: sf::Session
}
impl sf::IObject for ApplicationDisplayService {
ipc_sf_object_impl_default_command_metadata!();
}
impl IApplicationDisplayService for ApplicationDisplayService {
fn get_relay_service(&mut self) -> Result<mem::Shared<dyn dispdrv::IHOSBinderDriver>> {
ipc_client_send_request_command!([self.session.object_info; 100] () => (relay_service: mem::Shared<dispdrv::HOSBinderDriver>))
}
fn get_system_display_service(&mut self) -> Result<mem::Shared<dyn ISystemDisplayService>> {
ipc_client_send_request_command!([self.session.object_info; 101] () => (relay_service: mem::Shared<SystemDisplayService>))
}
fn get_manager_display_service(&mut self) -> Result<mem::Shared<dyn IManagerDisplayService>> {
ipc_client_send_request_command!([self.session.object_info; 102] () => (relay_service: mem::Shared<ManagerDisplayService>))
}
fn open_display(&mut self, name: DisplayName) -> Result<DisplayId> {
ipc_client_send_request_command!([self.session.object_info; 1010] (name) => (id: DisplayId))
}
fn close_display(&mut self, display_id: DisplayId) -> Result<()> {
ipc_client_send_request_command!([self.session.object_info; 1020] (display_id) => ())
}
fn open_layer(&mut self, name: DisplayName, id: LayerId, aruid: sf::ProcessId, out_native_window: sf::OutMapAliasBuffer<u8>) -> Result<usize> {
ipc_client_send_request_command!([self.session.object_info; 2020] (name, id, aruid, out_native_window) => (native_window_size: usize))
}
fn create_stray_layer(&mut self, flags: LayerFlags, display_id: DisplayId, out_native_window: sf::OutMapAliasBuffer<u8>) -> Result<(LayerId, usize)> {
ipc_client_send_request_command!([self.session.object_info; 2030] (flags, display_id, out_native_window) => (id: LayerId, native_window_size: usize))
}
fn destroy_stray_layer(&mut self, id: LayerId) -> Result<()> {
ipc_client_send_request_command!([self.session.object_info; 2031] (id) => ())
}
fn get_display_vsync_event(&mut self, display_id: DisplayId) -> Result<sf::CopyHandle> {
ipc_client_send_request_command!([self.session.object_info; 5202] (display_id) => (event_handle: sf::CopyHandle))
}
}
impl client::IClientObject for ApplicationDisplayService {
fn new(session: sf::Session) -> Self {
Self { session }
}
fn get_session(&mut self) -> &mut sf::Session {
&mut self.session
}
}
pub struct ApplicationRootService {
session: sf::Session
}
impl sf::IObject for ApplicationRootService {
ipc_sf_object_impl_default_command_metadata!();
}
impl IApplicationRootService for ApplicationRootService {
fn get_display_service(&mut self, mode: DisplayServiceMode) -> Result<mem::Shared<dyn IApplicationDisplayService>> {
ipc_client_send_request_command!([self.session.object_info; 0] (mode) => (display_service: mem::Shared<ApplicationDisplayService>))
}
}
impl client::IClientObject for ApplicationRootService {
fn new(session: sf::Session) -> Self {
Self { session }
}
fn get_session(&mut self) -> &mut sf::Session {
&mut self.session
}
}
impl service::IService for ApplicationRootService {
fn get_name() -> sm::ServiceName {
sm::ServiceName::new("vi:u")
}
fn as_domain() -> bool {
true
}
fn post_initialize(&mut self) -> Result<()> {
Ok(())
}
}
pub struct SystemRootService {
session: sf::Session
}
impl sf::IObject for SystemRootService {
ipc_sf_object_impl_default_command_metadata!();
}
impl ISystemRootService for SystemRootService {
fn get_display_service(&mut self, mode: DisplayServiceMode) -> Result<mem::Shared<dyn IApplicationDisplayService>> {
ipc_client_send_request_command!([self.session.object_info; 1] (mode) => (display_service: mem::Shared<ApplicationDisplayService>))
}
}
impl client::IClientObject for SystemRootService {
fn new(session: sf::Session) -> Self {
Self { session }
}
fn get_session(&mut self) -> &mut sf::Session {
&mut self.session
}
}
impl service::IService for SystemRootService {
fn get_name() -> sm::ServiceName {
sm::ServiceName::new("vi:s")
}
fn as_domain() -> bool {
true
}
fn post_initialize(&mut self) -> Result<()> {
Ok(())
}
}
pub struct ManagerRootService {
session: sf::Session
}
impl sf::IObject for ManagerRootService {
ipc_sf_object_impl_default_command_metadata!();
}
impl IManagerRootService for ManagerRootService {
fn get_display_service(&mut self, mode: DisplayServiceMode) -> Result<mem::Shared<dyn IApplicationDisplayService>> {
ipc_client_send_request_command!([self.session.object_info; 2] (mode) => (display_service: mem::Shared<ApplicationDisplayService>))
}
}
impl client::IClientObject for ManagerRootService {
fn new(session: sf::Session) -> Self {
Self { session }
}
fn get_session(&mut self) -> &mut sf::Session {
&mut self.session
}
}
impl service::IService for ManagerRootService {
fn get_name() -> sm::ServiceName {
sm::ServiceName::new("vi:m")
}
fn as_domain() -> bool {
true
}
fn post_initialize(&mut self) -> Result<()> {
Ok(())
}
}