2023-01-05 13:25:55 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**************************************************************************/
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*  java_godot_io_wrapper.h                                               */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/**************************************************************************/
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*                         This file is part of:                          */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*                             GODOT ENGINE                               */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*                        https://godotengine.org                         */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/**************************************************************************/
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*                                                                        */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* Permission is hereby granted, free of charge, to any person obtaining  */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* a copy of this software and associated documentation files (the        */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* "Software"), to deal in the Software without restriction, including    */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* without limitation the rights to use, copy, modify, merge, publish,    */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* distribute, sublicense, and/or sell copies of the Software, and to     */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* permit persons to whom the Software is furnished to do so, subject to  */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* the following conditions:                                              */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*                                                                        */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* The above copyright notice and this permission notice shall be         */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* included in all copies or substantial portions of the Software.        */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/*                                                                        */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/**************************************************************************/
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-02-01 10:33:58 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#pragma once
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-11-20 10:10:17 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "jni_utils.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-04-26 11:40:57 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "core/math/rect2i.h"
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-05 03:41:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "core/variant/typed_array.h"
							 | 
						
					
						
							
								
									
										
										
										
											2023-06-08 14:51:32 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <android/log.h>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <jni.h>
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// Class that makes functions in java/src/org/godotengine/godot/GodotIO.java callable from C++
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class GodotIOJavaWrapper {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								private:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jobject godot_io_instance;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jclass cls;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jmethodID _open_URI = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-10 18:39:31 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_cache_dir = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_data_dir = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-21 15:02:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_temp_dir = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2022-04-24 21:12:22 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_display_cutouts = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-18 22:20:21 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_display_rotation = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2022-04-26 11:40:57 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_display_safe_area = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_locale = 0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_model = 0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_screen_DPI = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2022-04-04 02:22:51 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_scaled_density = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-27 13:46:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_screen_refresh_rate = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-09 05:21:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_unique_id = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jmethodID _show_keyboard = 0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jmethodID _hide_keyboard = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-02 20:01:27 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									jmethodID _has_hardware_keyboard = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jmethodID _set_screen_orientation = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-27 17:30:18 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_screen_orientation = 0;
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jmethodID _get_system_dir = 0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								public:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instance);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									~GodotIOJavaWrapper();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									jobject get_instance();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Error open_uri(const String &p_uri);
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-10 18:39:31 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									String get_cache_dir();
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-21 15:02:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									String get_temp_dir();
							 | 
						
					
						
							
								
									
										
										
										
											2024-04-30 21:13:10 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									String get_user_data_dir(const String &p_user_dir);
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									String get_locale();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									String get_model();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int get_screen_dpi();
							 | 
						
					
						
							
								
									
										
										
										
											2022-04-04 02:22:51 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									float get_scaled_density();
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-27 13:46:57 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									float get_screen_refresh_rate(float fallback);
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-05 03:41:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									TypedArray<Rect2> get_display_cutouts();
							 | 
						
					
						
							
								
									
										
										
										
											2022-04-26 11:40:57 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									Rect2i get_display_safe_area();
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									String get_unique_id();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bool has_vk();
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-02 20:01:27 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool has_hardware_keyboard();
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-07 14:20:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void show_vk(const String &p_existing, int p_type, int p_max_input_length, int p_cursor_start, int p_cursor_end);
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void hide_vk();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int get_vk_height();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void set_vk_height(int p_height);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void set_screen_orientation(int p_orient);
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-27 17:30:18 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									int get_screen_orientation();
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-10 18:39:31 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									String get_system_dir(int p_dir, bool p_shared_storage);
							 | 
						
					
						
							
								
									
										
										
										
											2025-04-18 22:20:21 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									int get_display_rotation();
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-13 23:51:55 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 |