/* shortcut.c generated by valac 0.56.19, the Vala compiler
 * generated from shortcut.vala, do not modify */

#include "protonplus_core.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gee.h>
#include <gio/gio.h>
#include <glib/gstdio.h>
#include <errno.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _proton_plus_utils_vdf_binary_unref0(var) ((var == NULL) ? NULL : (var = (proton_plus_utils_vdf_binary_unref (var), NULL)))
typedef struct _ProtonPlusUtilsVdfShortcutsInstallData ProtonPlusUtilsVdfShortcutsInstallData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

struct _ProtonPlusUtilsVDFShortcutsPrivate {
	gchar* shortcuts_file_path;
};

struct _ProtonPlusUtilsVdfShortcutsInstallData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusUtilsVDFShortcuts* self;
	gboolean result;
};

static gint ProtonPlusUtilsVDFShortcuts_private_offset;
static gpointer proton_plus_utils_vdf_shortcuts_parent_class = NULL;

static ProtonPlusUtilsVDFShortcuts* proton_plus_utils_vdf_shortcuts_new (const gchar* path);
static ProtonPlusUtilsVDFShortcuts* proton_plus_utils_vdf_shortcuts_construct (GType object_type,
                                                                        const gchar* path);
static void proton_plus_utils_vdf_shortcuts_install_data_free (gpointer _data);
static gboolean proton_plus_utils_vdf_shortcuts_install_co (ProtonPlusUtilsVdfShortcutsInstallData* _data_);
static gchar* proton_plus_utils_vdf_shortcuts_install_icon (ProtonPlusUtilsVDFShortcuts* self);
static void proton_plus_utils_vdf_shortcuts_remove_icon (ProtonPlusUtilsVDFShortcuts* self,
                                                  GError** error);
static gchar* proton_plus_utils_vdf_shortcuts_get_icon_path (ProtonPlusUtilsVDFShortcuts* self);
static gboolean proton_plus_utils_vdf_shortcuts_is_shortcut_node (ProtonPlusUtilsVDFShortcuts* self,
                                                           const gchar* path);
static gboolean proton_plus_utils_vdf_shortcuts_get_shortcut_id_from_path (ProtonPlusUtilsVDFShortcuts* self,
                                                                    const gchar* path,
                                                                    gint* id);
static gint proton_plus_utils_vdf_shortcuts_get_first_unused_shortcut_id (ProtonPlusUtilsVDFShortcuts* self);
static void proton_plus_utils_vdf_shortcuts_write_shortcut_on_node (ProtonPlusUtilsVDFShortcuts* self,
                                                             ProtonPlusUtilsVDFNode* node,
                                                             ProtonPlusUtilsVDFShortcut* shortcut);
static void proton_plus_utils_vdf_shortcuts_finalize (ProtonPlusUtilsVDFBinary * obj);
static GType proton_plus_utils_vdf_shortcuts_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

void
proton_plus_utils_vdf_shortcut_copy (const ProtonPlusUtilsVDFShortcut* self,
                                     ProtonPlusUtilsVDFShortcut* dest)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	ProtonPlusUtilsVDFNode* _tmp16_;
	ProtonPlusUtilsVDFNode* _tmp17_;
	ProtonPlusUtilsVDFNode* _tmp18_;
	ProtonPlusUtilsVDFNode* _tmp19_;
	(*dest).AppID = (*self).AppID;
	(*dest).AllowDesktopConfig = (*self).AllowDesktopConfig;
	(*dest).AllowOverlay = (*self).AllowOverlay;
	_tmp0_ = (*self).AppName;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).AppName);
	(*dest).AppName = _tmp1_;
	(*dest).Devkit = (*self).Devkit;
	_tmp2_ = (*self).DevkitGameID;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 ((*dest).DevkitGameID);
	(*dest).DevkitGameID = _tmp3_;
	(*dest).DevkitOverrideAppID = (*self).DevkitOverrideAppID;
	_tmp4_ = (*self).Exe;
	_tmp5_ = g_strdup (_tmp4_);
	_g_free0 ((*dest).Exe);
	(*dest).Exe = _tmp5_;
	_tmp6_ = (*self).FlatpakAppID;
	_tmp7_ = g_strdup (_tmp6_);
	_g_free0 ((*dest).FlatpakAppID);
	(*dest).FlatpakAppID = _tmp7_;
	(*dest).IsHidden = (*self).IsHidden;
	(*dest).LastPlayTime = (*self).LastPlayTime;
	_tmp8_ = (*self).LaunchOptions;
	_tmp9_ = g_strdup (_tmp8_);
	_g_free0 ((*dest).LaunchOptions);
	(*dest).LaunchOptions = _tmp9_;
	(*dest).OpenVR = (*self).OpenVR;
	_tmp10_ = (*self).ShortcutPath;
	_tmp11_ = g_strdup (_tmp10_);
	_g_free0 ((*dest).ShortcutPath);
	(*dest).ShortcutPath = _tmp11_;
	_tmp12_ = (*self).StartDir;
	_tmp13_ = g_strdup (_tmp12_);
	_g_free0 ((*dest).StartDir);
	(*dest).StartDir = _tmp13_;
	_tmp14_ = (*self).Icon;
	_tmp15_ = g_strdup (_tmp14_);
	_g_free0 ((*dest).Icon);
	(*dest).Icon = _tmp15_;
	_tmp16_ = (*self).shortcut_node;
	_tmp17_ = _g_object_ref0 (_tmp16_);
	_g_object_unref0 ((*dest).shortcut_node);
	(*dest).shortcut_node = _tmp17_;
	_tmp18_ = (*self).shortcut_node_tags;
	_tmp19_ = _g_object_ref0 (_tmp18_);
	_g_object_unref0 ((*dest).shortcut_node_tags);
	(*dest).shortcut_node_tags = _tmp19_;
}

void
proton_plus_utils_vdf_shortcut_destroy (ProtonPlusUtilsVDFShortcut* self)
{
	_g_free0 ((*self).AppName);
	_g_free0 ((*self).DevkitGameID);
	_g_free0 ((*self).Exe);
	_g_free0 ((*self).FlatpakAppID);
	_g_free0 ((*self).LaunchOptions);
	_g_free0 ((*self).ShortcutPath);
	_g_free0 ((*self).StartDir);
	_g_free0 ((*self).Icon);
	_g_object_unref0 ((*self).shortcut_node);
	_g_object_unref0 ((*self).shortcut_node_tags);
}

ProtonPlusUtilsVDFShortcut*
proton_plus_utils_vdf_shortcut_dup (const ProtonPlusUtilsVDFShortcut* self)
{
	ProtonPlusUtilsVDFShortcut* dup;
	dup = g_new0 (ProtonPlusUtilsVDFShortcut, 1);
	proton_plus_utils_vdf_shortcut_copy (self, dup);
	return dup;
}

void
proton_plus_utils_vdf_shortcut_free (ProtonPlusUtilsVDFShortcut* self)
{
	proton_plus_utils_vdf_shortcut_destroy (self);
	g_free (self);
}

static GType
proton_plus_utils_vdf_shortcut_get_type_once (void)
{
	GType proton_plus_utils_vdf_shortcut_type_id;
	proton_plus_utils_vdf_shortcut_type_id = g_boxed_type_register_static ("ProtonPlusUtilsVDFShortcut", (GBoxedCopyFunc) proton_plus_utils_vdf_shortcut_dup, (GBoxedFreeFunc) proton_plus_utils_vdf_shortcut_free);
	return proton_plus_utils_vdf_shortcut_type_id;
}

GType
proton_plus_utils_vdf_shortcut_get_type (void)
{
	static volatile gsize proton_plus_utils_vdf_shortcut_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_vdf_shortcut_type_id__once)) {
		GType proton_plus_utils_vdf_shortcut_type_id;
		proton_plus_utils_vdf_shortcut_type_id = proton_plus_utils_vdf_shortcut_get_type_once ();
		g_once_init_leave (&proton_plus_utils_vdf_shortcut_type_id__once, proton_plus_utils_vdf_shortcut_type_id);
	}
	return proton_plus_utils_vdf_shortcut_type_id__once;
}

static inline gpointer
proton_plus_utils_vdf_shortcuts_get_instance_private (ProtonPlusUtilsVDFShortcuts* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsVDFShortcuts_private_offset);
}

static ProtonPlusUtilsVDFShortcuts*
proton_plus_utils_vdf_shortcuts_construct (GType object_type,
                                           const gchar* path)
{
	ProtonPlusUtilsVDFShortcuts* self = NULL;
	gchar* _tmp0_;
	g_return_val_if_fail (path != NULL, NULL);
	self = (ProtonPlusUtilsVDFShortcuts*) proton_plus_utils_vdf_binary_construct (object_type, path);
	_tmp0_ = g_strdup (path);
	_g_free0 (self->priv->shortcuts_file_path);
	self->priv->shortcuts_file_path = _tmp0_;
	return self;
}

static ProtonPlusUtilsVDFShortcuts*
proton_plus_utils_vdf_shortcuts_new (const gchar* path)
{
	return proton_plus_utils_vdf_shortcuts_construct (PROTON_PLUS_UTILS_VDF_TYPE_SHORTCUTS, path);
}

ProtonPlusUtilsVDFShortcuts*
proton_plus_utils_vdf_shortcuts_load (const gchar* path,
                                      GError** error)
{
	ProtonPlusUtilsVDFShortcuts* shortcuts = NULL;
	ProtonPlusUtilsVDFShortcuts* _tmp0_;
	GError* _inner_error0_ = NULL;
	ProtonPlusUtilsVDFShortcuts* result;
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = proton_plus_utils_vdf_shortcuts_new (path);
	shortcuts = _tmp0_;
	proton_plus_utils_vdf_binary_parse ((ProtonPlusUtilsVDFBinary*) shortcuts, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_proton_plus_utils_vdf_binary_unref0 (shortcuts);
		return NULL;
	}
	result = shortcuts;
	return result;
}

ProtonPlusUtilsVDFShortcuts*
proton_plus_utils_vdf_shortcuts_empty (const gchar* path)
{
	ProtonPlusUtilsVDFShortcuts* shortcuts = NULL;
	ProtonPlusUtilsVDFShortcuts* _tmp0_;
	GeeTreeMap* _tmp1_;
	GeeTreeMap* _tmp2_;
	ProtonPlusUtilsVDFNode* _tmp3_;
	ProtonPlusUtilsVDFNode* _tmp4_;
	ProtonPlusUtilsVDFShortcuts* result;
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = proton_plus_utils_vdf_shortcuts_new (path);
	shortcuts = _tmp0_;
	_tmp1_ = proton_plus_utils_vdf_binary_get_nodes ((ProtonPlusUtilsVDFBinary*) shortcuts);
	_tmp2_ = _tmp1_;
	_tmp3_ = proton_plus_utils_vdf_node_new ("shortcuts");
	_tmp4_ = _tmp3_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp2_, "shortcuts", _tmp4_);
	_g_object_unref0 (_tmp4_);
	result = shortcuts;
	return result;
}

