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

#include "protonplus_core.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <glib-object.h>
#include "config.h"
#include <gee.h>
#include <errno.h>
#include <glib/gstdio.h>
#include <glib/gi18n-lib.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

enum  {
	PROTON_PLUS_MODELS_LAUNCHERS_STEAM_0_PROPERTY,
	PROTON_PLUS_MODELS_LAUNCHERS_STEAM_PROFILE_PROPERTY,
	PROTON_PLUS_MODELS_LAUNCHERS_STEAM_DEFAULT_COMPATIBILITY_TOOL_PROPERTY,
	PROTON_PLUS_MODELS_LAUNCHERS_STEAM_NUM_PROPERTIES
};
static GParamSpec* proton_plus_models_launchers_steam_properties[PROTON_PLUS_MODELS_LAUNCHERS_STEAM_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _ProtonPlusModelsLaunchersSteamSwitchProfileData ProtonPlusModelsLaunchersSteamSwitchProfileData;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_match_info_unref0(var) ((var == NULL) ? NULL : (var = (g_match_info_unref (var), NULL)))
typedef struct _ProtonPlusModelsLaunchersSteamLoadGameLibraryData ProtonPlusModelsLaunchersSteamLoadGameLibraryData;
typedef struct _Block61Data Block61Data;
#define _proton_plus_models_games_steam_awacy_game_unref0(var) ((var == NULL) ? NULL : (var = (proton_plus_models_games_steam_awacy_game_unref (var), NULL)))
typedef struct _ProtonPlusModelsLaunchersSteamEnrichGamesWithAwacyData ProtonPlusModelsLaunchersSteamEnrichGamesWithAwacyData;
typedef struct _Block62Data Block62Data;
typedef struct _ProtonPlusModelsLaunchersSteamLoadCompatibilityToolHashtableData ProtonPlusModelsLaunchersSteamLoadCompatibilityToolHashtableData;

struct _ProtonPlusModelsLaunchersSteamPrivate {
	ProtonPlusModelsSteamProfile* _profile;
	gchar* _default_compatibility_tool;
	ProtonPlusModelsGamesAwacyGameCatalog* awacy_game_catalog;
	ProtonPlusModelsSteamCompatibilityToolDiscovery* compatibility_tool_discovery;
	guint game_library_generation;
};

struct _ProtonPlusModelsLaunchersSteamSwitchProfileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusModelsLaunchersSteam* self;
	ProtonPlusModelsSteamProfile* profile;
	ProtonPlusModelsSteamProfile* _tmp0_;
	ProtonPlusModelsSteamProfile* _tmp1_;
	GList* _tmp2_;
	GList* non_steam_game_collection;
	GList* non_steam_game_it;
	ProtonPlusModelsGamesSteam* _tmp3_;
	ProtonPlusModelsGamesSteam* non_steam_game;
	ProtonPlusModelsGamesSteam* _tmp4_;
	GList* _tmp5_;
	GList* game_collection;
	GList* game_it;
	ProtonPlusModelsGamesSteam* _tmp6_;
	ProtonPlusModelsGamesSteam* game;
	gchar* launch_options;
	GHashTable* _tmp7_;
	ProtonPlusModelsGamesSteam* _tmp8_;
	guint _tmp9_;
	guint _tmp10_;
	gconstpointer _tmp11_;
	gchar* _tmp12_;
	ProtonPlusModelsGamesSteam* _tmp13_;
	const gchar* _tmp14_;
	GList* _tmp15_;
	GList* _vala1_non_steam_game_collection;
	GList* _vala1_non_steam_game_it;
	ProtonPlusModelsGamesSteam* _tmp16_;
	ProtonPlusModelsGamesSteam* _vala1_non_steam_game;
	ProtonPlusModelsGamesSteam* _tmp17_;
	ProtonPlusModelsGame* _tmp18_;
};

struct _ProtonPlusModelsLaunchersSteamLoadGameLibraryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusModelsLaunchersSteam* self;
	gboolean result;
	guint current_generation;
	guint _tmp0_;
	GeeLinkedList* _tmp1_;
	ProtonPlusModelsSteamCompatibilityToolDiscovery* _tmp2_;
	GRegex* name_regex;
	GRegex* _tmp3_;
	GRegex* dir_regex;
	GRegex* _tmp4_;
	GeeHashSet* excluded_appids;
	GeeHashSet* _tmp5_;
	GeeHashSet* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar** _tmp16_;
	gchar** _tmp17_;
	gint _tmp17__length1;
	gboolean compatibility_tool_hashtable_loaded;
	gchar* default_compatibility_tool;
	GHashTable* _tmp18_;
	gconstpointer _tmp19_;
	gchar* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	gchar* libraryfolder_content;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	ProtonPlusUtilsVDFVdfDocument* libraryfolder_document;
	const gchar* _tmp28_;
	ProtonPlusUtilsVDFVdfDocument* _tmp29_;
	ProtonPlusUtilsVDFVdfDocument* _tmp30_;
	ProtonPlusUtilsVDFVdfEntry* libraryfolders;
	ProtonPlusUtilsVDFVdfDocument* _tmp31_;
	ProtonPlusUtilsVDFVdfEntry* _tmp32_;
	ProtonPlusUtilsVDFVdfEntry* _tmp33_;
	ProtonPlusUtilsVDFVdfEntry* _tmp34_;
	ProtonPlusUtilsVDFVdfEntry* _tmp35_;
	GeeArrayList* _libraryfolder_list;
	ProtonPlusUtilsVDFVdfEntry* _tmp36_;
	GeeArrayList* _tmp37_;
	GeeArrayList* _tmp38_;
	gint _libraryfolder_size;
	GeeArrayList* _tmp39_;
	gint _tmp40_;
	gint _tmp41_;
	gint _libraryfolder_index;
	gint _tmp42_;
	gint _tmp43_;
	ProtonPlusUtilsVDFVdfEntry* libraryfolder;
	GeeArrayList* _tmp44_;
	gpointer _tmp45_;
	gint libraryfolder_id;
	ProtonPlusUtilsVDFVdfEntry* _tmp46_;
	const gchar* _tmp47_;
	const gchar* _tmp48_;
	gint _tmp49_;
	gboolean _tmp50_;
	ProtonPlusUtilsVDFVdfEntry* path;
	ProtonPlusUtilsVDFVdfEntry* _tmp51_;
	ProtonPlusUtilsVDFVdfEntry* _tmp52_;
	ProtonPlusUtilsVDFVdfEntry* apps;
	ProtonPlusUtilsVDFVdfEntry* _tmp53_;
	ProtonPlusUtilsVDFVdfEntry* _tmp54_;
	gboolean _tmp55_;
	gboolean _tmp56_;
	ProtonPlusUtilsVDFVdfEntry* _tmp57_;
	ProtonPlusUtilsVDFVdfEntry* _tmp58_;
	const gchar* _tmp59_;
	const gchar* _tmp60_;
	ProtonPlusUtilsVDFVdfEntry* _tmp61_;
	GeeArrayList* _app_list;
	ProtonPlusUtilsVDFVdfEntry* _tmp62_;
	GeeArrayList* _tmp63_;
	GeeArrayList* _tmp64_;
	gint _app_size;
	GeeArrayList* _tmp65_;
	gint _tmp66_;
	gint _tmp67_;
	gint _app_index;
	gint _tmp68_;
	gint _tmp69_;
	ProtonPlusUtilsVDFVdfEntry* app;
	GeeArrayList* _tmp70_;
	gpointer _tmp71_;
	guint id;
	gboolean id_valid;
	ProtonPlusUtilsVDFVdfEntry* _tmp72_;
	const gchar* _tmp73_;
	const gchar* _tmp74_;
	guint _tmp75_;
	gboolean _tmp76_;
	gint current_libraryfolder_id;
	gchar* current_libraryfolder_path;
	ProtonPlusUtilsVDFVdfEntry* _tmp77_;
	const gchar* _tmp78_;
	const gchar* _tmp79_;
	gchar* _tmp80_;
	gchar* current_appid;
	ProtonPlusUtilsVDFVdfEntry* _tmp81_;
	const gchar* _tmp82_;
	const gchar* _tmp83_;
	gchar* _tmp84_;
	gchar* current_steamapps_path;
	ProtonPlusUtilsVDFVdfEntry* _tmp85_;
	const gchar* _tmp86_;
	const gchar* _tmp87_;
	gchar* _tmp88_;
	gchar* current_manifest_path;
	gchar* _tmp89_;
	gchar* current_manifest_content;
	gchar* _tmp90_;
	gchar* current_name;
	gchar* _tmp91_;
	gchar* current_installdir;
	gchar* _tmp92_;
	const gchar* _tmp93_;
	const gchar* _tmp94_;
	gchar* _tmp95_;
	const gchar* _tmp96_;
	const gchar* _tmp97_;
	gchar* _tmp98_;
	GMatchInfo* name_match;
	GRegex* _tmp99_;
	const gchar* _tmp100_;
	GMatchInfo* _tmp101_;
	gboolean _tmp102_;
	GMatchInfo* _tmp103_;
	gchar* _tmp104_;
	GMatchInfo* dir_match;
	GRegex* _tmp105_;
	const gchar* _tmp106_;
	GMatchInfo* _tmp107_;
	gboolean _tmp108_;
	GMatchInfo* _tmp109_;
	gchar* _tmp110_;
	gchar* steam_tool_internal_title;
	ProtonPlusModelsCompatibilityToolRuntimeKind steam_tool_runtime_kind;
	gchar* _tmp111_;
	ProtonPlusModelsCompatibilityToolRuntimeKind _tmp112_;
	gboolean _tmp113_;
	ProtonPlusModelsSteamCompatibilityToolDiscovery* _tmp114_;
	const gchar* _tmp115_;
	const gchar* _tmp116_;
	gchar* _tmp117_;
	gchar* _tmp118_;
	const gchar* _tmp119_;
	const gchar* _tmp120_;
	GeeHashSet* _tmp121_;
	const gchar* _tmp122_;
	gchar* compatibility_tool_path;
	const gchar* _tmp123_;
	const gchar* _tmp124_;
	gchar* _tmp125_;
	gboolean has_proton_launcher;
	const gchar* _tmp126_;
	gchar* _tmp127_;
	gchar* _tmp128_;
	gboolean _tmp129_;
	gboolean _tmp130_;
	const gchar* _tmp131_;
	const gchar* _tmp132_;
	const gchar* _tmp133_;
	const gchar* _tmp134_;
	const gchar* _tmp135_;
	gchar* _tmp136_;
	gchar* _tmp137_;
	gboolean _tmp138_;
	ProtonPlusModelsGamesSteam* game;
	const gchar* _tmp139_;
	const gchar* _tmp140_;
	const gchar* _tmp141_;
	ProtonPlusModelsGamesSteam* _tmp142_;
	gchar* compatibility_tool;
	GHashTable* _tmp143_;
	ProtonPlusModelsGamesSteam* _tmp144_;
	guint _tmp145_;
	guint _tmp146_;
	gconstpointer _tmp147_;
	gchar* _tmp148_;
	const gchar* _tmp149_;
	gchar* _tmp150_;
	ProtonPlusModelsGamesSteam* _tmp151_;
	const gchar* _tmp152_;
	ProtonPlusModelsGamesSteam* _tmp153_;
	ProtonPlusModelsGame* _tmp154_;
};

struct _Block61Data {
	int _ref_count_;
	ProtonPlusModelsLaunchersSteam* self;
	guint generation;
};

struct _ProtonPlusModelsLaunchersSteamEnrichGamesWithAwacyData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusModelsLaunchersSteam* self;
	guint generation;
	GeeHashMap* awacy_games;
	ProtonPlusModelsGamesAwacyGameCatalog* _tmp0_;
	GeeHashMap* _tmp1_;
	GList* _tmp2_;
	GList* base_game_collection;
	GList* base_game_it;
	ProtonPlusModelsGame* _tmp3_;
	ProtonPlusModelsGame* base_game;
	ProtonPlusModelsGamesSteam* game;
	ProtonPlusModelsGame* _tmp4_;
	ProtonPlusModelsGamesSteam* _tmp5_;
	gboolean _tmp6_;
	ProtonPlusModelsGamesSteam* _tmp7_;
	ProtonPlusModelsGamesSteam* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	GeeHashMap* _tmp11_;
	ProtonPlusModelsGamesSteam* _tmp12_;
	guint _tmp13_;
	guint _tmp14_;
	ProtonPlusModelsGamesSteamAwacyGame* awacy_game;
	GeeHashMap* _tmp15_;
	ProtonPlusModelsGamesSteam* _tmp16_;
	guint _tmp17_;
	guint _tmp18_;
	gpointer _tmp19_;
	ProtonPlusModelsGamesSteamAwacyGame* _tmp20_;
	ProtonPlusModelsGamesSteam* _tmp21_;
	ProtonPlusModelsGamesSteamAwacyGame* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	ProtonPlusModelsGamesSteam* _tmp25_;
	ProtonPlusModelsGamesSteamAwacyGame* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	ProtonPlusModelsGamesSteam* _tmp29_;
};

struct _Block62Data {
	int _ref_count_;
	ProtonPlusModelsLaunchersSteam* self;
	gchar* tool_path;
};

struct _ProtonPlusModelsLaunchersSteamLoadCompatibilityToolHashtableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusModelsLaunchersSteam* self;
	gboolean result;
	GHashTable* _tmp0_;
	gchar* config_content;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	ProtonPlusUtilsVDFVdfDocument* document;
	const gchar* _tmp6_;
	ProtonPlusUtilsVDFVdfDocument* _tmp7_;
	ProtonPlusUtilsVDFVdfDocument* _tmp8_;
	ProtonPlusUtilsVDFVdfEntry* install_config_store;
	ProtonPlusUtilsVDFVdfDocument* _tmp9_;
	ProtonPlusUtilsVDFVdfEntry* _tmp10_;
	ProtonPlusUtilsVDFVdfEntry* _tmp11_;
	ProtonPlusUtilsVDFVdfEntry* _tmp12_;
	ProtonPlusUtilsVDFVdfEntry* _tmp13_;
	ProtonPlusUtilsVDFVdfEntry* _tmp14_;
	ProtonPlusUtilsVDFVdfEntry* _tmp15_;
	ProtonPlusUtilsVDFVdfEntry* _tmp16_;
	ProtonPlusUtilsVDFVdfEntry* software;
	ProtonPlusUtilsVDFVdfEntry* _tmp17_;
	ProtonPlusUtilsVDFVdfEntry* _tmp18_;
	ProtonPlusUtilsVDFVdfEntry* _tmp19_;
	ProtonPlusUtilsVDFVdfEntry* _tmp20_;
	ProtonPlusUtilsVDFVdfEntry* _tmp21_;
	ProtonPlusUtilsVDFVdfEntry* valve;
	ProtonPlusUtilsVDFVdfEntry* _tmp22_;
	ProtonPlusUtilsVDFVdfEntry* _tmp23_;
	ProtonPlusUtilsVDFVdfEntry* _tmp24_;
	ProtonPlusUtilsVDFVdfEntry* _tmp25_;
	ProtonPlusUtilsVDFVdfEntry* _tmp26_;
	ProtonPlusUtilsVDFVdfEntry* steam;
	ProtonPlusUtilsVDFVdfEntry* _tmp27_;
	ProtonPlusUtilsVDFVdfEntry* _tmp28_;
	ProtonPlusUtilsVDFVdfEntry* _tmp29_;
	ProtonPlusUtilsVDFVdfEntry* _tmp30_;
	ProtonPlusUtilsVDFVdfEntry* _tmp31_;
	ProtonPlusUtilsVDFVdfEntry* mapping;
	ProtonPlusUtilsVDFVdfEntry* _tmp32_;
	ProtonPlusUtilsVDFVdfEntry* _tmp33_;
	GHashTable* _tmp34_;
	gchar* _tmp35_;
	ProtonPlusServicesSteamConfigurationService* configuration;
	ProtonPlusServicesSteamConfigurationService* _tmp36_;
	ProtonPlusServicesSteamConfigurationService* _tmp37_;
	ProtonPlusServicesSteamConfigurationService* _tmp38_;
	ProtonPlusServicesSteamConfigurationService* _tmp39_;
	ProtonPlusServicesSteamConfigurationService* _tmp40_;
	GeeArrayList* _mapping_entry_list;
	ProtonPlusUtilsVDFVdfEntry* _tmp41_;
	GeeArrayList* _tmp42_;
	GeeArrayList* _tmp43_;
	gint _mapping_entry_size;
	GeeArrayList* _tmp44_;
	gint _tmp45_;
	gint _tmp46_;
	gint _mapping_entry_index;
	gint _tmp47_;
	gint _tmp48_;
	ProtonPlusUtilsVDFVdfEntry* mapping_entry;
	GeeArrayList* _tmp49_;
	gpointer _tmp50_;
	guint appid;
	ProtonPlusUtilsVDFVdfEntry* _tmp51_;
	const gchar* _tmp52_;
	const gchar* _tmp53_;
	guint _tmp54_;
	gboolean _tmp55_;
	ProtonPlusUtilsVDFVdfEntry* name;
	ProtonPlusUtilsVDFVdfEntry* _tmp56_;
	ProtonPlusUtilsVDFVdfEntry* _tmp57_;
	gboolean _tmp58_;
	ProtonPlusUtilsVDFVdfEntry* _tmp59_;
	ProtonPlusUtilsVDFVdfEntry* _tmp60_;
	const gchar* _tmp61_;
	const gchar* _tmp62_;
	GHashTable* _tmp63_;
	ProtonPlusUtilsVDFVdfEntry* _tmp64_;
	const gchar* _tmp65_;
	const gchar* _tmp66_;
	gchar* _tmp67_;
	ProtonPlusServicesSteamConfigurationService* _vala1_configuration;
	ProtonPlusServicesSteamConfigurationService* _tmp68_;
	ProtonPlusServicesSteamConfigurationService* _tmp69_;
	ProtonPlusServicesSteamConfigurationService* _tmp70_;
	ProtonPlusServicesSteamConfigurationService* _tmp71_;
	ProtonPlusServicesSteamConfigurationService* _tmp72_;
};

static gint ProtonPlusModelsLaunchersSteam_private_offset;
static gpointer proton_plus_models_launchers_steam_parent_class = NULL;

static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void _g_free0_ (gpointer var);
static ProtonPlusModelsSteamRestartTarget* proton_plus_models_launchers_steam_real_get_steam_restart_target (ProtonPlusModelsLauncher* base);
static GList* proton_plus_models_launchers_steam_real_get_managed_tool_directories (ProtonPlusModelsLauncher* base,
                                                                             ProtonPlusModelsGroup* group);
static gchar* proton_plus_models_launchers_steam_real_get_primary_managed_tool_directory (ProtonPlusModelsLauncher* base,
                                                                                   ProtonPlusModelsGroup* group);
static gchar* proton_plus_models_launchers_steam_get_managed_compatibility_tools_root (ProtonPlusModelsLaunchersSteam* self);
static void proton_plus_models_launchers_steam_switch_profile_data_free (gpointer _data);
static gboolean proton_plus_models_launchers_steam_switch_profile_co (ProtonPlusModelsLaunchersSteamSwitchProfileData* _data_);
static gint proton_plus_models_launchers_steam_real_get_compatibility_tool_usage_count (ProtonPlusModelsLauncher* base,
                                                                                 const gchar* compatibility_tool_name);
static gboolean proton_plus_models_launchers_steam_uses_compatibility_tool (ProtonPlusModelsLaunchersSteam* self,
                                                                     ProtonPlusModelsGame* game,
                                                                     const gchar* compatibility_tool_name,
                                                                     gboolean is_default_tool);
