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

#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <gio/gio.h>
#include <glib/gstdio.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define PROTON_PLUS_VDF_TYPE_SHORTCUT (proton_plus_vdf_shortcut_get_type ())
typedef struct _ProtonPlusVDFShortcut ProtonPlusVDFShortcut;

#define PROTON_PLUS_VDF_TYPE_NODE (proton_plus_vdf_node_get_type ())
#define PROTON_PLUS_VDF_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_VDF_TYPE_NODE, ProtonPlusVDFNode))
#define PROTON_PLUS_VDF_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_VDF_TYPE_NODE, ProtonPlusVDFNodeClass))
#define PROTON_PLUS_VDF_IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_VDF_TYPE_NODE))
#define PROTON_PLUS_VDF_IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_VDF_TYPE_NODE))
#define PROTON_PLUS_VDF_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_VDF_TYPE_NODE, ProtonPlusVDFNodeClass))

typedef struct _ProtonPlusVDFNode ProtonPlusVDFNode;
typedef struct _ProtonPlusVDFNodeClass ProtonPlusVDFNodeClass;
#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_VDF_TYPE_BINARY (proton_plus_vdf_binary_get_type ())
#define PROTON_PLUS_VDF_BINARY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_VDF_TYPE_BINARY, ProtonPlusVDFBinary))
#define PROTON_PLUS_VDF_BINARY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_VDF_TYPE_BINARY, ProtonPlusVDFBinaryClass))
#define PROTON_PLUS_VDF_IS_BINARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_VDF_TYPE_BINARY))
#define PROTON_PLUS_VDF_IS_BINARY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_VDF_TYPE_BINARY))
#define PROTON_PLUS_VDF_BINARY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_VDF_TYPE_BINARY, ProtonPlusVDFBinaryClass))

typedef struct _ProtonPlusVDFBinary ProtonPlusVDFBinary;
typedef struct _ProtonPlusVDFBinaryClass ProtonPlusVDFBinaryClass;
typedef struct _ProtonPlusVDFBinaryPrivate ProtonPlusVDFBinaryPrivate;

#define PROTON_PLUS_VDF_TYPE_SHORTCUTS (proton_plus_vdf_shortcuts_get_type ())
#define PROTON_PLUS_VDF_SHORTCUTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_VDF_TYPE_SHORTCUTS, ProtonPlusVDFShortcuts))
#define PROTON_PLUS_VDF_SHORTCUTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_VDF_TYPE_SHORTCUTS, ProtonPlusVDFShortcutsClass))
#define PROTON_PLUS_VDF_IS_SHORTCUTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_VDF_TYPE_SHORTCUTS))
#define PROTON_PLUS_VDF_IS_SHORTCUTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_VDF_TYPE_SHORTCUTS))
#define PROTON_PLUS_VDF_SHORTCUTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_VDF_TYPE_SHORTCUTS, ProtonPlusVDFShortcutsClass))

typedef struct _ProtonPlusVDFShortcuts ProtonPlusVDFShortcuts;
typedef struct _ProtonPlusVDFShortcutsClass ProtonPlusVDFShortcutsClass;
typedef struct _ProtonPlusVDFShortcutsPrivate ProtonPlusVDFShortcutsPrivate;
#define _proton_plus_vdf_binary_unref0(var) ((var == NULL) ? NULL : (var = (proton_plus_vdf_binary_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ProtonPlusVdfShortcutsInstallData ProtonPlusVdfShortcutsInstallData;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

struct _ProtonPlusVDFShortcut {
	gint32 AppID;
	gboolean AllowDesktopConfig;
	gboolean AllowOverlay;
	gchar* AppName;
	gint32 Devkit;
	gchar* DevkitGameID;
	gint32 DevkitOverrideAppID;
	gchar* Exe;
	gchar* FlatpakAppID;
	gboolean IsHidden;
	gint32 LastPlayTime;
	gchar* LaunchOptions;
	gint32 OpenVR;
	gchar* ShortcutPath;
	gchar* StartDir;
	gchar* Icon;
	ProtonPlusVDFNode* shortcut_node;
	ProtonPlusVDFNode* shortcut_node_tags;
};

struct _ProtonPlusVDFBinary {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ProtonPlusVDFBinaryPrivate * priv;
	GeeTreeMap* nodes;
};

struct _ProtonPlusVDFBinaryClass {
	GTypeClass parent_class;
	void (*finalize) (ProtonPlusVDFBinary *self);
};

struct _ProtonPlusVDFShortcuts {
	ProtonPlusVDFBinary parent_instance;
	ProtonPlusVDFShortcutsPrivate * priv;
};

struct _ProtonPlusVDFShortcutsClass {
	ProtonPlusVDFBinaryClass parent_class;
};

struct _ProtonPlusVdfShortcutsInstallData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusVDFShortcuts* self;
	gboolean result;
	ProtonPlusVDFShortcut pp_shortcut;
	ProtonPlusVDFShortcut _tmp0_;
	gchar* exe;
	gchar* _tmp1_;
	gchar* launch_options;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* icon;
	gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* which_output;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	const gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	ProtonPlusVDFShortcut _tmp31_;
	GError* e;
	GError* _tmp32_;
	const gchar* _tmp33_;
	GError* _inner_error0_;
};

static gpointer proton_plus_vdf_shortcuts_parent_class = NULL;