static void
proton_plus_utils_vdf_shortcuts_install_data_free (gpointer _data)
{
	ProtonPlusUtilsVdfShortcutsInstallData* _data_;
	_data_ = _data;
	_proton_plus_utils_vdf_binary_unref0 (_data_->self);
	g_slice_free (ProtonPlusUtilsVdfShortcutsInstallData, _data_);
}

static gpointer
_proton_plus_utils_vdf_binary_ref0 (gpointer self)
{
	return self ? proton_plus_utils_vdf_binary_ref (self) : NULL;
}

void
proton_plus_utils_vdf_shortcuts_install (ProtonPlusUtilsVDFShortcuts* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	ProtonPlusUtilsVdfShortcutsInstallData* _data_;
	ProtonPlusUtilsVDFShortcuts* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsVdfShortcutsInstallData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_vdf_shortcuts_install_data_free);
	_tmp0_ = _proton_plus_utils_vdf_binary_ref0 (self);
	_data_->self = _tmp0_;
	proton_plus_utils_vdf_shortcuts_install_co (_data_);
}

gboolean
proton_plus_utils_vdf_shortcuts_install_finish (ProtonPlusUtilsVDFShortcuts* self,
                                                GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsVdfShortcutsInstallData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static gboolean
proton_plus_utils_vdf_shortcuts_install_co (ProtonPlusUtilsVdfShortcutsInstallData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->result = proton_plus_utils_vdf_shortcuts_install_for_current_environment (_data_->self);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

gboolean
proton_plus_utils_vdf_shortcuts_install_for_current_environment (ProtonPlusUtilsVDFShortcuts* self)
{
	ProtonPlusUtilsVDFShortcut pp_shortcut = {0};
	ProtonPlusUtilsVDFShortcut _tmp0_ = {0};
	gchar* exe = NULL;
	gchar* _tmp1_;
	gchar* launch_options = NULL;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* icon_path = NULL;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	gboolean _tmp31_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	pp_shortcut = _tmp0_;
	_tmp1_ = g_strdup ("");
	exe = _tmp1_;
	_tmp2_ = g_getenv ("LANG");
	_tmp3_ = g_strdup_printf ("LC_ALL=%s", _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strconcat (_tmp4_, " %command%", NULL);
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp4_);
	launch_options = _tmp6_;
	if (g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS)) {
		gchar* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp7_ = g_strdup ("\"/usr/bin/flatpak\"");
		_g_free0 (exe);
		exe = _tmp7_;
		_tmp8_ = launch_options;
		_tmp9_ = g_strconcat (_tmp8_, " \"run\" \"--branch=stable\" \"--arch=x86_64\" \"--command=protonplus\"" \
" \"com.vysp3r.ProtonPlus\"", NULL);
		_g_free0 (launch_options);
		launch_options = _tmp9_;
	} else {
		gchar* executable = NULL;
		gchar* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp10_ = g_find_program_in_path ("protonplus");
		executable = _tmp10_;
		_tmp11_ = executable;
		if (_tmp11_ == NULL) {
			result = FALSE;
			_g_free0 (executable);
			_g_free0 (launch_options);
			_g_free0 (exe);
			proton_plus_utils_vdf_shortcut_destroy (&pp_shortcut);
			return result;
		}
		_tmp12_ = executable;
		_tmp13_ = g_strdup ((const gchar*) _tmp12_);
		_g_free0 (exe);
		exe = _tmp13_;
		_g_free0 (executable);
	}
	_tmp14_ = proton_plus_utils_vdf_shortcuts_install_icon (self);
	icon_path = _tmp14_;
	_tmp15_ = icon_path;
	if (_tmp15_ == NULL) {
		result = FALSE;
		_g_free0 (icon_path);
		_g_free0 (launch_options);
		_g_free0 (exe);
		proton_plus_utils_vdf_shortcut_destroy (&pp_shortcut);
		return result;
	}
	{
		gchar* _tmp16_;
		const gchar* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		const gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		const gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		ProtonPlusUtilsVDFShortcut _tmp27_;
		pp_shortcut.AppID = (gint32) 1621167220;
		_tmp16_ = g_strdup ("ProtonPlus");
		_g_free0 (pp_shortcut.AppName);
		pp_shortcut.AppName = _tmp16_;
		_tmp17_ = exe;
		_tmp18_ = g_strdup (_tmp17_);
		_g_free0 (pp_shortcut.Exe);
		pp_shortcut.Exe = _tmp18_;
		_tmp19_ = g_strdup ("./");
		_g_free0 (pp_shortcut.StartDir);
		pp_shortcut.StartDir = _tmp19_;
		_tmp20_ = icon_path;
		_tmp21_ = g_strdup (_tmp20_);
		_g_free0 (pp_shortcut.Icon);
		pp_shortcut.Icon = _tmp21_;
		_tmp22_ = g_strdup ("");
		_g_free0 (pp_shortcut.ShortcutPath);
		pp_shortcut.ShortcutPath = _tmp22_;
		_tmp23_ = launch_options;
		_tmp24_ = g_strdup (_tmp23_);
		_g_free0 (pp_shortcut.LaunchOptions);
		pp_shortcut.LaunchOptions = _tmp24_;
		pp_shortcut.IsHidden = FALSE;
		pp_shortcut.AllowDesktopConfig = TRUE;
		pp_shortcut.AllowOverlay = TRUE;
		pp_shortcut.OpenVR = (gint32) 0;
		pp_shortcut.Devkit = (gint32) 0;
		_tmp25_ = g_strdup ("\0");
		_g_free0 (pp_shortcut.DevkitGameID);
		pp_shortcut.DevkitGameID = _tmp25_;
		pp_shortcut.DevkitOverrideAppID = (gint32) 0;
		pp_shortcut.LastPlayTime = (gint32) 0;
		_tmp26_ = g_strdup ("");
		_g_free0 (pp_shortcut.FlatpakAppID);
		pp_shortcut.FlatpakAppID = _tmp26_;
		_tmp27_ = pp_shortcut;
		proton_plus_utils_vdf_shortcuts_append_shortcut (self, &_tmp27_);
		proton_plus_utils_vdf_binary_save ((ProtonPlusUtilsVDFBinary*) self, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		result = TRUE;
		_g_free0 (icon_path);
		_g_free0 (launch_options);
		_g_free0 (exe);
		proton_plus_utils_vdf_shortcut_destroy (&pp_shortcut);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp29_;
		const gchar* _tmp30_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		{
			proton_plus_utils_vdf_shortcuts_remove_icon (self, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch1_g_error;
			}
		}
		goto __finally1;
		__catch1_g_error:
		{
			g_clear_error (&_inner_error0_);
		}
		__finally1:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp28_ = FALSE;
			_g_error_free0 (e);
			_g_free0 (icon_path);
			_g_free0 (launch_options);
			_g_free0 (exe);
			proton_plus_utils_vdf_shortcut_destroy (&pp_shortcut);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp28_;
		}
		_tmp29_ = e;
		_tmp30_ = _tmp29_->message;
		g_warning ("shortcut.vala:98: %s", _tmp30_);
		result = FALSE;
		_g_error_free0 (e);
		_g_free0 (icon_path);
		_g_free0 (launch_options);
		_g_free0 (exe);
		proton_plus_utils_vdf_shortcut_destroy (&pp_shortcut);
		return result;
	}
	__finally0:
	_g_free0 (icon_path);
	_g_free0 (launch_options);
	_g_free0 (exe);
	proton_plus_utils_vdf_shortcut_destroy (&pp_shortcut);
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return _tmp31_;
}

static gchar*
proton_plus_utils_vdf_shortcuts_install_icon (ProtonPlusUtilsVDFShortcuts* self)
{
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	{
		GBytes* icon_resource = NULL;
		GBytes* _tmp0_;
		gchar* icon_path = NULL;
		gchar* _tmp1_;
		GMemoryInputStream* input_stream = NULL;
		GBytes* _tmp2_;
		GMemoryInputStream* _tmp3_;
		GFile* icon_file = NULL;
		const gchar* _tmp4_;
		GFile* _tmp5_;
		GFileOutputStream* output_stream = NULL;
		GFile* _tmp6_;
		GFileOutputStream* _tmp7_;
		GFileOutputStream* _tmp8_;
		GMemoryInputStream* _tmp9_;
		_tmp0_ = g_resources_lookup_data ("/com/vysp3r/ProtonPlus/com.vysp3r.ProtonPlus.png", G_RESOURCE_LOOKUP_FLAGS_NONE, &_inner_error0_);
		icon_resource = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = proton_plus_utils_vdf_shortcuts_get_icon_path (self);
		icon_path = _tmp1_;
		_tmp2_ = icon_resource;
		_tmp3_ = (GMemoryInputStream*) g_memory_input_stream_new_from_bytes (_tmp2_);
		input_stream = _tmp3_;
		_tmp4_ = icon_path;
		_tmp5_ = g_file_new_for_path (_tmp4_);
		icon_file = _tmp5_;
		_tmp6_ = icon_file;
		_tmp7_ = g_file_replace (_tmp6_, NULL, FALSE, G_FILE_CREATE_PRIVATE, NULL, &_inner_error0_);
		output_stream = _tmp7_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (icon_file);
			_g_object_unref0 (input_stream);
			_g_free0 (icon_path);
			_g_bytes_unref0 (icon_resource);
			goto __catch0_g_error;
		}
		_tmp8_ = output_stream;
		_tmp9_ = input_stream;
		g_output_stream_splice ((GOutputStream*) _tmp8_, (GInputStream*) _tmp9_, G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (output_stream);
			_g_object_unref0 (icon_file);
			_g_object_unref0 (input_stream);
			_g_free0 (icon_path);
			_g_bytes_unref0 (icon_resource);
			goto __catch0_g_error;
		}
		result = icon_path;
		_g_object_unref0 (output_stream);
		_g_object_unref0 (icon_file);
		_g_object_unref0 (input_stream);
		_g_bytes_unref0 (icon_resource);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp10_;
		const gchar* _tmp11_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp10_ = e;
		_tmp11_ = _tmp10_->message;
		g_warning ("shortcut.vala:119: %s", _tmp11_);
		result = NULL;
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static void
proton_plus_utils_vdf_shortcuts_remove_icon (ProtonPlusUtilsVDFShortcuts* self,
                                             GError** error)
{
	GFile* icon_file = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	GFile* _tmp2_;
	GFile* _tmp3_;
	GFile* _tmp4_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = proton_plus_utils_vdf_shortcuts_get_icon_path (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_file_new_for_path (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	icon_file = _tmp3_;
	_tmp4_ = icon_file;
	if (g_file_query_exists (_tmp4_, NULL)) {
		GFile* _tmp5_;
		_tmp5_ = icon_file;
		g_file_delete (_tmp5_, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (icon_file);
			return;
		}
	}
	_g_object_unref0 (icon_file);
}

static gchar*
proton_plus_utils_vdf_shortcuts_get_icon_path (ProtonPlusUtilsVDFShortcuts* self)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->shortcuts_file_path;
	_tmp1_ = g_path_get_dirname (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_build_filename (_tmp2_, "com.vysp3r.ProtonPlus.png", NULL);
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp2_);
	result = _tmp4_;
	return result;
}

gboolean
proton_plus_utils_vdf_shortcuts_uninstall (ProtonPlusUtilsVDFShortcuts* self)
{
	gboolean _tmp2_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	{
		proton_plus_utils_vdf_shortcuts_remove_shortcut_by_name (self, "ProtonPlus", &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		proton_plus_utils_vdf_binary_save ((ProtonPlusUtilsVDFBinary*) self, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		proton_plus_utils_vdf_shortcuts_remove_icon (self, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		result = TRUE;
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		g_warning ("shortcut.vala:144: %s", _tmp1_);
		result = FALSE;
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return _tmp2_;
}

gboolean
proton_plus_utils_vdf_shortcuts_get_installed_status (ProtonPlusUtilsVDFShortcuts* self)
{
	ProtonPlusUtilsVDFShortcut shortcut = {0};
	ProtonPlusUtilsVDFShortcut _tmp0_ = {0};
	ProtonPlusUtilsVDFShortcut _tmp1_;
	const gchar* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	proton_plus_utils_vdf_shortcuts_get_shortcut_by_name (self, "ProtonPlus", &_tmp0_);
	shortcut = _tmp0_;
	_tmp1_ = shortcut;
	_tmp2_ = _tmp1_.AppName;
	result = _tmp2_ != NULL;
	proton_plus_utils_vdf_shortcut_destroy (&shortcut);
	return result;
}

gsize
proton_plus_utils_vdf_shortcuts_get_shortcuts_count (ProtonPlusUtilsVDFShortcuts* self)
{
	gsize count = 0UL;
	gsize result;
	g_return_val_if_fail (self != NULL, 0UL);
	count = (gsize) 0;
	{
		GeeIterator* _entry_it = NULL;
		GeeTreeMap* _tmp0_;
		GeeTreeMap* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeIterator* _tmp5_;
		GeeIterator* _tmp6_;
		_tmp0_ = proton_plus_utils_vdf_binary_get_nodes ((ProtonPlusUtilsVDFBinary*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_entry_it = _tmp6_;
		while (TRUE) {
			GeeIterator* _tmp7_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp8_;
			gpointer _tmp9_;
			GeeMapEntry* _tmp10_;
			gconstpointer _tmp11_;
			gconstpointer _tmp12_;
			_tmp7_ = _entry_it;
			if (!gee_iterator_next (_tmp7_)) {
				break;
			}
			_tmp8_ = _entry_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			entry = (GeeMapEntry*) _tmp9_;
			_tmp10_ = entry;
			_tmp11_ = gee_map_entry_get_key (_tmp10_);
			_tmp12_ = _tmp11_;
			if (proton_plus_utils_vdf_shortcuts_is_shortcut_node (self, (const gchar*) _tmp12_)) {
				gsize _tmp13_;
				_tmp13_ = count;
				count = _tmp13_ + 1;
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	result = count;
	return result;
}

static gboolean
int_try_parse (const gchar* str,
               gint* _result_,
               const gchar** unparsed,
               guint _base)
{
	gint _vala__result_ = 0;
	const gchar* _vala_unparsed = NULL;
	gchar* endptr = NULL;
	glong long_result = 0L;
	gchar* _tmp0_ = NULL;
	glong _tmp1_;
	gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	glong _tmp6_;
	gboolean result;
	g_return_val_if_fail (str != NULL, FALSE);
	errno = 0;
	_tmp1_ = strtol (str, &_tmp0_, (gint) _base);
	endptr = _tmp0_;
	long_result = _tmp1_;
	_tmp2_ = endptr;
	_tmp3_ = strlen (str);
	_tmp4_ = _tmp3_;
	if (_tmp2_ == (((gchar*) str) + _tmp4_)) {
		_vala_unparsed = "";
	} else {
		gchar* _tmp5_;
		_tmp5_ = endptr;
		_vala_unparsed = (const gchar*) _tmp5_;
	}
	_tmp6_ = long_result;
	if ((((glong) G_MININT) <= _tmp6_) && (_tmp6_ <= ((glong) G_MAXINT))) {
		gboolean _tmp7_ = FALSE;
		gboolean _tmp8_ = FALSE;
		_vala__result_ = (gint) long_result;
		if (errno != ERANGE) {
			_tmp8_ = errno != EINVAL;
		} else {
			_tmp8_ = FALSE;
		}
		if (_tmp8_) {
			const gchar* _tmp9_;
			gchar* _tmp10_;
			_tmp9_ = _vala_unparsed;
			_tmp10_ = endptr;
			_tmp7_ = _tmp9_ != _tmp10_;
		} else {
			_tmp7_ = FALSE;
		}
		result = _tmp7_;
		if (_result_) {
			*_result_ = _vala__result_;
		}
		if (unparsed) {
			*unparsed = _vala_unparsed;
		}
		return result;
	} else {
		_vala__result_ = G_MAXINT;
		result = FALSE;
		if (_result_) {
			*_result_ = _vala__result_;
		}
		if (unparsed) {
			*unparsed = _vala_unparsed;
		}
		return result;
	}
}

static gboolean
proton_plus_utils_vdf_shortcuts_get_shortcut_id_from_path (ProtonPlusUtilsVDFShortcuts* self,
                                                           const gchar* path,
                                                           gint* id)
{
	gint _vala_id = 0;
	gchar** components = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint components_length1;
	gint _components_size_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	_tmp1_ = _tmp0_ = g_strsplit (path, ".", 0);
	components = _tmp1_;
	components_length1 = _vala_array_length (_tmp0_);
	_components_size_ = components_length1;
	_vala_id = -1;
	_tmp5_ = components;
	_tmp5__length1 = components_length1;
	if (_tmp5__length1 >= 2) {
		gchar** _tmp6_;
		gint _tmp6__length1;
		const gchar* _tmp7_;
		_tmp6_ = components;
		_tmp6__length1 = components_length1;
		_tmp7_ = _tmp6_[0];
		_tmp4_ = g_strcmp0 (_tmp7_, "shortcuts") == 0;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		gchar** _tmp8_;
		gint _tmp8__length1;
		const gchar* _tmp9_;
		gint _tmp10_ = 0;
		gboolean _tmp11_;
		_tmp8_ = components;
		_tmp8__length1 = components_length1;
		_tmp9_ = _tmp8_[1];
		_tmp11_ = int_try_parse (_tmp9_, &_tmp10_, NULL, (guint) 0);
		_vala_id = _tmp10_;
		_tmp3_ = _tmp11_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		_tmp2_ = _vala_id >= 0;
	} else {
		_tmp2_ = FALSE;
	}
	result = _tmp2_;
	components = (_vala_array_free (components, components_length1, (GDestroyNotify) g_free), NULL);
	if (id) {
		*id = _vala_id;
	}
	return result;
}

static gboolean
proton_plus_utils_vdf_shortcuts_is_shortcut_node (ProtonPlusUtilsVDFShortcuts* self,
                                                  const gchar* path)
{
	gint id = 0;
	gboolean _tmp0_ = FALSE;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (path != NULL, FALSE);
	_tmp2_ = _tmp1_ = g_strsplit (path, ".", 0);
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _vala_array_length (_tmp1_);
	_tmp4_ = _vala_array_length (_tmp1_) == 2;
	_tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
	if (_tmp4_) {
		gint _tmp5_ = 0;
		gboolean _tmp6_;
		_tmp6_ = proton_plus_utils_vdf_shortcuts_get_shortcut_id_from_path (self, path, &_tmp5_);
		id = _tmp5_;
		_tmp0_ = _tmp6_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gint
proton_plus_utils_vdf_shortcuts_get_first_unused_shortcut_id (ProtonPlusUtilsVDFShortcuts* self)
{
	GeeHashSet* used_ids = NULL;
	GeeHashSet* _tmp0_;
	gint id = 0;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = gee_hash_set_new (G_TYPE_INT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	used_ids = _tmp0_;
	{
		GeeIterator* _entry_it = NULL;
		GeeTreeMap* _tmp1_;
		GeeTreeMap* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeSet* _tmp5_;
		GeeIterator* _tmp6_;
		GeeIterator* _tmp7_;
		_tmp1_ = proton_plus_utils_vdf_binary_get_nodes ((ProtonPlusUtilsVDFBinary*) self);
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_;
		_tmp6_ = gee_iterable_iterator ((GeeIterable*) _tmp5_);
		_tmp7_ = _tmp6_;
		_g_object_unref0 (_tmp5_);
		_entry_it = _tmp7_;
		while (TRUE) {
			GeeIterator* _tmp8_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp9_;
			gpointer _tmp10_;
			gint id = 0;
			GeeMapEntry* _tmp11_;
			gconstpointer _tmp12_;
			gconstpointer _tmp13_;
			gint _tmp14_ = 0;
			gboolean _tmp15_;
			_tmp8_ = _entry_it;
			if (!gee_iterator_next (_tmp8_)) {
				break;
			}
			_tmp9_ = _entry_it;
			_tmp10_ = gee_iterator_get (_tmp9_);
			entry = (GeeMapEntry*) _tmp10_;
			_tmp11_ = entry;
			_tmp12_ = gee_map_entry_get_key (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp15_ = proton_plus_utils_vdf_shortcuts_get_shortcut_id_from_path (self, (const gchar*) _tmp13_, &_tmp14_);
			id = _tmp14_;
			if (_tmp15_) {
				GeeHashSet* _tmp16_;
				_tmp16_ = used_ids;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, (gpointer) ((gintptr) id));
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	id = 0;
	while (TRUE) {
		GeeHashSet* _tmp17_;
		gint _tmp18_;
		_tmp17_ = used_ids;
		if (!gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp17_, (gpointer) ((gintptr) id))) {
			break;
		}
		_tmp18_ = id;
		id = _tmp18_ + 1;
	}
	result = id;
	_g_object_unref0 (used_ids);
	return result;
}

void
proton_plus_utils_vdf_shortcuts_get_shortcut_by_name (ProtonPlusUtilsVDFShortcuts* self,
                                                      const gchar* name,
                                                      ProtonPlusUtilsVDFShortcut* result)
{
	ProtonPlusUtilsVDFShortcut shortcut = {0};
	ProtonPlusUtilsVDFShortcut _tmp0_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	shortcut = _tmp0_;
	{
		GeeIterator* _entry_it = NULL;
		GeeTreeMap* _tmp1_;
		GeeTreeMap* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeSet* _tmp5_;
		GeeIterator* _tmp6_;
		GeeIterator* _tmp7_;
		_tmp1_ = proton_plus_utils_vdf_binary_get_nodes ((ProtonPlusUtilsVDFBinary*) self);
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_;
		_tmp6_ = gee_iterable_iterator ((GeeIterable*) _tmp5_);
		_tmp7_ = _tmp6_;
		_g_object_unref0 (_tmp5_);
		_entry_it = _tmp7_;
		while (TRUE) {
			GeeIterator* _tmp8_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp9_;
			gpointer _tmp10_;
			GeeMapEntry* _tmp11_;
			gconstpointer _tmp12_;
			gconstpointer _tmp13_;
			_tmp8_ = _entry_it;
			if (!gee_iterator_next (_tmp8_)) {
				break;
			}
			_tmp9_ = _entry_it;
			_tmp10_ = gee_iterator_get (_tmp9_);
			entry = (GeeMapEntry*) _tmp10_;
			_tmp11_ = entry;
			_tmp12_ = gee_map_entry_get_key (_tmp11_);
			_tmp13_ = _tmp12_;
			if (proton_plus_utils_vdf_shortcuts_is_shortcut_node (self, (const gchar*) _tmp13_)) {
				gboolean _tmp14_ = FALSE;
				GeeMapEntry* _tmp15_;
				gconstpointer _tmp16_;
				gconstpointer _tmp17_;
				_tmp15_ = entry;
				_tmp16_ = gee_map_entry_get_value (_tmp15_);
				_tmp17_ = _tmp16_;
				if (gee_abstract_map_has_key ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp17_), "AppName")) {
					GeeMapEntry* _tmp18_;
					gconstpointer _tmp19_;
					gconstpointer _tmp20_;
					gpointer _tmp21_;
					GVariant* _tmp22_;
					const gchar* _tmp23_;
					_tmp18_ = entry;
					_tmp19_ = gee_map_entry_get_value (_tmp18_);
					_tmp20_ = _tmp19_;
					_tmp21_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp20_), "AppName");
					_tmp22_ = (GVariant*) _tmp21_;
					_tmp23_ = g_variant_get_string (_tmp22_, NULL);
					_tmp14_ = g_strcmp0 (_tmp23_, name) == 0;
					_g_variant_unref0 (_tmp22_);
				} else {
					_tmp14_ = FALSE;
				}
				if (_tmp14_) {
					GeeMapEntry* _tmp24_;
					gconstpointer _tmp25_;
					gconstpointer _tmp26_;
					gpointer _tmp27_;
					GVariant* _tmp28_;
					gboolean _tmp29_ = FALSE;
					GeeMapEntry* _tmp30_;
					gconstpointer _tmp31_;
					gconstpointer _tmp32_;
					gpointer _tmp33_;
					GVariant* _tmp34_;
					gboolean _tmp35_;
					gboolean _tmp36_ = FALSE;
					GeeMapEntry* _tmp37_;
					gconstpointer _tmp38_;
					gconstpointer _tmp39_;
					gpointer _tmp40_;
					GVariant* _tmp41_;
					gboolean _tmp42_;
					GeeMapEntry* _tmp43_;
					gconstpointer _tmp44_;
					gconstpointer _tmp45_;
					gpointer _tmp46_;
					GVariant* _tmp47_;
					const gchar* _tmp48_;
					gchar* _tmp49_;
					GeeMapEntry* _tmp50_;
					gconstpointer _tmp51_;
					gconstpointer _tmp52_;
					gpointer _tmp53_;
					GVariant* _tmp54_;
					GeeMapEntry* _tmp55_;
					gconstpointer _tmp56_;
					gconstpointer _tmp57_;
					gpointer _tmp58_;
					GVariant* _tmp59_;
					const gchar* _tmp60_;
					gchar* _tmp61_;
					GeeMapEntry* _tmp62_;
					gconstpointer _tmp63_;
					gconstpointer _tmp64_;
					gpointer _tmp65_;
					GVariant* _tmp66_;
					GeeMapEntry* _tmp67_;
					gconstpointer _tmp68_;
					gconstpointer _tmp69_;
					gpointer _tmp70_;
					GVariant* _tmp71_;
					const gchar* _tmp72_;
					gchar* _tmp73_;
					GeeMapEntry* _tmp74_;
					gconstpointer _tmp75_;
					gconstpointer _tmp76_;
					gpointer _tmp77_;
					GVariant* _tmp78_;
					const gchar* _tmp79_;
					gchar* _tmp80_;
					gboolean _tmp81_ = FALSE;
					GeeMapEntry* _tmp82_;
					gconstpointer _tmp83_;
					gconstpointer _tmp84_;
					gpointer _tmp85_;
					GVariant* _tmp86_;
					gboolean _tmp87_;
					GeeMapEntry* _tmp88_;
					gconstpointer _tmp89_;
					gconstpointer _tmp90_;
					gpointer _tmp91_;
					GVariant* _tmp92_;
					GeeMapEntry* _tmp93_;
					gconstpointer _tmp94_;
					gconstpointer _tmp95_;
					gpointer _tmp96_;
					GVariant* _tmp97_;
					const gchar* _tmp98_;
					gchar* _tmp99_;
					GeeMapEntry* _tmp100_;
					gconstpointer _tmp101_;
					gconstpointer _tmp102_;
					gpointer _tmp103_;
					GVariant* _tmp104_;
					GeeMapEntry* _tmp105_;
					gconstpointer _tmp106_;
					gconstpointer _tmp107_;
					gpointer _tmp108_;
					GVariant* _tmp109_;
					const gchar* _tmp110_;
					gchar* _tmp111_;
					GeeMapEntry* _tmp112_;
					gconstpointer _tmp113_;
					gconstpointer _tmp114_;
					gpointer _tmp115_;
					GVariant* _tmp116_;
					const gchar* _tmp117_;
					gchar* _tmp118_;
					GeeMapEntry* _tmp119_;
					gconstpointer _tmp120_;
					gconstpointer _tmp121_;
					gpointer _tmp122_;
					GVariant* _tmp123_;
					const gchar* _tmp124_;
					gchar* _tmp125_;
					_tmp24_ = entry;
					_tmp25_ = gee_map_entry_get_value (_tmp24_);
					_tmp26_ = _tmp25_;
					_tmp27_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp26_), "appid");
					_tmp28_ = (GVariant*) _tmp27_;
					shortcut.AppID = g_variant_get_int32 (_tmp28_);
					_g_variant_unref0 (_tmp28_);
					_tmp30_ = entry;
					_tmp31_ = gee_map_entry_get_value (_tmp30_);
					_tmp32_ = _tmp31_;
					_tmp33_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp32_), "AllowDesktopConfig");
					_tmp34_ = (GVariant*) _tmp33_;
					_tmp35_ = g_variant_get_int32 (_tmp34_) > ((gint32) 0);
					_g_variant_unref0 (_tmp34_);
					if (_tmp35_) {
						_tmp29_ = TRUE;
					} else {
						_tmp29_ = FALSE;
					}
					shortcut.AllowDesktopConfig = _tmp29_;
					_tmp37_ = entry;
					_tmp38_ = gee_map_entry_get_value (_tmp37_);
					_tmp39_ = _tmp38_;
					_tmp40_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp39_), "AllowOverlay");
					_tmp41_ = (GVariant*) _tmp40_;
					_tmp42_ = g_variant_get_int32 (_tmp41_) > ((gint32) 0);
					_g_variant_unref0 (_tmp41_);
					if (_tmp42_) {
						_tmp36_ = TRUE;
					} else {
						_tmp36_ = FALSE;
					}
					shortcut.AllowOverlay = _tmp36_;
					_tmp43_ = entry;
					_tmp44_ = gee_map_entry_get_value (_tmp43_);
					_tmp45_ = _tmp44_;
					_tmp46_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp45_), "AppName");
					_tmp47_ = (GVariant*) _tmp46_;
					_tmp48_ = g_variant_get_string (_tmp47_, NULL);
					_tmp49_ = g_strdup (_tmp48_);
					_g_free0 (shortcut.AppName);
					shortcut.AppName = _tmp49_;
					_g_variant_unref0 (_tmp47_);
					_tmp50_ = entry;
					_tmp51_ = gee_map_entry_get_value (_tmp50_);
					_tmp52_ = _tmp51_;
					_tmp53_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp52_), "Devkit");
					_tmp54_ = (GVariant*) _tmp53_;
					shortcut.Devkit = g_variant_get_int32 (_tmp54_);
					_g_variant_unref0 (_tmp54_);
					_tmp55_ = entry;
					_tmp56_ = gee_map_entry_get_value (_tmp55_);
					_tmp57_ = _tmp56_;
					_tmp58_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp57_), "DevkitGameID");
					_tmp59_ = (GVariant*) _tmp58_;
					_tmp60_ = g_variant_get_string (_tmp59_, NULL);
					_tmp61_ = g_strdup (_tmp60_);
					_g_free0 (shortcut.DevkitGameID);
					shortcut.DevkitGameID = _tmp61_;
					_g_variant_unref0 (_tmp59_);
					_tmp62_ = entry;
					_tmp63_ = gee_map_entry_get_value (_tmp62_);
					_tmp64_ = _tmp63_;
					_tmp65_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp64_), "DevkitOverrideAppID");
					_tmp66_ = (GVariant*) _tmp65_;
					shortcut.DevkitOverrideAppID = g_variant_get_int32 (_tmp66_);
					_g_variant_unref0 (_tmp66_);
					_tmp67_ = entry;
					_tmp68_ = gee_map_entry_get_value (_tmp67_);
					_tmp69_ = _tmp68_;
					_tmp70_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp69_), "Exe");
					_tmp71_ = (GVariant*) _tmp70_;
					_tmp72_ = g_variant_get_string (_tmp71_, NULL);
					_tmp73_ = g_strdup (_tmp72_);
					_g_free0 (shortcut.Exe);
					shortcut.Exe = _tmp73_;
					_g_variant_unref0 (_tmp71_);
					_tmp74_ = entry;
					_tmp75_ = gee_map_entry_get_value (_tmp74_);
					_tmp76_ = _tmp75_;
					_tmp77_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp76_), "FlatpakAppID");
					_tmp78_ = (GVariant*) _tmp77_;
					_tmp79_ = g_variant_get_string (_tmp78_, NULL);
					_tmp80_ = g_strdup (_tmp79_);
					_g_free0 (shortcut.FlatpakAppID);
					shortcut.FlatpakAppID = _tmp80_;
					_g_variant_unref0 (_tmp78_);
					_tmp82_ = entry;
					_tmp83_ = gee_map_entry_get_value (_tmp82_);
					_tmp84_ = _tmp83_;
					_tmp85_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp84_), "IsHidden");
					_tmp86_ = (GVariant*) _tmp85_;
					_tmp87_ = g_variant_get_int32 (_tmp86_) > ((gint32) 0);
					_g_variant_unref0 (_tmp86_);
					if (_tmp87_) {
						_tmp81_ = TRUE;
					} else {
						_tmp81_ = FALSE;
					}
					shortcut.IsHidden = _tmp81_;
					_tmp88_ = entry;
					_tmp89_ = gee_map_entry_get_value (_tmp88_);
					_tmp90_ = _tmp89_;
					_tmp91_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp90_), "LastPlayTime");
					_tmp92_ = (GVariant*) _tmp91_;
					shortcut.LastPlayTime = g_variant_get_int32 (_tmp92_);
					_g_variant_unref0 (_tmp92_);
					_tmp93_ = entry;
					_tmp94_ = gee_map_entry_get_value (_tmp93_);
					_tmp95_ = _tmp94_;
					_tmp96_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp95_), "LaunchOptions");
					_tmp97_ = (GVariant*) _tmp96_;
					_tmp98_ = g_variant_get_string (_tmp97_, NULL);
					_tmp99_ = g_strdup (_tmp98_);
					_g_free0 (shortcut.LaunchOptions);
					shortcut.LaunchOptions = _tmp99_;
					_g_variant_unref0 (_tmp97_);
					_tmp100_ = entry;
					_tmp101_ = gee_map_entry_get_value (_tmp100_);
					_tmp102_ = _tmp101_;
					_tmp103_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp102_), "OpenVR");
					_tmp104_ = (GVariant*) _tmp103_;
					shortcut.OpenVR = g_variant_get_int32 (_tmp104_);
					_g_variant_unref0 (_tmp104_);
					_tmp105_ = entry;
					_tmp106_ = gee_map_entry_get_value (_tmp105_);
					_tmp107_ = _tmp106_;
					_tmp108_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp107_), "ShortcutPath");
					_tmp109_ = (GVariant*) _tmp108_;
					_tmp110_ = g_variant_get_string (_tmp109_, NULL);
					_tmp111_ = g_strdup (_tmp110_);
					_g_free0 (shortcut.ShortcutPath);
					shortcut.ShortcutPath = _tmp111_;
					_g_variant_unref0 (_tmp109_);
					_tmp112_ = entry;
					_tmp113_ = gee_map_entry_get_value (_tmp112_);
					_tmp114_ = _tmp113_;
					_tmp115_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp114_), "StartDir");
					_tmp116_ = (GVariant*) _tmp115_;
					_tmp117_ = g_variant_get_string (_tmp116_, NULL);
					_tmp118_ = g_strdup (_tmp117_);
					_g_free0 (shortcut.StartDir);
					shortcut.StartDir = _tmp118_;
					_g_variant_unref0 (_tmp116_);
					_tmp119_ = entry;
					_tmp120_ = gee_map_entry_get_value (_tmp119_);
					_tmp121_ = _tmp120_;
					_tmp122_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp121_), "icon");
					_tmp123_ = (GVariant*) _tmp122_;
					_tmp124_ = g_variant_get_string (_tmp123_, NULL);
					_tmp125_ = g_strdup (_tmp124_);
					_g_free0 (shortcut.Icon);
					shortcut.Icon = _tmp125_;
					_g_variant_unref0 (_tmp123_);
				}
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	*result = shortcut;
	return;
}