static void proton_plus_models_launchers_steam_real_load_game_library_data_free (gpointer _data);
static void proton_plus_models_launchers_steam_real_load_game_library (ProtonPlusModelsLauncher* base,
                                                                GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_);
static gboolean proton_plus_models_launchers_steam_real_load_game_library_co (ProtonPlusModelsLaunchersSteamLoadGameLibraryData* _data_);
static void proton_plus_models_launchers_steam_load_compatibility_tool_hashtable (ProtonPlusModelsLaunchersSteam* self,
                                                                           GAsyncReadyCallback _callback_,
                                                                           gpointer _user_data_);
static gboolean proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_finish (ProtonPlusModelsLaunchersSteam* self,
                                                                                      GAsyncResult* _res_);
static void proton_plus_models_launchers_steam_load_game_library_ready (GObject* source_object,
                                                                 GAsyncResult* _res_,
                                                                 gpointer _user_data_);
static void proton_plus_models_launchers_steam_load_discovered_compatibility_tools (ProtonPlusModelsLaunchersSteam* self);
static void proton_plus_models_launchers_steam_schedule_awacy_enrichment (ProtonPlusModelsLaunchersSteam* self,
                                                                   guint generation);
static Block61Data* block61_data_ref (Block61Data* _data61_);
static void block61_data_unref (void * _userdata_);
static gboolean __lambda27_ (Block61Data* _data61_);
static void proton_plus_models_launchers_steam_enrich_games_with_awacy (ProtonPlusModelsLaunchersSteam* self,
                                                                 guint generation,
                                                                 GAsyncReadyCallback _callback_,
                                                                 gpointer _user_data_);
static void proton_plus_models_launchers_steam_enrich_games_with_awacy_finish (ProtonPlusModelsLaunchersSteam* self,
                                                                        GAsyncResult* _res_);
static gboolean ___lambda27__gsource_func (gpointer self);
static void proton_plus_models_launchers_steam_enrich_games_with_awacy_data_free (gpointer _data);
static gboolean proton_plus_models_launchers_steam_enrich_games_with_awacy_co (ProtonPlusModelsLaunchersSteamEnrichGamesWithAwacyData* _data_);
static void proton_plus_models_launchers_steam_enrich_games_with_awacy_ready (GObject* source_object,
                                                                       GAsyncResult* _res_,
                                                                       gpointer _user_data_);
static gint proton_plus_models_launchers_steam_get_compatibility_tool_sort_priority (ProtonPlusModelsLaunchersSteam* self,
                                                                              ProtonPlusModelsCompatibilityTool* tool);
static void proton_plus_models_launchers_steam_add_unavailable_mappings (ProtonPlusModelsLaunchersSteam* self);
static void proton_plus_models_launchers_steam_sort_compatibility_tools (ProtonPlusModelsLaunchersSteam* self);
static void proton_plus_models_launchers_steam_add_compatibility_tool_if_missing (ProtonPlusModelsLaunchersSteam* self,
                                                                           ProtonPlusModelsCompatibilityTool* compatibility_tool);
static void proton_plus_models_launchers_steam_real_register_compatibility_tool_from_path (ProtonPlusModelsLauncher* base,
                                                                                    const gchar* tool_path);
static void proton_plus_models_launchers_steam_real_unregister_compatibility_tool_by_path (ProtonPlusModelsLauncher* base,
                                                                                    const gchar* tool_path);
static Block62Data* block62_data_ref (Block62Data* _data62_);
static void block62_data_unref (void * _userdata_);
static gboolean __lambda28_ (Block62Data* _data62_,
                      ProtonPlusModelsCompatibilityTool* tool);
static gboolean ___lambda28__gee_predicate (gconstpointer g,
                                     gpointer self);
static gint __lambda26_ (ProtonPlusModelsLaunchersSteam* self,
                  ProtonPlusModelsCompatibilityTool* a,
                  ProtonPlusModelsCompatibilityTool* b);
static gboolean proton_plus_models_launchers_steam_try_parse_any_proton_version (ProtonPlusModelsLaunchersSteam* self,
                                                                          const gchar* title,
                                                                          gint* major,
                                                                          gint* minor);
static gint ___lambda26__gcompare_data_func (gconstpointer a,
                                      gconstpointer b,
                                      gpointer self);
static gboolean proton_plus_models_launchers_steam_try_parse_proton_version (ProtonPlusModelsLaunchersSteam* self,
                                                                      const gchar* title,
                                                                      gint* major,
                                                                      gint* minor);
static void proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_data_free (gpointer _data);
static gboolean proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_co (ProtonPlusModelsLaunchersSteamLoadCompatibilityToolHashtableData* _data_);
static void proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_ready (GObject* source_object,
                                                                                 GAsyncResult* _res_,
                                                                                 gpointer _user_data_);
static void proton_plus_models_launchers_steam_finalize (GObject * obj);
static GType proton_plus_models_launchers_steam_get_type_once (void);
static void _vala_proton_plus_models_launchers_steam_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);
static void _vala_proton_plus_models_launchers_steam_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec);
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 inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GRegex* _tmp_regex_0 = NULL;
static GRegex* _tmp_regex_1 = NULL;

static inline gpointer
proton_plus_models_launchers_steam_get_instance_private (ProtonPlusModelsLaunchersSteam* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusModelsLaunchersSteam_private_offset);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

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

ProtonPlusModelsLaunchersSteam*
proton_plus_models_launchers_steam_construct (GType object_type,
                                              ProtonPlusModelsLauncherInstallationTypes installation_type,
                                              ProtonPlusModelsGamesAwacyGameCatalog* awacy_game_catalog,
                                              ProtonPlusModelsSteamCompatibilityToolDiscovery* compatibility_tool_discovery)
{
	ProtonPlusModelsLaunchersSteam * self = NULL;
	gchar** directories = NULL;
	gint directories_length1;
	gint _directories_size_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar** _tmp20_;
	gint _tmp20__length1;
	GHashTable* _tmp21_;
	ProtonPlusModelsGamesAwacyGameCatalog* _tmp22_ = NULL;
	ProtonPlusModelsGamesAwacyGameCatalog* _tmp23_;
	ProtonPlusModelsGamesAwacyGameCatalog* _tmp25_;
	ProtonPlusModelsSteamCompatibilityToolDiscovery* _tmp26_ = NULL;
	ProtonPlusModelsSteamCompatibilityToolDiscovery* _tmp27_;
	ProtonPlusModelsSteamCompatibilityToolDiscovery* _tmp29_;
	directories = NULL;
	directories_length1 = 0;
	_directories_size_ = directories_length1;
	switch (installation_type) {
		case PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_SYSTEM:
		{
			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_;
			gchar* _tmp10_;
			gchar** _tmp11_;
			_tmp0_ = g_get_user_data_dir ();
			_tmp1_ = g_strdup_printf ("%s/Steam", _tmp0_);
			_tmp2_ = g_get_home_dir ();
			_tmp3_ = g_strdup_printf ("%s/.local/share/Steam", _tmp2_);
			_tmp4_ = g_get_home_dir ();
			_tmp5_ = g_strdup_printf ("%s/.steam/steam", _tmp4_);
			_tmp6_ = g_get_home_dir ();
			_tmp7_ = g_strdup_printf ("%s/.steam/root", _tmp6_);
			_tmp8_ = g_get_home_dir ();
			_tmp9_ = g_strdup_printf ("%s/.steam/debian-installation", _tmp8_);
			_tmp10_ = g_strdup ("/usr/share/steam");
			_tmp11_ = g_new0 (gchar*, 6 + 1);
			_tmp11_[0] = _tmp1_;
			_tmp11_[1] = _tmp3_;
			_tmp11_[2] = _tmp5_;
			_tmp11_[3] = _tmp7_;
			_tmp11_[4] = _tmp9_;
			_tmp11_[5] = _tmp10_;
			directories = (_vala_array_free (directories, directories_length1, (GDestroyNotify) g_free), NULL);
			directories = _tmp11_;
			directories_length1 = 6;
			_directories_size_ = directories_length1;
			break;
		}
		case PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_FLATPAK:
		{
			const gchar* _tmp12_;
			gchar* _tmp13_;
			gchar** _tmp14_;
			_tmp12_ = g_get_home_dir ();
			_tmp13_ = g_strdup_printf ("%s/.var/app/com.valvesoftware.Steam/data/Steam", _tmp12_);
			_tmp14_ = g_new0 (gchar*, 1 + 1);
			_tmp14_[0] = _tmp13_;
			directories = (_vala_array_free (directories, directories_length1, (GDestroyNotify) g_free), NULL);
			directories = _tmp14_;
			directories_length1 = 1;
			_directories_size_ = directories_length1;
			break;
		}
		case PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_SNAP:
		{
			const gchar* _tmp15_;
			gchar* _tmp16_;
			gchar** _tmp17_;
			_tmp15_ = g_get_home_dir ();
			_tmp16_ = g_strdup_printf ("%s/snap/steam/common/.steam/root", _tmp15_);
			_tmp17_ = g_new0 (gchar*, 1 + 1);
			_tmp17_[0] = _tmp16_;
			directories = (_vala_array_free (directories, directories_length1, (GDestroyNotify) g_free), NULL);
			directories = _tmp17_;
			directories_length1 = 1;
			_directories_size_ = directories_length1;
			break;
		}
		default:
		break;
	}
	_tmp18_ = g_strdup_printf ("%s/steam.svg", RESOURCE_BASE);
	_tmp19_ = _tmp18_;
	_tmp20_ = directories;
	_tmp20__length1 = directories_length1;
	self = (ProtonPlusModelsLaunchersSteam*) proton_plus_models_launcher_construct (object_type, "Steam", installation_type, _tmp19_, _tmp20_, (gint) _tmp20__length1, PROTON_PLUS_MODELS_LAUNCHERS_STEAM_FAMILY_ID, NULL, (gint) 0, NULL, NULL, NULL);
	_g_free0 (_tmp19_);
	((ProtonPlusModelsLauncher*) self)->has_library_support = TRUE;
	(self->profiles == NULL) ? NULL : (self->profiles = (_g_list_free__g_object_unref0_ (self->profiles), NULL));
	self->profiles = NULL;
	proton_plus_models_launchers_steam_set_default_compatibility_tool (self, "");
	_tmp21_ = g_hash_table_new_full (NULL, NULL, NULL, _g_free0_);
	_g_hash_table_unref0 (self->compatibility_tool_hashtable);
	self->compatibility_tool_hashtable = _tmp21_;
	_tmp23_ = _g_object_ref0 (awacy_game_catalog);
	_tmp22_ = _tmp23_;
	if (_tmp22_ == NULL) {
		ProtonPlusModelsGamesAwacyGameCatalog* _tmp24_;
		_tmp24_ = proton_plus_models_games_awacy_game_catalog_get_shared ();
		_g_object_unref0 (_tmp22_);
		_tmp22_ = _tmp24_;
	}
	_tmp25_ = _tmp22_;
	_tmp22_ = NULL;
	_g_object_unref0 (self->priv->awacy_game_catalog);
	self->priv->awacy_game_catalog = _tmp25_;
	_tmp27_ = _g_object_ref0 (compatibility_tool_discovery);
	_tmp26_ = _tmp27_;
	if (_tmp26_ == NULL) {
		ProtonPlusModelsSteamCompatibilityToolDiscovery* _tmp28_;
		_tmp28_ = proton_plus_models_steam_compatibility_tool_discovery_new (installation_type, proton_plus_globals_IS_FLATPAK, "/usr/share/steam/compatibilitytools.d", "", NULL, 0);
		_g_object_unref0 (_tmp26_);
		_tmp26_ = _tmp28_;
	}
	_tmp29_ = _tmp26_;
	_tmp26_ = NULL;
	_g_object_unref0 (self->priv->compatibility_tool_discovery);
	self->priv->compatibility_tool_discovery = _tmp29_;
	_g_object_unref0 (_tmp26_);
	_g_object_unref0 (_tmp22_);
	directories = (_vala_array_free (directories, directories_length1, (GDestroyNotify) g_free), NULL);
	return self;
}

ProtonPlusModelsLaunchersSteam*
proton_plus_models_launchers_steam_new (ProtonPlusModelsLauncherInstallationTypes installation_type,
                                        ProtonPlusModelsGamesAwacyGameCatalog* awacy_game_catalog,
                                        ProtonPlusModelsSteamCompatibilityToolDiscovery* compatibility_tool_discovery)
{
	return proton_plus_models_launchers_steam_construct (PROTON_PLUS_MODELS_LAUNCHERS_TYPE_STEAM, installation_type, awacy_game_catalog, compatibility_tool_discovery);
}

static ProtonPlusModelsSteamRestartTarget*
proton_plus_models_launchers_steam_real_get_steam_restart_target (ProtonPlusModelsLauncher* base)
{
	ProtonPlusModelsLaunchersSteam * self;
	const gchar* _tmp0_;
	ProtonPlusModelsSteamRestartTarget* result;
	self = (ProtonPlusModelsLaunchersSteam*) base;
	_tmp0_ = ((ProtonPlusModelsLauncher*) self)->directory;
	if (g_strcmp0 (_tmp0_, "") == 0) {
		result = NULL;
		return result;
	}
	switch (((ProtonPlusModelsLauncher*) self)->installation_type) {
		case PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_SYSTEM:
		{
			const gchar* _tmp1_;
			ProtonPlusModelsSteamRestartTarget* _tmp2_;
			_tmp1_ = ((ProtonPlusModelsLauncher*) self)->directory;
			_tmp2_ = proton_plus_models_steam_restart_target_for_native (_tmp1_, "Steam", "steam.desktop");
			result = _tmp2_;
			return result;
		}
		case PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_FLATPAK:
		{
			const gchar* _tmp3_;
			ProtonPlusModelsSteamRestartTarget* _tmp4_;
			_tmp3_ = ((ProtonPlusModelsLauncher*) self)->directory;
			_tmp4_ = proton_plus_models_steam_restart_target_for_flatpak (_tmp3_);
			result = _tmp4_;
			return result;
		}
		case PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_SNAP:
		{
			const gchar* _tmp5_;
			ProtonPlusModelsSteamRestartTarget* _tmp6_;
			_tmp5_ = ((ProtonPlusModelsLauncher*) self)->directory;
			_tmp6_ = proton_plus_models_steam_restart_target_for_snap (_tmp5_);
			result = _tmp6_;
			return result;
		}
		default:
		{
			result = NULL;
			return result;
		}
	}
}

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;
}

gboolean
proton_plus_models_launchers_steam_is_steam_linux_runtime (const gchar* display_title,
                                                           const gchar* internal_title)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
	gboolean result;
	g_return_val_if_fail (display_title != NULL, FALSE);
	g_return_val_if_fail (internal_title != NULL, FALSE);
	_tmp2_ = g_utf8_strdown (display_title, (gssize) -1);
	_tmp3_ = _tmp2_;
	_tmp4_ = string_contains (_tmp3_, "steam linux runtime");
	_g_free0 (_tmp3_);
	if (_tmp4_) {
		_tmp1_ = TRUE;
	} else {
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp5_ = g_utf8_strdown (internal_title, (gssize) -1);
		_tmp6_ = _tmp5_;
		_tmp1_ = string_contains (_tmp6_, "steam_linux_runtime");
		_g_free0 (_tmp6_);
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp7_ = g_utf8_strdown (internal_title, (gssize) -1);
		_tmp8_ = _tmp7_;
		_tmp0_ = string_contains (_tmp8_, "steamlinuxruntime");
		_g_free0 (_tmp8_);
	}
	result = _tmp0_;
	return result;
}

ProtonPlusModelsCompatibilityToolRuntimeKind
proton_plus_models_launchers_steam_get_compatibility_tool_runtime_kind (ProtonPlusModelsCompatibilityTool* tool)
{
	ProtonPlusModelsCompatibilityToolRuntimeKind _tmp0_;
	ProtonPlusModelsCompatibilityToolRuntimeKind _tmp1_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	ProtonPlusModelsCompatibilityToolRuntimeKind result;
	if (tool == NULL) {
		result = PROTON_PLUS_MODELS_COMPATIBILITY_TOOL_RUNTIME_KIND_UNKNOWN;
		return result;
	}
	_tmp0_ = proton_plus_models_compatibility_tool_get_runtime_kind (tool);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != PROTON_PLUS_MODELS_COMPATIBILITY_TOOL_RUNTIME_KIND_UNKNOWN) {
		ProtonPlusModelsCompatibilityToolRuntimeKind _tmp2_;
		ProtonPlusModelsCompatibilityToolRuntimeKind _tmp3_;
		_tmp2_ = proton_plus_models_compatibility_tool_get_runtime_kind (tool);
		_tmp3_ = _tmp2_;
		result = _tmp3_;
		return result;
	}
	_tmp4_ = proton_plus_models_compatibility_tool_get_internal_title (tool);
	_tmp5_ = _tmp4_;
	if (g_strcmp0 (_tmp5_, "Default") == 0) {
		result = PROTON_PLUS_MODELS_COMPATIBILITY_TOOL_RUNTIME_KIND_PROTON;
		return result;
	}
	_tmp6_ = proton_plus_models_compatibility_tool_get_display_title (tool);
	_tmp7_ = _tmp6_;
	_tmp8_ = proton_plus_models_compatibility_tool_get_internal_title (tool);
	_tmp9_ = _tmp8_;
	if (proton_plus_models_launchers_steam_is_steam_linux_runtime (_tmp7_, _tmp9_)) {
		result = PROTON_PLUS_MODELS_COMPATIBILITY_TOOL_RUNTIME_KIND_NATIVE;
		return result;
	}
	result = PROTON_PLUS_MODELS_COMPATIBILITY_TOOL_RUNTIME_KIND_UNKNOWN;
	return result;
}

gboolean
proton_plus_models_launchers_steam_is_game_steam_linux_runtime_compatible (ProtonPlusModelsGame* game)
{
	ProtonPlusModelsGamesSteam* steam_game = NULL;
	ProtonPlusModelsGamesSteam* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	g_return_val_if_fail (game != NULL, FALSE);
	_tmp0_ = _g_object_ref0 (PROTON_PLUS_MODELS_GAMES_IS_STEAM (game) ? ((ProtonPlusModelsGamesSteam*) game) : NULL);
	steam_game = _tmp0_;
	_tmp2_ = proton_plus_models_game_get_is_native (game);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		_tmp1_ = TRUE;
	} else {
		gboolean _tmp4_ = FALSE;
		ProtonPlusModelsGamesSteam* _tmp5_;
		_tmp5_ = steam_game;
		if (_tmp5_ != NULL) {
			ProtonPlusModelsGamesSteam* _tmp6_;
			gboolean _tmp7_;
			gboolean _tmp8_;
			_tmp6_ = steam_game;
			_tmp7_ = proton_plus_models_games_steam_get_is_non_steam (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, PROTON_PLUS_MODELS_GAMES_TYPE_STEAM, ProtonPlusModelsGamesSteam));
			_tmp8_ = _tmp7_;
			_tmp4_ = _tmp8_;
		} else {
			_tmp4_ = FALSE;
		}
		_tmp1_ = _tmp4_;
	}
	result = _tmp1_;
	_g_object_unref0 (steam_game);
	return result;
}

gboolean
proton_plus_models_launchers_steam_has_explicit_compatibility_tool_mapping (ProtonPlusModelsLaunchersSteam* self,
                                                                            guint appid)
{
	GHashTable* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->compatibility_tool_hashtable;
	result = g_hash_table_contains (_tmp0_, (gpointer) ((guintptr) appid));
	return result;
}

