os_iphone.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. /*************************************************************************/
  2. /* os_iphone.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifdef IPHONE_ENABLED
  31. #include "os_iphone.h"
  32. #include "drivers/gles2/rasterizer_gles2.h"
  33. #include "drivers/gles3/rasterizer_gles3.h"
  34. #include "servers/visual/visual_server_raster.h"
  35. #include "servers/visual/visual_server_wrap_mt.h"
  36. #include "main/main.h"
  37. #include "core/io/file_access_pack.h"
  38. #include "core/os/dir_access.h"
  39. #include "core/os/file_access.h"
  40. #include "core/project_settings.h"
  41. #include "drivers/unix/syslog_logger.h"
  42. #include "semaphore_iphone.h"
  43. #include <dlfcn.h>
  44. int OSIPhone::get_video_driver_count() const {
  45. return 2;
  46. };
  47. const char *OSIPhone::get_video_driver_name(int p_driver) const {
  48. switch (p_driver) {
  49. case VIDEO_DRIVER_GLES3:
  50. return "GLES3";
  51. case VIDEO_DRIVER_GLES2:
  52. return "GLES2";
  53. }
  54. ERR_FAIL_V_MSG(NULL, "Invalid video driver index: " + itos(p_driver) + ".");
  55. };
  56. OSIPhone *OSIPhone::get_singleton() {
  57. return (OSIPhone *)OS::get_singleton();
  58. };
  59. extern int gl_view_base_fb; // from gl_view.mm
  60. void OSIPhone::set_data_dir(String p_dir) {
  61. DirAccess *da = DirAccess::open(p_dir);
  62. data_dir = da->get_current_dir();
  63. printf("setting data dir to %ls from %ls\n", data_dir.c_str(), p_dir.c_str());
  64. memdelete(da);
  65. };
  66. void OSIPhone::set_unique_id(String p_id) {
  67. unique_id = p_id;
  68. };
  69. String OSIPhone::get_unique_id() const {
  70. return unique_id;
  71. };
  72. void OSIPhone::initialize_core() {
  73. OS_Unix::initialize_core();
  74. SemaphoreIphone::make_default();
  75. set_data_dir(data_dir);
  76. };
  77. int OSIPhone::get_current_video_driver() const {
  78. return video_driver_index;
  79. }
  80. extern bool gles3_available; // from gl_view.mm
  81. Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
  82. bool use_gl3 = GLOBAL_GET("rendering/quality/driver/driver_name") == "GLES3";
  83. bool gl_initialization_error = false;
  84. while (true) {
  85. if (use_gl3) {
  86. if (RasterizerGLES3::is_viable() == OK && gles3_available) {
  87. RasterizerGLES3::register_config();
  88. RasterizerGLES3::make_current();
  89. break;
  90. } else {
  91. if (GLOBAL_GET("rendering/quality/driver/fallback_to_gles2")) {
  92. p_video_driver = VIDEO_DRIVER_GLES2;
  93. use_gl3 = false;
  94. continue;
  95. } else {
  96. gl_initialization_error = true;
  97. break;
  98. }
  99. }
  100. } else {
  101. if (RasterizerGLES2::is_viable() == OK) {
  102. RasterizerGLES2::register_config();
  103. RasterizerGLES2::make_current();
  104. break;
  105. } else {
  106. gl_initialization_error = true;
  107. break;
  108. }
  109. }
  110. }
  111. if (gl_initialization_error) {
  112. OS::get_singleton()->alert("Your device does not support any of the supported OpenGL versions.",
  113. "Unable to initialize Video driver");
  114. return ERR_UNAVAILABLE;
  115. }
  116. video_driver_index = p_video_driver;
  117. visual_server = memnew(VisualServerRaster);
  118. // FIXME: Reimplement threaded rendering
  119. if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
  120. visual_server = memnew(VisualServerWrapMT(visual_server, false));
  121. }
  122. visual_server->init();
  123. //visual_server->cursor_set_visible(false, 0);
  124. // reset this to what it should be, it will have been set to 0 after visual_server->init() is called
  125. if (use_gl3)
  126. RasterizerStorageGLES3::system_fbo = gl_view_base_fb;
  127. else
  128. RasterizerStorageGLES2::system_fbo = gl_view_base_fb;
  129. AudioDriverManager::initialize(p_audio_driver);
  130. input = memnew(InputDefault);
  131. #ifdef GAME_CENTER_ENABLED
  132. game_center = memnew(GameCenter);
  133. Engine::get_singleton()->add_singleton(Engine::Singleton("GameCenter", game_center));
  134. game_center->connect();
  135. #endif
  136. #ifdef STOREKIT_ENABLED
  137. store_kit = memnew(InAppStore);
  138. Engine::get_singleton()->add_singleton(Engine::Singleton("InAppStore", store_kit));
  139. #endif
  140. #ifdef ICLOUD_ENABLED
  141. icloud = memnew(ICloud);
  142. Engine::get_singleton()->add_singleton(Engine::Singleton("ICloud", icloud));
  143. //icloud->connect();
  144. #endif
  145. ios = memnew(iOS);
  146. Engine::get_singleton()->add_singleton(Engine::Singleton("iOS", ios));
  147. return OK;
  148. };
  149. MainLoop *OSIPhone::get_main_loop() const {
  150. return main_loop;
  151. };
  152. void OSIPhone::set_main_loop(MainLoop *p_main_loop) {
  153. main_loop = p_main_loop;
  154. if (main_loop) {
  155. input->set_main_loop(p_main_loop);
  156. main_loop->init();
  157. }
  158. };
  159. bool OSIPhone::iterate() {
  160. if (!main_loop)
  161. return true;
  162. if (main_loop) {
  163. for (int i = 0; i < event_count; i++) {
  164. input->parse_input_event(event_queue[i]);
  165. };
  166. };
  167. event_count = 0;
  168. return Main::iteration();
  169. };
  170. void OSIPhone::key(uint32_t p_key, bool p_pressed) {
  171. Ref<InputEventKey> ev;
  172. ev.instance();
  173. ev->set_echo(false);
  174. ev->set_pressed(p_pressed);
  175. ev->set_scancode(p_key);
  176. ev->set_unicode(p_key);
  177. queue_event(ev);
  178. };
  179. void OSIPhone::touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick) {
  180. if (!GLOBAL_DEF("debug/disable_touch", false)) {
  181. Ref<InputEventScreenTouch> ev;
  182. ev.instance();
  183. ev->set_index(p_idx);
  184. ev->set_pressed(p_pressed);
  185. ev->set_position(Vector2(p_x, p_y));
  186. queue_event(ev);
  187. };
  188. touch_list.pressed[p_idx] = p_pressed;
  189. };
  190. void OSIPhone::touch_drag(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y) {
  191. if (!GLOBAL_DEF("debug/disable_touch", false)) {
  192. Ref<InputEventScreenDrag> ev;
  193. ev.instance();
  194. ev->set_index(p_idx);
  195. ev->set_position(Vector2(p_x, p_y));
  196. ev->set_relative(Vector2(p_x - p_prev_x, p_y - p_prev_y));
  197. queue_event(ev);
  198. };
  199. };
  200. void OSIPhone::queue_event(const Ref<InputEvent> &p_event) {
  201. ERR_FAIL_INDEX(event_count, MAX_EVENTS);
  202. event_queue[event_count++] = p_event;
  203. };
  204. void OSIPhone::touches_cancelled() {
  205. for (int i = 0; i < MAX_MOUSE_COUNT; i++) {
  206. if (touch_list.pressed[i]) {
  207. // send a mouse_up outside the screen
  208. touch_press(i, -1, -1, false, false);
  209. };
  210. };
  211. };
  212. static const float ACCEL_RANGE = 1;
  213. void OSIPhone::update_gravity(float p_x, float p_y, float p_z) {
  214. input->set_gravity(Vector3(p_x, p_y, p_z));
  215. };
  216. void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
  217. // Found out the Z should not be negated! Pass as is!
  218. input->set_accelerometer(Vector3(p_x / (float)ACCEL_RANGE, p_y / (float)ACCEL_RANGE, p_z / (float)ACCEL_RANGE));
  219. /*
  220. if (p_x != last_accel.x) {
  221. //printf("updating accel x %f\n", p_x);
  222. InputEvent ev;
  223. ev.type = InputEvent::JOYPAD_MOTION;
  224. ev.device = 0;
  225. ev.joy_motion.axis = JOY_ANALOG_0;
  226. ev.joy_motion.axis_value = (p_x / (float)ACCEL_RANGE);
  227. last_accel.x = p_x;
  228. queue_event(ev);
  229. };
  230. if (p_y != last_accel.y) {
  231. //printf("updating accel y %f\n", p_y);
  232. InputEvent ev;
  233. ev.type = InputEvent::JOYPAD_MOTION;
  234. ev.device = 0;
  235. ev.joy_motion.axis = JOY_ANALOG_1;
  236. ev.joy_motion.axis_value = (p_y / (float)ACCEL_RANGE);
  237. last_accel.y = p_y;
  238. queue_event(ev);
  239. };
  240. if (p_z != last_accel.z) {
  241. //printf("updating accel z %f\n", p_z);
  242. InputEvent ev;
  243. ev.type = InputEvent::JOYPAD_MOTION;
  244. ev.device = 0;
  245. ev.joy_motion.axis = JOY_ANALOG_2;
  246. ev.joy_motion.axis_value = ( (1.0 - p_z) / (float)ACCEL_RANGE);
  247. last_accel.z = p_z;
  248. queue_event(ev);
  249. };
  250. */
  251. };
  252. void OSIPhone::update_magnetometer(float p_x, float p_y, float p_z) {
  253. input->set_magnetometer(Vector3(p_x, p_y, p_z));
  254. };
  255. void OSIPhone::update_gyroscope(float p_x, float p_y, float p_z) {
  256. input->set_gyroscope(Vector3(p_x, p_y, p_z));
  257. };
  258. int OSIPhone::get_unused_joy_id() {
  259. return input->get_unused_joy_id();
  260. };
  261. void OSIPhone::joy_connection_changed(int p_idx, bool p_connected, String p_name) {
  262. input->joy_connection_changed(p_idx, p_connected, p_name);
  263. };
  264. void OSIPhone::joy_button(int p_device, int p_button, bool p_pressed) {
  265. input->joy_button(p_device, p_button, p_pressed);
  266. };
  267. void OSIPhone::joy_axis(int p_device, int p_axis, const InputDefault::JoyAxis &p_value) {
  268. input->joy_axis(p_device, p_axis, p_value);
  269. };
  270. void OSIPhone::delete_main_loop() {
  271. if (main_loop) {
  272. main_loop->finish();
  273. memdelete(main_loop);
  274. };
  275. main_loop = NULL;
  276. };
  277. void OSIPhone::finalize() {
  278. delete_main_loop();
  279. memdelete(input);
  280. memdelete(ios);
  281. #ifdef GAME_CENTER_ENABLED
  282. memdelete(game_center);
  283. #endif
  284. #ifdef STOREKIT_ENABLED
  285. memdelete(store_kit);
  286. #endif
  287. #ifdef ICLOUD_ENABLED
  288. memdelete(icloud);
  289. #endif
  290. visual_server->finish();
  291. memdelete(visual_server);
  292. // memdelete(rasterizer);
  293. // Free unhandled events before close
  294. for (int i = 0; i < MAX_EVENTS; i++) {
  295. event_queue[i].unref();
  296. };
  297. event_count = 0;
  298. };
  299. void OSIPhone::set_mouse_show(bool p_show){};
  300. void OSIPhone::set_mouse_grab(bool p_grab){};
  301. bool OSIPhone::is_mouse_grab_enabled() const {
  302. return true;
  303. };
  304. Point2 OSIPhone::get_mouse_position() const {
  305. return Point2();
  306. };
  307. int OSIPhone::get_mouse_button_state() const {
  308. return 0;
  309. };
  310. void OSIPhone::set_window_title(const String &p_title){};
  311. void OSIPhone::alert(const String &p_alert, const String &p_title) {
  312. const CharString utf8_alert = p_alert.utf8();
  313. const CharString utf8_title = p_title.utf8();
  314. iOS::alert(utf8_alert.get_data(), utf8_title.get_data());
  315. }
  316. Error OSIPhone::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
  317. if (p_path.length() == 0) {
  318. p_library_handle = RTLD_SELF;
  319. return OK;
  320. }
  321. return OS_Unix::open_dynamic_library(p_path, p_library_handle, p_also_set_library_path);
  322. }
  323. Error OSIPhone::close_dynamic_library(void *p_library_handle) {
  324. if (p_library_handle == RTLD_SELF) {
  325. return OK;
  326. }
  327. return OS_Unix::close_dynamic_library(p_library_handle);
  328. }
  329. HashMap<String, void *> OSIPhone::dynamic_symbol_lookup_table;
  330. void register_dynamic_symbol(char *name, void *address) {
  331. OSIPhone::dynamic_symbol_lookup_table[String(name)] = address;
  332. }
  333. Error OSIPhone::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional) {
  334. if (p_library_handle == RTLD_SELF) {
  335. void **ptr = OSIPhone::dynamic_symbol_lookup_table.getptr(p_name);
  336. if (ptr) {
  337. p_symbol_handle = *ptr;
  338. return OK;
  339. }
  340. }
  341. return OS_Unix::get_dynamic_library_symbol_handle(p_library_handle, p_name, p_symbol_handle, p_optional);
  342. }
  343. void OSIPhone::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
  344. video_mode = p_video_mode;
  345. };
  346. OS::VideoMode OSIPhone::get_video_mode(int p_screen) const {
  347. return video_mode;
  348. };
  349. void OSIPhone::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
  350. p_list->push_back(video_mode);
  351. };
  352. bool OSIPhone::can_draw() const {
  353. if (native_video_is_playing())
  354. return false;
  355. return true;
  356. };
  357. int OSIPhone::set_base_framebuffer(int p_fb) {
  358. // gl_view_base_fb has not been updated yet
  359. RasterizerStorageGLES3::system_fbo = p_fb;
  360. return 0;
  361. };
  362. bool OSIPhone::has_virtual_keyboard() const {
  363. return true;
  364. };
  365. extern void _show_keyboard(String p_existing);
  366. extern void _hide_keyboard();
  367. extern Error _shell_open(String p_uri);
  368. extern void _set_keep_screen_on(bool p_enabled);
  369. extern void _vibrate();
  370. void OSIPhone::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect, bool p_multiline, int p_max_input_length, int p_cursor_start, int p_cursor_end) {
  371. _show_keyboard(p_existing_text);
  372. };
  373. void OSIPhone::hide_virtual_keyboard() {
  374. _hide_keyboard();
  375. };
  376. void OSIPhone::set_virtual_keyboard_height(int p_height) {
  377. virtual_keyboard_height = p_height;
  378. }
  379. int OSIPhone::get_virtual_keyboard_height() const {
  380. return virtual_keyboard_height;
  381. }
  382. Error OSIPhone::shell_open(String p_uri) {
  383. return _shell_open(p_uri);
  384. };
  385. void OSIPhone::set_keep_screen_on(bool p_enabled) {
  386. OS::set_keep_screen_on(p_enabled);
  387. _set_keep_screen_on(p_enabled);
  388. };
  389. String OSIPhone::get_user_data_dir() const {
  390. return data_dir;
  391. };
  392. String OSIPhone::get_name() const {
  393. return "iOS";
  394. };
  395. String OSIPhone::get_model_name() const {
  396. String model = ios->get_model();
  397. if (model != "")
  398. return model;
  399. return OS_Unix::get_model_name();
  400. }
  401. Size2 OSIPhone::get_window_size() const {
  402. return Vector2(video_mode.width, video_mode.height);
  403. }
  404. extern Rect2 _get_ios_window_safe_area(float p_window_width, float p_window_height);
  405. Rect2 OSIPhone::get_window_safe_area() const {
  406. return _get_ios_window_safe_area(video_mode.width, video_mode.height);
  407. }
  408. bool OSIPhone::has_touchscreen_ui_hint() const {
  409. return true;
  410. }
  411. void OSIPhone::set_locale(String p_locale) {
  412. locale_code = p_locale;
  413. }
  414. String OSIPhone::get_locale() const {
  415. return locale_code;
  416. }
  417. extern bool _play_video(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
  418. extern bool _is_video_playing();
  419. extern void _pause_video();
  420. extern void _unpause_video();
  421. extern void _stop_video();
  422. extern void _focus_out_video();
  423. Error OSIPhone::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) {
  424. FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
  425. bool exists = f && f->is_open();
  426. String tempFile = get_user_data_dir();
  427. if (!exists)
  428. return FAILED;
  429. if (p_path.begins_with("res://")) {
  430. if (PackedData::get_singleton()->has_path(p_path)) {
  431. print("Unable to play %S using the native player as it resides in a .pck file\n", p_path.c_str());
  432. return ERR_INVALID_PARAMETER;
  433. } else {
  434. p_path = p_path.replace("res:/", ProjectSettings::get_singleton()->get_resource_path());
  435. }
  436. } else if (p_path.begins_with("user://"))
  437. p_path = p_path.replace("user:/", get_user_data_dir());
  438. memdelete(f);
  439. print("Playing video: %S\n", p_path.c_str());
  440. if (_play_video(p_path, p_volume, p_audio_track, p_subtitle_track))
  441. return OK;
  442. return FAILED;
  443. }
  444. bool OSIPhone::native_video_is_playing() const {
  445. return _is_video_playing();
  446. }
  447. void OSIPhone::native_video_pause() {
  448. if (native_video_is_playing())
  449. _pause_video();
  450. }
  451. void OSIPhone::native_video_unpause() {
  452. _unpause_video();
  453. };
  454. void OSIPhone::native_video_focus_out() {
  455. _focus_out_video();
  456. };
  457. void OSIPhone::native_video_stop() {
  458. if (native_video_is_playing())
  459. _stop_video();
  460. }
  461. void OSIPhone::vibrate_handheld(int p_duration_ms) {
  462. // iOS does not support duration for vibration
  463. _vibrate();
  464. }
  465. bool OSIPhone::_check_internal_feature_support(const String &p_feature) {
  466. return p_feature == "mobile";
  467. }
  468. // Initialization order between compilation units is not guaranteed,
  469. // so we use this as a hack to ensure certain code is called before
  470. // everything else, but after all units are initialized.
  471. typedef void (*init_callback)();
  472. static init_callback *ios_init_callbacks = NULL;
  473. static int ios_init_callbacks_count = 0;
  474. static int ios_init_callbacks_capacity = 0;
  475. void add_ios_init_callback(init_callback cb) {
  476. if (ios_init_callbacks_count == ios_init_callbacks_capacity) {
  477. void *new_ptr = realloc(ios_init_callbacks, sizeof(cb) * 32);
  478. if (new_ptr) {
  479. ios_init_callbacks = (init_callback *)(new_ptr);
  480. ios_init_callbacks_capacity += 32;
  481. }
  482. }
  483. if (ios_init_callbacks_capacity > ios_init_callbacks_count) {
  484. ios_init_callbacks[ios_init_callbacks_count] = cb;
  485. ++ios_init_callbacks_count;
  486. }
  487. }
  488. OSIPhone::OSIPhone(int width, int height, String p_data_dir) {
  489. for (int i = 0; i < ios_init_callbacks_count; ++i) {
  490. ios_init_callbacks[i]();
  491. }
  492. free(ios_init_callbacks);
  493. ios_init_callbacks = NULL;
  494. ios_init_callbacks_count = 0;
  495. ios_init_callbacks_capacity = 0;
  496. main_loop = NULL;
  497. visual_server = NULL;
  498. VideoMode vm;
  499. vm.fullscreen = true;
  500. vm.width = width;
  501. vm.height = height;
  502. vm.resizable = false;
  503. set_video_mode(vm);
  504. event_count = 0;
  505. virtual_keyboard_height = 0;
  506. // can't call set_data_dir from here, since it requires DirAccess
  507. // which is initialized in initialize_core
  508. data_dir = p_data_dir;
  509. Vector<Logger *> loggers;
  510. loggers.push_back(memnew(SyslogLogger));
  511. #ifdef DEBUG_ENABLED
  512. // it seems iOS app's stdout/stderr is only obtainable if you launch it from Xcode
  513. loggers.push_back(memnew(StdLogger));
  514. #endif
  515. _set_logger(memnew(CompositeLogger(loggers)));
  516. AudioDriverManager::add_driver(&audio_driver);
  517. };
  518. OSIPhone::~OSIPhone() {
  519. }
  520. #endif