void
proton_plus_utils_vdf_shortcuts_get_shortcut_by_appid (ProtonPlusUtilsVDFShortcuts* self,
                                                       guint appid,
                                                       ProtonPlusUtilsVDFShortcut* result)
{
	ProtonPlusUtilsVDFShortcut shortcut = {0};
	ProtonPlusUtilsVDFShortcut _tmp0_ = {0};
	g_return_if_fail (self != NULL);
	shortcut = _tmp0_;
	{
		GeeIterator* _entry_it = NULL;
		GeeTreeMap* _tmp1_;
		GeeTreeMap* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeSet* _tmp5_;
		GeeIterator* _tmp6_;
		GeeIterator* _tmp7_;
		_tmp1_ = proton_plus_utils_vdf_binary_get_nodes ((ProtonPlusUtilsVDFBinary*) self);
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_;
		_tmp6_ = gee_iterable_iterator ((GeeIterable*) _tmp5_);
		_tmp7_ = _tmp6_;
		_g_object_unref0 (_tmp5_);
		_entry_it = _tmp7_;
		while (TRUE) {
			GeeIterator* _tmp8_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp9_;
			gpointer _tmp10_;
			gboolean _tmp11_ = FALSE;
			gboolean _tmp12_ = FALSE;
			GeeMapEntry* _tmp13_;
			gconstpointer _tmp14_;
			gconstpointer _tmp15_;
			_tmp8_ = _entry_it;
			if (!gee_iterator_next (_tmp8_)) {
				break;
			}
			_tmp9_ = _entry_it;
			_tmp10_ = gee_iterator_get (_tmp9_);
			entry = (GeeMapEntry*) _tmp10_;
			_tmp13_ = entry;
			_tmp14_ = gee_map_entry_get_key (_tmp13_);
			_tmp15_ = _tmp14_;
			if (proton_plus_utils_vdf_shortcuts_is_shortcut_node (self, (const gchar*) _tmp15_)) {
				GeeMapEntry* _tmp16_;
				gconstpointer _tmp17_;
				gconstpointer _tmp18_;
				_tmp16_ = entry;
				_tmp17_ = gee_map_entry_get_value (_tmp16_);
				_tmp18_ = _tmp17_;
				_tmp12_ = gee_abstract_map_has_key ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp18_), "appid");
			} else {
				_tmp12_ = FALSE;
			}
			if (_tmp12_) {
				GeeMapEntry* _tmp19_;
				gconstpointer _tmp20_;
				gconstpointer _tmp21_;
				gpointer _tmp22_;
				GVariant* _tmp23_;
				_tmp19_ = entry;
				_tmp20_ = gee_map_entry_get_value (_tmp19_);
				_tmp21_ = _tmp20_;
				_tmp22_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp21_), "appid");
				_tmp23_ = (GVariant*) _tmp22_;
				_tmp11_ = ((guint) g_variant_get_int32 (_tmp23_)) == appid;
				_g_variant_unref0 (_tmp23_);
			} else {
				_tmp11_ = FALSE;
			}
			if (_tmp11_) {
				GeeMapEntry* _tmp24_;
				gconstpointer _tmp25_;
				gconstpointer _tmp26_;
				gpointer _tmp27_;
				GVariant* _tmp28_;
				const gchar* _tmp29_;
				ProtonPlusUtilsVDFShortcut _tmp30_ = {0};
				_tmp24_ = entry;
				_tmp25_ = gee_map_entry_get_value (_tmp24_);
				_tmp26_ = _tmp25_;
				_tmp27_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp26_), "AppName");
				_tmp28_ = (GVariant*) _tmp27_;
				_tmp29_ = g_variant_get_string (_tmp28_, NULL);
				proton_plus_utils_vdf_shortcuts_get_shortcut_by_name (self, _tmp29_, &_tmp30_);
				proton_plus_utils_vdf_shortcut_destroy (&shortcut);
				shortcut = _tmp30_;
				_g_variant_unref0 (_tmp28_);
				_g_object_unref0 (entry);
				break;
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	*result = shortcut;
	return;
}