void
proton_plus_models_launchers_steam_update_game_compatibility_tool_mapping (ProtonPlusModelsLaunchersSteam* self,
                                                                           guint appid,
                                                                           const gchar* compatibility_tool)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (compatibility_tool != NULL);
	if (g_strcmp0 (compatibility_tool, "Default") == 0) {
		GHashTable* _tmp0_;
		_tmp0_ = self->compatibility_tool_hashtable;
		g_hash_table_remove (_tmp0_, (gpointer) ((guintptr) appid));
	} else {
		GHashTable* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = self->compatibility_tool_hashtable;
		_tmp2_ = g_strdup (compatibility_tool);
		g_hash_table_insert (_tmp1_, (gpointer) ((guintptr) appid), _tmp2_);
	}
}

static GList*
proton_plus_models_launchers_steam_real_get_managed_tool_directories (ProtonPlusModelsLauncher* base,
                                                                      ProtonPlusModelsGroup* group)
{
	ProtonPlusModelsLaunchersSteam * self;
	GList* directories = NULL;
	gchar* _tmp0_;
	GList* result;
	self = (ProtonPlusModelsLaunchersSteam*) base;
	g_return_val_if_fail (group != NULL, NULL);
	directories = NULL;
	_tmp0_ = proton_plus_models_launcher_get_primary_managed_tool_directory ((ProtonPlusModelsLauncher*) self, group);
	directories = g_list_append (directories, _tmp0_);
	result = directories;
	return result;
}

static gchar*
proton_plus_models_launchers_steam_real_get_primary_managed_tool_directory (ProtonPlusModelsLauncher* base,
                                                                            ProtonPlusModelsGroup* group)
{
	ProtonPlusModelsLaunchersSteam * self;
	gchar* _tmp0_;
	gchar* result;
	self = (ProtonPlusModelsLaunchersSteam*) base;
	g_return_val_if_fail (group != NULL, NULL);
	_tmp0_ = proton_plus_models_launchers_steam_get_managed_compatibility_tools_root (self);
	result = _tmp0_;
	return result;
}

static gchar*
proton_plus_models_launchers_steam_get_managed_compatibility_tools_root (ProtonPlusModelsLaunchersSteam* self)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (((ProtonPlusModelsLauncher*) self)->installation_type == PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_SYSTEM) {
		const gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp1_ = ((ProtonPlusModelsLauncher*) self)->directory;
		_tmp2_ = g_canonicalize_filename (_tmp1_, NULL);
		_tmp3_ = _tmp2_;
		_tmp0_ = g_strcmp0 (_tmp3_, "/usr/share/steam") == 0;
		_g_free0 (_tmp3_);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gchar* host_data_home = NULL;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gboolean _tmp6_ = FALSE;
		const gchar* _tmp7_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		_tmp4_ = g_getenv ("HOST_XDG_DATA_HOME");
		_tmp5_ = g_strdup (_tmp4_);
		host_data_home = _tmp5_;
		_tmp7_ = host_data_home;
		if (_tmp7_ == NULL) {
			_tmp6_ = TRUE;
		} else {
			const gchar* _tmp8_;
			_tmp8_ = host_data_home;
			_tmp6_ = g_strcmp0 (_tmp8_, "") == 0;
		}
		if (_tmp6_) {
			gchar* _tmp9_ = NULL;
			gchar* _tmp14_;
			if (proton_plus_globals_IS_FLATPAK) {
				const gchar* _tmp10_;
				gchar* _tmp11_;
				_tmp10_ = g_get_home_dir ();
				_tmp11_ = g_build_filename (_tmp10_, ".local", "share", NULL);
				_g_free0 (_tmp9_);
				_tmp9_ = _tmp11_;
			} else {
				const gchar* _tmp12_;
				gchar* _tmp13_;
				_tmp12_ = g_get_user_data_dir ();
				_tmp13_ = g_strdup (_tmp12_);
				_g_free0 (_tmp9_);
				_tmp9_ = _tmp13_;
			}
			_tmp14_ = _tmp9_;
			_tmp9_ = NULL;
			_g_free0 (host_data_home);
			host_data_home = _tmp14_;
			_g_free0 (_tmp9_);
		}
		_tmp15_ = host_data_home;
		_tmp16_ = g_build_filename ((const gchar*) _tmp15_, "Steam", "compatibilitytools.d", NULL);
		result = _tmp16_;
		_g_free0 (host_data_home);
		return result;
	}
	_tmp17_ = ((ProtonPlusModelsLauncher*) self)->directory;
	_tmp18_ = g_build_filename (_tmp17_, "compatibilitytools.d", NULL);
	result = _tmp18_;
	return result;
}

ProtonPlusModelsSteamProfile*
proton_plus_models_launchers_steam_get_steam_profile_by_id (ProtonPlusModelsLaunchersSteam* self,
                                                            const gchar* steam_id)
{
	GList* _tmp0_;
	ProtonPlusModelsSteamProfile* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (steam_id != NULL, NULL);
	_tmp0_ = self->profiles;
	{
		GList* profile_collection = NULL;
		GList* profile_it = NULL;
		profile_collection = _tmp0_;
		for (profile_it = profile_collection; profile_it != NULL; profile_it = profile_it->next) {
			ProtonPlusModelsSteamProfile* _tmp1_;
			ProtonPlusModelsSteamProfile* profile = NULL;
			_tmp1_ = _g_object_ref0 ((ProtonPlusModelsSteamProfile*) profile_it->data);
			profile = _tmp1_;
			{
				ProtonPlusModelsSteamProfile* _tmp2_;
				const gchar* _tmp3_;
				const gchar* _tmp4_;
				_tmp2_ = profile;
				_tmp3_ = proton_plus_models_steam_profile_get_steam_id (_tmp2_);
				_tmp4_ = _tmp3_;
				if (g_strcmp0 (_tmp4_, steam_id) == 0) {
					result = profile;
					return result;
				}
				_g_object_unref0 (profile);
			}
		}
	}
	result = NULL;
	return result;
}

static void
proton_plus_models_launchers_steam_switch_profile_data_free (gpointer _data)
{
	ProtonPlusModelsLaunchersSteamSwitchProfileData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->profile);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusModelsLaunchersSteamSwitchProfileData, _data_);
}