VALA_EXTERN GType proton_plus_vdf_shortcut_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType proton_plus_vdf_node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusVDFNode, g_object_unref)
VALA_EXTERN ProtonPlusVDFShortcut* proton_plus_vdf_shortcut_dup (const ProtonPlusVDFShortcut* self);
VALA_EXTERN void proton_plus_vdf_shortcut_free (ProtonPlusVDFShortcut* self);
VALA_EXTERN void proton_plus_vdf_shortcut_copy (const ProtonPlusVDFShortcut* self,
                                    ProtonPlusVDFShortcut* dest);
VALA_EXTERN void proton_plus_vdf_shortcut_destroy (ProtonPlusVDFShortcut* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (ProtonPlusVDFShortcut, proton_plus_vdf_shortcut_destroy)
VALA_EXTERN gpointer proton_plus_vdf_binary_ref (gpointer instance);
VALA_EXTERN void proton_plus_vdf_binary_unref (gpointer instance);
VALA_EXTERN GParamSpec* proton_plus_vdf_param_spec_binary (const gchar* name,
                                               const gchar* nick,
                                               const gchar* blurb,
                                               GType object_type,
                                               GParamFlags flags);
VALA_EXTERN void proton_plus_vdf_value_set_binary (GValue* value,
                                       gpointer v_object);
VALA_EXTERN void proton_plus_vdf_value_take_binary (GValue* value,
                                        gpointer v_object);
VALA_EXTERN gpointer proton_plus_vdf_value_get_binary (const GValue* value);
VALA_EXTERN GType proton_plus_vdf_binary_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusVDFBinary, proton_plus_vdf_binary_unref)
VALA_EXTERN GType proton_plus_vdf_shortcuts_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusVDFShortcuts, proton_plus_vdf_binary_unref)
VALA_EXTERN ProtonPlusVDFShortcuts* proton_plus_vdf_shortcuts_new (const gchar* path);
VALA_EXTERN ProtonPlusVDFShortcuts* proton_plus_vdf_shortcuts_construct (GType object_type,
                                                             const gchar* path);
VALA_EXTERN ProtonPlusVDFBinary* proton_plus_vdf_binary_new (const gchar* path);
VALA_EXTERN ProtonPlusVDFBinary* proton_plus_vdf_binary_construct (GType object_type,
                                                       const gchar* path);
static void proton_plus_vdf_shortcuts_install_data_free (gpointer _data);
VALA_EXTERN void proton_plus_vdf_shortcuts_install (ProtonPlusVDFShortcuts* self,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN gboolean proton_plus_vdf_shortcuts_install_finish (ProtonPlusVDFShortcuts* self,
                                                   GAsyncResult* _res_);
static gboolean proton_plus_vdf_shortcuts_install_co (ProtonPlusVdfShortcutsInstallData* _data_);
VALA_EXTERN void proton_plus_utils_system_run_command (const gchar* command,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
VALA_EXTERN gchar* proton_plus_utils_system_run_command_finish (GAsyncResult* _res_);
static void proton_plus_vdf_shortcuts_install_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
VALA_EXTERN void proton_plus_vdf_shortcuts_append_shortcut (ProtonPlusVDFShortcuts* self,
                                                ProtonPlusVDFShortcut* shortcut);
VALA_EXTERN void proton_plus_vdf_binary_save (ProtonPlusVDFBinary* self,
                                  GError** error);
VALA_EXTERN gboolean proton_plus_vdf_shortcuts_uninstall (ProtonPlusVDFShortcuts* self);
VALA_EXTERN void proton_plus_vdf_shortcuts_remove_shortcut_by_name (ProtonPlusVDFShortcuts* self,
                                                        const gchar* name,
                                                        GError** error);
VALA_EXTERN gboolean proton_plus_vdf_shortcuts_get_installed_status (ProtonPlusVDFShortcuts* self);
VALA_EXTERN void proton_plus_vdf_shortcuts_get_shortcut_by_name (ProtonPlusVDFShortcuts* self,
                                                     const gchar* name,
                                                     ProtonPlusVDFShortcut* result);
VALA_EXTERN gsize proton_plus_vdf_shortcuts_get_shortcuts_count (ProtonPlusVDFShortcuts* self);
VALA_EXTERN void proton_plus_vdf_shortcuts_replace_shortcut_by_name (ProtonPlusVDFShortcuts* self,
                                                         const gchar* name,
                                                         ProtonPlusVDFShortcut* shortcut);
static void proton_plus_vdf_shortcuts_write_shortcut_on_node (ProtonPlusVDFShortcuts* self,
                                                       ProtonPlusVDFNode* node,
                                                       ProtonPlusVDFShortcut* shortcut);
VALA_EXTERN gint proton_plus_vdf_shortcuts_get_shortcut_id_by_name (ProtonPlusVDFShortcuts* self,
                                                        const gchar* name,
                                                        GError** error);
VALA_EXTERN ProtonPlusVDFNode* proton_plus_vdf_node_new (const gchar* name);
VALA_EXTERN ProtonPlusVDFNode* proton_plus_vdf_node_construct (GType object_type,
                                                   const gchar* name);
VALA_EXTERN void proton_plus_vdf_shortcuts_create_new_shortcuts_file_at (const gchar* path,
                                                             GError** error);
static GType proton_plus_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 gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

void
proton_plus_vdf_shortcut_copy (const ProtonPlusVDFShortcut* self,
                               ProtonPlusVDFShortcut* 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_;
	ProtonPlusVDFNode* _tmp16_;
	ProtonPlusVDFNode* _tmp17_;
	ProtonPlusVDFNode* _tmp18_;
	ProtonPlusVDFNode* _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_vdf_shortcut_destroy (ProtonPlusVDFShortcut* 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);
}

ProtonPlusVDFShortcut*
proton_plus_vdf_shortcut_dup (const ProtonPlusVDFShortcut* self)
{
	ProtonPlusVDFShortcut* dup;
	dup = g_new0 (ProtonPlusVDFShortcut, 1);
	proton_plus_vdf_shortcut_copy (self, dup);
	return dup;
}

void
proton_plus_vdf_shortcut_free (ProtonPlusVDFShortcut* self)
{
	proton_plus_vdf_shortcut_destroy (self);
	g_free (self);
}

static GType
proton_plus_vdf_shortcut_get_type_once (void)
{
	GType proton_plus_vdf_shortcut_type_id;
	proton_plus_vdf_shortcut_type_id = g_boxed_type_register_static ("ProtonPlusVDFShortcut", (GBoxedCopyFunc) proton_plus_vdf_shortcut_dup, (GBoxedFreeFunc) proton_plus_vdf_shortcut_free);
	return proton_plus_vdf_shortcut_type_id;
}

GType
proton_plus_vdf_shortcut_get_type (void)
{
	static volatile gsize proton_plus_vdf_shortcut_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_vdf_shortcut_type_id__once)) {
		GType proton_plus_vdf_shortcut_type_id;
		proton_plus_vdf_shortcut_type_id = proton_plus_vdf_shortcut_get_type_once ();
		g_once_init_leave (&proton_plus_vdf_shortcut_type_id__once, proton_plus_vdf_shortcut_type_id);
	}
	return proton_plus_vdf_shortcut_type_id__once;
}