void
proton_plus_utils_vdf_shortcuts_replace_shortcut_by_name (ProtonPlusUtilsVDFShortcuts* self,
                                                          const gchar* name,
                                                          ProtonPlusUtilsVDFShortcut* shortcut)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (shortcut != NULL);
	{
		GeeIterator* _entry_it = NULL;
		GeeTreeMap* _tmp0_;
		GeeTreeMap* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeIterator* _tmp5_;
		GeeIterator* _tmp6_;
		_tmp0_ = proton_plus_utils_vdf_binary_get_nodes ((ProtonPlusUtilsVDFBinary*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_entry_it = _tmp6_;
		while (TRUE) {
			GeeIterator* _tmp7_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp8_;
			gpointer _tmp9_;
			GeeMapEntry* _tmp10_;
			gconstpointer _tmp11_;
			gconstpointer _tmp12_;
			_tmp7_ = _entry_it;
			if (!gee_iterator_next (_tmp7_)) {
				break;
			}
			_tmp8_ = _entry_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			entry = (GeeMapEntry*) _tmp9_;
			_tmp10_ = entry;
			_tmp11_ = gee_map_entry_get_key (_tmp10_);
			_tmp12_ = _tmp11_;
			if (proton_plus_utils_vdf_shortcuts_is_shortcut_node (self, (const gchar*) _tmp12_)) {
				GeeMapEntry* _tmp13_;
				gconstpointer _tmp14_;
				gconstpointer _tmp15_;
				gpointer _tmp16_;
				GVariant* _tmp17_;
				const gchar* _tmp18_;
				gboolean _tmp19_;
				_tmp13_ = entry;
				_tmp14_ = gee_map_entry_get_value (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp16_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp15_), "AppName");
				_tmp17_ = (GVariant*) _tmp16_;
				_tmp18_ = g_variant_get_string (_tmp17_, NULL);
				_tmp19_ = g_strcmp0 (_tmp18_, name) == 0;
				_g_variant_unref0 (_tmp17_);
				if (_tmp19_) {
					GeeMapEntry* _tmp20_;
					gconstpointer _tmp21_;
					gconstpointer _tmp22_;
					ProtonPlusUtilsVDFShortcut _tmp23_;
					_tmp20_ = entry;
					_tmp21_ = gee_map_entry_get_value (_tmp20_);
					_tmp22_ = _tmp21_;
					_tmp23_ = *shortcut;
					proton_plus_utils_vdf_shortcuts_write_shortcut_on_node (self, (ProtonPlusUtilsVDFNode*) _tmp22_, &_tmp23_);
					_g_object_unref0 (entry);
					_g_object_unref0 (_entry_it);
					return;
				}
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
}

gboolean
proton_plus_utils_vdf_shortcuts_replace_shortcut_by_appid (ProtonPlusUtilsVDFShortcuts* self,
                                                           guint appid,
                                                           ProtonPlusUtilsVDFShortcut* shortcut)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (shortcut != NULL, FALSE);
	{
		GeeIterator* _entry_it = NULL;
		GeeTreeMap* _tmp0_;
		GeeTreeMap* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeIterator* _tmp5_;
		GeeIterator* _tmp6_;
		_tmp0_ = proton_plus_utils_vdf_binary_get_nodes ((ProtonPlusUtilsVDFBinary*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_entry_it = _tmp6_;
		while (TRUE) {
			GeeIterator* _tmp7_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp8_;
			gpointer _tmp9_;
			gboolean _tmp10_ = FALSE;
			gboolean _tmp11_ = FALSE;
			GeeMapEntry* _tmp12_;
			gconstpointer _tmp13_;
			gconstpointer _tmp14_;
			_tmp7_ = _entry_it;
			if (!gee_iterator_next (_tmp7_)) {
				break;
			}
			_tmp8_ = _entry_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			entry = (GeeMapEntry*) _tmp9_;
			_tmp12_ = entry;
			_tmp13_ = gee_map_entry_get_key (_tmp12_);
			_tmp14_ = _tmp13_;
			if (proton_plus_utils_vdf_shortcuts_is_shortcut_node (self, (const gchar*) _tmp14_)) {
				GeeMapEntry* _tmp15_;
				gconstpointer _tmp16_;
				gconstpointer _tmp17_;
				_tmp15_ = entry;
				_tmp16_ = gee_map_entry_get_value (_tmp15_);
				_tmp17_ = _tmp16_;
				_tmp11_ = gee_abstract_map_has_key ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp17_), "appid");
			} else {
				_tmp11_ = FALSE;
			}
			if (_tmp11_) {
				GeeMapEntry* _tmp18_;
				gconstpointer _tmp19_;
				gconstpointer _tmp20_;
				gpointer _tmp21_;
				GVariant* _tmp22_;
				_tmp18_ = entry;
				_tmp19_ = gee_map_entry_get_value (_tmp18_);
				_tmp20_ = _tmp19_;
				_tmp21_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp20_), "appid");
				_tmp22_ = (GVariant*) _tmp21_;
				_tmp10_ = ((guint) g_variant_get_int32 (_tmp22_)) == appid;
				_g_variant_unref0 (_tmp22_);
			} else {
				_tmp10_ = FALSE;
			}
			if (_tmp10_) {
				GeeMapEntry* _tmp23_;
				gconstpointer _tmp24_;
				gconstpointer _tmp25_;
				ProtonPlusUtilsVDFShortcut _tmp26_;
				_tmp23_ = entry;
				_tmp24_ = gee_map_entry_get_value (_tmp23_);
				_tmp25_ = _tmp24_;
				_tmp26_ = *shortcut;
				proton_plus_utils_vdf_shortcuts_write_shortcut_on_node (self, (ProtonPlusUtilsVDFNode*) _tmp25_, &_tmp26_);
				result = TRUE;
				_g_object_unref0 (entry);
				_g_object_unref0 (_entry_it);
				return result;
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	result = FALSE;
	return result;
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

gint
proton_plus_utils_vdf_shortcuts_get_shortcut_id_by_name (ProtonPlusUtilsVDFShortcuts* self,
                                                         const gchar* name,
                                                         GError** error)
{
	const gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	GError* _tmp27_;
	GError* _tmp28_;
	gint _tmp29_ = -1;
	GError* _inner_error0_ = NULL;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (name != NULL, -1);
	{
		GeeIterator* _entry_it = NULL;
		GeeTreeMap* _tmp0_;
		GeeTreeMap* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeIterator* _tmp5_;
		GeeIterator* _tmp6_;
		_tmp0_ = proton_plus_utils_vdf_binary_get_nodes ((ProtonPlusUtilsVDFBinary*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_entry_it = _tmp6_;
		while (TRUE) {
			GeeIterator* _tmp7_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp8_;
			gpointer _tmp9_;
			GeeMapEntry* _tmp10_;
			gconstpointer _tmp11_;
			gconstpointer _tmp12_;
			_tmp7_ = _entry_it;
			if (!gee_iterator_next (_tmp7_)) {
				break;
			}
			_tmp8_ = _entry_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			entry = (GeeMapEntry*) _tmp9_;
			_tmp10_ = entry;
			_tmp11_ = gee_map_entry_get_key (_tmp10_);
			_tmp12_ = _tmp11_;
			if (proton_plus_utils_vdf_shortcuts_is_shortcut_node (self, (const gchar*) _tmp12_)) {
				GeeMapEntry* _tmp13_;
				gconstpointer _tmp14_;
				gconstpointer _tmp15_;
				gpointer _tmp16_;
				GVariant* _tmp17_;
				const gchar* _tmp18_;
				gboolean _tmp19_;
				_tmp13_ = entry;
				_tmp14_ = gee_map_entry_get_value (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp16_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusUtilsVDFNode*) _tmp15_), "AppName");
				_tmp17_ = (GVariant*) _tmp16_;
				_tmp18_ = g_variant_get_string (_tmp17_, NULL);
				_tmp19_ = g_strcmp0 (_tmp18_, name) == 0;
				_g_variant_unref0 (_tmp17_);
				if (_tmp19_) {
					gint id = 0;
					GeeMapEntry* _tmp20_;
					gconstpointer _tmp21_;
					gconstpointer _tmp22_;
					gint _tmp23_ = 0;
					_tmp20_ = entry;
					_tmp21_ = gee_map_entry_get_key (_tmp20_);
					_tmp22_ = _tmp21_;
					proton_plus_utils_vdf_shortcuts_get_shortcut_id_from_path (self, (const gchar*) _tmp22_, &_tmp23_);
					id = _tmp23_;
					result = id;
					_g_object_unref0 (entry);
					_g_object_unref0 (_entry_it);
					return result;
				}
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	_tmp24_ = string_to_string (name);
	_tmp25_ = g_strconcat ("Could not find the shortcut named ", _tmp24_, ".", NULL);
	_tmp26_ = _tmp25_;
	_tmp27_ = g_error_new (g_quark_from_string ("vala-vdf"), 0, "%s", _tmp26_);
	_tmp28_ = _tmp27_;
	_g_free0 (_tmp26_);
	_inner_error0_ = _tmp28_;
	g_propagate_error (error, _inner_error0_);
	return _tmp29_;
}

static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

void
proton_plus_utils_vdf_shortcuts_remove_shortcut_by_name (ProtonPlusUtilsVDFShortcuts* self,
                                                         const gchar* name,
                                                         GError** error)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	{
		GeeTreeMap* new_nodes = NULL;
		GeeTreeMap* _tmp0_;
		gint node_base_id = 0;
		gchar* node_base_name = NULL;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GeeTreeMap* _tmp49_;
		_tmp0_ = gee_tree_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, PROTON_PLUS_UTILS_VDF_TYPE_NODE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
		new_nodes = _tmp0_;
		node_base_id = proton_plus_utils_vdf_shortcuts_get_shortcut_id_by_name (self, name, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (new_nodes);
			goto __catch0_g_error;
		}
		_tmp1_ = g_strdup_printf ("%i", node_base_id);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_strconcat ("shortcuts.", _tmp2_, NULL);
		_tmp4_ = _tmp3_;
		_g_free0 (_tmp2_);
		node_base_name = _tmp4_;
		{
			GeeIterator* _entry_it = NULL;
			GeeTreeMap* _tmp5_;
			GeeTreeMap* _tmp6_;
			GeeSet* _tmp7_;
			GeeSet* _tmp8_;
			GeeSet* _tmp9_;
			GeeIterator* _tmp10_;
			GeeIterator* _tmp11_;
			_tmp5_ = proton_plus_utils_vdf_binary_get_nodes ((ProtonPlusUtilsVDFBinary*) self);
			_tmp6_ = _tmp5_;
			_tmp7_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp6_);
			_tmp8_ = _tmp7_;
			_tmp9_ = _tmp8_;
			_tmp10_ = gee_iterable_iterator ((GeeIterable*) _tmp9_);
			_tmp11_ = _tmp10_;
			_g_object_unref0 (_tmp9_);
			_entry_it = _tmp11_;
			while (TRUE) {
				GeeIterator* _tmp12_;
				GeeMapEntry* entry = NULL;
				GeeIterator* _tmp13_;
				gpointer _tmp14_;
				gboolean _tmp15_ = FALSE;
				GeeMapEntry* _tmp16_;
				gconstpointer _tmp17_;
				gconstpointer _tmp18_;
				const gchar* _tmp19_;
				_tmp12_ = _entry_it;
				if (!gee_iterator_next (_tmp12_)) {
					break;
				}
				_tmp13_ = _entry_it;
				_tmp14_ = gee_iterator_get (_tmp13_);
				entry = (GeeMapEntry*) _tmp14_;
				_tmp16_ = entry;
				_tmp17_ = gee_map_entry_get_key (_tmp16_);
				_tmp18_ = _tmp17_;
				_tmp19_ = node_base_name;
				if (g_strcmp0 ((const gchar*) _tmp18_, _tmp19_) != 0) {
					GeeMapEntry* _tmp20_;
					gconstpointer _tmp21_;
					gconstpointer _tmp22_;
					const gchar* _tmp23_;
					gchar* _tmp24_;
					gchar* _tmp25_;
					_tmp20_ = entry;
					_tmp21_ = gee_map_entry_get_key (_tmp20_);
					_tmp22_ = _tmp21_;
					_tmp23_ = node_base_name;
					_tmp24_ = g_strconcat (_tmp23_, ".", NULL);
					_tmp25_ = _tmp24_;
					_tmp15_ = !g_str_has_prefix ((const gchar*) _tmp22_, _tmp25_);
					_g_free0 (_tmp25_);
				} else {
					_tmp15_ = FALSE;
				}
				if (_tmp15_) {
					gchar* curr_key = NULL;
					GeeMapEntry* _tmp26_;
					gconstpointer _tmp27_;
					gconstpointer _tmp28_;
					gchar* _tmp29_;
					gint curr_id = 0;
					GeeMapEntry* _tmp30_;
					gconstpointer _tmp31_;
					gconstpointer _tmp32_;
					gint _tmp33_ = 0;
					gboolean _tmp34_;
					GeeTreeMap* _tmp44_;
					const gchar* _tmp45_;
					GeeMapEntry* _tmp46_;
					gconstpointer _tmp47_;
					gconstpointer _tmp48_;
					_tmp26_ = entry;
					_tmp27_ = gee_map_entry_get_key (_tmp26_);
					_tmp28_ = _tmp27_;
					_tmp29_ = g_strdup ((const gchar*) _tmp28_);
					curr_key = _tmp29_;
					_tmp30_ = entry;
					_tmp31_ = gee_map_entry_get_key (_tmp30_);
					_tmp32_ = _tmp31_;
					_tmp34_ = proton_plus_utils_vdf_shortcuts_get_shortcut_id_from_path (self, (const gchar*) _tmp32_, &_tmp33_);
					curr_id = _tmp33_;
					if (_tmp34_) {
						gint new_id = 0;
						new_id = curr_id - 1;
						if (curr_id > node_base_id) {
							gchar** components = NULL;
							GeeMapEntry* _tmp35_;
							gconstpointer _tmp36_;
							gconstpointer _tmp37_;
							gchar** _tmp38_;
							gchar** _tmp39_;
							gint components_length1;
							gint _components_size_;
							gchar** _tmp40_;
							gint _tmp40__length1;
							gchar* _tmp41_;
							gchar** _tmp42_;
							gint _tmp42__length1;
							gchar* _tmp43_;
							_tmp35_ = entry;
							_tmp36_ = gee_map_entry_get_key (_tmp35_);
							_tmp37_ = _tmp36_;
							_tmp39_ = _tmp38_ = g_strsplit ((const gchar*) _tmp37_, ".", 0);
							components = _tmp39_;
							components_length1 = _vala_array_length (_tmp38_);
							_components_size_ = components_length1;
							_tmp40_ = components;
							_tmp40__length1 = components_length1;
							_tmp41_ = g_strdup_printf ("%d", new_id);
							_g_free0 (_tmp40_[1]);
							_tmp40_[1] = _tmp41_;
							_tmp42_ = components;
							_tmp42__length1 = components_length1;
							_tmp43_ = _vala_g_strjoinv (".", _tmp42_, (gint) _tmp42__length1);
							_g_free0 (curr_key);
							curr_key = _tmp43_;
							components = (_vala_array_free (components, components_length1, (GDestroyNotify) g_free), NULL);
						}
					}
					_tmp44_ = new_nodes;
					_tmp45_ = curr_key;
					_tmp46_ = entry;
					_tmp47_ = gee_map_entry_get_value (_tmp46_);
					_tmp48_ = _tmp47_;
					gee_abstract_map_set ((GeeAbstractMap*) _tmp44_, _tmp45_, (ProtonPlusUtilsVDFNode*) _tmp48_);
					_g_free0 (curr_key);
				}
				_g_object_unref0 (entry);
			}
			_g_object_unref0 (_entry_it);
		}
		_tmp49_ = new_nodes;
		proton_plus_utils_vdf_binary_set_nodes ((ProtonPlusUtilsVDFBinary*) self, _tmp49_);
		_g_free0 (node_base_name);
		_g_object_unref0 (new_nodes);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp50_;
		GError* _tmp51_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp50_ = e;
		_tmp51_ = _g_error_copy0 (_tmp50_);
		_inner_error0_ = _tmp51_;
		_g_error_free0 (e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
}

static void
proton_plus_utils_vdf_shortcuts_write_shortcut_on_node (ProtonPlusUtilsVDFShortcuts* self,
                                                        ProtonPlusUtilsVDFNode* node,
                                                        ProtonPlusUtilsVDFShortcut* shortcut)
{
	ProtonPlusUtilsVDFShortcut _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	gint _tmp3_ = 0;
	ProtonPlusUtilsVDFShortcut _tmp4_;
	GVariant* _tmp5_;
	GVariant* _tmp6_;
	gint _tmp7_ = 0;
	ProtonPlusUtilsVDFShortcut _tmp8_;
	GVariant* _tmp9_;
	GVariant* _tmp10_;
	ProtonPlusUtilsVDFShortcut _tmp11_;
	const gchar* _tmp12_;
	GVariant* _tmp13_;
	GVariant* _tmp14_;
	ProtonPlusUtilsVDFShortcut _tmp15_;
	GVariant* _tmp16_;
	GVariant* _tmp17_;
	ProtonPlusUtilsVDFShortcut _tmp18_;
	const gchar* _tmp19_;
	GVariant* _tmp20_;
	GVariant* _tmp21_;
	ProtonPlusUtilsVDFShortcut _tmp22_;
	GVariant* _tmp23_;
	GVariant* _tmp24_;
	ProtonPlusUtilsVDFShortcut _tmp25_;
	const gchar* _tmp26_;
	GVariant* _tmp27_;
	GVariant* _tmp28_;
	ProtonPlusUtilsVDFShortcut _tmp29_;
	const gchar* _tmp30_;
	GVariant* _tmp31_;
	GVariant* _tmp32_;
	gint _tmp33_ = 0;
	ProtonPlusUtilsVDFShortcut _tmp34_;
	GVariant* _tmp35_;
	GVariant* _tmp36_;
	ProtonPlusUtilsVDFShortcut _tmp37_;
	GVariant* _tmp38_;
	GVariant* _tmp39_;
	ProtonPlusUtilsVDFShortcut _tmp40_;
	const gchar* _tmp41_;
	GVariant* _tmp42_;
	GVariant* _tmp43_;
	ProtonPlusUtilsVDFShortcut _tmp44_;
	GVariant* _tmp45_;
	GVariant* _tmp46_;
	ProtonPlusUtilsVDFShortcut _tmp47_;
	const gchar* _tmp48_;
	GVariant* _tmp49_;
	GVariant* _tmp50_;
	ProtonPlusUtilsVDFShortcut _tmp51_;
	const gchar* _tmp52_;
	GVariant* _tmp53_;
	GVariant* _tmp54_;
	ProtonPlusUtilsVDFShortcut _tmp55_;
	const gchar* _tmp56_;
	GVariant* _tmp57_;
	GVariant* _tmp58_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	g_return_if_fail (shortcut != NULL);
	_tmp0_ = *shortcut;
	_tmp1_ = g_variant_new_int32 (_tmp0_.AppID);
	g_variant_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "appid", _tmp2_);
	_g_variant_unref0 (_tmp2_);
	_tmp4_ = *shortcut;
	if (_tmp4_.AllowDesktopConfig) {
		_tmp3_ = 1;
	} else {
		_tmp3_ = 0;
	}
	_tmp5_ = g_variant_new_int32 ((gint32) _tmp3_);
	g_variant_ref_sink (_tmp5_);
	_tmp6_ = _tmp5_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "AllowDesktopConfig", _tmp6_);
	_g_variant_unref0 (_tmp6_);
	_tmp8_ = *shortcut;
	if (_tmp8_.AllowOverlay) {
		_tmp7_ = 1;
	} else {
		_tmp7_ = 0;
	}
	_tmp9_ = g_variant_new_int32 ((gint32) _tmp7_);
	g_variant_ref_sink (_tmp9_);
	_tmp10_ = _tmp9_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "AllowOverlay", _tmp10_);
	_g_variant_unref0 (_tmp10_);
	_tmp11_ = *shortcut;
	_tmp12_ = _tmp11_.AppName;
	_tmp13_ = g_variant_new_string (_tmp12_);
	g_variant_ref_sink (_tmp13_);
	_tmp14_ = _tmp13_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "AppName", _tmp14_);
	_g_variant_unref0 (_tmp14_);
	_tmp15_ = *shortcut;
	_tmp16_ = g_variant_new_int32 (_tmp15_.Devkit);
	g_variant_ref_sink (_tmp16_);
	_tmp17_ = _tmp16_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "Devkit", _tmp17_);
	_g_variant_unref0 (_tmp17_);
	_tmp18_ = *shortcut;
	_tmp19_ = _tmp18_.DevkitGameID;
	_tmp20_ = g_variant_new_string (_tmp19_);
	g_variant_ref_sink (_tmp20_);
	_tmp21_ = _tmp20_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "DevkitGameID", _tmp21_);
	_g_variant_unref0 (_tmp21_);
	_tmp22_ = *shortcut;
	_tmp23_ = g_variant_new_int32 (_tmp22_.DevkitOverrideAppID);
	g_variant_ref_sink (_tmp23_);
	_tmp24_ = _tmp23_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "DevkitOverrideAppID", _tmp24_);
	_g_variant_unref0 (_tmp24_);
	_tmp25_ = *shortcut;
	_tmp26_ = _tmp25_.Exe;
	_tmp27_ = g_variant_new_string (_tmp26_);
	g_variant_ref_sink (_tmp27_);
	_tmp28_ = _tmp27_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "Exe", _tmp28_);
	_g_variant_unref0 (_tmp28_);
	_tmp29_ = *shortcut;
	_tmp30_ = _tmp29_.FlatpakAppID;
	_tmp31_ = g_variant_new_string (_tmp30_);
	g_variant_ref_sink (_tmp31_);
	_tmp32_ = _tmp31_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "FlatpakAppID", _tmp32_);
	_g_variant_unref0 (_tmp32_);
	_tmp34_ = *shortcut;
	if (_tmp34_.IsHidden) {
		_tmp33_ = 1;
	} else {
		_tmp33_ = 0;
	}
	_tmp35_ = g_variant_new_int32 ((gint32) _tmp33_);
	g_variant_ref_sink (_tmp35_);
	_tmp36_ = _tmp35_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "IsHidden", _tmp36_);
	_g_variant_unref0 (_tmp36_);
	_tmp37_ = *shortcut;
	_tmp38_ = g_variant_new_int32 (_tmp37_.LastPlayTime);
	g_variant_ref_sink (_tmp38_);
	_tmp39_ = _tmp38_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "LastPlayTime", _tmp39_);
	_g_variant_unref0 (_tmp39_);
	_tmp40_ = *shortcut;
	_tmp41_ = _tmp40_.LaunchOptions;
	_tmp42_ = g_variant_new_string (_tmp41_);
	g_variant_ref_sink (_tmp42_);
	_tmp43_ = _tmp42_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "LaunchOptions", _tmp43_);
	_g_variant_unref0 (_tmp43_);
	_tmp44_ = *shortcut;
	_tmp45_ = g_variant_new_int32 (_tmp44_.OpenVR);
	g_variant_ref_sink (_tmp45_);
	_tmp46_ = _tmp45_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "OpenVR", _tmp46_);
	_g_variant_unref0 (_tmp46_);
	_tmp47_ = *shortcut;
	_tmp48_ = _tmp47_.ShortcutPath;
	_tmp49_ = g_variant_new_string (_tmp48_);
	g_variant_ref_sink (_tmp49_);
	_tmp50_ = _tmp49_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "ShortcutPath", _tmp50_);
	_g_variant_unref0 (_tmp50_);
	_tmp51_ = *shortcut;
	_tmp52_ = _tmp51_.StartDir;
	_tmp53_ = g_variant_new_string (_tmp52_);
	g_variant_ref_sink (_tmp53_);
	_tmp54_ = _tmp53_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "StartDir", _tmp54_);
	_g_variant_unref0 (_tmp54_);
	_tmp55_ = *shortcut;
	_tmp56_ = _tmp55_.Icon;
	_tmp57_ = g_variant_new_string (_tmp56_);
	g_variant_ref_sink (_tmp57_);
	_tmp58_ = _tmp57_;
	gee_abstract_map_set ((GeeAbstractMap*) node, "icon", _tmp58_);
	_g_variant_unref0 (_tmp58_);
}