void
proton_plus_models_launchers_steam_switch_profile (ProtonPlusModelsLaunchersSteam* self,
                                                   ProtonPlusModelsSteamProfile* profile,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	ProtonPlusModelsLaunchersSteamSwitchProfileData* _data_;
	ProtonPlusModelsLaunchersSteam* _tmp0_;
	ProtonPlusModelsSteamProfile* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (profile != NULL);
	_data_ = g_slice_new0 (ProtonPlusModelsLaunchersSteamSwitchProfileData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_models_launchers_steam_switch_profile_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (profile);
	_g_object_unref0 (_data_->profile);
	_data_->profile = _tmp1_;
	proton_plus_models_launchers_steam_switch_profile_co (_data_);
}

void
proton_plus_models_launchers_steam_switch_profile_finish (ProtonPlusModelsLaunchersSteam* self,
                                                          GAsyncResult* _res_)
{
	ProtonPlusModelsLaunchersSteamSwitchProfileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static GList*
vala_g_list_remove_full (GList* self,
                         gconstpointer data,
                         GFreeFunc func)
{
	GList* l = NULL;
	GList* result;
	l = self;
	while (TRUE) {
		GList* _tmp0_;
		GList* _tmp1_;
		gconstpointer _tmp2_;
		_tmp0_ = l;
		if (!(_tmp0_ != NULL)) {
			break;
		}
		_tmp1_ = l;
		_tmp2_ = ((GList*) _tmp1_)->data;
		if (_tmp2_ != data) {
			GList* _tmp3_;
			GList* _tmp4_;
			_tmp3_ = l;
			_tmp4_ = ((GList*) _tmp3_)->next;
			l = _tmp4_;
		} else {
			GList* _tmp5_;
			gconstpointer _tmp6_;
			GList* _tmp7_;
			_tmp5_ = l;
			_tmp6_ = ((GList*) _tmp5_)->data;
			func (_tmp6_);
			_tmp7_ = l;
			self = g_list_delete_link (self, (GList*) _tmp7_);
			break;
		}
	}
	result = self;
	return result;
}

static gboolean
proton_plus_models_launchers_steam_switch_profile_co (ProtonPlusModelsLaunchersSteamSwitchProfileData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->_profile;
	if (_data_->_tmp0_ != NULL) {
		_data_->_tmp1_ = _data_->self->priv->_profile;
		_data_->_tmp2_ = _data_->_tmp1_->non_steam_games;
		{
			_data_->non_steam_game_collection = _data_->_tmp2_;
			for (_data_->non_steam_game_it = _data_->non_steam_game_collection; _data_->non_steam_game_it != NULL; _data_->non_steam_game_it = _data_->non_steam_game_it->next) {
				_data_->_tmp3_ = _g_object_ref0 ((ProtonPlusModelsGamesSteam*) _data_->non_steam_game_it->data);
				_data_->non_steam_game = _data_->_tmp3_;
				{
					_data_->_tmp4_ = _data_->non_steam_game;
					((ProtonPlusModelsLauncher*) _data_->self)->games = vala_g_list_remove_full (((ProtonPlusModelsLauncher*) _data_->self)->games, (ProtonPlusModelsGame*) _data_->_tmp4_, _g_object_unref0_);
					_g_object_unref0 (_data_->non_steam_game);
				}
			}
		}
	}
	_data_->_tmp5_ = ((ProtonPlusModelsLauncher*) _data_->self)->games;
	{
		_data_->game_collection = (GList*) _data_->_tmp5_;
		for (_data_->game_it = _data_->game_collection; _data_->game_it != NULL; _data_->game_it = _data_->game_it->next) {
			_data_->_tmp6_ = _g_object_ref0 ((ProtonPlusModelsGamesSteam*) _data_->game_it->data);
			_data_->game = _data_->_tmp6_;
			{
				_data_->_tmp7_ = _data_->profile->launch_options_hashtable;
				_data_->_tmp8_ = _data_->game;
				_data_->_tmp9_ = proton_plus_models_games_steam_get_appid (_data_->_tmp8_);
				_data_->_tmp10_ = _data_->_tmp9_;
				_data_->_tmp11_ = g_hash_table_lookup (_data_->_tmp7_, (gpointer) ((guintptr) _data_->_tmp10_));
				_data_->_tmp12_ = g_strdup ((const gchar*) _data_->_tmp11_);
				_data_->launch_options = _data_->_tmp12_;
				_data_->_tmp13_ = _data_->game;
				_data_->_tmp14_ = _data_->launch_options;
				proton_plus_models_games_steam_set_launch_options (_data_->_tmp13_, _data_->_tmp14_);
				_g_free0 (_data_->launch_options);
				_g_object_unref0 (_data_->game);
			}
		}
	}
	_data_->_tmp15_ = _data_->profile->non_steam_games;
	{
		_data_->_vala1_non_steam_game_collection = _data_->_tmp15_;
		for (_data_->_vala1_non_steam_game_it = _data_->_vala1_non_steam_game_collection; _data_->_vala1_non_steam_game_it != NULL; _data_->_vala1_non_steam_game_it = _data_->_vala1_non_steam_game_it->next) {
			_data_->_tmp16_ = _g_object_ref0 ((ProtonPlusModelsGamesSteam*) _data_->_vala1_non_steam_game_it->data);
			_data_->_vala1_non_steam_game = _data_->_tmp16_;
			{
				_data_->_tmp17_ = _data_->_vala1_non_steam_game;
				_data_->_tmp18_ = _g_object_ref0 ((ProtonPlusModelsGame*) _data_->_tmp17_);
				((ProtonPlusModelsLauncher*) _data_->self)->games = g_list_append (((ProtonPlusModelsLauncher*) _data_->self)->games, _data_->_tmp18_);
				_g_object_unref0 (_data_->_vala1_non_steam_game);
			}
		}
	}
	proton_plus_models_launchers_steam_set_profile (_data_->self, _data_->profile);
	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;
}

static gint
proton_plus_models_launchers_steam_real_get_compatibility_tool_usage_count (ProtonPlusModelsLauncher* base,
                                                                            const gchar* compatibility_tool_name)
{
	ProtonPlusModelsLaunchersSteam * self;
	GeeList* _tmp0_;
	GeeList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint result;
	self = (ProtonPlusModelsLaunchersSteam*) base;
	g_return_val_if_fail (compatibility_tool_name != NULL, -1);
	_tmp0_ = proton_plus_models_launchers_steam_get_compatibility_tool_usage_games (self, compatibility_tool_name);
	_tmp1_ = _tmp0_;
	_tmp2_ = gee_collection_get_size ((GeeCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_g_object_unref0 (_tmp1_);
	result = _tmp4_;
	return result;
}

GeeList*
proton_plus_models_launchers_steam_get_compatibility_tool_usage_games (ProtonPlusModelsLaunchersSteam* self,
                                                                       const gchar* compatibility_tool_name)
{
	GeeArrayList* usage_games = NULL;
	GeeArrayList* _tmp0_;
	gboolean is_default_tool = FALSE;
	const gchar* _tmp1_;
	GList* _tmp2_;
	GList* _tmp7_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (compatibility_tool_name != NULL, NULL);
	_tmp0_ = gee_array_list_new (PROTON_PLUS_MODELS_TYPE_GAME, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	usage_games = _tmp0_;
	_tmp1_ = self->priv->_default_compatibility_tool;
	is_default_tool = g_strcmp0 (compatibility_tool_name, _tmp1_) == 0;
	_tmp2_ = ((ProtonPlusModelsLauncher*) self)->games;
	{
		GList* game_collection = NULL;
		GList* game_it = NULL;
		game_collection = _tmp2_;
		for (game_it = game_collection; game_it != NULL; game_it = game_it->next) {
			ProtonPlusModelsGame* _tmp3_;
			ProtonPlusModelsGame* game = NULL;
			_tmp3_ = _g_object_ref0 ((ProtonPlusModelsGame*) game_it->data);
			game = _tmp3_;
			{
				ProtonPlusModelsGame* _tmp4_;
				_tmp4_ = game;
				if (proton_plus_models_launchers_steam_uses_compatibility_tool (self, _tmp4_, compatibility_tool_name, is_default_tool)) {
					GeeArrayList* _tmp5_;
					ProtonPlusModelsGame* _tmp6_;
					_tmp5_ = usage_games;
					_tmp6_ = game;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp5_, _tmp6_);
				}
				_g_object_unref0 (game);
			}
		}
	}
	_tmp7_ = self->profiles;
	{
		GList* profile_collection = NULL;
		GList* profile_it = NULL;
		profile_collection = _tmp7_;
		for (profile_it = profile_collection; profile_it != NULL; profile_it = profile_it->next) {
			ProtonPlusModelsSteamProfile* _tmp8_;
			ProtonPlusModelsSteamProfile* profile = NULL;
			_tmp8_ = _g_object_ref0 ((ProtonPlusModelsSteamProfile*) profile_it->data);
			profile = _tmp8_;
			{
				ProtonPlusModelsSteamProfile* _tmp9_;
				ProtonPlusModelsSteamProfile* _tmp10_;
				ProtonPlusModelsSteamProfile* _tmp11_;
				GList* _tmp12_;
				_tmp9_ = profile;
				_tmp10_ = self->priv->_profile;
				if (_tmp9_ == _tmp10_) {
					_g_object_unref0 (profile);
					continue;
				}
				_tmp11_ = profile;
				_tmp12_ = _tmp11_->non_steam_games;
				{
					GList* game_collection = NULL;
					GList* game_it = NULL;
					game_collection = _tmp12_;
					for (game_it = game_collection; game_it != NULL; game_it = game_it->next) {
						ProtonPlusModelsGamesSteam* _tmp13_;
						ProtonPlusModelsGamesSteam* game = NULL;
						_tmp13_ = _g_object_ref0 ((ProtonPlusModelsGamesSteam*) game_it->data);
						game = _tmp13_;
						{
							ProtonPlusModelsGamesSteam* _tmp14_;
							_tmp14_ = game;
							if (proton_plus_models_launchers_steam_uses_compatibility_tool (self, (ProtonPlusModelsGame*) _tmp14_, compatibility_tool_name, is_default_tool)) {
								GeeArrayList* _tmp15_;
								ProtonPlusModelsGamesSteam* _tmp16_;
								_tmp15_ = usage_games;
								_tmp16_ = game;
								gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, (ProtonPlusModelsGame*) _tmp16_);
							}
							_g_object_unref0 (game);
						}
					}
				}
				_g_object_unref0 (profile);
			}
		}
	}
	result = (GeeList*) usage_games;
	return result;
}

static gboolean
proton_plus_models_launchers_steam_uses_compatibility_tool (ProtonPlusModelsLaunchersSteam* self,
                                                            ProtonPlusModelsGame* game,
                                                            const gchar* compatibility_tool_name,
                                                            gboolean is_default_tool)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (game != NULL, FALSE);
	g_return_val_if_fail (compatibility_tool_name != NULL, FALSE);
	_tmp1_ = proton_plus_models_game_get_is_native (game);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		gboolean _tmp3_ = FALSE;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = proton_plus_models_game_get_compatibility_tool (game);
		_tmp5_ = _tmp4_;
		if (g_strcmp0 (_tmp5_, compatibility_tool_name) == 0) {
			_tmp3_ = TRUE;
		} else {
			gboolean _tmp6_ = FALSE;
			if (is_default_tool) {
				const gchar* _tmp7_;
				const gchar* _tmp8_;
				_tmp7_ = proton_plus_models_game_get_compatibility_tool (game);
				_tmp8_ = _tmp7_;
				_tmp6_ = g_strcmp0 (_tmp8_, "Default") == 0;
			} else {
				_tmp6_ = FALSE;
			}
			_tmp3_ = _tmp6_;
		}
		_tmp0_ = _tmp3_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static void
proton_plus_models_launchers_steam_real_load_game_library_data_free (gpointer _data)
{
	ProtonPlusModelsLaunchersSteamLoadGameLibraryData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusModelsLaunchersSteamLoadGameLibraryData, _data_);
}

static void
proton_plus_models_launchers_steam_real_load_game_library (ProtonPlusModelsLauncher* base,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_)
{
	ProtonPlusModelsLaunchersSteam * self;
	ProtonPlusModelsLaunchersSteamLoadGameLibraryData* _data_;
	ProtonPlusModelsLaunchersSteam* _tmp0_;
	self = (ProtonPlusModelsLaunchersSteam*) base;
	_data_ = g_slice_new0 (ProtonPlusModelsLaunchersSteamLoadGameLibraryData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_models_launchers_steam_real_load_game_library_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	proton_plus_models_launchers_steam_real_load_game_library_co (_data_);
}

static gboolean
proton_plus_models_launchers_steam_load_game_library_finish (ProtonPlusModelsLauncher* base,
                                                             GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusModelsLaunchersSteamLoadGameLibraryData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static inline GRegex*
_thread_safe_regex_init (GRegex** re,
                         const gchar * pattern,
                         GRegexCompileFlags compile_flags)
{
	if (g_once_init_enter ((volatile gsize*) re)) {
		GRegex* val = g_regex_new (pattern, compile_flags, 0, NULL);
		g_once_init_leave ((volatile gsize*) re, (gsize) val);
	}
	return *re;
}

static gpointer
_g_regex_ref0 (gpointer self)
{
	return self ? g_regex_ref (self) : NULL;
}

static void
proton_plus_models_launchers_steam_load_game_library_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_)
{
	ProtonPlusModelsLaunchersSteamLoadGameLibraryData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_models_launchers_steam_real_load_game_library_co (_data_);
}

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
uint_try_parse (const gchar* str,
                guint* _result_,
                const gchar** unparsed,
                guint _base)
{
	guint _vala__result_ = 0U;
	const gchar* _vala_unparsed = NULL;
	gchar* endptr = NULL;
	gulong ulong_result = 0UL;
	gchar* _tmp0_ = NULL;
	gulong _tmp1_;
	gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gulong _tmp6_;
	gboolean result;
	g_return_val_if_fail (str != NULL, FALSE);
	errno = 0;
	_tmp1_ = strtoul (str, &_tmp0_, (gint) _base);
	endptr = _tmp0_;
	ulong_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_ = ulong_result;
	if ((((gulong) 0) <= _tmp6_) && (_tmp6_ <= ((gulong) G_MAXUINT))) {
		gboolean _tmp7_ = FALSE;
		gboolean _tmp8_ = FALSE;
		_vala__result_ = (guint) ulong_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_MAXUINT;
		result = FALSE;
		if (_result_) {
			*_result_ = _vala__result_;
		}
		if (unparsed) {
			*unparsed = _vala_unparsed;
		}
		return result;
	}
}

static gboolean
proton_plus_models_launchers_steam_real_load_game_library_co (ProtonPlusModelsLaunchersSteamLoadGameLibraryData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->self->priv->game_library_generation = _data_->self->priv->game_library_generation + 1;
	_data_->_tmp0_ = _data_->self->priv->game_library_generation;
	_data_->current_generation = _data_->_tmp0_;
	(((ProtonPlusModelsLauncher*) _data_->self)->games == NULL) ? NULL : (((ProtonPlusModelsLauncher*) _data_->self)->games = (_g_list_free__g_object_unref0_ (((ProtonPlusModelsLauncher*) _data_->self)->games), NULL));
	((ProtonPlusModelsLauncher*) _data_->self)->games = NULL;
	_data_->_tmp1_ = ((ProtonPlusModelsLauncher*) _data_->self)->compatibility_tools;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _data_->_tmp1_);
	_data_->_tmp2_ = _data_->self->priv->compatibility_tool_discovery;
	proton_plus_models_steam_compatibility_tool_discovery_clear (_data_->_tmp2_);
	_data_->_tmp3_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_0, "\\\"name\\\"\\s+\\\"([^\\\"]+)\\\"", 0));
	_data_->name_regex = _data_->_tmp3_;
	_data_->_tmp4_ = _g_regex_ref0 (_thread_safe_regex_init (&_tmp_regex_1, "\\\"installdir\\\"\\s+\\\"([^\\\"]+)\\\"", 0));
	_data_->dir_regex = _data_->_tmp4_;
	_data_->_tmp5_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->excluded_appids = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->excluded_appids;
	_data_->_tmp7_ = g_strdup ("2230260");
	_data_->_tmp8_ = g_strdup ("1826330");
	_data_->_tmp9_ = g_strdup ("1161040");
	_data_->_tmp10_ = g_strdup ("1070560");
	_data_->_tmp11_ = g_strdup ("1628350");
	_data_->_tmp12_ = g_strdup ("228980");
	_data_->_tmp13_ = g_strdup ("4183110");
	_data_->_tmp14_ = g_strdup ("3086180");
	_data_->_tmp15_ = g_strdup ("250820");
	_data_->_tmp16_ = g_new0 (gchar*, 9 + 1);
	_data_->_tmp16_[0] = _data_->_tmp7_;
	_data_->_tmp16_[1] = _data_->_tmp8_;
	_data_->_tmp16_[2] = _data_->_tmp9_;
	_data_->_tmp16_[3] = _data_->_tmp10_;
	_data_->_tmp16_[4] = _data_->_tmp11_;
	_data_->_tmp16_[5] = _data_->_tmp12_;
	_data_->_tmp16_[6] = _data_->_tmp13_;
	_data_->_tmp16_[7] = _data_->_tmp14_;
	_data_->_tmp16_[8] = _data_->_tmp15_;
	_data_->_tmp17_ = _data_->_tmp16_;
	_data_->_tmp17__length1 = 9;
	gee_collection_add_all_array ((GeeCollection*) _data_->_tmp6_, _data_->_tmp17_, (gint) 9);
	_data_->_tmp17_ = (_vala_array_free (_data_->_tmp17_, _data_->_tmp17__length1, (GDestroyNotify) g_free), NULL);
	_data_->_state_ = 1;
	proton_plus_models_launchers_steam_load_compatibility_tool_hashtable (_data_->self, proton_plus_models_launchers_steam_load_game_library_ready, _data_);
	return FALSE;
	_state_1:
	_data_->compatibility_tool_hashtable_loaded = proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_finish (_data_->self, _data_->_res_);
	if (!_data_->compatibility_tool_hashtable_loaded) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->excluded_appids);
		_g_regex_unref0 (_data_->dir_regex);
		_g_regex_unref0 (_data_->name_regex);
		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_->_tmp18_ = _data_->self->compatibility_tool_hashtable;
	_data_->_tmp19_ = g_hash_table_lookup (_data_->_tmp18_, (gpointer) ((guintptr) 0));
	_data_->_tmp20_ = g_strdup ((const gchar*) _data_->_tmp19_);
	_data_->default_compatibility_tool = _data_->_tmp20_;
	_data_->_tmp21_ = _data_->default_compatibility_tool;
	if (_data_->_tmp21_ != NULL) {
		_data_->_tmp22_ = _data_->default_compatibility_tool;
		proton_plus_models_launchers_steam_set_default_compatibility_tool (_data_->self, _data_->_tmp22_);
	}
	_data_->_tmp23_ = ((ProtonPlusModelsLauncher*) _data_->self)->directory;
	_data_->_tmp24_ = g_strdup_printf ("%s/steamapps/libraryfolders.vdf", _data_->_tmp23_);
	_data_->_tmp25_ = _data_->_tmp24_;
	_data_->_state_ = 2;
	proton_plus_utils_filesystem_get_file_content_async (_data_->_tmp25_, FALSE, proton_plus_models_launchers_steam_load_game_library_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp26_ = proton_plus_utils_filesystem_get_file_content_finish (_data_->_res_);
	_data_->_tmp27_ = _data_->_tmp26_;
	_g_free0 (_data_->_tmp25_);
	_data_->libraryfolder_content = _data_->_tmp27_;
	_data_->_tmp28_ = _data_->libraryfolder_content;
	_data_->_tmp29_ = proton_plus_utils_vdf_vdf_parser_parse_document (_data_->_tmp28_);
	_data_->libraryfolder_document = _data_->_tmp29_;
	_data_->_tmp30_ = _data_->libraryfolder_document;
	if (_data_->_tmp30_ == NULL) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->libraryfolder_document);
		_g_free0 (_data_->libraryfolder_content);
		_g_free0 (_data_->default_compatibility_tool);
		_g_object_unref0 (_data_->excluded_appids);
		_g_regex_unref0 (_data_->dir_regex);
		_g_regex_unref0 (_data_->name_regex);
		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_->_tmp31_ = _data_->libraryfolder_document;
	_data_->_tmp32_ = proton_plus_utils_vdf_vdf_document_get_root (_data_->_tmp31_);
	_data_->_tmp33_ = _data_->_tmp32_;
	_data_->_tmp34_ = proton_plus_utils_vdf_vdf_entry_get_child (_data_->_tmp33_, "libraryfolders");
	_data_->libraryfolders = _data_->_tmp34_;
	_data_->_tmp35_ = _data_->libraryfolders;
	if (_data_->_tmp35_ == NULL) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->libraryfolders);
		_g_object_unref0 (_data_->libraryfolder_document);
		_g_free0 (_data_->libraryfolder_content);
		_g_free0 (_data_->default_compatibility_tool);
		_g_object_unref0 (_data_->excluded_appids);
		_g_regex_unref0 (_data_->dir_regex);
		_g_regex_unref0 (_data_->name_regex);
		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_->_tmp36_ = _data_->libraryfolders;
		_data_->_tmp37_ = proton_plus_utils_vdf_vdf_entry_get_children (_data_->_tmp36_);
		_data_->_tmp38_ = _data_->_tmp37_;
		_data_->_libraryfolder_list = _data_->_tmp38_;
		_data_->_tmp39_ = _data_->_libraryfolder_list;
		_data_->_tmp40_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp39_);
		_data_->_tmp41_ = _data_->_tmp40_;
		_data_->_libraryfolder_size = _data_->_tmp41_;
		_data_->_libraryfolder_index = -1;
		while (TRUE) {
			_data_->_libraryfolder_index = _data_->_libraryfolder_index + 1;
			_data_->_tmp42_ = _data_->_libraryfolder_index;
			_data_->_tmp43_ = _data_->_libraryfolder_size;
			if (!(_data_->_tmp42_ < _data_->_tmp43_)) {
				break;
			}
			_data_->_tmp44_ = _data_->_libraryfolder_list;
			_data_->_tmp45_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp44_, _data_->_libraryfolder_index);
			_data_->libraryfolder = (ProtonPlusUtilsVDFVdfEntry*) _data_->_tmp45_;
			_data_->_tmp46_ = _data_->libraryfolder;
			_data_->_tmp47_ = proton_plus_utils_vdf_vdf_entry_get_key (_data_->_tmp46_);
			_data_->_tmp48_ = _data_->_tmp47_;
			_data_->_tmp49_ = 0;
			_data_->_tmp50_ = int_try_parse (_data_->_tmp48_, &_data_->_tmp49_, NULL, (guint) 0);
			_data_->libraryfolder_id = _data_->_tmp49_;
			if (!_data_->_tmp50_) {
				_g_object_unref0 (_data_->libraryfolder);
				continue;
			}
			_data_->_tmp51_ = _data_->libraryfolder;
			_data_->_tmp52_ = proton_plus_utils_vdf_vdf_entry_get_child (_data_->_tmp51_, "path");
			_data_->path = _data_->_tmp52_;
			_data_->_tmp53_ = _data_->libraryfolder;
			_data_->_tmp54_ = proton_plus_utils_vdf_vdf_entry_get_child (_data_->_tmp53_, "apps");
			_data_->apps = _data_->_tmp54_;
			_data_->_tmp57_ = _data_->path;
			if (_data_->_tmp57_ == NULL) {
				_data_->_tmp56_ = TRUE;
			} else {
				_data_->_tmp58_ = _data_->path;
				_data_->_tmp59_ = proton_plus_utils_vdf_vdf_entry_get_value (_data_->_tmp58_);
				_data_->_tmp60_ = _data_->_tmp59_;
				_data_->_tmp56_ = _data_->_tmp60_ == NULL;
			}
			if (_data_->_tmp56_) {
				_data_->_tmp55_ = TRUE;
			} else {
				_data_->_tmp61_ = _data_->apps;
				_data_->_tmp55_ = _data_->_tmp61_ == NULL;
			}
			if (_data_->_tmp55_) {
				_g_object_unref0 (_data_->apps);
				_g_object_unref0 (_data_->path);
				_g_object_unref0 (_data_->libraryfolder);
				continue;
			}
			{
				_data_->_tmp62_ = _data_->apps;
				_data_->_tmp63_ = proton_plus_utils_vdf_vdf_entry_get_children (_data_->_tmp62_);
				_data_->_tmp64_ = _data_->_tmp63_;
				_data_->_app_list = _data_->_tmp64_;
				_data_->_tmp65_ = _data_->_app_list;
				_data_->_tmp66_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp65_);
				_data_->_tmp67_ = _data_->_tmp66_;
				_data_->_app_size = _data_->_tmp67_;
				_data_->_app_index = -1;
				while (TRUE) {
					_data_->_app_index = _data_->_app_index + 1;
					_data_->_tmp68_ = _data_->_app_index;
					_data_->_tmp69_ = _data_->_app_size;
					if (!(_data_->_tmp68_ < _data_->_tmp69_)) {
						break;
					}
					_data_->_tmp70_ = _data_->_app_list;
					_data_->_tmp71_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp70_, _data_->_app_index);
					_data_->app = (ProtonPlusUtilsVDFVdfEntry*) _data_->_tmp71_;
					_data_->id = (guint) 0;
					_data_->_tmp72_ = _data_->app;
					_data_->_tmp73_ = proton_plus_utils_vdf_vdf_entry_get_key (_data_->_tmp72_);
					_data_->_tmp74_ = _data_->_tmp73_;
					_data_->_tmp75_ = 0U;
					_data_->_tmp76_ = uint_try_parse (_data_->_tmp74_, &_data_->_tmp75_, NULL, (guint) 0);
					_data_->id = _data_->_tmp75_;
					_data_->id_valid = _data_->_tmp76_;
					if (!_data_->id_valid) {
						_g_object_unref0 (_data_->app);
						continue;
					}
					_data_->current_libraryfolder_id = _data_->libraryfolder_id;
					_data_->_tmp77_ = _data_->path;
					_data_->_tmp78_ = proton_plus_utils_vdf_vdf_entry_get_value (_data_->_tmp77_);
					_data_->_tmp79_ = _data_->_tmp78_;
					_data_->_tmp80_ = g_strdup (_data_->_tmp79_);
					_data_->current_libraryfolder_path = _data_->_tmp80_;
					_data_->_tmp81_ = _data_->app;
					_data_->_tmp82_ = proton_plus_utils_vdf_vdf_entry_get_key (_data_->_tmp81_);
					_data_->_tmp83_ = _data_->_tmp82_;
					_data_->_tmp84_ = g_strdup (_data_->_tmp83_);
					_data_->current_appid = _data_->_tmp84_;
					_data_->_tmp85_ = _data_->path;
					_data_->_tmp86_ = proton_plus_utils_vdf_vdf_entry_get_value (_data_->_tmp85_);
					_data_->_tmp87_ = _data_->_tmp86_;
					_data_->_tmp88_ = g_strdup_printf ("%s/steamapps", _data_->_tmp87_);
					_data_->current_steamapps_path = _data_->_tmp88_;
					_data_->_tmp89_ = g_strdup ("");
					_data_->current_manifest_path = _data_->_tmp89_;
					_data_->_tmp90_ = g_strdup ("");
					_data_->current_manifest_content = _data_->_tmp90_;
					_data_->_tmp91_ = g_strdup ("");
					_data_->current_name = _data_->_tmp91_;
					_data_->_tmp92_ = g_strdup ("");
					_data_->current_installdir = _data_->_tmp92_;
					_data_->_tmp93_ = _data_->current_steamapps_path;
					_data_->_tmp94_ = _data_->current_appid;
					_data_->_tmp95_ = g_strdup_printf ("%s/appmanifest_%s.acf", _data_->_tmp93_, _data_->_tmp94_);
					_g_free0 (_data_->current_manifest_path);
					_data_->current_manifest_path = _data_->_tmp95_;
					_data_->_tmp96_ = _data_->current_manifest_path;
					if (!g_file_test (_data_->_tmp96_, G_FILE_TEST_IS_REGULAR)) {
						_g_free0 (_data_->current_installdir);
						_g_free0 (_data_->current_name);
						_g_free0 (_data_->current_manifest_content);
						_g_free0 (_data_->current_manifest_path);
						_g_free0 (_data_->current_steamapps_path);
						_g_free0 (_data_->current_appid);
						_g_free0 (_data_->current_libraryfolder_path);
						_g_object_unref0 (_data_->app);
						continue;
					}
					_data_->_tmp97_ = _data_->current_manifest_path;
					_data_->_tmp98_ = proton_plus_utils_filesystem_get_file_content (_data_->_tmp97_, FALSE);
					_g_free0 (_data_->current_manifest_content);
					_data_->current_manifest_content = _data_->_tmp98_;
					_data_->_tmp99_ = _data_->name_regex;
					_data_->_tmp100_ = _data_->current_manifest_content;
					_data_->_tmp101_ = NULL;
					_data_->_tmp102_ = g_regex_match (_data_->_tmp99_, _data_->_tmp100_, 0, &_data_->_tmp101_);
					_g_match_info_unref0 (_data_->name_match);
					_data_->name_match = _data_->_tmp101_;
					if (!_data_->_tmp102_) {
						_g_match_info_unref0 (_data_->name_match);
						_g_free0 (_data_->current_installdir);
						_g_free0 (_data_->current_name);
						_g_free0 (_data_->current_manifest_content);
						_g_free0 (_data_->current_manifest_path);
						_g_free0 (_data_->current_steamapps_path);
						_g_free0 (_data_->current_appid);
						_g_free0 (_data_->current_libraryfolder_path);
						_g_object_unref0 (_data_->app);
						continue;
					}
					_data_->_tmp103_ = _data_->name_match;
					_data_->_tmp104_ = g_match_info_fetch (_data_->_tmp103_, 1);
					_g_free0 (_data_->current_name);
					_data_->current_name = _data_->_tmp104_;
					_data_->_tmp105_ = _data_->dir_regex;
					_data_->_tmp106_ = _data_->current_manifest_content;
					_data_->_tmp107_ = NULL;
					_data_->_tmp108_ = g_regex_match (_data_->_tmp105_, _data_->_tmp106_, 0, &_data_->_tmp107_);
					_g_match_info_unref0 (_data_->dir_match);
					_data_->dir_match = _data_->_tmp107_;
					if (!_data_->_tmp108_) {
						_g_match_info_unref0 (_data_->dir_match);
						_g_match_info_unref0 (_data_->name_match);
						_g_free0 (_data_->current_installdir);
						_g_free0 (_data_->current_name);
						_g_free0 (_data_->current_manifest_content);
						_g_free0 (_data_->current_manifest_path);
						_g_free0 (_data_->current_steamapps_path);
						_g_free0 (_data_->current_appid);
						_g_free0 (_data_->current_libraryfolder_path);
						_g_object_unref0 (_data_->app);
						continue;
					}
					_data_->_tmp109_ = _data_->dir_match;
					_data_->_tmp110_ = g_match_info_fetch (_data_->_tmp109_, 1);
					_g_free0 (_data_->current_installdir);
					_data_->current_installdir = _data_->_tmp110_;
					_data_->_tmp111_ = NULL;
					_data_->_tmp112_ = 0;
					_data_->_tmp113_ = proton_plus_models_steam_compatibility_tool_discovery_try_get_steam_library_tool_identity (_data_->id, &_data_->_tmp111_, &_data_->_tmp112_);
					_g_free0 (_data_->steam_tool_internal_title);
					_data_->steam_tool_internal_title = _data_->_tmp111_;
					_data_->steam_tool_runtime_kind = _data_->_tmp112_;
					if (_data_->_tmp113_) {
						_data_->_tmp114_ = _data_->self->priv->compatibility_tool_discovery;
						_data_->_tmp115_ = _data_->current_steamapps_path;
						_data_->_tmp116_ = _data_->current_installdir;
						_data_->_tmp117_ = g_strdup_printf ("%s/common/%s", _data_->_tmp115_, _data_->_tmp116_);
						_data_->_tmp118_ = _data_->_tmp117_;
						_data_->_tmp119_ = _data_->steam_tool_internal_title;
						_data_->_tmp120_ = _data_->current_name;
						proton_plus_models_steam_compatibility_tool_discovery_add_steam_library_app (_data_->_tmp114_, _data_->_tmp118_, _data_->id, _data_->_tmp119_, _data_->_tmp120_, _data_->steam_tool_runtime_kind);
						_g_free0 (_data_->_tmp118_);
						_g_free0 (_data_->steam_tool_internal_title);
						_g_match_info_unref0 (_data_->dir_match);
						_g_match_info_unref0 (_data_->name_match);
						_g_free0 (_data_->current_installdir);
						_g_free0 (_data_->current_name);
						_g_free0 (_data_->current_manifest_content);
						_g_free0 (_data_->current_manifest_path);
						_g_free0 (_data_->current_steamapps_path);
						_g_free0 (_data_->current_appid);
						_g_free0 (_data_->current_libraryfolder_path);
						_g_object_unref0 (_data_->app);
						continue;
					}
					_data_->_tmp121_ = _data_->excluded_appids;
					_data_->_tmp122_ = _data_->current_appid;
					if (gee_abstract_collection_contains ((GeeAbstractCollection*) _data_->_tmp121_, _data_->_tmp122_)) {
						_g_free0 (_data_->steam_tool_internal_title);
						_g_match_info_unref0 (_data_->dir_match);
						_g_match_info_unref0 (_data_->name_match);
						_g_free0 (_data_->current_installdir);
						_g_free0 (_data_->current_name);
						_g_free0 (_data_->current_manifest_content);
						_g_free0 (_data_->current_manifest_path);
						_g_free0 (_data_->current_steamapps_path);
						_g_free0 (_data_->current_appid);
						_g_free0 (_data_->current_libraryfolder_path);
						_g_object_unref0 (_data_->app);
						continue;
					}
					_data_->_tmp123_ = _data_->current_steamapps_path;
					_data_->_tmp124_ = _data_->current_installdir;
					_data_->_tmp125_ = g_strdup_printf ("%s/common/%s", _data_->_tmp123_, _data_->_tmp124_);
					_data_->compatibility_tool_path = _data_->_tmp125_;
					_data_->_tmp126_ = _data_->compatibility_tool_path;
					_data_->_tmp127_ = g_build_filename (_data_->_tmp126_, "proton", NULL);
					_data_->_tmp128_ = _data_->_tmp127_;
					_data_->_tmp129_ = g_file_test (_data_->_tmp128_, G_FILE_TEST_IS_REGULAR);
					_g_free0 (_data_->_tmp128_);
					_data_->has_proton_launcher = _data_->_tmp129_;
					if (_data_->has_proton_launcher) {
						_data_->_tmp130_ = TRUE;
					} else {
						_data_->_tmp131_ = _data_->current_name;
						_data_->_tmp130_ = proton_plus_models_launchers_steam_is_steam_linux_runtime (_data_->_tmp131_, "");
					}
					if (_data_->_tmp130_) {
						_data_->_tmp132_ = _data_->current_appid;
						_data_->_tmp133_ = _data_->current_name;
						g_debug ("steam.vala:283: Ignoring unrecognized Steam compatibility-tool app %s " \
"(%s)", _data_->_tmp132_, _data_->_tmp133_);
						_g_free0 (_data_->compatibility_tool_path);
						_g_free0 (_data_->steam_tool_internal_title);
						_g_match_info_unref0 (_data_->dir_match);
						_g_match_info_unref0 (_data_->name_match);
						_g_free0 (_data_->current_installdir);
						_g_free0 (_data_->current_name);
						_g_free0 (_data_->current_manifest_content);
						_g_free0 (_data_->current_manifest_path);
						_g_free0 (_data_->current_steamapps_path);
						_g_free0 (_data_->current_appid);
						_g_free0 (_data_->current_libraryfolder_path);
						_g_object_unref0 (_data_->app);
						continue;
					}
					_data_->_tmp134_ = _data_->current_steamapps_path;
					_data_->_tmp135_ = _data_->current_installdir;
					_data_->_tmp136_ = g_strdup_printf ("%s/common/%s", _data_->_tmp134_, _data_->_tmp135_);
					_data_->_tmp137_ = _data_->_tmp136_;
					_data_->_tmp138_ = !g_file_test (_data_->_tmp137_, G_FILE_TEST_IS_DIR);
					_g_free0 (_data_->_tmp137_);
					if (_data_->_tmp138_) {
						_g_free0 (_data_->compatibility_tool_path);
						_g_free0 (_data_->steam_tool_internal_title);
						_g_match_info_unref0 (_data_->dir_match);
						_g_match_info_unref0 (_data_->name_match);
						_g_free0 (_data_->current_installdir);
						_g_free0 (_data_->current_name);
						_g_free0 (_data_->current_manifest_content);
						_g_free0 (_data_->current_manifest_path);
						_g_free0 (_data_->current_steamapps_path);
						_g_free0 (_data_->current_appid);
						_g_free0 (_data_->current_libraryfolder_path);
						_g_object_unref0 (_data_->app);
						continue;
					}
					_data_->_tmp139_ = _data_->current_name;
					_data_->_tmp140_ = _data_->current_installdir;
					_data_->_tmp141_ = _data_->current_libraryfolder_path;
					_data_->_tmp142_ = proton_plus_models_games_steam_new (_data_->id, _data_->_tmp139_, _data_->_tmp140_, _data_->current_libraryfolder_id, _data_->_tmp141_, _data_->self);
					_data_->game = _data_->_tmp142_;
					_data_->_tmp143_ = _data_->self->compatibility_tool_hashtable;
					_data_->_tmp144_ = _data_->game;
					_data_->_tmp145_ = proton_plus_models_games_steam_get_appid (_data_->_tmp144_);
					_data_->_tmp146_ = _data_->_tmp145_;
					_data_->_tmp147_ = g_hash_table_lookup (_data_->_tmp143_, (gpointer) ((guintptr) _data_->_tmp146_));
					_data_->_tmp148_ = g_strdup ((const gchar*) _data_->_tmp147_);
					_data_->compatibility_tool = _data_->_tmp148_;
					_data_->_tmp149_ = _data_->compatibility_tool;
					if (_data_->_tmp149_ == NULL) {
						_data_->_tmp150_ = g_strdup ("Default");
						_g_free0 (_data_->compatibility_tool);
						_data_->compatibility_tool = _data_->_tmp150_;
					}
					_data_->_tmp151_ = _data_->game;
					_data_->_tmp152_ = _data_->compatibility_tool;
					proton_plus_models_game_set_compatibility_tool ((ProtonPlusModelsGame*) _data_->_tmp151_, _data_->_tmp152_);
					_data_->_tmp153_ = _data_->game;
					_data_->_tmp154_ = _g_object_ref0 ((ProtonPlusModelsGame*) _data_->_tmp153_);
					((ProtonPlusModelsLauncher*) _data_->self)->games = g_list_append (((ProtonPlusModelsLauncher*) _data_->self)->games, _data_->_tmp154_);
					_g_free0 (_data_->compatibility_tool);
					_g_object_unref0 (_data_->game);
					_g_free0 (_data_->compatibility_tool_path);
					_g_free0 (_data_->steam_tool_internal_title);
					_g_match_info_unref0 (_data_->dir_match);
					_g_match_info_unref0 (_data_->name_match);
					_g_free0 (_data_->current_installdir);
					_g_free0 (_data_->current_name);
					_g_free0 (_data_->current_manifest_content);
					_g_free0 (_data_->current_manifest_path);
					_g_free0 (_data_->current_steamapps_path);
					_g_free0 (_data_->current_appid);
					_g_free0 (_data_->current_libraryfolder_path);
					_g_object_unref0 (_data_->app);
				}
			}
			_g_object_unref0 (_data_->apps);
			_g_object_unref0 (_data_->path);
			_g_object_unref0 (_data_->libraryfolder);
		}
	}
	proton_plus_models_launchers_steam_load_discovered_compatibility_tools (_data_->self);
	proton_plus_models_launchers_steam_schedule_awacy_enrichment (_data_->self, _data_->current_generation);
	_data_->result = TRUE;
	_g_object_unref0 (_data_->libraryfolders);
	_g_object_unref0 (_data_->libraryfolder_document);
	_g_free0 (_data_->libraryfolder_content);
	_g_free0 (_data_->default_compatibility_tool);
	_g_object_unref0 (_data_->excluded_appids);
	_g_regex_unref0 (_data_->dir_regex);
	_g_regex_unref0 (_data_->name_regex);
	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;
}