ProtonPlusVDFShortcuts*
proton_plus_vdf_shortcuts_construct (GType object_type,
                                     const gchar* path)
{
	ProtonPlusVDFShortcuts* self = NULL;
	g_return_val_if_fail (path != NULL, NULL);
	self = (ProtonPlusVDFShortcuts*) proton_plus_vdf_binary_construct (object_type, path);
	return self;
}

ProtonPlusVDFShortcuts*
proton_plus_vdf_shortcuts_new (const gchar* path)
{
	return proton_plus_vdf_shortcuts_construct (PROTON_PLUS_VDF_TYPE_SHORTCUTS, path);
}

static void
proton_plus_vdf_shortcuts_install_data_free (gpointer _data)
{
	ProtonPlusVdfShortcutsInstallData* _data_;
	_data_ = _data;
	_proton_plus_vdf_binary_unref0 (_data_->self);
	g_slice_free (ProtonPlusVdfShortcutsInstallData, _data_);
}

static gpointer
_proton_plus_vdf_binary_ref0 (gpointer self)
{
	return self ? proton_plus_vdf_binary_ref (self) : NULL;
}

void
proton_plus_vdf_shortcuts_install (ProtonPlusVDFShortcuts* self,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	ProtonPlusVdfShortcutsInstallData* _data_;
	ProtonPlusVDFShortcuts* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusVdfShortcutsInstallData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_vdf_shortcuts_install_data_free);
	_tmp0_ = _proton_plus_vdf_binary_ref0 (self);
	_data_->self = _tmp0_;
	proton_plus_vdf_shortcuts_install_co (_data_);
}