void
proton_plus_utils_vdf_shortcuts_append_shortcut (ProtonPlusUtilsVDFShortcuts* self,
                                                 ProtonPlusUtilsVDFShortcut* shortcut)
{
	gint new_node_id = 0;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	ProtonPlusUtilsVDFNode* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	ProtonPlusUtilsVDFNode* _tmp9_;
	ProtonPlusUtilsVDFShortcut _tmp10_;
	ProtonPlusUtilsVDFNode* _tmp11_;
	ProtonPlusUtilsVDFShortcut _tmp12_;
	GeeTreeMap* _tmp13_;
	GeeTreeMap* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	ProtonPlusUtilsVDFShortcut _tmp19_;
	ProtonPlusUtilsVDFNode* _tmp20_;
	GeeTreeMap* _tmp21_;
	GeeTreeMap* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	ProtonPlusUtilsVDFShortcut _tmp27_;
	ProtonPlusUtilsVDFNode* _tmp28_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (shortcut != NULL);
	new_node_id = proton_plus_utils_vdf_shortcuts_get_first_unused_shortcut_id (self);
	_tmp0_ = g_strdup_printf ("%i", new_node_id);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat ("shortcuts.", _tmp1_, NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = proton_plus_utils_vdf_node_new (_tmp3_);
	_g_object_unref0 ((*shortcut).shortcut_node);
	(*shortcut).shortcut_node = _tmp4_;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	_tmp5_ = g_strdup_printf ("%i", new_node_id);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_strconcat ("shortcuts.", _tmp6_, ".tags", NULL);
	_tmp8_ = _tmp7_;
	_tmp9_ = proton_plus_utils_vdf_node_new (_tmp8_);
	_g_object_unref0 ((*shortcut).shortcut_node_tags);
	(*shortcut).shortcut_node_tags = _tmp9_;
	_g_free0 (_tmp8_);
	_g_free0 (_tmp6_);
	_tmp10_ = *shortcut;
	_tmp11_ = _tmp10_.shortcut_node;
	_tmp12_ = *shortcut;
	proton_plus_utils_vdf_shortcuts_write_shortcut_on_node (self, _tmp11_, &_tmp12_);
	_tmp13_ = proton_plus_utils_vdf_binary_get_nodes ((ProtonPlusUtilsVDFBinary*) self);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_strdup_printf ("%i", new_node_id);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_strconcat ("shortcuts.", _tmp16_, NULL);
	_tmp18_ = _tmp17_;
	_tmp19_ = *shortcut;
	_tmp20_ = _tmp19_.shortcut_node;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp14_, _tmp18_, _tmp20_);
	_g_free0 (_tmp18_);
	_g_free0 (_tmp16_);
	_tmp21_ = proton_plus_utils_vdf_binary_get_nodes ((ProtonPlusUtilsVDFBinary*) self);
	_tmp22_ = _tmp21_;
	_tmp23_ = g_strdup_printf ("%i", new_node_id);
	_tmp24_ = _tmp23_;
	_tmp25_ = g_strconcat ("shortcuts.", _tmp24_, ".tags", NULL);
	_tmp26_ = _tmp25_;
	_tmp27_ = *shortcut;
	_tmp28_ = _tmp27_.shortcut_node_tags;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp22_, _tmp26_, _tmp28_);
	_g_free0 (_tmp26_);
	_g_free0 (_tmp24_);
}