static Block61Data*
block61_data_ref (Block61Data* _data61_)
{
	g_atomic_int_inc (&_data61_->_ref_count_);
	return _data61_;
}

static void
block61_data_unref (void * _userdata_)
{
	Block61Data* _data61_;
	_data61_ = (Block61Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data61_->_ref_count_)) {
		ProtonPlusModelsLaunchersSteam* self;
		self = _data61_->self;
		_g_object_unref0 (self);
		g_slice_free (Block61Data, _data61_);
	}
}

static gboolean
__lambda27_ (Block61Data* _data61_)
{
	ProtonPlusModelsLaunchersSteam* self;
	gboolean result;
	self = _data61_->self;
	proton_plus_models_launchers_steam_enrich_games_with_awacy (self, _data61_->generation, NULL, NULL);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda27__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda27_ (self);
	return result;
}

static void
proton_plus_models_launchers_steam_schedule_awacy_enrichment (ProtonPlusModelsLaunchersSteam* self,
                                                              guint generation)
{
	Block61Data* _data61_;
	g_return_if_fail (self != NULL);
	_data61_ = g_slice_new0 (Block61Data);
	_data61_->_ref_count_ = 1;
	_data61_->self = g_object_ref (self);
	_data61_->generation = generation;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda27__gsource_func, block61_data_ref (_data61_), block61_data_unref);
	block61_data_unref (_data61_);
	_data61_ = NULL;
}

static void
proton_plus_models_launchers_steam_enrich_games_with_awacy_data_free (gpointer _data)
{
	ProtonPlusModelsLaunchersSteamEnrichGamesWithAwacyData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusModelsLaunchersSteamEnrichGamesWithAwacyData, _data_);
}

static void
proton_plus_models_launchers_steam_enrich_games_with_awacy (ProtonPlusModelsLaunchersSteam* self,
                                                            guint generation,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_)
{
	ProtonPlusModelsLaunchersSteamEnrichGamesWithAwacyData* _data_;
	ProtonPlusModelsLaunchersSteam* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusModelsLaunchersSteamEnrichGamesWithAwacyData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_models_launchers_steam_enrich_games_with_awacy_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->generation = generation;
	proton_plus_models_launchers_steam_enrich_games_with_awacy_co (_data_);
}

static void
proton_plus_models_launchers_steam_enrich_games_with_awacy_finish (ProtonPlusModelsLaunchersSteam* self,
                                                                   GAsyncResult* _res_)
{
	ProtonPlusModelsLaunchersSteamEnrichGamesWithAwacyData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
proton_plus_models_launchers_steam_enrich_games_with_awacy_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_)
{
	ProtonPlusModelsLaunchersSteamEnrichGamesWithAwacyData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_models_launchers_steam_enrich_games_with_awacy_co (_data_);
}

static gboolean
proton_plus_models_launchers_steam_enrich_games_with_awacy_co (ProtonPlusModelsLaunchersSteamEnrichGamesWithAwacyData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->awacy_game_catalog;
	_data_->_state_ = 1;
	proton_plus_models_games_awacy_game_catalog_get_games (_data_->_tmp0_, proton_plus_models_launchers_steam_enrich_games_with_awacy_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp1_ = proton_plus_models_games_awacy_game_catalog_get_games_finish (_data_->_tmp0_, _data_->_res_);
	_data_->awacy_games = _data_->_tmp1_;
	if (_data_->generation != _data_->self->priv->game_library_generation) {
		_g_object_unref0 (_data_->awacy_games);
		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_->_tmp2_ = ((ProtonPlusModelsLauncher*) _data_->self)->games;
	{
		_data_->base_game_collection = _data_->_tmp2_;
		for (_data_->base_game_it = _data_->base_game_collection; _data_->base_game_it != NULL; _data_->base_game_it = _data_->base_game_it->next) {
			_data_->_tmp3_ = _g_object_ref0 ((ProtonPlusModelsGame*) _data_->base_game_it->data);
			_data_->base_game = _data_->_tmp3_;
			{
				_data_->_tmp4_ = _data_->base_game;
				_data_->_tmp5_ = _g_object_ref0 (PROTON_PLUS_MODELS_GAMES_IS_STEAM (_data_->_tmp4_) ? ((ProtonPlusModelsGamesSteam*) _data_->_tmp4_) : NULL);
				_data_->game = _data_->_tmp5_;
				_data_->_tmp7_ = _data_->game;
				if (_data_->_tmp7_ == NULL) {
					_data_->_tmp6_ = TRUE;
				} else {
					_data_->_tmp8_ = _data_->game;
					_data_->_tmp9_ = proton_plus_models_games_steam_get_is_non_steam (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp8_, PROTON_PLUS_MODELS_GAMES_TYPE_STEAM, ProtonPlusModelsGamesSteam));
					_data_->_tmp10_ = _data_->_tmp9_;
					_data_->_tmp6_ = _data_->_tmp10_;
				}
				if (_data_->_tmp6_) {
					_g_object_unref0 (_data_->game);
					_g_object_unref0 (_data_->base_game);
					continue;
				}
				_data_->_tmp11_ = _data_->awacy_games;
				_data_->_tmp12_ = _data_->game;
				_data_->_tmp13_ = proton_plus_models_games_steam_get_appid (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp12_, PROTON_PLUS_MODELS_GAMES_TYPE_STEAM, ProtonPlusModelsGamesSteam));
				_data_->_tmp14_ = _data_->_tmp13_;
				if (gee_abstract_map_has_key ((GeeAbstractMap*) _data_->_tmp11_, (gpointer) ((guintptr) _data_->_tmp14_))) {
					_data_->_tmp15_ = _data_->awacy_games;
					_data_->_tmp16_ = _data_->game;
					_data_->_tmp17_ = proton_plus_models_games_steam_get_appid (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp16_, PROTON_PLUS_MODELS_GAMES_TYPE_STEAM, ProtonPlusModelsGamesSteam));
					_data_->_tmp18_ = _data_->_tmp17_;
					_data_->_tmp19_ = gee_abstract_map_get ((GeeAbstractMap*) _data_->_tmp15_, (gpointer) ((guintptr) _data_->_tmp18_));
					_data_->awacy_game = (ProtonPlusModelsGamesSteamAwacyGame*) _data_->_tmp19_;
					_data_->_tmp20_ = _data_->awacy_game;
					if (_data_->_tmp20_ != NULL) {
						_data_->_tmp21_ = _data_->game;
						_data_->_tmp22_ = _data_->awacy_game;
						_data_->_tmp23_ = proton_plus_models_games_steam_awacy_game_get_name (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp22_, PROTON_PLUS_MODELS_GAMES_STEAM_TYPE_AWACY_GAME, ProtonPlusModelsGamesSteamAwacyGame));
						_data_->_tmp24_ = _data_->_tmp23_;
						proton_plus_models_games_steam_set_awacy_name (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp21_, PROTON_PLUS_MODELS_GAMES_TYPE_STEAM, ProtonPlusModelsGamesSteam), _data_->_tmp24_);
						_data_->_tmp25_ = _data_->game;
						_data_->_tmp26_ = _data_->awacy_game;
						_data_->_tmp27_ = proton_plus_models_games_steam_awacy_game_get_status (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp26_, PROTON_PLUS_MODELS_GAMES_STEAM_TYPE_AWACY_GAME, ProtonPlusModelsGamesSteamAwacyGame));
						_data_->_tmp28_ = _data_->_tmp27_;
						proton_plus_models_games_steam_set_awacy_status (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp25_, PROTON_PLUS_MODELS_GAMES_TYPE_STEAM, ProtonPlusModelsGamesSteam), _data_->_tmp28_);
					}
					_proton_plus_models_games_steam_awacy_game_unref0 (_data_->awacy_game);
				}
				_data_->_tmp29_ = _data_->game;
				proton_plus_models_games_steam_set_awacy_lookup_complete (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp29_, PROTON_PLUS_MODELS_GAMES_TYPE_STEAM, ProtonPlusModelsGamesSteam), TRUE);
				_g_object_unref0 (_data_->game);
				_g_object_unref0 (_data_->base_game);
			}
		}
	}
	_g_object_unref0 (_data_->awacy_games);
	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;
}

void
proton_plus_models_launchers_steam_refresh_compatibility_tools (ProtonPlusModelsLaunchersSteam* self)
{
	ProtonPlusModelsSteamCompatibilityToolDiscovery* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->compatibility_tool_discovery;
	proton_plus_models_steam_compatibility_tool_discovery_clear (_tmp0_);
	proton_plus_models_launchers_steam_load_discovered_compatibility_tools (self);
}

static void
proton_plus_models_launchers_steam_load_discovered_compatibility_tools (ProtonPlusModelsLaunchersSteam* self)
{
	ProtonPlusModelsSteamCompatibilityToolDiscovery* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GeeLinkedList* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->compatibility_tool_discovery;
	_tmp1_ = proton_plus_models_launchers_steam_get_managed_compatibility_tools_root (self);
	_tmp2_ = _tmp1_;
	proton_plus_models_steam_compatibility_tool_discovery_discover_launcher_roots (_tmp0_, _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = ((ProtonPlusModelsLauncher*) self)->compatibility_tools;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp3_);
	{
		GeeList* _compatibility_tool_list = NULL;
		ProtonPlusModelsSteamCompatibilityToolDiscovery* _tmp4_;
		GeeList* _tmp5_;
		gint _compatibility_tool_size = 0;
		GeeList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _compatibility_tool_index = 0;
		_tmp4_ = self->priv->compatibility_tool_discovery;
		_tmp5_ = proton_plus_models_steam_compatibility_tool_discovery_get_snapshot (_tmp4_);
		_compatibility_tool_list = _tmp5_;
		_tmp6_ = _compatibility_tool_list;
		_tmp7_ = gee_collection_get_size ((GeeCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_compatibility_tool_size = _tmp8_;
		_compatibility_tool_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			ProtonPlusModelsCompatibilityTool* compatibility_tool = NULL;
			GeeList* _tmp11_;
			gpointer _tmp12_;
			ProtonPlusModelsCompatibilityTool* _tmp13_;
			ProtonPlusModelsCompatibilityTool* _tmp14_;
			GeeLinkedList* _tmp15_;
			ProtonPlusModelsCompatibilityTool* _tmp16_;
			_compatibility_tool_index = _compatibility_tool_index + 1;
			_tmp9_ = _compatibility_tool_index;
			_tmp10_ = _compatibility_tool_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _compatibility_tool_list;
			_tmp12_ = gee_list_get (_tmp11_, _compatibility_tool_index);
			compatibility_tool = (ProtonPlusModelsCompatibilityTool*) _tmp12_;
			_tmp13_ = compatibility_tool;
			_tmp14_ = compatibility_tool;
			proton_plus_models_compatibility_tool_set_sort_priority (_tmp13_, proton_plus_models_launchers_steam_get_compatibility_tool_sort_priority (self, _tmp14_));
			_tmp15_ = ((ProtonPlusModelsLauncher*) self)->compatibility_tools;
			_tmp16_ = compatibility_tool;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_);
			_g_object_unref0 (compatibility_tool);
		}
		_g_object_unref0 (_compatibility_tool_list);
	}
	proton_plus_models_launchers_steam_add_unavailable_mappings (self);
	proton_plus_models_launchers_steam_sort_compatibility_tools (self);
}