gboolean
proton_plus_vdf_shortcuts_install_finish (ProtonPlusVDFShortcuts* self,
                                          GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusVdfShortcutsInstallData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_vdf_shortcuts_install_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	ProtonPlusVdfShortcutsInstallData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_vdf_shortcuts_install_co (_data_);
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static gboolean
proton_plus_vdf_shortcuts_install_co (ProtonPlusVdfShortcutsInstallData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	memset (&_data_->_tmp0_, 0, sizeof (ProtonPlusVDFShortcut));
	_data_->pp_shortcut = _data_->_tmp0_;
	_data_->_tmp1_ = g_strdup ("");
	_data_->exe = _data_->_tmp1_;
	_data_->_tmp2_ = g_getenv ("LANG");
	_data_->_tmp3_ = g_strdup_printf ("LC_ALL=%s", _data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = g_strconcat (_data_->_tmp4_, " %command%", NULL);
	_data_->_tmp6_ = _data_->_tmp5_;
	_g_free0 (_data_->_tmp4_);
	_data_->launch_options = _data_->_tmp6_;
	_data_->_tmp7_ = g_strdup ("");
	_data_->icon = _data_->_tmp7_;
	if (g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS)) {
		_data_->_tmp8_ = g_strdup ("\"/usr/bin/flatpak\"");
		_g_free0 (_data_->exe);
		_data_->exe = _data_->_tmp8_;
		_data_->_tmp9_ = _data_->launch_options;
		_data_->_tmp10_ = g_strconcat (_data_->_tmp9_, " \"run\" \"--branch=stable\" \"--arch=x86_64\" \"--command=protonplus\"" \
" \"com.vysp3r.ProtonPlus\"", NULL);
		_g_free0 (_data_->launch_options);
		_data_->launch_options = _data_->_tmp10_;
		_data_->_tmp11_ = g_strdup ("/var/lib/flatpak/app/com.vysp3r.ProtonPlus/current/active/files/share/" \
"icons/hicolor/512x512/apps/com.vysp3r.ProtonPlus.png");
		_g_free0 (_data_->icon);
		_data_->icon = _data_->_tmp11_;
	} else {
		_data_->_tmp12_ = g_strdup_printf ("which protonplus");
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_state_ = 1;
		proton_plus_utils_system_run_command (_data_->_tmp13_, proton_plus_vdf_shortcuts_install_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp14_ = proton_plus_utils_system_run_command_finish (_data_->_res_);
		_data_->_tmp15_ = _data_->_tmp14_;
		_g_free0 (_data_->_tmp13_);
		_data_->which_output = _data_->_tmp15_;
		_data_->_tmp16_ = _data_->which_output;
		if (string_contains (_data_->_tmp16_, "which: no")) {
			_data_->result = FALSE;
			_g_free0 (_data_->which_output);
			_g_free0 (_data_->icon);
			_g_free0 (_data_->launch_options);
			_g_free0 (_data_->exe);
			proton_plus_vdf_shortcut_destroy (&_data_->pp_shortcut);
			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;
		}
		_data_->_tmp17_ = _data_->which_output;
		_data_->_tmp18_ = g_strdup_printf ("%s", _data_->_tmp17_);
		_g_free0 (_data_->exe);
		_data_->exe = _data_->_tmp18_;
		_data_->_tmp19_ = g_strdup ("/usr/share/icons/hicolor/512x512/apps/com.vysp3r.ProtonPlus.png");
		_g_free0 (_data_->icon);
		_data_->icon = _data_->_tmp19_;
		_g_free0 (_data_->which_output);
	}
	{
		_data_->pp_shortcut.AppID = (gint32) 1621167220;
		_data_->_tmp20_ = g_strdup ("ProtonPlus");
		_g_free0 (_data_->pp_shortcut.AppName);
		_data_->pp_shortcut.AppName = _data_->_tmp20_;
		_data_->_tmp21_ = _data_->exe;
		_data_->_tmp22_ = g_strdup (_data_->_tmp21_);
		_g_free0 (_data_->pp_shortcut.Exe);
		_data_->pp_shortcut.Exe = _data_->_tmp22_;
		_data_->_tmp23_ = g_strdup ("./");
		_g_free0 (_data_->pp_shortcut.StartDir);
		_data_->pp_shortcut.StartDir = _data_->_tmp23_;
		_data_->_tmp24_ = _data_->icon;
		_data_->_tmp25_ = g_strdup (_data_->_tmp24_);
		_g_free0 (_data_->pp_shortcut.Icon);
		_data_->pp_shortcut.Icon = _data_->_tmp25_;
		_data_->_tmp26_ = g_strdup ("");
		_g_free0 (_data_->pp_shortcut.ShortcutPath);
		_data_->pp_shortcut.ShortcutPath = _data_->_tmp26_;
		_data_->_tmp27_ = _data_->launch_options;
		_data_->_tmp28_ = g_strdup (_data_->_tmp27_);
		_g_free0 (_data_->pp_shortcut.LaunchOptions);
		_data_->pp_shortcut.LaunchOptions = _data_->_tmp28_;
		_data_->pp_shortcut.IsHidden = FALSE;
		_data_->pp_shortcut.AllowDesktopConfig = TRUE;
		_data_->pp_shortcut.AllowOverlay = TRUE;
		_data_->pp_shortcut.OpenVR = (gint32) 0;
		_data_->pp_shortcut.Devkit = (gint32) 0;
		_data_->_tmp29_ = g_strdup ("\0");
		_g_free0 (_data_->pp_shortcut.DevkitGameID);
		_data_->pp_shortcut.DevkitGameID = _data_->_tmp29_;
		_data_->pp_shortcut.DevkitOverrideAppID = (gint32) 0;
		_data_->pp_shortcut.LastPlayTime = (gint32) 0;
		_data_->_tmp30_ = g_strdup ("");
		_g_free0 (_data_->pp_shortcut.FlatpakAppID);
		_data_->pp_shortcut.FlatpakAppID = _data_->_tmp30_;
		_data_->_tmp31_ = _data_->pp_shortcut;
		proton_plus_vdf_shortcuts_append_shortcut (_data_->self, &_data_->_tmp31_);
		proton_plus_vdf_binary_save ((ProtonPlusVDFBinary*) _data_->self, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->result = TRUE;
		_g_free0 (_data_->icon);
		_g_free0 (_data_->launch_options);
		_g_free0 (_data_->exe);
		proton_plus_vdf_shortcut_destroy (&_data_->pp_shortcut);
		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;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp32_ = _data_->e;
		_data_->_tmp33_ = _data_->_tmp32_->message;
		g_warning ("shortcut.vala:72: %s", _data_->_tmp33_);
		_data_->result = FALSE;
		_g_error_free0 (_data_->e);
		_g_free0 (_data_->icon);
		_g_free0 (_data_->launch_options);
		_g_free0 (_data_->exe);
		proton_plus_vdf_shortcut_destroy (&_data_->pp_shortcut);
		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;
	}
	__finally0:
	_g_free0 (_data_->icon);
	_g_free0 (_data_->launch_options);
	_g_free0 (_data_->exe);
	proton_plus_vdf_shortcut_destroy (&_data_->pp_shortcut);
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
	g_clear_error (&_data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

gboolean
proton_plus_vdf_shortcuts_uninstall (ProtonPlusVDFShortcuts* self)
{
	gboolean _tmp2_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	{
		proton_plus_vdf_shortcuts_remove_shortcut_by_name (self, "ProtonPlus", &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		proton_plus_vdf_binary_save ((ProtonPlusVDFBinary*) 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:83: %s", _tmp1_);
		result = TRUE;
		_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_vdf_shortcuts_get_installed_status (ProtonPlusVDFShortcuts* self)
{
	ProtonPlusVDFShortcut shortcut = {0};
	ProtonPlusVDFShortcut _tmp0_ = {0};
	ProtonPlusVDFShortcut _tmp1_;
	const gchar* _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	proton_plus_vdf_shortcuts_get_shortcut_by_name (self, "ProtonPlus", &_tmp0_);
	shortcut = _tmp0_;
	_tmp1_ = shortcut;
	_tmp2_ = _tmp1_.AppName;
	result = _tmp2_ != NULL;
	proton_plus_vdf_shortcut_destroy (&shortcut);
	return result;
}

gsize
proton_plus_vdf_shortcuts_get_shortcuts_count (ProtonPlusVDFShortcuts* self)
{
	gsize count = 0UL;
	gsize result;
	g_return_val_if_fail (self != NULL, 0UL);
	count = (gsize) 0;
	{
		GeeIterator* _entry_it = NULL;
		GeeTreeMap* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = ((ProtonPlusVDFBinary*) self)->nodes;
		_tmp1_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_entry_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			gboolean _tmp9_ = FALSE;
			GeeMapEntry* _tmp10_;
			gconstpointer _tmp11_;
			gconstpointer _tmp12_;
			_tmp6_ = _entry_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _entry_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			entry = (GeeMapEntry*) _tmp8_;
			_tmp10_ = entry;
			_tmp11_ = gee_map_entry_get_key (_tmp10_);
			_tmp12_ = _tmp11_;
			if (string_contains ((const gchar*) _tmp12_, "shortcuts.")) {
				GeeMapEntry* _tmp13_;
				gconstpointer _tmp14_;
				gconstpointer _tmp15_;
				_tmp13_ = entry;
				_tmp14_ = gee_map_entry_get_key (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp9_ = !string_contains ((const gchar*) _tmp15_, ".tags");
			} else {
				_tmp9_ = FALSE;
			}
			if (_tmp9_) {
				gsize _tmp16_;
				_tmp16_ = count;
				count = _tmp16_ + 1;
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	result = count;
	return result;
}

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

void
proton_plus_vdf_shortcuts_replace_shortcut_by_name (ProtonPlusVDFShortcuts* self,
                                                    const gchar* name,
                                                    ProtonPlusVDFShortcut* 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_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = ((ProtonPlusVDFBinary*) self)->nodes;
		_tmp1_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_entry_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			gboolean _tmp9_ = FALSE;
			GeeMapEntry* _tmp10_;
			gconstpointer _tmp11_;
			gconstpointer _tmp12_;
			_tmp6_ = _entry_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _entry_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			entry = (GeeMapEntry*) _tmp8_;
			_tmp10_ = entry;
			_tmp11_ = gee_map_entry_get_key (_tmp10_);
			_tmp12_ = _tmp11_;
			if (string_contains ((const gchar*) _tmp12_, "shortcuts.")) {
				GeeMapEntry* _tmp13_;
				gconstpointer _tmp14_;
				gconstpointer _tmp15_;
				_tmp13_ = entry;
				_tmp14_ = gee_map_entry_get_key (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp9_ = !string_contains ((const gchar*) _tmp15_, ".tags");
			} else {
				_tmp9_ = FALSE;
			}
			if (_tmp9_) {
				GeeMapEntry* _tmp16_;
				gconstpointer _tmp17_;
				gconstpointer _tmp18_;
				gpointer _tmp19_;
				GVariant* _tmp20_;
				const gchar* _tmp21_;
				gboolean _tmp22_;
				_tmp16_ = entry;
				_tmp17_ = gee_map_entry_get_value (_tmp16_);
				_tmp18_ = _tmp17_;
				_tmp19_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusVDFNode*) _tmp18_), "AppName");
				_tmp20_ = (GVariant*) _tmp19_;
				_tmp21_ = g_variant_get_string (_tmp20_, NULL);
				_tmp22_ = g_strcmp0 (_tmp21_, name) == 0;
				_g_variant_unref0 (_tmp20_);
				if (_tmp22_) {
					GeeMapEntry* _tmp23_;
					gconstpointer _tmp24_;
					gconstpointer _tmp25_;
					ProtonPlusVDFShortcut _tmp26_;
					_tmp23_ = entry;
					_tmp24_ = gee_map_entry_get_value (_tmp23_);
					_tmp25_ = _tmp24_;
					_tmp26_ = *shortcut;
					proton_plus_vdf_shortcuts_write_shortcut_on_node (self, (ProtonPlusVDFNode*) _tmp25_, &_tmp26_);
					_g_object_unref0 (entry);
					_g_object_unref0 (_entry_it);
					return;
				}
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
}

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_vdf_shortcuts_get_shortcut_id_by_name (ProtonPlusVDFShortcuts* self,
                                                   const gchar* name,
                                                   GError** error)
{
	const gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	GError* _tmp34_;
	GError* _tmp35_;
	gint _tmp36_ = -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_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = ((ProtonPlusVDFBinary*) self)->nodes;
		_tmp1_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_entry_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			GeeMapEntry* entry = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			gboolean _tmp9_ = FALSE;
			GeeMapEntry* _tmp10_;
			gconstpointer _tmp11_;
			gconstpointer _tmp12_;
			_tmp6_ = _entry_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _entry_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			entry = (GeeMapEntry*) _tmp8_;
			_tmp10_ = entry;
			_tmp11_ = gee_map_entry_get_key (_tmp10_);
			_tmp12_ = _tmp11_;
			if (string_contains ((const gchar*) _tmp12_, "shortcuts.")) {
				GeeMapEntry* _tmp13_;
				gconstpointer _tmp14_;
				gconstpointer _tmp15_;
				_tmp13_ = entry;
				_tmp14_ = gee_map_entry_get_key (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp9_ = !string_contains ((const gchar*) _tmp15_, ".tags");
			} else {
				_tmp9_ = FALSE;
			}
			if (_tmp9_) {
				GeeMapEntry* _tmp16_;
				gconstpointer _tmp17_;
				gconstpointer _tmp18_;
				gpointer _tmp19_;
				GVariant* _tmp20_;
				const gchar* _tmp21_;
				gboolean _tmp22_;
				_tmp16_ = entry;
				_tmp17_ = gee_map_entry_get_value (_tmp16_);
				_tmp18_ = _tmp17_;
				_tmp19_ = gee_abstract_map_get ((GeeAbstractMap*) ((ProtonPlusVDFNode*) _tmp18_), "AppName");
				_tmp20_ = (GVariant*) _tmp19_;
				_tmp21_ = g_variant_get_string (_tmp20_, NULL);
				_tmp22_ = g_strcmp0 (_tmp21_, name) == 0;
				_g_variant_unref0 (_tmp20_);
				if (_tmp22_) {
					GeeMapEntry* _tmp23_;
					gconstpointer _tmp24_;
					gconstpointer _tmp25_;
					gchar** _tmp26_;
					gchar** _tmp27_;
					gchar** _tmp28_;
					gint _tmp28__length1;
					const gchar* _tmp29_;
					gint _tmp30_;
					_tmp23_ = entry;
					_tmp24_ = gee_map_entry_get_key (_tmp23_);
					_tmp25_ = _tmp24_;
					_tmp27_ = _tmp26_ = g_strsplit ((const gchar*) _tmp25_, ".", 0);
					_tmp28_ = _tmp27_;
					_tmp28__length1 = _vala_array_length (_tmp26_);
					_tmp29_ = _tmp28_[1];
					_tmp30_ = atoi (_tmp29_);
					_tmp28_ = (_vala_array_free (_tmp28_, _tmp28__length1, (GDestroyNotify) g_free), NULL);
					result = _tmp30_;
					_g_object_unref0 (entry);
					_g_object_unref0 (_entry_it);
					return result;
				}
			}
			_g_object_unref0 (entry);
		}
		_g_object_unref0 (_entry_it);
	}
	_tmp31_ = string_to_string (name);
	_tmp32_ = g_strconcat ("Could not find the shortcut named ", _tmp31_, ".", NULL);
	_tmp33_ = _tmp32_;
	_tmp34_ = g_error_new (g_quark_from_string ("vala-vdf"), 0, "%s", _tmp33_);
	_tmp35_ = _tmp34_;
	_g_free0 (_tmp33_);
	_inner_error0_ = _tmp35_;
	g_propagate_error (error, _inner_error0_);
	return _tmp36_;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			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 NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			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 NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__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 gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

void
proton_plus_vdf_shortcuts_remove_shortcut_by_name (ProtonPlusVDFShortcuts* 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* _tmp44_;
		GeeTreeMap* _tmp45_;
		_tmp0_ = gee_tree_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, PROTON_PLUS_VDF_TYPE_NODE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		new_nodes = _tmp0_;
		node_base_id = proton_plus_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_;
			GeeSet* _tmp6_;
			GeeSet* _tmp7_;
			GeeSet* _tmp8_;
			GeeIterator* _tmp9_;
			GeeIterator* _tmp10_;
			_tmp5_ = ((ProtonPlusVDFBinary*) self)->nodes;
			_tmp6_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp5_);
			_tmp7_ = _tmp6_;
			_tmp8_ = _tmp7_;
			_tmp9_ = gee_iterable_iterator ((GeeIterable*) _tmp8_);
			_tmp10_ = _tmp9_;
			_g_object_unref0 (_tmp8_);
			_entry_it = _tmp10_;
			while (TRUE) {
				GeeIterator* _tmp11_;
				GeeMapEntry* entry = NULL;
				GeeIterator* _tmp12_;
				gpointer _tmp13_;
				GeeMapEntry* _tmp14_;
				gconstpointer _tmp15_;
				gconstpointer _tmp16_;
				const gchar* _tmp17_;
				_tmp11_ = _entry_it;
				if (!gee_iterator_next (_tmp11_)) {
					break;
				}
				_tmp12_ = _entry_it;
				_tmp13_ = gee_iterator_get (_tmp12_);
				entry = (GeeMapEntry*) _tmp13_;
				_tmp14_ = entry;
				_tmp15_ = gee_map_entry_get_key (_tmp14_);
				_tmp16_ = _tmp15_;
				_tmp17_ = node_base_name;
				if (!string_contains ((const gchar*) _tmp16_, _tmp17_)) {
					gchar* curr_key = NULL;
					GeeMapEntry* _tmp18_;
					gconstpointer _tmp19_;
					gconstpointer _tmp20_;
					gchar* _tmp21_;
					GeeMapEntry* _tmp22_;
					gconstpointer _tmp23_;
					gconstpointer _tmp24_;
					GeeTreeMap* _tmp39_;
					const gchar* _tmp40_;
					GeeMapEntry* _tmp41_;
					gconstpointer _tmp42_;
					gconstpointer _tmp43_;
					_tmp18_ = entry;
					_tmp19_ = gee_map_entry_get_key (_tmp18_);
					_tmp20_ = _tmp19_;
					_tmp21_ = g_strdup ((const gchar*) _tmp20_);
					curr_key = _tmp21_;
					_tmp22_ = entry;
					_tmp23_ = gee_map_entry_get_key (_tmp22_);
					_tmp24_ = _tmp23_;
					if (string_contains ((const gchar*) _tmp24_, ".")) {
						gint curr_id = 0;
						GeeMapEntry* _tmp25_;
						gconstpointer _tmp26_;
						gconstpointer _tmp27_;
						gchar** _tmp28_;
						gchar** _tmp29_;
						gchar** _tmp30_;
						gint _tmp30__length1;
						const gchar* _tmp31_;
						gint _tmp32_;
						gint new_id = 0;
						_tmp25_ = entry;
						_tmp26_ = gee_map_entry_get_key (_tmp25_);
						_tmp27_ = _tmp26_;
						_tmp29_ = _tmp28_ = g_strsplit ((const gchar*) _tmp27_, ".", 0);
						_tmp30_ = _tmp29_;
						_tmp30__length1 = _vala_array_length (_tmp28_);
						_tmp31_ = _tmp30_[1];
						_tmp32_ = atoi (_tmp31_);
						_tmp30_ = (_vala_array_free (_tmp30_, _tmp30__length1, (GDestroyNotify) g_free), NULL);
						curr_id = _tmp32_;
						new_id = curr_id - 1;
						if (curr_id > node_base_id) {
							const gchar* _tmp33_;
							gchar* _tmp34_;
							gchar* _tmp35_;
							gchar* _tmp36_;
							gchar* _tmp37_;
							gchar* _tmp38_;
							_tmp33_ = curr_key;
							_tmp34_ = g_strdup_printf ("%d", curr_id);
							_tmp35_ = _tmp34_;
							_tmp36_ = g_strdup_printf ("%d", new_id);
							_tmp37_ = _tmp36_;
							_tmp38_ = string_replace (_tmp33_, _tmp35_, _tmp37_);
							_g_free0 (curr_key);
							curr_key = _tmp38_;
							_g_free0 (_tmp37_);
							_g_free0 (_tmp35_);
						}
					}
					_tmp39_ = new_nodes;
					_tmp40_ = curr_key;
					_tmp41_ = entry;
					_tmp42_ = gee_map_entry_get_value (_tmp41_);
					_tmp43_ = _tmp42_;
					gee_abstract_map_set ((GeeAbstractMap*) _tmp39_, _tmp40_, (ProtonPlusVDFNode*) _tmp43_);
					_g_free0 (curr_key);
				}
				_g_object_unref0 (entry);
			}
			_g_object_unref0 (_entry_it);
		}
		_tmp44_ = new_nodes;
		_tmp45_ = _g_object_ref0 (_tmp44_);
		_g_object_unref0 (((ProtonPlusVDFBinary*) self)->nodes);
		((ProtonPlusVDFBinary*) self)->nodes = _tmp45_;
		_g_free0 (node_base_name);
		_g_object_unref0 (new_nodes);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp46_;
		GError* _tmp47_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp46_ = e;
		_tmp47_ = _g_error_copy0 (_tmp46_);
		_inner_error0_ = _tmp47_;
		_g_error_free0 (e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
}

static void
proton_plus_vdf_shortcuts_write_shortcut_on_node (ProtonPlusVDFShortcuts* self,
                                                  ProtonPlusVDFNode* node,
                                                  ProtonPlusVDFShortcut* shortcut)
{
	ProtonPlusVDFShortcut _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	gint _tmp3_ = 0;
	ProtonPlusVDFShortcut _tmp4_;
	GVariant* _tmp5_;
	GVariant* _tmp6_;
	gint _tmp7_ = 0;
	ProtonPlusVDFShortcut _tmp8_;
	GVariant* _tmp9_;
	GVariant* _tmp10_;
	ProtonPlusVDFShortcut _tmp11_;
	const gchar* _tmp12_;
	GVariant* _tmp13_;
	GVariant* _tmp14_;
	ProtonPlusVDFShortcut _tmp15_;
	GVariant* _tmp16_;
	GVariant* _tmp17_;
	ProtonPlusVDFShortcut _tmp18_;
	const gchar* _tmp19_;
	GVariant* _tmp20_;
	GVariant* _tmp21_;
	ProtonPlusVDFShortcut _tmp22_;
	GVariant* _tmp23_;
	GVariant* _tmp24_;
	ProtonPlusVDFShortcut _tmp25_;
	const gchar* _tmp26_;
	GVariant* _tmp27_;
	GVariant* _tmp28_;
	ProtonPlusVDFShortcut _tmp29_;
	const gchar* _tmp30_;
	GVariant* _tmp31_;
	GVariant* _tmp32_;
	gint _tmp33_ = 0;
	ProtonPlusVDFShortcut _tmp34_;
	GVariant* _tmp35_;
	GVariant* _tmp36_;
	ProtonPlusVDFShortcut _tmp37_;
	GVariant* _tmp38_;
	GVariant* _tmp39_;
	ProtonPlusVDFShortcut _tmp40_;
	const gchar* _tmp41_;
	GVariant* _tmp42_;
	GVariant* _tmp43_;
	ProtonPlusVDFShortcut _tmp44_;
	GVariant* _tmp45_;
	GVariant* _tmp46_;
	ProtonPlusVDFShortcut _tmp47_;
	const gchar* _tmp48_;
	GVariant* _tmp49_;
	GVariant* _tmp50_;
	ProtonPlusVDFShortcut _tmp51_;
	const gchar* _tmp52_;
	GVariant* _tmp53_;
	GVariant* _tmp54_;
	ProtonPlusVDFShortcut _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_vdf_shortcuts_append_shortcut (ProtonPlusVDFShortcuts* self,
                                           ProtonPlusVDFShortcut* shortcut)
{
	gsize new_node_id = 0UL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	ProtonPlusVDFNode* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	ProtonPlusVDFNode* _tmp9_;
	ProtonPlusVDFShortcut _tmp10_;
	ProtonPlusVDFNode* _tmp11_;
	ProtonPlusVDFShortcut _tmp12_;
	GeeTreeMap* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	ProtonPlusVDFShortcut _tmp18_;
	ProtonPlusVDFNode* _tmp19_;
	GeeTreeMap* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	ProtonPlusVDFShortcut _tmp25_;
	ProtonPlusVDFNode* _tmp26_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (shortcut != NULL);
	new_node_id = proton_plus_vdf_shortcuts_get_shortcuts_count (self);
	_tmp0_ = g_strdup_printf ("%" G_GSIZE_FORMAT, new_node_id);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat ("shortcuts.", _tmp1_, NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = proton_plus_vdf_node_new (_tmp3_);
	_g_object_unref0 ((*shortcut).shortcut_node);
	(*shortcut).shortcut_node = _tmp4_;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	_tmp5_ = g_strdup_printf ("%" G_GSIZE_FORMAT, new_node_id);
	_tmp6_ = _tmp5_;
	_tmp7_ = g_strconcat ("shortcuts.", _tmp6_, ".tags", NULL);
	_tmp8_ = _tmp7_;
	_tmp9_ = proton_plus_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_vdf_shortcuts_write_shortcut_on_node (self, _tmp11_, &_tmp12_);
	_tmp13_ = ((ProtonPlusVDFBinary*) self)->nodes;
	_tmp14_ = g_strdup_printf ("%" G_GSIZE_FORMAT, new_node_id);
	_tmp15_ = _tmp14_;
	_tmp16_ = g_strconcat ("shortcuts.", _tmp15_, NULL);
	_tmp17_ = _tmp16_;
	_tmp18_ = *shortcut;
	_tmp19_ = _tmp18_.shortcut_node;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp13_, _tmp17_, _tmp19_);
	_g_free0 (_tmp17_);
	_g_free0 (_tmp15_);
	_tmp20_ = ((ProtonPlusVDFBinary*) self)->nodes;
	_tmp21_ = g_strdup_printf ("%" G_GSIZE_FORMAT, new_node_id);
	_tmp22_ = _tmp21_;
	_tmp23_ = g_strconcat ("shortcuts.", _tmp22_, ".tags", NULL);
	_tmp24_ = _tmp23_;
	_tmp25_ = *shortcut;
	_tmp26_ = _tmp25_.shortcut_node_tags;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp20_, _tmp24_, _tmp26_);
	_g_free0 (_tmp24_);
	_g_free0 (_tmp22_);
}

void
proton_plus_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_vdf_shortcuts_class_init (ProtonPlusVDFShortcutsClass * klass,
                                      gpointer klass_data)
{
	proton_plus_vdf_shortcuts_parent_class = g_type_class_peek_parent (klass);
}

static void
proton_plus_vdf_shortcuts_instance_init (ProtonPlusVDFShortcuts * self,
                                         gpointer klass)
{
}

static GType
proton_plus_vdf_shortcuts_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusVDFShortcutsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_vdf_shortcuts_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusVDFShortcuts), 0, (GInstanceInitFunc) proton_plus_vdf_shortcuts_instance_init, NULL };
	GType proton_plus_vdf_shortcuts_type_id;
	proton_plus_vdf_shortcuts_type_id = g_type_register_static (PROTON_PLUS_VDF_TYPE_BINARY, "ProtonPlusVDFShortcuts", &g_define_type_info, 0);
	return proton_plus_vdf_shortcuts_type_id;
}

GType
proton_plus_vdf_shortcuts_get_type (void)
{
	static volatile gsize proton_plus_vdf_shortcuts_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_vdf_shortcuts_type_id__once)) {
		GType proton_plus_vdf_shortcuts_type_id;
		proton_plus_vdf_shortcuts_type_id = proton_plus_vdf_shortcuts_get_type_once ();
		g_once_init_leave (&proton_plus_vdf_shortcuts_type_id__once, proton_plus_vdf_shortcuts_type_id);
	}
	return proton_plus_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;
}