void
proton_plus_utils_vdf_shortcuts_create_new_shortcuts_file_at (const gchar* path,
                                                              GError** error)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (path != NULL);
	{
		GFile* new_vdf = NULL;
		GFile* _tmp0_;
		GFileOutputStream* new_vdf_stream = NULL;
		GFile* _tmp1_;
		GFileOutputStream* _tmp2_;
		GDataOutputStream* data_stream = NULL;
		GFileOutputStream* _tmp3_;
		GDataOutputStream* _tmp4_;
		GDataOutputStream* _tmp5_;
		GDataOutputStream* _tmp6_;
		GDataOutputStream* _tmp7_;
		GDataOutputStream* _tmp8_;
		GDataOutputStream* _tmp9_;
		GDataOutputStream* _tmp10_;
		_tmp0_ = g_file_new_for_path (path);
		new_vdf = _tmp0_;
		_tmp1_ = new_vdf;
		_tmp2_ = g_file_create (_tmp1_, G_FILE_CREATE_PRIVATE, NULL, &_inner_error0_);
		new_vdf_stream = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (new_vdf);
			goto __catch0_g_error;
		}
		_tmp3_ = new_vdf_stream;
		_tmp4_ = g_data_output_stream_new ((GOutputStream*) _tmp3_);
		data_stream = _tmp4_;
		_tmp5_ = data_stream;
		g_data_output_stream_set_byte_order (_tmp5_, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN);
		_tmp6_ = data_stream;
		g_data_output_stream_put_byte (_tmp6_, (guint8) '\x00', NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (data_stream);
			_g_object_unref0 (new_vdf_stream);
			_g_object_unref0 (new_vdf);
			goto __catch0_g_error;
		}
		_tmp7_ = data_stream;
		g_data_output_stream_put_string (_tmp7_, "shortcuts", NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (data_stream);
			_g_object_unref0 (new_vdf_stream);
			_g_object_unref0 (new_vdf);
			goto __catch0_g_error;
		}
		_tmp8_ = data_stream;
		g_data_output_stream_put_byte (_tmp8_, (guint8) '\x00', NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (data_stream);
			_g_object_unref0 (new_vdf_stream);
			_g_object_unref0 (new_vdf);
			goto __catch0_g_error;
		}
		_tmp9_ = data_stream;
		g_data_output_stream_put_byte (_tmp9_, (guint8) '\x08', NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (data_stream);
			_g_object_unref0 (new_vdf_stream);
			_g_object_unref0 (new_vdf);
			goto __catch0_g_error;
		}
		_tmp10_ = data_stream;
		g_data_output_stream_put_byte (_tmp10_, (guint8) '\x08', NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (data_stream);
			_g_object_unref0 (new_vdf_stream);
			_g_object_unref0 (new_vdf);
			goto __catch0_g_error;
		}
		_g_object_unref0 (data_stream);
		_g_object_unref0 (new_vdf_stream);
		_g_object_unref0 (new_vdf);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp11_;
		GError* _tmp12_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp11_ = e;
		_tmp12_ = _g_error_copy0 (_tmp11_);
		_inner_error0_ = _tmp12_;
		_g_error_free0 (e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
}