static void
proton_plus_models_launchers_steam_add_unavailable_mappings (ProtonPlusModelsLaunchersSteam* self)
{
	GHashTable* _tmp0_;
	GHashTable* _tmp1_;
	GList* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->compatibility_tool_hashtable;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->compatibility_tool_hashtable;
	_tmp2_ = g_hash_table_get_values (_tmp1_);
	{
		GList* internal_title_collection = NULL;
		GList* internal_title_it = NULL;
		internal_title_collection = _tmp2_;
		for (internal_title_it = internal_title_collection; internal_title_it != NULL; internal_title_it = internal_title_it->next) {
			const gchar* internal_title = NULL;
			internal_title = (const gchar*) internal_title_it->data;
			{
				gboolean _tmp3_ = FALSE;
				gboolean _tmp4_ = FALSE;
				const gchar* _tmp5_;
				ProtonPlusModelsCompatibilityTool* unavailable = NULL;
				const gchar* _tmp10_;
				gchar* _tmp11_;
				gchar* _tmp12_;
				const gchar* _tmp13_;
				ProtonPlusModelsCompatibilityTool* _tmp14_;
				ProtonPlusModelsCompatibilityTool* _tmp15_;
				ProtonPlusModelsCompatibilityTool* _tmp16_;
				ProtonPlusModelsCompatibilityTool* _tmp17_;
				ProtonPlusModelsCompatibilityTool* _tmp18_;
				GeeLinkedList* _tmp19_;
				ProtonPlusModelsCompatibilityTool* _tmp20_;
				_tmp5_ = internal_title;
				if (_tmp5_ == NULL) {
					_tmp4_ = TRUE;
				} else {
					const gchar* _tmp6_;
					_tmp6_ = internal_title;
					_tmp4_ = g_strcmp0 (_tmp6_, "Default") == 0;
				}
				if (_tmp4_) {
					_tmp3_ = TRUE;
				} else {
					const gchar* _tmp7_;
					ProtonPlusModelsCompatibilityTool* _tmp8_;
					ProtonPlusModelsCompatibilityTool* _tmp9_;
					_tmp7_ = internal_title;
					_tmp8_ = proton_plus_models_launchers_steam_find_compatibility_tool (self, _tmp7_);
					_tmp9_ = _tmp8_;
					_tmp3_ = _tmp9_ != NULL;
					_g_object_unref0 (_tmp9_);
				}
				if (_tmp3_) {
					continue;
				}
				_tmp10_ = internal_title;
				_tmp11_ = g_strdup_printf (_ ("%s (Unavailable)"), _tmp10_);
				_tmp12_ = _tmp11_;
				_tmp13_ = internal_title;
				_tmp14_ = proton_plus_models_compatibility_tool_new (_tmp12_, _tmp13_, "", PROTON_PLUS_MODELS_COMPATIBILITY_TOOL_RUNTIME_KIND_UNKNOWN, "", FALSE);
				_tmp15_ = _tmp14_;
				_g_free0 (_tmp12_);
				unavailable = _tmp15_;
				_tmp16_ = unavailable;
				proton_plus_models_compatibility_tool_set_is_available (_tmp16_, FALSE);
				_tmp17_ = unavailable;
				proton_plus_models_compatibility_tool_set_is_assignable (_tmp17_, FALSE);
				_tmp18_ = unavailable;
				proton_plus_models_compatibility_tool_set_sort_priority (_tmp18_, 900);
				_tmp19_ = ((ProtonPlusModelsLauncher*) self)->compatibility_tools;
				_tmp20_ = unavailable;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp19_, _tmp20_);
				_g_object_unref0 (unavailable);
			}
		}
		(internal_title_collection == NULL) ? NULL : (internal_title_collection = (g_list_free (internal_title_collection), NULL));
	}
}

static void
proton_plus_models_launchers_steam_add_compatibility_tool_if_missing (ProtonPlusModelsLaunchersSteam* self,
                                                                      ProtonPlusModelsCompatibilityTool* compatibility_tool)
{
	GeeLinkedList* _tmp19_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (compatibility_tool != NULL);
	{
		GeeLinkedList* _existing_runner_list = NULL;
		GeeLinkedList* _tmp0_;
		gint _existing_runner_size = 0;
		GeeLinkedList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _existing_runner_index = 0;
		_tmp0_ = ((ProtonPlusModelsLauncher*) self)->compatibility_tools;
		_existing_runner_list = _tmp0_;
		_tmp1_ = _existing_runner_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_existing_runner_size = _tmp3_;
		_existing_runner_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			ProtonPlusModelsCompatibilityTool* existing_runner = NULL;
			GeeLinkedList* _tmp6_;
			gpointer _tmp7_;
			gboolean _tmp8_ = FALSE;
			ProtonPlusModelsCompatibilityTool* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			_existing_runner_index = _existing_runner_index + 1;
			_tmp4_ = _existing_runner_index;
			_tmp5_ = _existing_runner_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _existing_runner_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _existing_runner_index);
			existing_runner = (ProtonPlusModelsCompatibilityTool*) _tmp7_;
			_tmp9_ = existing_runner;
			_tmp10_ = proton_plus_models_compatibility_tool_get_path (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = proton_plus_models_compatibility_tool_get_path (compatibility_tool);
			_tmp13_ = _tmp12_;
			if (g_strcmp0 (_tmp11_, _tmp13_) == 0) {
				_tmp8_ = TRUE;
			} else {
				ProtonPlusModelsCompatibilityTool* _tmp14_;
				const gchar* _tmp15_;
				const gchar* _tmp16_;
				const gchar* _tmp17_;
				const gchar* _tmp18_;
				_tmp14_ = existing_runner;
				_tmp15_ = proton_plus_models_compatibility_tool_get_internal_title (_tmp14_);
				_tmp16_ = _tmp15_;
				_tmp17_ = proton_plus_models_compatibility_tool_get_internal_title (compatibility_tool);
				_tmp18_ = _tmp17_;
				_tmp8_ = g_strcmp0 (_tmp16_, _tmp18_) == 0;
			}
			if (_tmp8_) {
				_g_object_unref0 (existing_runner);
				return;
			}
			_g_object_unref0 (existing_runner);
		}
	}
	proton_plus_models_compatibility_tool_set_sort_priority (compatibility_tool, proton_plus_models_launchers_steam_get_compatibility_tool_sort_priority (self, compatibility_tool));
	_tmp19_ = ((ProtonPlusModelsLauncher*) self)->compatibility_tools;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp19_, compatibility_tool);
}

void
proton_plus_models_launchers_steam_register_compatibility_tool (ProtonPlusModelsLaunchersSteam* self,
                                                                ProtonPlusModelsCompatibilityTool* compatibility_tool)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (compatibility_tool != NULL);
	proton_plus_models_launchers_steam_add_compatibility_tool_if_missing (self, compatibility_tool);
	proton_plus_models_launchers_steam_sort_compatibility_tools (self);
}

ProtonPlusModelsCompatibilityTool*
proton_plus_models_launchers_steam_find_compatibility_tool (ProtonPlusModelsLaunchersSteam* self,
                                                            const gchar* internal_title)
{
	ProtonPlusModelsCompatibilityTool* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (internal_title != NULL, NULL);
	{
		GeeLinkedList* _tool_list = NULL;
		GeeLinkedList* _tmp0_;
		gint _tool_size = 0;
		GeeLinkedList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		gint _tool_index = 0;
		_tmp0_ = ((ProtonPlusModelsLauncher*) self)->compatibility_tools;
		_tool_list = _tmp0_;
		_tmp1_ = _tool_list;
		_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tool_size = _tmp3_;
		_tool_index = -1;
		while (TRUE) {
			gint _tmp4_;
			gint _tmp5_;
			ProtonPlusModelsCompatibilityTool* tool = NULL;
			GeeLinkedList* _tmp6_;
			gpointer _tmp7_;
			ProtonPlusModelsCompatibilityTool* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			_tool_index = _tool_index + 1;
			_tmp4_ = _tool_index;
			_tmp5_ = _tool_size;
			if (!(_tmp4_ < _tmp5_)) {
				break;
			}
			_tmp6_ = _tool_list;
			_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, _tool_index);
			tool = (ProtonPlusModelsCompatibilityTool*) _tmp7_;
			_tmp8_ = tool;
			_tmp9_ = proton_plus_models_compatibility_tool_get_internal_title (_tmp8_);
			_tmp10_ = _tmp9_;
			if (g_strcmp0 (_tmp10_, internal_title) == 0) {
				result = tool;
				return result;
			}
			_g_object_unref0 (tool);
		}
	}
	result = NULL;
	return result;
}

GeeList*
proton_plus_models_launchers_steam_get_assignable_compatibility_tools (ProtonPlusModelsLaunchersSteam* self)
{
	GeeArrayList* tools = NULL;
	GeeArrayList* _tmp0_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	tools = _tmp0_;
	{
		GeeLinkedList* _tool_list = NULL;
		GeeLinkedList* _tmp1_;
		gint _tool_size = 0;
		GeeLinkedList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _tool_index = 0;
		_tmp1_ = ((ProtonPlusModelsLauncher*) self)->compatibility_tools;
		_tool_list = _tmp1_;
		_tmp2_ = _tool_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_tool_size = _tmp4_;
		_tool_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			ProtonPlusModelsCompatibilityTool* tool = NULL;
			GeeLinkedList* _tmp7_;
			gpointer _tmp8_;
			gboolean _tmp9_ = FALSE;
			ProtonPlusModelsCompatibilityTool* _tmp10_;
			gboolean _tmp11_;
			gboolean _tmp12_;
			_tool_index = _tool_index + 1;
			_tmp5_ = _tool_index;
			_tmp6_ = _tool_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _tool_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _tool_index);
			tool = (ProtonPlusModelsCompatibilityTool*) _tmp8_;
			_tmp10_ = tool;
			_tmp11_ = proton_plus_models_compatibility_tool_get_is_assignable (_tmp10_);
			_tmp12_ = _tmp11_;
			if (_tmp12_) {
				ProtonPlusModelsCompatibilityTool* _tmp13_;
				gboolean _tmp14_;
				gboolean _tmp15_;
				_tmp13_ = tool;
				_tmp14_ = proton_plus_models_compatibility_tool_get_is_available (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp9_ = _tmp15_;
			} else {
				_tmp9_ = FALSE;
			}
			if (_tmp9_) {
				GeeArrayList* _tmp16_;
				ProtonPlusModelsCompatibilityTool* _tmp17_;
				_tmp16_ = tools;
				_tmp17_ = tool;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_);
			}
			_g_object_unref0 (tool);
		}
	}
	result = (GeeList*) tools;
	return result;
}

gboolean
proton_plus_models_launchers_steam_can_assign_compatibility_tool (ProtonPlusModelsLaunchersSteam* self,
                                                                  const gchar* internal_title)
{
	ProtonPlusModelsCompatibilityTool* tool = NULL;
	ProtonPlusModelsCompatibilityTool* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	ProtonPlusModelsCompatibilityTool* _tmp3_;
	gboolean _tmp10_ = FALSE;
	ProtonPlusModelsCompatibilityTool* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (internal_title != NULL, FALSE);
	if (g_strcmp0 (internal_title, "Default") == 0) {
		result = TRUE;
		return result;
	}
	_tmp0_ = proton_plus_models_launchers_steam_find_compatibility_tool (self, internal_title);
	tool = _tmp0_;
	_tmp3_ = tool;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		ProtonPlusModelsCompatibilityTool* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = tool;
		_tmp5_ = proton_plus_models_compatibility_tool_get_is_assignable (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, ProtonPlusModelsCompatibilityTool));
		_tmp6_ = _tmp5_;
		_tmp2_ = !_tmp6_;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		ProtonPlusModelsCompatibilityTool* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp7_ = tool;
		_tmp8_ = proton_plus_models_compatibility_tool_get_is_available (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, ProtonPlusModelsCompatibilityTool));
		_tmp9_ = _tmp8_;
		_tmp1_ = !_tmp9_;
	}
	if (_tmp1_) {
		result = FALSE;
		_g_object_unref0 (tool);
		return result;
	}
	_tmp11_ = tool;
	_tmp12_ = proton_plus_models_compatibility_tool_get_externally_managed (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, ProtonPlusModelsCompatibilityTool));
	_tmp13_ = _tmp12_;
	if (!_tmp13_) {
		_tmp10_ = TRUE;
	} else {
		ProtonPlusModelsSteamCompatibilityToolDiscovery* _tmp14_;
		ProtonPlusModelsCompatibilityTool* _tmp15_;
		_tmp14_ = self->priv->compatibility_tool_discovery;
		_tmp15_ = tool;
		_tmp10_ = proton_plus_models_steam_compatibility_tool_discovery_remains_available (_tmp14_, G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, ProtonPlusModelsCompatibilityTool));
	}
	result = _tmp10_;
	_g_object_unref0 (tool);
	return result;
}

gboolean
proton_plus_models_launchers_steam_external_compatibility_tool_remains_available (ProtonPlusModelsLaunchersSteam* self,
                                                                                  const gchar* internal_title)
{
	ProtonPlusModelsCompatibilityTool* tool = NULL;
	ProtonPlusModelsCompatibilityTool* _tmp0_;
	gboolean _tmp1_ = FALSE;
	ProtonPlusModelsCompatibilityTool* _tmp2_;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	ProtonPlusModelsCompatibilityTool* _tmp8_;
	gboolean _tmp9_;
	gboolean _tmp10_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (internal_title != NULL, FALSE);
	_tmp0_ = proton_plus_models_launchers_steam_find_compatibility_tool (self, internal_title);
	tool = _tmp0_;
	_tmp2_ = tool;
	if (_tmp2_ == NULL) {
		_tmp1_ = TRUE;
	} else {
		ProtonPlusModelsCompatibilityTool* _tmp3_;
		gboolean _tmp4_;
		gboolean _tmp5_;
		_tmp3_ = tool;
		_tmp4_ = proton_plus_models_compatibility_tool_get_externally_managed (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, ProtonPlusModelsCompatibilityTool));
		_tmp5_ = _tmp4_;
		_tmp1_ = !_tmp5_;
	}
	if (_tmp1_) {
		result = TRUE;
		_g_object_unref0 (tool);
		return result;
	}
	_tmp8_ = tool;
	_tmp9_ = proton_plus_models_compatibility_tool_get_is_assignable (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, ProtonPlusModelsCompatibilityTool));
	_tmp10_ = _tmp9_;
	if (_tmp10_) {
		ProtonPlusModelsCompatibilityTool* _tmp11_;
		gboolean _tmp12_;
		gboolean _tmp13_;
		_tmp11_ = tool;
		_tmp12_ = proton_plus_models_compatibility_tool_get_is_available (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, ProtonPlusModelsCompatibilityTool));
		_tmp13_ = _tmp12_;
		_tmp7_ = _tmp13_;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		ProtonPlusModelsSteamCompatibilityToolDiscovery* _tmp14_;
		ProtonPlusModelsCompatibilityTool* _tmp15_;
		_tmp14_ = self->priv->compatibility_tool_discovery;
		_tmp15_ = tool;
		_tmp6_ = proton_plus_models_steam_compatibility_tool_discovery_remains_available (_tmp14_, G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, ProtonPlusModelsCompatibilityTool));
	} else {
		_tmp6_ = FALSE;
	}
	result = _tmp6_;
	_g_object_unref0 (tool);
	return result;
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

ProtonPlusModelsCompatibilityTool*
proton_plus_models_launchers_steam_resolve_effective_compatibility_tool (ProtonPlusModelsLaunchersSteam* self,
                                                                         const gchar* selected_internal_title)
{
	gchar* effective_internal_title = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	const gchar* _tmp6_;
	const gchar* _tmp11_;
	ProtonPlusModelsCompatibilityTool* _tmp12_;
	ProtonPlusModelsCompatibilityTool* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (selected_internal_title != NULL, NULL);
	_tmp0_ = g_strdup (selected_internal_title);
	effective_internal_title = _tmp0_;
	_tmp1_ = effective_internal_title;
	if (g_strcmp0 (_tmp1_, "Default") == 0) {
		const gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp2_ = self->priv->_default_compatibility_tool;
		_tmp3_ = g_strdup (_tmp2_);
		_g_free0 (effective_internal_title);
		effective_internal_title = _tmp3_;
	}
	_tmp6_ = effective_internal_title;
	if (_tmp6_ == NULL) {
		_tmp5_ = TRUE;
	} else {
		const gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp7_ = effective_internal_title;
		_tmp8_ = string_strip (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp5_ = g_strcmp0 (_tmp9_, "") == 0;
		_g_free0 (_tmp9_);
	}
	if (_tmp5_) {
		_tmp4_ = TRUE;
	} else {
		const gchar* _tmp10_;
		_tmp10_ = effective_internal_title;
		_tmp4_ = g_strcmp0 (_tmp10_, "Default") == 0;
	}
	if (_tmp4_) {
		result = NULL;
		_g_free0 (effective_internal_title);
		return result;
	}
	_tmp11_ = effective_internal_title;
	_tmp12_ = proton_plus_models_launchers_steam_find_compatibility_tool (self, _tmp11_);
	result = _tmp12_;
	_g_free0 (effective_internal_title);
	return result;
}

gchar*
proton_plus_models_launchers_steam_resolve_effective_proton_executable (ProtonPlusModelsLaunchersSteam* self,
                                                                        const gchar* selected_internal_title)
{
	ProtonPlusModelsCompatibilityTool* tool = NULL;
	ProtonPlusModelsCompatibilityTool* _tmp0_;
	gboolean _tmp1_ = FALSE;
	ProtonPlusModelsCompatibilityTool* _tmp2_;
	gchar* inspection_proton_path = NULL;
	ProtonPlusModelsCompatibilityTool* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gboolean _tmp12_ = FALSE;
	const gchar* _tmp13_;
	ProtonPlusModelsCompatibilityTool* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (selected_internal_title != NULL, NULL);
	_tmp0_ = proton_plus_models_launchers_steam_resolve_effective_compatibility_tool (self, selected_internal_title);
	tool = _tmp0_;
	_tmp2_ = tool;
	if (_tmp2_ == NULL) {
		_tmp1_ = TRUE;
	} else {
		ProtonPlusModelsCompatibilityTool* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp3_ = tool;
		_tmp4_ = proton_plus_models_compatibility_tool_get_path (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, ProtonPlusModelsCompatibilityTool));
		_tmp5_ = _tmp4_;
		_tmp6_ = string_strip (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp1_ = g_strcmp0 (_tmp7_, "") == 0;
		_g_free0 (_tmp7_);
	}
	if (_tmp1_) {
		result = NULL;
		_g_object_unref0 (tool);
		return result;
	}
	_tmp8_ = tool;
	_tmp9_ = proton_plus_models_compatibility_tool_get_inspection_path (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, ProtonPlusModelsCompatibilityTool));
	_tmp10_ = _tmp9_;
	_tmp11_ = g_build_filename (_tmp10_, "proton", NULL);
	inspection_proton_path = _tmp11_;
	_tmp13_ = inspection_proton_path;
	if (!g_file_test (_tmp13_, G_FILE_TEST_IS_REGULAR)) {
		_tmp12_ = TRUE;
	} else {
		const gchar* _tmp14_;
		_tmp14_ = inspection_proton_path;
		_tmp12_ = !g_file_test (_tmp14_, G_FILE_TEST_IS_EXECUTABLE);
	}
	if (_tmp12_) {
		result = NULL;
		_g_free0 (inspection_proton_path);
		_g_object_unref0 (tool);
		return result;
	}
	_tmp15_ = tool;
	_tmp16_ = proton_plus_models_compatibility_tool_get_path (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, PROTON_PLUS_MODELS_TYPE_COMPATIBILITY_TOOL, ProtonPlusModelsCompatibilityTool));
	_tmp17_ = _tmp16_;
	_tmp18_ = g_build_filename (_tmp17_, "proton", NULL);
	result = _tmp18_;
	_g_free0 (inspection_proton_path);
	_g_object_unref0 (tool);
	return result;
}

