Example #1
0
static int
_set_query_data(
	gnsdk_musicidfile_query_handle_t	query_handle
	)
{
	int									rc = 0;

	/* add our 6 sample files to the query */
	rc = _add_file(query_handle, MYAPP_SAMPLE_FILE_1);
	if (0 == rc)
	{
		rc = _add_file(query_handle, MYAPP_SAMPLE_FILE_2);
	}
	if (0 == rc)
	{
		rc = _add_file(query_handle, MYAPP_SAMPLE_FILE_3);
	}
	if (0 == rc)
	{
		rc = _add_file(query_handle, MYAPP_SAMPLE_FILE_4);
	}
	if (0 == rc)
	{
		rc = _add_file(query_handle, MYAPP_SAMPLE_FILE_5);
	}
	if (0 == rc)
	{
		rc = _add_file(query_handle, MYAPP_SAMPLE_FILE_6);
	}

	return rc;
}
Example #2
0
void GodotSharpExport::_export_begin(const Set<String> &p_features, bool p_debug, const String &p_path, int p_flags) {

	// TODO right now there is no way to stop the export process with an error

	ERR_FAIL_COND(!GDMono::get_singleton()->is_runtime_initialized());
	ERR_FAIL_NULL(TOOLS_DOMAIN);
	ERR_FAIL_NULL(GDMono::get_singleton()->get_editor_tools_assembly());

	if (FileAccess::exists(GodotSharpDirs::get_project_sln_path())) {
		String build_config = p_debug ? "Debug" : "Release";

		String scripts_metadata_path = GodotSharpDirs::get_res_metadata_dir().plus_file("scripts_metadata." + String(p_debug ? "debug" : "release"));
		Error metadata_err = CSharpProject::generate_scripts_metadata(GodotSharpDirs::get_project_csproj_path(), scripts_metadata_path);
		ERR_FAIL_COND(metadata_err != OK);

		ERR_FAIL_COND(!_add_file(scripts_metadata_path, scripts_metadata_path));

		// Turn export features into defines
		Vector<String> godot_defines;
		for (Set<String>::Element *E = p_features.front(); E; E = E->next()) {
			godot_defines.push_back(E->get());
		}
		ERR_FAIL_COND(!GodotSharpBuilds::build_project_blocking(build_config, godot_defines));

		// Add dependency assemblies

		Map<String, String> dependencies;

		String project_dll_name = ProjectSettings::get_singleton()->get("application/config/name");
		if (project_dll_name.empty()) {
			project_dll_name = "UnnamedProject";
		}

		String project_dll_src_dir = GodotSharpDirs::get_res_temp_assemblies_base_dir().plus_file(build_config);
		String project_dll_src_path = project_dll_src_dir.plus_file(project_dll_name + ".dll");
		dependencies.insert(project_dll_name, project_dll_src_path);

		{
			MonoDomain *export_domain = GDMonoUtils::create_domain("GodotEngine.ProjectExportDomain");
			ERR_FAIL_NULL(export_domain);
			_GDMONO_SCOPE_EXIT_DOMAIN_UNLOAD_(export_domain);

			_GDMONO_SCOPE_DOMAIN_(export_domain);

			GDMonoAssembly *scripts_assembly = NULL;
			bool load_success = GDMono::get_singleton()->load_assembly_from(project_dll_name,
					project_dll_src_path, &scripts_assembly, /* refonly: */ true);

			ERR_EXPLAIN("Cannot load refonly assembly: " + project_dll_name);
			ERR_FAIL_COND(!load_success);

			Vector<String> search_dirs;
			GDMonoAssembly::fill_search_dirs(search_dirs, build_config);
			Error depend_error = _get_assembly_dependencies(scripts_assembly, search_dirs, dependencies);
			ERR_FAIL_COND(depend_error != OK);
		}

		for (Map<String, String>::Element *E = dependencies.front(); E; E = E->next()) {
			String depend_src_path = E->value();
			String depend_dst_path = GodotSharpDirs::get_res_assemblies_dir().plus_file(depend_src_path.get_file());
			ERR_FAIL_COND(!_add_file(depend_src_path, depend_dst_path));
		}
	}

	// Mono specific export template extras (data dir)

	GDMonoClass *export_class = GDMono::get_singleton()->get_editor_tools_assembly()->get_class("GodotSharpTools.Editor", "GodotSharpExport");
	ERR_FAIL_NULL(export_class);
	GDMonoMethod *export_begin_method = export_class->get_method("_ExportBegin", 4);
	ERR_FAIL_NULL(export_begin_method);

	MonoArray *features = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(String), p_features.size());
	int i = 0;
	for (const Set<String>::Element *E = p_features.front(); E; E = E->next()) {
		MonoString *boxed = GDMonoMarshal::mono_string_from_godot(E->get());
		mono_array_set(features, MonoString *, i, boxed);
		i++;
	}

	MonoBoolean debug = p_debug;
	MonoString *path = GDMonoMarshal::mono_string_from_godot(p_path);
	uint32_t flags = p_flags;
	void *args[4] = { features, &debug, path, &flags };
	MonoException *exc = NULL;
	export_begin_method->invoke_raw(NULL, args, &exc);

	if (exc) {
		GDMonoUtils::debug_print_unhandled_exception(exc);
		ERR_FAIL();
	}
}