static void
proton_plus_utils_vdf_shortcuts_class_init (ProtonPlusUtilsVDFShortcutsClass * klass,
                                            gpointer klass_data)
{
	proton_plus_utils_vdf_shortcuts_parent_class = g_type_class_peek_parent (klass);
	((ProtonPlusUtilsVDFBinaryClass *) klass)->finalize = proton_plus_utils_vdf_shortcuts_finalize;
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsVDFShortcuts_private_offset);
}

static void
proton_plus_utils_vdf_shortcuts_instance_init (ProtonPlusUtilsVDFShortcuts * self,
                                               gpointer klass)
{
	self->priv = proton_plus_utils_vdf_shortcuts_get_instance_private (self);
}

static void
proton_plus_utils_vdf_shortcuts_finalize (ProtonPlusUtilsVDFBinary * obj)
{
	ProtonPlusUtilsVDFShortcuts * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_VDF_TYPE_SHORTCUTS, ProtonPlusUtilsVDFShortcuts);
	_g_free0 (self->priv->shortcuts_file_path);
	PROTON_PLUS_UTILS_VDF_BINARY_CLASS (proton_plus_utils_vdf_shortcuts_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_vdf_shortcuts_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsVDFShortcutsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_vdf_shortcuts_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsVDFShortcuts), 0, (GInstanceInitFunc) proton_plus_utils_vdf_shortcuts_instance_init, NULL };
	GType proton_plus_utils_vdf_shortcuts_type_id;
	proton_plus_utils_vdf_shortcuts_type_id = g_type_register_static (PROTON_PLUS_UTILS_VDF_TYPE_BINARY, "ProtonPlusUtilsVDFShortcuts", &g_define_type_info, 0);
	ProtonPlusUtilsVDFShortcuts_private_offset = g_type_add_instance_private (proton_plus_utils_vdf_shortcuts_type_id, sizeof (ProtonPlusUtilsVDFShortcutsPrivate));
	return proton_plus_utils_vdf_shortcuts_type_id;
}

GType
proton_plus_utils_vdf_shortcuts_get_type (void)
{
	static volatile gsize proton_plus_utils_vdf_shortcuts_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_vdf_shortcuts_type_id__once)) {
		GType proton_plus_utils_vdf_shortcuts_type_id;
		proton_plus_utils_vdf_shortcuts_type_id = proton_plus_utils_vdf_shortcuts_get_type_once ();
		g_once_init_leave (&proton_plus_utils_vdf_shortcuts_type_id__once, proton_plus_utils_vdf_shortcuts_type_id);
	}
	return proton_plus_utils_vdf_shortcuts_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