static void
proton_plus_models_launchers_steam_real_register_compatibility_tool_from_path (ProtonPlusModelsLauncher* base,
                                                                               const gchar* tool_path)
{
	ProtonPlusModelsLaunchersSteam * self;
	ProtonPlusModelsCompatibilityTool* _tmp0_;
	ProtonPlusModelsCompatibilityTool* _tmp1_;
	self = (ProtonPlusModelsLaunchersSteam*) base;
	g_return_if_fail (tool_path != NULL);
	_tmp0_ = proton_plus_utils_vdf_compatibility_tool_loader_from_path (tool_path);
	_tmp1_ = _tmp0_;
	proton_plus_models_launchers_steam_register_compatibility_tool (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
}

static Block62Data*
block62_data_ref (Block62Data* _data62_)
{
	g_atomic_int_inc (&_data62_->_ref_count_);
	return _data62_;
}

static void
block62_data_unref (void * _userdata_)
{
	Block62Data* _data62_;
	_data62_ = (Block62Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data62_->_ref_count_)) {
		ProtonPlusModelsLaunchersSteam* self;
		self = _data62_->self;
		_g_free0 (_data62_->tool_path);
		_g_object_unref0 (self);
		g_slice_free (Block62Data, _data62_);
	}
}

static gboolean
__lambda28_ (Block62Data* _data62_,
             ProtonPlusModelsCompatibilityTool* tool)
{
	ProtonPlusModelsLaunchersSteam* self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gboolean result;
	self = _data62_->self;
	g_return_val_if_fail (tool != NULL, FALSE);
	_tmp0_ = proton_plus_models_compatibility_tool_get_path (tool);
	_tmp1_ = _tmp0_;
	result = g_strcmp0 (_tmp1_, _data62_->tool_path) == 0;
	return result;
}

static gboolean
___lambda28__gee_predicate (gconstpointer g,
                            gpointer self)
{
	gboolean result;
	result = __lambda28_ (self, (ProtonPlusModelsCompatibilityTool*) g);
	return result;
}

static void
proton_plus_models_launchers_steam_real_unregister_compatibility_tool_by_path (ProtonPlusModelsLauncher* base,
                                                                               const gchar* tool_path)
{
	ProtonPlusModelsLaunchersSteam * self;
	Block62Data* _data62_;
	gchar* _tmp0_;
	ProtonPlusModelsCompatibilityTool* tool = NULL;
	GeeLinkedList* _tmp1_;
	gpointer _tmp2_;
	ProtonPlusModelsCompatibilityTool* _tmp3_;
	GeeLinkedList* _tmp4_;
	ProtonPlusModelsCompatibilityTool* _tmp5_;
	self = (ProtonPlusModelsLaunchersSteam*) base;
	g_return_if_fail (tool_path != NULL);
	_data62_ = g_slice_new0 (Block62Data);
	_data62_->_ref_count_ = 1;
	_data62_->self = g_object_ref (self);
	_tmp0_ = g_strdup (tool_path);
	_g_free0 (_data62_->tool_path);
	_data62_->tool_path = _tmp0_;
	_tmp1_ = ((ProtonPlusModelsLauncher*) self)->compatibility_tools;
	_tmp2_ = gee_traversable_first_match ((GeeTraversable*) _tmp1_, ___lambda28__gee_predicate, block62_data_ref (_data62_), block62_data_unref);
	tool = (ProtonPlusModelsCompatibilityTool*) _tmp2_;
	_tmp3_ = tool;
	if (_tmp3_ == NULL) {
		_g_object_unref0 (tool);
		block62_data_unref (_data62_);
		_data62_ = NULL;
		return;
	}
	_tmp4_ = ((ProtonPlusModelsLauncher*) self)->compatibility_tools;
	_tmp5_ = tool;
	gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp4_, _tmp5_);
	proton_plus_models_launchers_steam_sort_compatibility_tools (self);
	_g_object_unref0 (tool);
	block62_data_unref (_data62_);
	_data62_ = NULL;
}

static gint
__lambda26_ (ProtonPlusModelsLaunchersSteam* self,
             ProtonPlusModelsCompatibilityTool* a,
             ProtonPlusModelsCompatibilityTool* b)
{
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint a_major = 0;
	gint a_minor = 0;
	gint b_major = 0;
	gint b_minor = 0;
	gboolean has_a_proton_version = FALSE;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gint _tmp10_ = 0;
	gint _tmp11_ = 0;
	gboolean _tmp12_;
	gboolean has_b_proton_version = FALSE;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gint _tmp15_ = 0;
	gint _tmp16_ = 0;
	gboolean _tmp17_;
	gboolean _tmp18_ = FALSE;
	GCompareFunc _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gint _tmp28_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp0_ = proton_plus_models_compatibility_tool_get_sort_priority (a);
	_tmp1_ = _tmp0_;
	_tmp2_ = proton_plus_models_compatibility_tool_get_sort_priority (b);
	_tmp3_ = _tmp2_;
	if (_tmp1_ != _tmp3_) {
		gint _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		_tmp4_ = proton_plus_models_compatibility_tool_get_sort_priority (a);
		_tmp5_ = _tmp4_;
		_tmp6_ = proton_plus_models_compatibility_tool_get_sort_priority (b);
		_tmp7_ = _tmp6_;
		result = _tmp5_ - _tmp7_;
		return result;
	}
	a_major = 0;
	a_minor = 0;
	b_major = 0;
	b_minor = 0;
	_tmp8_ = proton_plus_models_compatibility_tool_get_display_title (a);
	_tmp9_ = _tmp8_;
	_tmp12_ = proton_plus_models_launchers_steam_try_parse_any_proton_version (self, _tmp9_, &_tmp10_, &_tmp11_);
	a_major = _tmp10_;
	a_minor = _tmp11_;
	has_a_proton_version = _tmp12_;
	_tmp13_ = proton_plus_models_compatibility_tool_get_display_title (b);
	_tmp14_ = _tmp13_;
	_tmp17_ = proton_plus_models_launchers_steam_try_parse_any_proton_version (self, _tmp14_, &_tmp15_, &_tmp16_);
	b_major = _tmp15_;
	b_minor = _tmp16_;
	has_b_proton_version = _tmp17_;
	if (has_a_proton_version) {
		_tmp18_ = has_b_proton_version;
	} else {
		_tmp18_ = FALSE;
	}
	if (_tmp18_) {
		if (a_major != b_major) {
			result = b_major - a_major;
			return result;
		}
		if (a_minor != b_minor) {
			result = b_minor - a_minor;
			return result;
		}
	}
	_tmp19_ = ((GCompareFunc) g_strcmp0);
	_tmp20_ = proton_plus_models_compatibility_tool_get_display_title (a);
	_tmp21_ = _tmp20_;
	_tmp22_ = g_utf8_strdown (_tmp21_, (gssize) -1);
	_tmp23_ = _tmp22_;
	_tmp24_ = proton_plus_models_compatibility_tool_get_display_title (b);
	_tmp25_ = _tmp24_;
	_tmp26_ = g_utf8_strdown (_tmp25_, (gssize) -1);
	_tmp27_ = _tmp26_;
	_tmp28_ = _tmp19_ (_tmp23_, _tmp27_);
	_g_free0 (_tmp27_);
	_g_free0 (_tmp23_);
	result = _tmp28_;
	return result;
}

static gint
___lambda26__gcompare_data_func (gconstpointer a,
                                 gconstpointer b,
                                 gpointer self)
{
	gint result;
	result = __lambda26_ ((ProtonPlusModelsLaunchersSteam*) self, (ProtonPlusModelsCompatibilityTool*) a, (ProtonPlusModelsCompatibilityTool*) b);
	return result;
}

static void
proton_plus_models_launchers_steam_sort_compatibility_tools (ProtonPlusModelsLaunchersSteam* self)
{
	GeeLinkedList* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ((ProtonPlusModelsLauncher*) self)->compatibility_tools;
	gee_list_sort ((GeeList*) _tmp0_, ___lambda26__gcompare_data_func, g_object_ref (self), g_object_unref);
}

static gint
proton_plus_models_launchers_steam_get_compatibility_tool_sort_priority (ProtonPlusModelsLaunchersSteam* self,
                                                                         ProtonPlusModelsCompatibilityTool* tool)
{
	gchar* title = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* internal_title = NULL;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_ = FALSE;
	const gchar* _tmp7_;
	gboolean _tmp9_ = FALSE;
	const gchar* _tmp10_;
	gint major = 0;
	gint minor = 0;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gint _tmp14_ = 0;
	gint _tmp15_ = 0;
	gboolean _tmp16_;
	gboolean _tmp17_ = FALSE;
	const gchar* _tmp18_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (tool != NULL, -1);
	_tmp0_ = proton_plus_models_compatibility_tool_get_display_title (tool);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_utf8_strdown (_tmp1_, (gssize) -1);
	title = _tmp2_;
	_tmp3_ = proton_plus_models_compatibility_tool_get_internal_title (tool);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_utf8_strdown (_tmp4_, (gssize) -1);
	internal_title = _tmp5_;
	_tmp7_ = internal_title;
	if (g_strcmp0 (_tmp7_, "proton_experimental") == 0) {
		_tmp6_ = TRUE;
	} else {
		const gchar* _tmp8_;
		_tmp8_ = title;
		_tmp6_ = string_contains (_tmp8_, "proton experimental");
	}
	if (_tmp6_) {
		result = 100;
		_g_free0 (internal_title);
		_g_free0 (title);
		return result;
	}
	_tmp10_ = internal_title;
	if (g_strcmp0 (_tmp10_, "proton_hotfix") == 0) {
		_tmp9_ = TRUE;
	} else {
		const gchar* _tmp11_;
		_tmp11_ = title;
		_tmp9_ = string_contains (_tmp11_, "proton hotfix");
	}
	if (_tmp9_) {
		result = 150;
		_g_free0 (internal_title);
		_g_free0 (title);
		return result;
	}
	major = 0;
	minor = 0;
	_tmp12_ = proton_plus_models_compatibility_tool_get_display_title (tool);
	_tmp13_ = _tmp12_;
	_tmp16_ = proton_plus_models_launchers_steam_try_parse_proton_version (self, _tmp13_, &_tmp14_, &_tmp15_);
	major = _tmp14_;
	minor = _tmp15_;
	if (_tmp16_) {
		result = 200;
		_g_free0 (internal_title);
		_g_free0 (title);
		return result;
	}
	_tmp18_ = title;
	if (string_contains (_tmp18_, "proton")) {
		_tmp17_ = TRUE;
	} else {
		const gchar* _tmp19_;
		_tmp19_ = internal_title;
		_tmp17_ = string_contains (_tmp19_, "proton");
	}
	if (_tmp17_) {
		result = 300;
		_g_free0 (internal_title);
		_g_free0 (title);
		return result;
	}
	_tmp20_ = proton_plus_models_compatibility_tool_get_display_title (tool);
	_tmp21_ = _tmp20_;
	_tmp22_ = proton_plus_models_compatibility_tool_get_internal_title (tool);
	_tmp23_ = _tmp22_;
	if (proton_plus_models_launchers_steam_is_steam_linux_runtime (_tmp21_, _tmp23_)) {
		result = 400;
		_g_free0 (internal_title);
		_g_free0 (title);
		return result;
	}
	result = 500;
	_g_free0 (internal_title);
	_g_free0 (title);
	return result;
}

static gboolean
proton_plus_models_launchers_steam_try_parse_proton_version (ProtonPlusModelsLaunchersSteam* self,
                                                             const gchar* title,
                                                             gint* major,
                                                             gint* minor)
{
	gint _vala_major = 0;
	gint _vala_minor = 0;
	gboolean _tmp16_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (title != NULL, FALSE);
	_vala_major = 0;
	_vala_minor = 0;
	{
		GRegex* regex = NULL;
		GRegex* _tmp0_;
		GMatchInfo* match = NULL;
		GRegex* _tmp2_;
		GMatchInfo* _tmp3_ = NULL;
		gboolean _tmp4_;
		GMatchInfo* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gint _tmp8_ = 0;
		gchar* minor_text = NULL;
		GMatchInfo* _tmp9_;
		gchar* _tmp10_;
		gboolean _tmp11_ = FALSE;
		const gchar* _tmp12_;
		_tmp0_ = g_regex_new ("(?ix)^\\s*proton\\s+ (\\d+) (?:\\. (\\d+))?", 0, 0, &_inner_error0_);
		regex = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp1_ = FALSE;
			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 _tmp1_;
		}
		_tmp2_ = regex;
		_tmp4_ = g_regex_match (_tmp2_, title, 0, &_tmp3_);
		_g_match_info_unref0 (match);
		match = _tmp3_;
		if (!_tmp4_) {
			result = FALSE;
			_g_match_info_unref0 (match);
			_g_regex_unref0 (regex);
			if (major) {
				*major = _vala_major;
			}
			if (minor) {
				*minor = _vala_minor;
			}
			return result;
		}
		_tmp5_ = match;
		_tmp6_ = g_match_info_fetch (_tmp5_, 1);
		_tmp7_ = _tmp6_;
		int_try_parse (_tmp7_, &_tmp8_, NULL, (guint) 0);
		_vala_major = _tmp8_;
		_g_free0 (_tmp7_);
		_tmp9_ = match;
		_tmp10_ = g_match_info_fetch (_tmp9_, 2);
		minor_text = _tmp10_;
		_tmp12_ = minor_text;
		if (_tmp12_ != NULL) {
			const gchar* _tmp13_;
			_tmp13_ = minor_text;
			_tmp11_ = g_strcmp0 (_tmp13_, "") != 0;
		} else {
			_tmp11_ = FALSE;
		}
		if (_tmp11_) {
			const gchar* _tmp14_;
			gint _tmp15_ = 0;
			_tmp14_ = minor_text;
			int_try_parse (_tmp14_, &_tmp15_, NULL, (guint) 0);
			_vala_minor = _tmp15_;
		}
		result = TRUE;
		_g_free0 (minor_text);
		_g_match_info_unref0 (match);
		_g_regex_unref0 (regex);
		if (major) {
			*major = _vala_major;
		}
		if (minor) {
			*minor = _vala_minor;
		}
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		result = FALSE;
		if (major) {
			*major = _vala_major;
		}
		if (minor) {
			*minor = _vala_minor;
		}
		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 _tmp16_;
}

static gboolean
proton_plus_models_launchers_steam_try_parse_any_proton_version (ProtonPlusModelsLaunchersSteam* self,
                                                                 const gchar* title,
                                                                 gint* major,
                                                                 gint* minor)
{
	gint _vala_major = 0;
	gint _vala_minor = 0;
	gboolean _tmp16_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (title != NULL, FALSE);
	_vala_major = 0;
	_vala_minor = 0;
	{
		GRegex* regex = NULL;
		GRegex* _tmp0_;
		GMatchInfo* match = NULL;
		GRegex* _tmp2_;
		GMatchInfo* _tmp3_ = NULL;
		gboolean _tmp4_;
		GMatchInfo* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gint _tmp8_ = 0;
		gchar* minor_text = NULL;
		GMatchInfo* _tmp9_;
		gchar* _tmp10_;
		gboolean _tmp11_ = FALSE;
		const gchar* _tmp12_;
		_tmp0_ = g_regex_new ("(?ix)proton[^0-9]* (\\d+) (?:[\\._-] (\\d+))?", 0, 0, &_inner_error0_);
		regex = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp1_ = FALSE;
			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 _tmp1_;
		}
		_tmp2_ = regex;
		_tmp4_ = g_regex_match (_tmp2_, title, 0, &_tmp3_);
		_g_match_info_unref0 (match);
		match = _tmp3_;
		if (!_tmp4_) {
			result = FALSE;
			_g_match_info_unref0 (match);
			_g_regex_unref0 (regex);
			if (major) {
				*major = _vala_major;
			}
			if (minor) {
				*minor = _vala_minor;
			}
			return result;
		}
		_tmp5_ = match;
		_tmp6_ = g_match_info_fetch (_tmp5_, 1);
		_tmp7_ = _tmp6_;
		int_try_parse (_tmp7_, &_tmp8_, NULL, (guint) 0);
		_vala_major = _tmp8_;
		_g_free0 (_tmp7_);
		_tmp9_ = match;
		_tmp10_ = g_match_info_fetch (_tmp9_, 2);
		minor_text = _tmp10_;
		_tmp12_ = minor_text;
		if (_tmp12_ != NULL) {
			const gchar* _tmp13_;
			_tmp13_ = minor_text;
			_tmp11_ = g_strcmp0 (_tmp13_, "") != 0;
		} else {
			_tmp11_ = FALSE;
		}
		if (_tmp11_) {
			const gchar* _tmp14_;
			gint _tmp15_ = 0;
			_tmp14_ = minor_text;
			int_try_parse (_tmp14_, &_tmp15_, NULL, (guint) 0);
			_vala_minor = _tmp15_;
		}
		result = TRUE;
		_g_free0 (minor_text);
		_g_match_info_unref0 (match);
		_g_regex_unref0 (regex);
		if (major) {
			*major = _vala_major;
		}
		if (minor) {
			*minor = _vala_minor;
		}
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		result = FALSE;
		if (major) {
			*major = _vala_major;
		}
		if (minor) {
			*minor = _vala_minor;
		}
		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 _tmp16_;
}

static void
proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_data_free (gpointer _data)
{
	ProtonPlusModelsLaunchersSteamLoadCompatibilityToolHashtableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusModelsLaunchersSteamLoadCompatibilityToolHashtableData, _data_);
}

static void
proton_plus_models_launchers_steam_load_compatibility_tool_hashtable (ProtonPlusModelsLaunchersSteam* self,
                                                                      GAsyncReadyCallback _callback_,
                                                                      gpointer _user_data_)
{
	ProtonPlusModelsLaunchersSteamLoadCompatibilityToolHashtableData* _data_;
	ProtonPlusModelsLaunchersSteam* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusModelsLaunchersSteamLoadCompatibilityToolHashtableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_co (_data_);
}

