Error MIDIDriverCoreMidi::open() { CFStringRef name = CFStringCreateWithCString(NULL, "Godot", kCFStringEncodingASCII); OSStatus result = MIDIClientCreate(name, NULL, NULL, &client); CFRelease(name); if (result != noErr) { ERR_PRINTS("MIDIClientCreate failed, code: " + itos(result)); return ERR_CANT_OPEN; } result = MIDIInputPortCreate(client, CFSTR("Godot Input"), MIDIDriverCoreMidi::read, (void *)this, &port_in); if (result != noErr) { ERR_PRINTS("MIDIInputPortCreate failed, code: " + itos(result)); return ERR_CANT_OPEN; } int sources = MIDIGetNumberOfSources(); for (int i = 0; i < sources; i++) { MIDIEndpointRef source = MIDIGetSource(i); if (source) { MIDIPortConnectSource(port_in, source, (void *)this); connected_sources.insert(i, source); } } return OK; }
void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value) { ERR_FAIL_COND(!p_node->is_inside_tree()); ERR_FAIL_COND(!network_peer.is_valid()); int node_id = network_peer->get_unique_id(); bool is_master = p_node->is_network_master(); bool skip_rset = false; if (p_peer_id == 0 || p_peer_id == node_id || (p_peer_id < 0 && p_peer_id != -node_id)) { //check that send mode can use local call bool set_local = false; const Map<StringName, RPCMode>::Element *E = p_node->get_node_rset_mode(p_property); if (E) { set_local = _should_call_local(E->get(), is_master, skip_rset); } if (set_local) { bool valid; p_node->set(p_property, p_value, &valid); if (!valid) { String error = "rset() aborted in local set, property not found: - " + String(p_property); ERR_PRINTS(error); return; } } else if (p_node->get_script_instance()) { //attempt with script RPCMode rpc_mode = p_node->get_script_instance()->get_rset_mode(p_property); set_local = _should_call_local(rpc_mode, is_master, skip_rset); if (set_local) { bool valid = p_node->get_script_instance()->set(p_property, p_value); if (!valid) { String error = "rset() aborted in local script set, property not found: - " + String(p_property); ERR_PRINTS(error); return; } } } } if (skip_rset) return; const Variant *vptr = &p_value; _send_rpc(p_node, p_peer_id, p_unreliable, true, p_property, &vptr, 1); }
void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount) { ERR_FAIL_COND(!p_node->is_inside_tree()); ERR_FAIL_COND(!network_peer.is_valid()); int node_id = network_peer->get_unique_id(); bool skip_rpc = false; bool call_local_native = false; bool call_local_script = false; bool is_master = p_node->is_network_master(); if (p_peer_id == 0 || p_peer_id == node_id || (p_peer_id < 0 && p_peer_id != -node_id)) { //check that send mode can use local call const Map<StringName, RPCMode>::Element *E = p_node->get_node_rpc_mode(p_method); if (E) { call_local_native = _should_call_local(E->get(), is_master, skip_rpc); } if (call_local_native) { // done below } else if (p_node->get_script_instance()) { //attempt with script RPCMode rpc_mode = p_node->get_script_instance()->get_rpc_mode(p_method); call_local_script = _should_call_local(rpc_mode, is_master, skip_rpc); } } if (!skip_rpc) { _send_rpc(p_node, p_peer_id, p_unreliable, false, p_method, p_arg, p_argcount); } if (call_local_native) { Variant::CallError ce; p_node->call(p_method, p_arg, p_argcount, ce); if (ce.error != Variant::CallError::CALL_OK) { String error = Variant::get_call_error_text(p_node, p_method, p_arg, p_argcount, ce); error = "rpc() aborted in local call: - " + error; ERR_PRINTS(error); return; } } if (call_local_script) { Variant::CallError ce; ce.error = Variant::CallError::CALL_OK; p_node->get_script_instance()->call(p_method, p_arg, p_argcount, ce); if (ce.error != Variant::CallError::CALL_OK) { String error = Variant::get_call_error_text(p_node, p_method, p_arg, p_argcount, ce); error = "rpc() aborted in script local call: - " + error; ERR_PRINTS(error); return; } } }
Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) { //printf("copy %s -> %s\n",p_from.ascii().get_data(),p_to.ascii().get_data()); Error err; FileAccess *fsrc = FileAccess::open(p_from, FileAccess::READ, &err); if (err) { ERR_PRINTS("Failed to open " + p_from); return err; } FileAccess *fdst = FileAccess::open(p_to, FileAccess::WRITE, &err); if (err) { fsrc->close(); memdelete(fsrc); ERR_PRINTS("Failed to open " + p_to); return err; } fsrc->seek_end(0); int size = fsrc->get_position(); fsrc->seek(0); err = OK; while (size--) { if (fsrc->get_error() != OK) { err = fsrc->get_error(); break; } if (fdst->get_error() != OK) { err = fdst->get_error(); break; } fdst->store_8(fsrc->get_8()); } if (err == OK && p_chmod_flags != -1) { fdst->close(); err = FileAccess::set_unix_permissions(p_to, p_chmod_flags); // If running on a platform with no chmod support (i.e., Windows), don't fail if (err == ERR_UNAVAILABLE) err = OK; } memdelete(fsrc); memdelete(fdst); return err; }
void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset) { ERR_FAIL_COND(p_offset >= p_packet_len); // Check that remote can call the RSET on this node RPCMode rset_mode = RPC_MODE_DISABLED; const Map<StringName, RPCMode>::Element *E = p_node->get_node_rset_mode(p_name); if (E) { rset_mode = E->get(); } else if (p_node->get_script_instance()) { rset_mode = p_node->get_script_instance()->get_rset_mode(p_name); } ERR_FAIL_COND(!_can_call_mode(p_node, rset_mode, p_from)); Variant value; decode_variant(value, &p_packet[p_offset], p_packet_len - p_offset); bool valid; p_node->set(p_name, value, &valid); if (!valid) { String error = "Error setting remote property '" + String(p_name) + "', not found in object of type " + p_node->get_class(); ERR_PRINTS(error); } }
Error GDMono::finalize_and_unload_domain(MonoDomain *p_domain) { CRASH_COND(p_domain == NULL); String domain_name = mono_domain_get_friendly_name(p_domain); print_verbose("Mono: Unloading domain `" + domain_name + "`..."); if (mono_domain_get() != root_domain) mono_domain_set(root_domain, true); mono_gc_collect(mono_gc_max_generation()); mono_domain_finalize(p_domain, 2000); mono_gc_collect(mono_gc_max_generation()); _domain_assemblies_cleanup(mono_domain_get_id(p_domain)); MonoException *exc = NULL; mono_domain_try_unload(p_domain, (MonoObject **)&exc); if (exc) { ERR_PRINTS("Exception thrown when unloading domain `" + domain_name + "`"); GDMonoUtils::debug_unhandled_exception(exc); return FAILED; } return OK; }
void MultiplayerAPI::_process_rpc(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset) { if (!p_node->can_call_rpc(p_name, p_from)) return; ERR_FAIL_COND(p_offset >= p_packet_len); int argc = p_packet[p_offset]; Vector<Variant> args; Vector<const Variant *> argp; args.resize(argc); argp.resize(argc); p_offset++; for (int i = 0; i < argc; i++) { ERR_FAIL_COND(p_offset >= p_packet_len); int vlen; Error err = decode_variant(args[i], &p_packet[p_offset], p_packet_len - p_offset, &vlen); ERR_FAIL_COND(err != OK); //args[i]=p_packet[3+i]; argp[i] = &args[i]; p_offset += vlen; } Variant::CallError ce; p_node->call(p_name, (const Variant **)argp.ptr(), argc, ce); if (ce.error != Variant::CallError::CALL_OK) { String error = Variant::get_call_error_text(p_node, p_name, (const Variant **)argp.ptr(), argc, ce); error = "RPC - " + error; ERR_PRINTS(error); } }
Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_custom) { ERR_FAIL_COND_V(p_image.is_null(), ERR_INVALID_PARAMETER); FileAccess *f = p_custom; if (!f) { Error err; f = FileAccess::open(p_file, FileAccess::READ, &err); if (!f) { ERR_PRINTS("Error opening file: " + p_file); return err; } } String extension = p_file.get_extension(); for (int i = 0; i < loader_count; i++) { if (!loader[i]->recognize(extension)) continue; Error err = loader[i]->load_image(p_image, f); if (err != ERR_FILE_UNRECOGNIZED) { if (!p_custom) memdelete(f); return err; } } if (!p_custom) memdelete(f); return ERR_FILE_UNRECOGNIZED; }
void SoftBody::_update_cache_pin_points_datas() { if (pinned_points_cache_dirty) { pinned_points_cache_dirty = false; PoolVector<PinnedPoint>::Write w = pinned_points_indices.write(); for (int i = pinned_points_indices.size() - 1; 0 <= i; --i) { if (!w[i].spatial_attachment_path.is_empty()) { w[i].spatial_attachment = Object::cast_to<Spatial>(get_node(w[i].spatial_attachment_path)); if (w[i].spatial_attachment) { Transform point_global_transform(get_global_transform()); point_global_transform.translate(PhysicsServer::get_singleton()->soft_body_get_point_offset(physics_rid, w[i].point_index)); // Local transform relative to spatial attachment node w[i].vertex_offset_transform = w[i].spatial_attachment->get_global_transform().affine_inverse() * point_global_transform; continue; } else { ERR_PRINTS("The node with path: " + String(w[i].spatial_attachment_path) + " was not found or is not a spatial node."); } } // Local transform relative to Soft body w[i].vertex_offset_transform.origin = PhysicsServer::get_singleton()->soft_body_get_point_offset(physics_rid, w[i].point_index); w[i].vertex_offset_transform.basis = Basis(); } } }
void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset) { ERR_EXPLAIN("Invalid packet received. Size too small."); ERR_FAIL_COND(p_offset >= p_packet_len); // Check that remote can call the RSET on this node. RPCMode rset_mode = RPC_MODE_DISABLED; const Map<StringName, RPCMode>::Element *E = p_node->get_node_rset_mode(p_name); if (E) { rset_mode = E->get(); } else if (p_node->get_script_instance()) { rset_mode = p_node->get_script_instance()->get_rset_mode(p_name); } bool can_call = _can_call_mode(p_node, rset_mode, p_from); ERR_EXPLAIN("RSET '" + String(p_name) + "' is not allowed on node " + p_node->get_path() + " from: " + itos(p_from) + ". Mode is " + itos((int)rset_mode) + ", master is " + itos(p_node->get_network_master()) + "."); ERR_FAIL_COND(!can_call); Variant value; Error err = decode_variant(value, &p_packet[p_offset], p_packet_len - p_offset, NULL, allow_object_decoding || network_peer->is_object_decoding_allowed()); ERR_EXPLAIN("Invalid packet received. Unable to decode RSET value."); ERR_FAIL_COND(err != OK); bool valid; p_node->set(p_name, value, &valid); if (!valid) { String error = "Error setting remote property '" + String(p_name) + "', not found in object of type " + p_node->get_class(); ERR_PRINTS(error); } }
void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) { //needs to be done before changes is reset to 0, to not force the editor to redraw VS::get_singleton()->emit_signal("frame_pre_draw"); changes = 0; VSG::rasterizer->begin_frame(frame_step); VSG::scene->update_dirty_instances(); //update scene stuff VSG::viewport->draw_viewports(); VSG::scene->render_probes(); _draw_margins(); VSG::rasterizer->end_frame(p_swap_buffers); while (frame_drawn_callbacks.front()) { Object *obj = ObjectDB::get_instance(frame_drawn_callbacks.front()->get().object); if (obj) { Variant::CallError ce; const Variant *v = &frame_drawn_callbacks.front()->get().param; obj->call(frame_drawn_callbacks.front()->get().method, &v, 1, ce); if (ce.error != Variant::CallError::CALL_OK) { String err = Variant::get_call_error_text(obj, frame_drawn_callbacks.front()->get().method, &v, 1, ce); ERR_PRINTS("Error calling frame drawn function: " + err); } } frame_drawn_callbacks.pop_front(); } VS::get_singleton()->emit_signal("frame_post_draw"); }
void VisualServerRaster::draw(bool p_swap_buffers) { changes = 0; VSG::rasterizer->begin_frame(); VSG::scene->update_dirty_instances(); //update scene stuff VSG::viewport->draw_viewports(); VSG::scene->render_probes(); _draw_margins(); VSG::rasterizer->end_frame(p_swap_buffers); while (frame_drawn_callbacks.front()) { Object *obj = ObjectDB::get_instance(frame_drawn_callbacks.front()->get().object); if (obj) { Variant::CallError ce; const Variant *v = &frame_drawn_callbacks.front()->get().param; obj->call(frame_drawn_callbacks.front()->get().method, &v, 1, ce); if (ce.error != Variant::CallError::CALL_OK) { String err = Variant::get_call_error_text(obj, frame_drawn_callbacks.front()->get().method, &v, 1, ce); ERR_PRINTS("Error calling frame drawn function: " + err); } } frame_drawn_callbacks.pop_front(); } emit_signal("frame_drawn_in_thread"); }
static void mono_log_callback(const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data) { FileAccess *f = GDMonoLog::get_singleton()->get_log_file(); if (GDMonoLog::get_singleton()->get_log_level_id() >= log_level_get_id(log_level)) { String text(message); text += " (in domain "; text += log_domain; if (log_level) { text += ", "; text += log_level; } text += ")\n"; f->seek_end(); f->store_string(text); } if (fatal) { ERR_PRINTS("Mono: FATAL ERROR, ABORTING! Logfile: " + GDMonoLog::get_singleton()->get_log_file_path() + "\n"); // If we were to abort without flushing, the log wouldn't get written. f->flush(); abort(); } }
Error StreamPeerMbedTLS::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String &p_for_hostname) { base = p_base; int ret = 0; int authmode = p_validate_certs ? MBEDTLS_SSL_VERIFY_REQUIRED : MBEDTLS_SSL_VERIFY_NONE; mbedtls_ssl_init(&ssl); mbedtls_ssl_config_init(&conf); mbedtls_ctr_drbg_init(&ctr_drbg); mbedtls_entropy_init(&entropy); ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0); if (ret != 0) { ERR_PRINTS(" failed\n ! mbedtls_ctr_drbg_seed returned an error" + itos(ret)); return FAILED; } mbedtls_ssl_config_defaults(&conf, MBEDTLS_SSL_IS_CLIENT, MBEDTLS_SSL_TRANSPORT_STREAM, MBEDTLS_SSL_PRESET_DEFAULT); mbedtls_ssl_conf_authmode(&conf, authmode); mbedtls_ssl_conf_ca_chain(&conf, &cacert, NULL); mbedtls_ssl_conf_rng(&conf, mbedtls_ctr_drbg_random, &ctr_drbg); mbedtls_ssl_conf_dbg(&conf, my_debug, stdout); mbedtls_ssl_setup(&ssl, &conf); mbedtls_ssl_set_hostname(&ssl, p_for_hostname.utf8().get_data()); mbedtls_ssl_set_bio(&ssl, this, bio_send, bio_recv, NULL); while ((ret = mbedtls_ssl_handshake(&ssl)) != 0) { if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) { ERR_PRINTS("TLS handshake error: " + itos(ret)); _print_error(ret); status = STATUS_ERROR_HOSTNAME_MISMATCH; return FAILED; } } connected = true; status = STATUS_CONNECTED; return OK; }
Error AudioDriverCoreAudio::capture_start() { OSStatus result = AudioOutputUnitStart(input_unit); if (result != noErr) { ERR_PRINTS("AudioOutputUnitStart failed, code: " + itos(result)); } return OK; }
Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, int p_packet_len) { uint32_t target = decode_uint32(&p_packet[1]); Node *node = NULL; if (target & 0x80000000) { // Use full path (not cached yet). int ofs = target & 0x7FFFFFFF; ERR_EXPLAIN("Invalid packet received. Size smaller than declared."); ERR_FAIL_COND_V(ofs >= p_packet_len, NULL); String paths; paths.parse_utf8((const char *)&p_packet[ofs], p_packet_len - ofs); NodePath np = paths; node = root_node->get_node(np); if (!node) ERR_PRINTS("Failed to get path from RPC: " + String(np)); } else { // Use cached path. int id = target; Map<int, PathGetCache>::Element *E = path_get_cache.find(p_from); ERR_EXPLAIN("Invalid packet received. Requests invalid peer cache."); ERR_FAIL_COND_V(!E, NULL); Map<int, PathGetCache::NodeInfo>::Element *F = E->get().nodes.find(id); ERR_EXPLAIN("Invalid packet received. Unabled to find requested cached node."); ERR_FAIL_COND_V(!F, NULL); PathGetCache::NodeInfo *ni = &F->get(); // Do proper caching later. node = root_node->get_node(ni->path); if (!node) ERR_PRINTS("Failed to get cached path from RPC: " + String(ni->path)); } return node; }
void AudioDriverCoreAudio::stop() { if (active) { OSStatus result = AudioOutputUnitStop(audio_unit); if (result != noErr) { ERR_PRINTS("AudioOutputUnitStop failed, code: " + itos(result)); } else { active = false; } } }
void ResourceLoader::finalize() { #ifndef NO_THREADS const LoadingMapKey *K = NULL; while ((K = loading_map.next(K))) { ERR_PRINTS("Exited while resource is being loaded: " + K->path); } loading_map.clear(); memdelete(loading_map_mutex); loading_map_mutex = NULL; #endif }
void Skeleton::_update_process_order() { if (!process_order_dirty) return; Bone *bonesptr = bones.ptrw(); int len = bones.size(); process_order.resize(len); int *order = process_order.ptrw(); for (int i = 0; i < len; i++) { if (bonesptr[i].parent >= len) { //validate this just in case ERR_PRINTS("Bone " + itos(i) + " has invalid parent: " + itos(bonesptr[i].parent)); bonesptr[i].parent = -1; } order[i] = i; bonesptr[i].sort_index = i; } //now check process order int pass_count = 0; while (pass_count < len * len) { //using bubblesort because of simplicity, it wont run every frame though. //bublesort worst case is O(n^2), and this may be an infinite loop if cyclic bool swapped = false; for (int i = 0; i < len; i++) { int parent_idx = bonesptr[order[i]].parent; if (parent_idx < 0) continue; //do nothing because it has no parent //swap indices int parent_order = bonesptr[parent_idx].sort_index; if (parent_order > i) { bonesptr[order[i]].sort_index = parent_order; bonesptr[parent_idx].sort_index = i; //swap order SWAP(order[i], order[parent_order]); swapped = true; } } if (!swapped) break; pass_count++; } if (pass_count == len * len) { ERR_PRINT("Skeleton parenthood graph is cyclic"); } process_order_dirty = false; }
void NativeScriptInstance::notification(int p_notification) { #ifdef DEBUG_ENABLED if (p_notification == MainLoop::NOTIFICATION_CRASH) { if (current_method_call != StringName("")) { ERR_PRINTS("NativeScriptInstance detected crash on method: " + current_method_call); current_method_call = ""; } } #endif Variant value = p_notification; const Variant *args[1] = { &value }; call_multilevel("_notification", args, 1); }
NetSocketPosix::NetError NetSocketPosix::_get_socket_error() { #if defined(WINDOWS_ENABLED) int err = WSAGetLastError(); if (err == WSAEISCONN) return ERR_NET_IS_CONNECTED; if (err == WSAEINPROGRESS || err == WSAEALREADY) return ERR_NET_IN_PROGRESS; if (err == WSAEWOULDBLOCK) return ERR_NET_WOULD_BLOCK; ERR_PRINTS("Socket error: " + itos(err)); return ERR_NET_OTHER; #else if (errno == EISCONN) return ERR_NET_IS_CONNECTED; if (errno == EINPROGRESS || errno == EALREADY) return ERR_NET_IN_PROGRESS; if (errno == EAGAIN || errno == EWOULDBLOCK) return ERR_NET_WOULD_BLOCK; ERR_PRINTS("Socket error: " + itos(errno)); return ERR_NET_OTHER; #endif }
void MultiplayerAPI::_process_rpc(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset) { ERR_EXPLAIN("Invalid packet received. Size too small."); ERR_FAIL_COND(p_offset >= p_packet_len); // Check that remote can call the RPC on this node. RPCMode rpc_mode = RPC_MODE_DISABLED; const Map<StringName, RPCMode>::Element *E = p_node->get_node_rpc_mode(p_name); if (E) { rpc_mode = E->get(); } else if (p_node->get_script_instance()) { rpc_mode = p_node->get_script_instance()->get_rpc_mode(p_name); } bool can_call = _can_call_mode(p_node, rpc_mode, p_from); ERR_EXPLAIN("RPC '" + String(p_name) + "' is not allowed on node " + p_node->get_path() + " from: " + itos(p_from) + ". Mode is " + itos((int)rpc_mode) + ", master is " + itos(p_node->get_network_master()) + "."); ERR_FAIL_COND(!can_call); int argc = p_packet[p_offset]; Vector<Variant> args; Vector<const Variant *> argp; args.resize(argc); argp.resize(argc); p_offset++; for (int i = 0; i < argc; i++) { ERR_EXPLAIN("Invalid packet received. Size too small."); ERR_FAIL_COND(p_offset >= p_packet_len); int vlen; Error err = decode_variant(args.write[i], &p_packet[p_offset], p_packet_len - p_offset, &vlen, allow_object_decoding || network_peer->is_object_decoding_allowed()); ERR_EXPLAIN("Invalid packet received. Unable to decode RPC argument."); ERR_FAIL_COND(err != OK); argp.write[i] = &args[i]; p_offset += vlen; } Variant::CallError ce; p_node->call(p_name, (const Variant **)argp.ptr(), argc, ce); if (ce.error != Variant::CallError::CALL_OK) { String error = Variant::get_call_error_text(p_node, p_name, (const Variant **)argp.ptr(), argc, ce); error = "RPC - " + error; ERR_PRINTS(error); } }
Error ConfigFile::load(const String& p_path) { Error err; FileAccess *f= FileAccess::open(p_path,FileAccess::READ,&err); if (!f) return ERR_CANT_OPEN; VariantParser::StreamFile stream; stream.f=f; String assign; Variant value; VariantParser::Tag next_tag; int lines=0; String error_text; String section; while(true) { assign=Variant(); next_tag.fields.clear(); next_tag.name=String(); err = VariantParser::parse_tag_assign_eof(&stream,lines,error_text,next_tag,assign,value,NULL,true); if (err==ERR_FILE_EOF) { memdelete(f); return OK; } else if (err!=OK) { ERR_PRINTS("ConfgFile::load - "+p_path+":"+itos(lines)+" error: "+error_text); memdelete(f); return err; } if (assign!=String()) { set_value(section,assign,value); } else if (next_tag.name!=String()) { section=next_tag.name; } } memdelete(f); return OK; }
void set_pending_exception(MonoException *p_exc) { #ifdef HAS_PENDING_EXCEPTIONS if (get_runtime_invoke_count() == 0) { debug_unhandled_exception(p_exc); _UNREACHABLE_(); } if (!mono_runtime_set_pending_exception(p_exc, false)) { ERR_PRINTS("Exception thrown from managed code, but it could not be set as pending:"); GDMonoUtils::debug_print_unhandled_exception(p_exc); } #else debug_unhandled_exception(p_exc); _UNREACHABLE_(); #endif }
IP_Address IP::get_resolve_item_address(ResolverID p_id) const { ERR_FAIL_INDEX_V(p_id, IP::RESOLVER_MAX_QUERIES, IP_Address()); resolver->mutex->lock(); if (resolver->queue[p_id].status != IP::RESOLVER_STATUS_DONE) { ERR_PRINTS("Resolve of '" + resolver->queue[p_id].hostname + "'' didn't complete yet."); resolver->mutex->unlock(); return IP_Address(); } IP_Address res = resolver->queue[p_id].response; resolver->mutex->unlock(); return res; }
static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam) { if (type == _EXT_DEBUG_TYPE_OTHER_ARB) return; if (type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB) return; //these are ultimately annoying, so removing for now char debSource[256], debType[256], debSev[256]; if (source == _EXT_DEBUG_SOURCE_API_ARB) strcpy(debSource, "OpenGL"); else if (source == _EXT_DEBUG_SOURCE_WINDOW_SYSTEM_ARB) strcpy(debSource, "Windows"); else if (source == _EXT_DEBUG_SOURCE_SHADER_COMPILER_ARB) strcpy(debSource, "Shader Compiler"); else if (source == _EXT_DEBUG_SOURCE_THIRD_PARTY_ARB) strcpy(debSource, "Third Party"); else if (source == _EXT_DEBUG_SOURCE_APPLICATION_ARB) strcpy(debSource, "Application"); else if (source == _EXT_DEBUG_SOURCE_OTHER_ARB) strcpy(debSource, "Other"); if (type == _EXT_DEBUG_TYPE_ERROR_ARB) strcpy(debType, "Error"); else if (type == _EXT_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB) strcpy(debType, "Deprecated behavior"); else if (type == _EXT_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB) strcpy(debType, "Undefined behavior"); else if (type == _EXT_DEBUG_TYPE_PORTABILITY_ARB) strcpy(debType, "Portability"); else if (type == _EXT_DEBUG_TYPE_PERFORMANCE_ARB) strcpy(debType, "Performance"); else if (type == _EXT_DEBUG_TYPE_OTHER_ARB) strcpy(debType, "Other"); if (severity == _EXT_DEBUG_SEVERITY_HIGH_ARB) strcpy(debSev, "High"); else if (severity == _EXT_DEBUG_SEVERITY_MEDIUM_ARB) strcpy(debSev, "Medium"); else if (severity == _EXT_DEBUG_SEVERITY_LOW_ARB) strcpy(debSev, "Low"); String output = String() + "GL ERROR: Source: " + debSource + "\tType: " + debType + "\tID: " + itos(id) + "\tSeverity: " + debSev + "\tMessage: " + message; ERR_PRINTS(output); }
void MessageQueue::_call_function(Object *p_target, const StringName &p_func, const Variant *p_args, int p_argcount, bool p_show_error) { const Variant **argptrs = NULL; if (p_argcount) { argptrs = (const Variant **)alloca(sizeof(Variant *) * p_argcount); for (int i = 0; i < p_argcount; i++) { argptrs[i] = &p_args[i]; } } Variant::CallError ce; p_target->call(p_func, argptrs, p_argcount, ce); if (p_show_error && ce.error != Variant::CallError::CALL_OK) { ERR_PRINTS("Error calling deferred method: " + Variant::get_call_error_text(p_target, p_func, argptrs, p_argcount, ce)); } }
void ResourceFormatImporter::get_internal_resource_path_list(const String &p_path, List<String> *r_paths) { Error err; FileAccess *f = FileAccess::open(p_path + ".import", FileAccess::READ, &err); if (!f) return; VariantParser::StreamFile stream; stream.f = f; String assign; Variant value; VariantParser::Tag next_tag; int lines = 0; String error_text; while (true) { assign = Variant(); next_tag.fields.clear(); next_tag.name = String(); err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true); if (err == ERR_FILE_EOF) { memdelete(f); return; } else if (err != OK) { ERR_PRINTS("ResourceFormatImporter::get_internal_resource_path_list - " + p_path + ".import:" + itos(lines) + " error: " + error_text); memdelete(f); return; } if (assign != String()) { if (assign.begins_with("path.")) { r_paths->push_back(value); } else if (assign == "path") { r_paths->push_back(value); } } else if (next_tag.name != "remap") { break; } } memdelete(f); }
void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p_from, const uint8_t *p_packet, int p_packet_len, int p_offset) { if (!p_node->can_call_rset(p_name, p_from)) return; ERR_FAIL_COND(p_offset >= p_packet_len); Variant value; decode_variant(value, &p_packet[p_offset], p_packet_len - p_offset); bool valid; p_node->set(p_name, value, &valid); if (!valid) { String error = "Error setting remote property '" + String(p_name) + "', not found in object of type " + p_node->get_class(); ERR_PRINTS(error); } }
static void _display_error_with_code(const String &p_error, const Vector<const char *> &p_code) { int line = 1; String total_code; for (int i = 0; i < p_code.size(); i++) { total_code += String(p_code[i]); } Vector<String> lines = String(total_code).split("\n"); for (int j = 0; j < lines.size(); j++) { print_line(itos(line) + ": " + lines[j]); line++; } ERR_PRINTS(p_error); }