static gboolean
proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_finish (ProtonPlusModelsLaunchersSteam* self,
                                                                             GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusModelsLaunchersSteamLoadCompatibilityToolHashtableData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_ready (GObject* source_object,
                                                                            GAsyncResult* _res_,
                                                                            gpointer _user_data_)
{
	ProtonPlusModelsLaunchersSteamLoadCompatibilityToolHashtableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_co (_data_);
}

static gboolean
proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_co (ProtonPlusModelsLaunchersSteamLoadCompatibilityToolHashtableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_hash_table_new_full (NULL, NULL, NULL, _g_free0_);
	_g_hash_table_unref0 (_data_->self->compatibility_tool_hashtable);
	_data_->self->compatibility_tool_hashtable = _data_->_tmp0_;
	_data_->_tmp1_ = ((ProtonPlusModelsLauncher*) _data_->self)->directory;
	_data_->_tmp2_ = g_strdup_printf ("%s/config/config.vdf", _data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_state_ = 1;
	proton_plus_utils_filesystem_get_file_content_async (_data_->_tmp3_, FALSE, proton_plus_models_launchers_steam_load_compatibility_tool_hashtable_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp4_ = proton_plus_utils_filesystem_get_file_content_finish (_data_->_res_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_g_free0 (_data_->_tmp3_);
	_data_->config_content = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->config_content;
	_data_->_tmp7_ = proton_plus_utils_vdf_vdf_parser_parse_document (_data_->_tmp6_);
	_data_->document = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->document;
	if (_data_->_tmp8_ == NULL) {
		_data_->result = FALSE;
		_g_object_unref0 (_data_->document);
		_g_free0 (_data_->config_content);
		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_->_tmp9_ = _data_->document;
	_data_->_tmp10_ = proton_plus_utils_vdf_vdf_document_get_root (_data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = proton_plus_utils_vdf_vdf_entry_get_child (_data_->_tmp11_, "InstallConfigStore");
	_data_->install_config_store = _data_->_tmp12_;
	_data_->_tmp14_ = _data_->install_config_store;
	if (_data_->_tmp14_ != NULL) {
		_data_->_tmp15_ = _data_->install_config_store;
		_data_->_tmp16_ = proton_plus_utils_vdf_vdf_entry_get_child (_data_->_tmp15_, "Software");
		_g_object_unref0 (_data_->_tmp13_);
		_data_->_tmp13_ = _data_->_tmp16_;
	} else {
		_g_object_unref0 (_data_->_tmp13_);
		_data_->_tmp13_ = NULL;
	}
	_data_->_tmp17_ = _data_->_tmp13_;
	_data_->_tmp13_ = NULL;
	_data_->software = _data_->_tmp17_;
	_data_->_tmp19_ = _data_->software;
	if (_data_->_tmp19_ != NULL) {
		_data_->_tmp20_ = _data_->software;
		_data_->_tmp21_ = proton_plus_utils_vdf_vdf_entry_get_child (_data_->_tmp20_, "Valve");
		_g_object_unref0 (_data_->_tmp18_);
		_data_->_tmp18_ = _data_->_tmp21_;
	} else {
		_g_object_unref0 (_data_->_tmp18_);
		_data_->_tmp18_ = NULL;
	}
	_data_->_tmp22_ = _data_->_tmp18_;
	_data_->_tmp18_ = NULL;
	_data_->valve = _data_->_tmp22_;
	_data_->_tmp24_ = _data_->valve;
	if (_data_->_tmp24_ != NULL) {
		_data_->_tmp25_ = _data_->valve;
		_data_->_tmp26_ = proton_plus_utils_vdf_vdf_entry_get_child (_data_->_tmp25_, "Steam");
		_g_object_unref0 (_data_->_tmp23_);
		_data_->_tmp23_ = _data_->_tmp26_;
	} else {
		_g_object_unref0 (_data_->_tmp23_);
		_data_->_tmp23_ = NULL;
	}
	_data_->_tmp27_ = _data_->_tmp23_;
	_data_->_tmp23_ = NULL;
	_data_->steam = _data_->_tmp27_;
	_data_->_tmp29_ = _data_->steam;
	if (_data_->_tmp29_ != NULL) {
		_data_->_tmp30_ = _data_->steam;
		_data_->_tmp31_ = proton_plus_utils_vdf_vdf_entry_get_child (_data_->_tmp30_, "CompatToolMapping");
		_g_object_unref0 (_data_->_tmp28_);
		_data_->_tmp28_ = _data_->_tmp31_;
	} else {
		_g_object_unref0 (_data_->_tmp28_);
		_data_->_tmp28_ = NULL;
	}
	_data_->_tmp32_ = _data_->_tmp28_;
	_data_->_tmp28_ = NULL;
	_data_->mapping = _data_->_tmp32_;
	_data_->_tmp33_ = _data_->mapping;
	if (_data_->_tmp33_ == NULL) {
		_data_->_tmp34_ = _data_->self->compatibility_tool_hashtable;
		_data_->_tmp35_ = g_strdup ("proton_experimental");
		g_hash_table_insert (_data_->_tmp34_, (gpointer) ((guintptr) 0), _data_->_tmp35_);
		_data_->_tmp36_ = proton_plus_services_steam_configuration_service_get_instance ();
		_data_->_tmp37_ = _data_->_tmp36_;
		_data_->_tmp38_ = _g_object_ref0 (_data_->_tmp37_);
		_data_->configuration = _data_->_tmp38_;
		_data_->_tmp39_ = _data_->configuration;
		if (_data_->_tmp39_ != NULL) {
			_data_->_tmp40_ = _data_->configuration;
			proton_plus_services_steam_configuration_service_overlay_launcher_effective_state (_data_->_tmp40_, _data_->self);
		}
		_data_->result = TRUE;
		_g_object_unref0 (_data_->configuration);
		_g_object_unref0 (_data_->mapping);
		_g_object_unref0 (_data_->_tmp28_);
		_g_object_unref0 (_data_->steam);
		_g_object_unref0 (_data_->_tmp23_);
		_g_object_unref0 (_data_->valve);
		_g_object_unref0 (_data_->_tmp18_);
		_g_object_unref0 (_data_->software);
		_g_object_unref0 (_data_->_tmp13_);
		_g_object_unref0 (_data_->install_config_store);
		_g_object_unref0 (_data_->document);
		_g_free0 (_data_->config_content);
		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_->_tmp41_ = _data_->mapping;
		_data_->_tmp42_ = proton_plus_utils_vdf_vdf_entry_get_children (_data_->_tmp41_);
		_data_->_tmp43_ = _data_->_tmp42_;
		_data_->_mapping_entry_list = _data_->_tmp43_;
		_data_->_tmp44_ = _data_->_mapping_entry_list;
		_data_->_tmp45_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp44_);
		_data_->_tmp46_ = _data_->_tmp45_;
		_data_->_mapping_entry_size = _data_->_tmp46_;
		_data_->_mapping_entry_index = -1;
		while (TRUE) {
			_data_->_mapping_entry_index = _data_->_mapping_entry_index + 1;
			_data_->_tmp47_ = _data_->_mapping_entry_index;
			_data_->_tmp48_ = _data_->_mapping_entry_size;
			if (!(_data_->_tmp47_ < _data_->_tmp48_)) {
				break;
			}
			_data_->_tmp49_ = _data_->_mapping_entry_list;
			_data_->_tmp50_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp49_, _data_->_mapping_entry_index);
			_data_->mapping_entry = (ProtonPlusUtilsVDFVdfEntry*) _data_->_tmp50_;
			_data_->_tmp51_ = _data_->mapping_entry;
			_data_->_tmp52_ = proton_plus_utils_vdf_vdf_entry_get_key (_data_->_tmp51_);
			_data_->_tmp53_ = _data_->_tmp52_;
			_data_->_tmp54_ = 0U;
			_data_->_tmp55_ = uint_try_parse (_data_->_tmp53_, &_data_->_tmp54_, NULL, (guint) 0);
			_data_->appid = _data_->_tmp54_;
			if (!_data_->_tmp55_) {
				_g_object_unref0 (_data_->mapping_entry);
				continue;
			}
			_data_->_tmp56_ = _data_->mapping_entry;
			_data_->_tmp57_ = proton_plus_utils_vdf_vdf_entry_get_child (_data_->_tmp56_, "name");
			_data_->name = _data_->_tmp57_;
			_data_->_tmp59_ = _data_->name;
			if (_data_->_tmp59_ == NULL) {
				_data_->_tmp58_ = TRUE;
			} else {
				_data_->_tmp60_ = _data_->name;
				_data_->_tmp61_ = proton_plus_utils_vdf_vdf_entry_get_value (_data_->_tmp60_);
				_data_->_tmp62_ = _data_->_tmp61_;
				_data_->_tmp58_ = _data_->_tmp62_ == NULL;
			}
			if (_data_->_tmp58_) {
				_g_object_unref0 (_data_->name);
				_g_object_unref0 (_data_->mapping_entry);
				continue;
			}
			_data_->_tmp63_ = _data_->self->compatibility_tool_hashtable;
			_data_->_tmp64_ = _data_->name;
			_data_->_tmp65_ = proton_plus_utils_vdf_vdf_entry_get_value (_data_->_tmp64_);
			_data_->_tmp66_ = _data_->_tmp65_;
			_data_->_tmp67_ = g_strdup (_data_->_tmp66_);
			g_hash_table_insert (_data_->_tmp63_, (gpointer) ((guintptr) _data_->appid), _data_->_tmp67_);
			_g_object_unref0 (_data_->name);
			_g_object_unref0 (_data_->mapping_entry);
		}
	}
	_data_->_tmp68_ = proton_plus_services_steam_configuration_service_get_instance ();
	_data_->_tmp69_ = _data_->_tmp68_;
	_data_->_tmp70_ = _g_object_ref0 (_data_->_tmp69_);
	_data_->_vala1_configuration = _data_->_tmp70_;
	_data_->_tmp71_ = _data_->_vala1_configuration;
	if (_data_->_tmp71_ != NULL) {
		_data_->_tmp72_ = _data_->_vala1_configuration;
		proton_plus_services_steam_configuration_service_overlay_launcher_effective_state (_data_->_tmp72_, _data_->self);
	}
	_data_->result = TRUE;
	_g_object_unref0 (_data_->_vala1_configuration);
	_g_object_unref0 (_data_->mapping);
	_g_object_unref0 (_data_->_tmp28_);
	_g_object_unref0 (_data_->steam);
	_g_object_unref0 (_data_->_tmp23_);
	_g_object_unref0 (_data_->valve);
	_g_object_unref0 (_data_->_tmp18_);
	_g_object_unref0 (_data_->software);
	_g_object_unref0 (_data_->_tmp13_);
	_g_object_unref0 (_data_->install_config_store);
	_g_object_unref0 (_data_->document);
	_g_free0 (_data_->config_content);
	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_models_launchers_steam_change_default_compatibility_tool (ProtonPlusModelsLaunchersSteam* self,
                                                                      const gchar* compatibility_tool)
{
	ProtonPlusServicesSteamConfigurationService* configuration = NULL;
	ProtonPlusServicesSteamConfigurationService* _tmp0_;
	ProtonPlusServicesSteamConfigurationService* _tmp1_;
	ProtonPlusServicesSteamConfigurationService* _tmp2_;
	ProtonPlusServicesSteamConfigurationService* _tmp3_;
	ProtonPlusServicesSteamConfigurationMutation* outcome = NULL;
	ProtonPlusServicesSteamConfigurationService* _tmp4_;
	ProtonPlusServicesSteamConfigurationMutation* _tmp5_;
	ProtonPlusServicesSteamConfigurationMutation* _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (compatibility_tool != NULL, FALSE);
	_tmp0_ = proton_plus_services_steam_configuration_service_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	configuration = _tmp2_;
	_tmp3_ = configuration;
	if (_tmp3_ == NULL) {
		g_warning ("steam.vala:616: Steam default compatibility change rejected because St" \
"eamConfigurationService is not configured.");
		result = FALSE;
		_g_object_unref0 (configuration);
		return result;
	}
	_tmp4_ = configuration;
	_tmp5_ = proton_plus_services_steam_configuration_service_change_default_compatibility_tool (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, PROTON_PLUS_SERVICES_TYPE_STEAM_CONFIGURATION_SERVICE, ProtonPlusServicesSteamConfigurationService), self, compatibility_tool);
	outcome = _tmp5_;
	_tmp6_ = outcome;
	_tmp7_ = proton_plus_services_steam_configuration_mutation_get_accepted (_tmp6_);
	_tmp8_ = _tmp7_;
	if (!_tmp8_) {
		result = FALSE;
		_g_object_unref0 (outcome);
		_g_object_unref0 (configuration);
		return result;
	}
	proton_plus_models_launchers_steam_set_default_compatibility_tool (self, compatibility_tool);
	result = TRUE;
	_g_object_unref0 (outcome);
	_g_object_unref0 (configuration);
	return result;
}

ProtonPlusModelsSteamProfile*
proton_plus_models_launchers_steam_get_profile (ProtonPlusModelsLaunchersSteam* self)
{
	ProtonPlusModelsSteamProfile* result;
	ProtonPlusModelsSteamProfile* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_profile;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_launchers_steam_set_profile (ProtonPlusModelsLaunchersSteam* self,
                                                ProtonPlusModelsSteamProfile* value)
{
	ProtonPlusModelsSteamProfile* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_launchers_steam_get_profile (self);
	if (old_value != value) {
		ProtonPlusModelsSteamProfile* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_profile);
		self->priv->_profile = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_launchers_steam_properties[PROTON_PLUS_MODELS_LAUNCHERS_STEAM_PROFILE_PROPERTY]);
	}
}

const gchar*
proton_plus_models_launchers_steam_get_default_compatibility_tool (ProtonPlusModelsLaunchersSteam* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_default_compatibility_tool;
	result = _tmp0_;
	return result;
}

void
proton_plus_models_launchers_steam_set_default_compatibility_tool (ProtonPlusModelsLaunchersSteam* self,
                                                                   const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_models_launchers_steam_get_default_compatibility_tool (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_default_compatibility_tool);
		self->priv->_default_compatibility_tool = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_models_launchers_steam_properties[PROTON_PLUS_MODELS_LAUNCHERS_STEAM_DEFAULT_COMPATIBILITY_TOOL_PROPERTY]);
	}
}

static void
proton_plus_models_launchers_steam_class_init (ProtonPlusModelsLaunchersSteamClass * klass,
                                               gpointer klass_data)
{
	proton_plus_models_launchers_steam_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusModelsLaunchersSteam_private_offset);
	((ProtonPlusModelsLauncherClass *) klass)->get_steam_restart_target = (ProtonPlusModelsSteamRestartTarget* (*) (ProtonPlusModelsLauncher*)) proton_plus_models_launchers_steam_real_get_steam_restart_target;
	((ProtonPlusModelsLauncherClass *) klass)->get_managed_tool_directories = (GList* (*) (ProtonPlusModelsLauncher*, ProtonPlusModelsGroup*)) proton_plus_models_launchers_steam_real_get_managed_tool_directories;
	((ProtonPlusModelsLauncherClass *) klass)->get_primary_managed_tool_directory = (gchar* (*) (ProtonPlusModelsLauncher*, ProtonPlusModelsGroup*)) proton_plus_models_launchers_steam_real_get_primary_managed_tool_directory;
	((ProtonPlusModelsLauncherClass *) klass)->get_compatibility_tool_usage_count = (gint (*) (ProtonPlusModelsLauncher*, const gchar*)) proton_plus_models_launchers_steam_real_get_compatibility_tool_usage_count;
	((ProtonPlusModelsLauncherClass *) klass)->load_game_library = (void (*) (ProtonPlusModelsLauncher*, GAsyncReadyCallback, gpointer)) proton_plus_models_launchers_steam_real_load_game_library;
	((ProtonPlusModelsLauncherClass *) klass)->load_game_library_finish = (gboolean (*) (ProtonPlusModelsLauncher*, GAsyncResult*)) proton_plus_models_launchers_steam_load_game_library_finish;
	((ProtonPlusModelsLauncherClass *) klass)->register_compatibility_tool_from_path = (void (*) (ProtonPlusModelsLauncher*, const gchar*)) proton_plus_models_launchers_steam_real_register_compatibility_tool_from_path;
	((ProtonPlusModelsLauncherClass *) klass)->unregister_compatibility_tool_by_path = (void (*) (ProtonPlusModelsLauncher*, const gchar*)) proton_plus_models_launchers_steam_real_unregister_compatibility_tool_by_path;
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_models_launchers_steam_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_models_launchers_steam_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_models_launchers_steam_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_LAUNCHERS_STEAM_PROFILE_PROPERTY, proton_plus_models_launchers_steam_properties[PROTON_PLUS_MODELS_LAUNCHERS_STEAM_PROFILE_PROPERTY] = g_param_spec_object ("profile", "profile", "profile", PROTON_PLUS_MODELS_TYPE_STEAM_PROFILE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_MODELS_LAUNCHERS_STEAM_DEFAULT_COMPATIBILITY_TOOL_PROPERTY, proton_plus_models_launchers_steam_properties[PROTON_PLUS_MODELS_LAUNCHERS_STEAM_DEFAULT_COMPATIBILITY_TOOL_PROPERTY] = g_param_spec_string ("default-compatibility-tool", "default-compatibility-tool", "default-compatibility-tool", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
proton_plus_models_launchers_steam_instance_init (ProtonPlusModelsLaunchersSteam * self,
                                                  gpointer klass)
{
	self->priv = proton_plus_models_launchers_steam_get_instance_private (self);
}

static void
proton_plus_models_launchers_steam_finalize (GObject * obj)
{
	ProtonPlusModelsLaunchersSteam * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_MODELS_LAUNCHERS_TYPE_STEAM, ProtonPlusModelsLaunchersSteam);
	(self->profiles == NULL) ? NULL : (self->profiles = (_g_list_free__g_object_unref0_ (self->profiles), NULL));
	_g_object_unref0 (self->priv->_profile);
	_g_free0 (self->priv->_default_compatibility_tool);
	_g_hash_table_unref0 (self->compatibility_tool_hashtable);
	_g_object_unref0 (self->priv->awacy_game_catalog);
	_g_object_unref0 (self->priv->compatibility_tool_discovery);
	G_OBJECT_CLASS (proton_plus_models_launchers_steam_parent_class)->finalize (obj);
}

static GType
proton_plus_models_launchers_steam_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusModelsLaunchersSteamClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_models_launchers_steam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusModelsLaunchersSteam), 0, (GInstanceInitFunc) proton_plus_models_launchers_steam_instance_init, NULL };
	GType proton_plus_models_launchers_steam_type_id;
	proton_plus_models_launchers_steam_type_id = g_type_register_static (PROTON_PLUS_MODELS_TYPE_LAUNCHER, "ProtonPlusModelsLaunchersSteam", &g_define_type_info, 0);
	ProtonPlusModelsLaunchersSteam_private_offset = g_type_add_instance_private (proton_plus_models_launchers_steam_type_id, sizeof (ProtonPlusModelsLaunchersSteamPrivate));
	return proton_plus_models_launchers_steam_type_id;
}

GType
proton_plus_models_launchers_steam_get_type (void)
{
	static volatile gsize proton_plus_models_launchers_steam_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_models_launchers_steam_type_id__once)) {
		GType proton_plus_models_launchers_steam_type_id;
		proton_plus_models_launchers_steam_type_id = proton_plus_models_launchers_steam_get_type_once ();
		g_once_init_leave (&proton_plus_models_launchers_steam_type_id__once, proton_plus_models_launchers_steam_type_id);
	}
	return proton_plus_models_launchers_steam_type_id__once;
}

static void
_vala_proton_plus_models_launchers_steam_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	ProtonPlusModelsLaunchersSteam * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_LAUNCHERS_TYPE_STEAM, ProtonPlusModelsLaunchersSteam);
	switch (property_id) {
		case PROTON_PLUS_MODELS_LAUNCHERS_STEAM_PROFILE_PROPERTY:
		g_value_set_object (value, proton_plus_models_launchers_steam_get_profile (self));
		break;
		case PROTON_PLUS_MODELS_LAUNCHERS_STEAM_DEFAULT_COMPATIBILITY_TOOL_PROPERTY:
		g_value_set_string (value, proton_plus_models_launchers_steam_get_default_compatibility_tool (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_models_launchers_steam_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec)
{
	ProtonPlusModelsLaunchersSteam * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_MODELS_LAUNCHERS_TYPE_STEAM, ProtonPlusModelsLaunchersSteam);
	switch (property_id) {
		case PROTON_PLUS_MODELS_LAUNCHERS_STEAM_PROFILE_PROPERTY:
		proton_plus_models_launchers_steam_set_profile (self, g_value_get_object (value));
		break;
		case PROTON_PLUS_MODELS_LAUNCHERS_STEAM_DEFAULT_COMPATIBILITY_TOOL_PROPERTY:
		proton_plus_models_launchers_steam_set_default_compatibility_tool (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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 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;
}

