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

#include "protonplus_core.h"
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.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_SERVICES_INSTALLATION_SERVICE_0_PROPERTY,
	PROTON_PLUS_SERVICES_INSTALLATION_SERVICE_NUM_PROPERTIES
};
static GParamSpec* proton_plus_services_installation_service_properties[PROTON_PLUS_SERVICES_INSTALLATION_SERVICE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ProtonPlusServicesInstallationServiceInstallData ProtonPlusServicesInstallationServiceInstallData;
typedef struct _ProtonPlusServicesInstallationServiceRemoveData ProtonPlusServicesInstallationServiceRemoveData;
typedef struct _ProtonPlusServicesInstallationServiceUpdateData ProtonPlusServicesInstallationServiceUpdateData;
typedef struct _ProtonPlusServicesInstallationServiceUpdateSpecificRunnerData ProtonPlusServicesInstallationServiceUpdateSpecificRunnerData;
typedef struct _ProtonPlusServicesInstallationServiceInstallForUpdateData ProtonPlusServicesInstallationServiceInstallForUpdateData;
typedef struct _ProtonPlusServicesInstallationServiceRefreshSteamTinkerLaunchReleaseData ProtonPlusServicesInstallationServiceRefreshSteamTinkerLaunchReleaseData;
typedef struct _ProtonPlusServicesInstallationServiceCheckForUpdatesData ProtonPlusServicesInstallationServiceCheckForUpdatesData;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _ProtonPlusServicesInstallationServiceStartInstallData ProtonPlusServicesInstallationServiceStartInstallData;
typedef struct _ProtonPlusServicesInstallationServiceExecuteInstallData ProtonPlusServicesInstallationServiceExecuteInstallData;
typedef struct _ProtonPlusServicesInstallationServiceCheckFinalProcessStateData ProtonPlusServicesInstallationServiceCheckFinalProcessStateData;
enum  {
	PROTON_PLUS_SERVICES_INSTALLATION_SERVICE_STEAM_RESTART_RECORDING_FAILED_SIGNAL,
	PROTON_PLUS_SERVICES_INSTALLATION_SERVICE_NUM_SIGNALS
};
static guint proton_plus_services_installation_service_signals[PROTON_PLUS_SERVICES_INSTALLATION_SERVICE_NUM_SIGNALS] = {0};

struct _ProtonPlusServicesInstallationServicePrivate {
	ProtonPlusServicesStandardArchiveWorkflow* standard_archive_workflow;
	ProtonPlusServicesSteamTinkerLaunchWorkflow* steam_tinker_launch_workflow;
	GeeHashSet* active_removal_locations;
	ProtonPlusServicesCompatibilityProcessGuard* compatibility_process_guard;
	ProtonPlusServicesSteamChangeRecorder* steam_change_recorder;
};

struct _ProtonPlusServicesInstallationServiceInstallData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesInstallationService* self;
	ProtonPlusServicesInstallJob* job;
	gboolean replace_existing;
	ProtonPlusReturnCode result;
	ProtonPlusUtilsDownloadManager* _tmp0_;
	ProtonPlusUtilsDownloadManager* _tmp1_;
};

struct _ProtonPlusServicesInstallationServiceRemoveData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesInstallationService* self;
	ProtonPlusServicesInstallJob* job;
	gboolean notify_removal;
	ProtonPlusReturnCode result;
	gboolean _tmp0_;
	ProtonPlusUtilsDownloadManager* _tmp1_;
	ProtonPlusUtilsDownloadManager* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GeeHashSet* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	ProtonPlusServicesInstallationWorkflow* workflow;
	ProtonPlusServicesInstallationWorkflow* _tmp8_;
	gboolean had_durable_state;
	ProtonPlusServicesCompatibilityProcessOperationContext* operation_context;
	ProtonPlusServicesCompatibilityProcessOperationContext* _tmp9_;
	ProtonPlusServicesCompatibilityProcessInspectionResult* inspection;
	ProtonPlusServicesCompatibilityProcessGuard* _tmp10_;
	ProtonPlusServicesCompatibilityProcessOperationContext* _tmp11_;
	ProtonPlusServicesCompatibilityProcessInspectionResult* _tmp12_;
	ProtonPlusReturnCode guard_code;
	ProtonPlusServicesCompatibilityProcessInspectionResult* _tmp13_;
	ProtonPlusServicesCompatibilityProcessOperationContext* _tmp14_;
	ProtonPlusServicesCompatibilityProcessInspectionResult* _tmp15_;
	GeeHashSet* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	gboolean _tmp19_;
	ProtonPlusServicesInstallJobState _tmp20_;
	ProtonPlusServicesInstallJobState _tmp21_;
	ProtonPlusServicesInstallJobState _tmp22_;
	ProtonPlusServicesInstallJobState _tmp23_;
	gboolean busy;
	ProtonPlusReturnCode code;
	ProtonPlusServicesInstallationWorkflow* _tmp24_;
	ProtonPlusModelsTool* _tmp25_;
	ProtonPlusModelsTool* _tmp26_;
	ProtonPlusModelsGroup* _tmp27_;
	ProtonPlusModelsGroup* _tmp28_;
	ProtonPlusServicesInstallationWorkflow* _tmp29_;
	ProtonPlusUtilsDownloadManager* _tmp30_;
	ProtonPlusUtilsDownloadManager* _tmp31_;
	GeeHashSet* _tmp32_;
	const gchar* _tmp33_;
	const gchar* _tmp34_;
};

struct _ProtonPlusServicesInstallationServiceUpdateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesInstallationService* self;
	ProtonPlusServicesInstallJob* job;
	ProtonPlusReturnCode result;
	ProtonPlusUtilsDownloadManager* _tmp0_;
	ProtonPlusUtilsDownloadManager* _tmp1_;
	ProtonPlusServicesInstallationWorkflow* _tmp2_;
	ProtonPlusServicesInstallationWorkflow* _tmp3_;
	ProtonPlusReturnCode _tmp4_;
};

struct _ProtonPlusServicesInstallationServiceUpdateSpecificRunnerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesInstallationService* self;
	ProtonPlusModelsToolsProviderTool* runner;
	ProtonPlusReturnCode result;
	ProtonPlusModelsGroup* _tmp0_;
	ProtonPlusModelsGroup* _tmp1_;
	gboolean found;
	gboolean updated;
	gboolean has_legacy_backup;
	GeeList* _entry_list;
	ProtonPlusModelsGroup* _tmp2_;
	ProtonPlusModelsGroup* _tmp3_;
	GeeList* _tmp4_;
	gint _entry_size;
	GeeList* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gint _entry_index;
	gint _tmp8_;
	gint _tmp9_;
	ProtonPlusModelsInstalledToolEntry* entry;
	GeeList* _tmp10_;
	gpointer _tmp11_;
	ProtonPlusModelsInstalledToolEntry* _tmp12_;
	ProtonPlusModelsInstalledToolEntry* _tmp13_;
	ProtonPlusReturnCode code;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp14_;
	ProtonPlusModelsInstalledToolEntry* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gboolean _tmp18_;
	gboolean _tmp19_;
	ProtonPlusReturnCode restore_code;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp20_;
	ProtonPlusModelsGroup* _tmp21_;
	ProtonPlusModelsGroup* _tmp22_;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp23_;
	ProtonPlusReturnCode _tmp24_;
};

struct _ProtonPlusServicesInstallationServiceInstallForUpdateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesInstallationService* self;
	ProtonPlusServicesInstallJob* job;
	ProtonPlusReturnCode result;
	ProtonPlusUtilsDownloadManager* _tmp0_;
	ProtonPlusUtilsDownloadManager* _tmp1_;
};

struct _ProtonPlusServicesInstallationServiceRefreshSteamTinkerLaunchReleaseData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesInstallationService* self;
	ProtonPlusServicesInstallJob* job;
	ProtonPlusServicesSteamTinkerLaunchWorkflow* workflow;
	ProtonPlusServicesInstallationWorkflow* _tmp0_;
	ProtonPlusServicesSteamTinkerLaunchWorkflow* _tmp1_;
	ProtonPlusServicesSteamTinkerLaunchWorkflow* _tmp2_;
	ProtonPlusServicesSteamTinkerLaunchWorkflow* _tmp3_;
};

struct _ProtonPlusServicesInstallationServiceCheckForUpdatesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesInstallationService* self;
	GList* launchers;
	ProtonPlusReturnCode result;
	gint updated;
	GeeHashSet* processed_tool_targets;
	GeeHashSet* _tmp0_;
	GList* launcher_collection;
	GList* launcher_it;
	ProtonPlusModelsLauncher* _tmp1_;
	ProtonPlusModelsLauncher* launcher;
	ProtonPlusModelsLauncher* _tmp2_;
	ProtonPlusModelsGroup** _tmp3_;
	gint _tmp3__length1;
	ProtonPlusModelsGroup** group_collection;
	gint group_collection_length1;
	gint _group_collection_size_;
	gint group_it;
	ProtonPlusModelsGroup* _tmp4_;
	ProtonPlusModelsGroup* group;
	ProtonPlusModelsGroup* _tmp5_;
	GeeList* entries;
	ProtonPlusModelsGroup* _tmp6_;
	GeeList* _tmp7_;
	GeeLinkedList* _tool_list;
	ProtonPlusModelsGroup* _tmp8_;
	GeeLinkedList* _tmp9_;
	GeeLinkedList* _tmp10_;
	gint _tool_size;
	GeeLinkedList* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	gint _tool_index;
	gint _tmp14_;
	gint _tmp15_;
	ProtonPlusModelsTool* tool;
	GeeLinkedList* _tmp16_;
	gpointer _tmp17_;
	ProtonPlusModelsToolsProviderTool* runner;
	ProtonPlusModelsTool* _tmp18_;
	ProtonPlusModelsToolsProviderTool* _tmp19_;
	ProtonPlusModelsToolsProviderTool* _tmp20_;
	gboolean has_latest;
	GeeList* _entry_list;
	GeeList* _tmp21_;
	gint _entry_size;
	GeeList* _tmp22_;
	gint _tmp23_;
	gint _tmp24_;
	gint _entry_index;
	gint _tmp25_;
	gint _tmp26_;
	ProtonPlusModelsInstalledToolEntry* entry;
	GeeList* _tmp27_;
	gpointer _tmp28_;
	gboolean _tmp29_;
	ProtonPlusModelsInstalledToolEntry* _tmp30_;
	ProtonPlusModelsToolsProviderTool* _tmp31_;
	ProtonPlusModelsInstalledToolEntry* _tmp32_;
	ProtonPlusModelsToolsProviderTool* _tmp33_;
	GeeHashSet* _tmp34_;
	ProtonPlusModelsToolsProviderTool* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	ProtonPlusReturnCode code;
	ProtonPlusModelsToolsProviderTool* _tmp38_;
	gint _tmp39_;
	gboolean _tmp40_;
	ProtonPlusReturnCode _tmp41_;
};

struct _ProtonPlusServicesInstallationServiceStartInstallData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesInstallationService* self;
	ProtonPlusServicesInstallJob* job;
	gboolean replace_existing;
	gboolean record_change;
	ProtonPlusReturnCode result;
	gboolean missing_explicit_selection;
	ProtonPlusReturnCode compatibility;
	gboolean _tmp0_;
	ProtonPlusReturnCode _tmp1_;
	ProtonPlusServicesInstallationWorkflow* workflow;
	ProtonPlusServicesInstallationWorkflow* _tmp2_;
	ProtonPlusReturnCode validation;
	ProtonPlusServicesInstallationWorkflow* _tmp3_;
	ProtonPlusServicesInstallationWorkflow* _tmp4_;
};

struct _ProtonPlusServicesInstallationServiceExecuteInstallData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesInstallationService* self;
	ProtonPlusServicesInstallJob* job;
	ProtonPlusServicesInstallationWorkflow* workflow;
	gboolean replace_existing;
	gboolean record_change;
	ProtonPlusReturnCode result;
	ProtonPlusServicesCompatibilityProcessOperationKind operation_kind;
	ProtonPlusServicesCompatibilityProcessOperationContext* operation_context;
	ProtonPlusServicesCompatibilityProcessOperationContext* _tmp0_;
	ProtonPlusServicesCompatibilityProcessInspectionResult* inspection;
	ProtonPlusServicesCompatibilityProcessGuard* _tmp1_;
	ProtonPlusServicesCompatibilityProcessOperationContext* _tmp2_;
	ProtonPlusServicesCompatibilityProcessInspectionResult* _tmp3_;
	ProtonPlusReturnCode guard_code;
	ProtonPlusServicesCompatibilityProcessInspectionResult* _tmp4_;
	ProtonPlusServicesCompatibilityProcessOperationContext* _tmp5_;
	ProtonPlusServicesCompatibilityProcessInspectionResult* _tmp6_;
	gboolean updating;
	ProtonPlusServicesInstallJobState _tmp7_;
	ProtonPlusServicesInstallJobState _tmp8_;
	ProtonPlusUtilsDownloadManager* _tmp9_;
	ProtonPlusUtilsDownloadManager* _tmp10_;
	ProtonPlusReturnCode code;
	ProtonPlusModelsTool* _tmp11_;
	ProtonPlusModelsTool* _tmp12_;
	ProtonPlusModelsGroup* _tmp13_;
	ProtonPlusModelsGroup* _tmp14_;
	gboolean success;
	ProtonPlusUtilsDownloadManager* _tmp15_;
	ProtonPlusUtilsDownloadManager* _tmp16_;
	gboolean _tmp17_;
	ProtonPlusUtilsDownloadManager* _tmp18_;
	ProtonPlusUtilsDownloadManager* _tmp19_;
	gboolean _tmp20_;
	ProtonPlusModelsSteamChangeKind _tmp21_;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp22_;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp23_;
	ProtonPlusModelsSteamChangeKind _tmp24_;
};

struct _ProtonPlusServicesInstallationServiceCheckFinalProcessStateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ProtonPlusServicesInstallationService* self;
	ProtonPlusServicesInstallJob* job;
	ProtonPlusServicesCompatibilityProcessOperationKind operation_kind;
	gboolean mutates_existing_destination;
	ProtonPlusReturnCode result;
	ProtonPlusServicesCompatibilityProcessOperationContext* context;
	ProtonPlusServicesCompatibilityProcessOperationContext* _tmp0_;
	ProtonPlusServicesCompatibilityProcessInspectionResult* inspection;
	ProtonPlusServicesCompatibilityProcessGuard* _tmp1_;
	ProtonPlusServicesCompatibilityProcessOperationContext* _tmp2_;
	ProtonPlusServicesCompatibilityProcessInspectionResult* _tmp3_;
	ProtonPlusReturnCode code;
	ProtonPlusServicesCompatibilityProcessInspectionResult* _tmp4_;
	ProtonPlusServicesCompatibilityProcessOperationContext* _tmp5_;
	ProtonPlusServicesCompatibilityProcessInspectionResult* _tmp6_;
};

static gint ProtonPlusServicesInstallationService_private_offset;
static gpointer proton_plus_services_installation_service_parent_class = NULL;
static ProtonPlusServicesInstallationService* proton_plus_services_installation_service__instance;
static ProtonPlusServicesInstallationService* proton_plus_services_installation_service__instance = NULL;
static ProtonPlusServicesInstallationOperationCoordinatorIface * proton_plus_services_installation_service_proton_plus_services_installation_operation_coordinator_parent_iface = NULL;
static ProtonPlusServicesInstallationLifecycleRecorderIface * proton_plus_services_installation_service_proton_plus_services_installation_lifecycle_recorder_parent_iface = NULL;

static ProtonPlusServicesInstallationService* proton_plus_services_installation_service_new (void);
static ProtonPlusServicesInstallationService* proton_plus_services_installation_service_construct (GType object_type);
static void proton_plus_services_installation_service_install_data_free (gpointer _data);
static gboolean proton_plus_services_installation_service_install_co (ProtonPlusServicesInstallationServiceInstallData* _data_);
static void proton_plus_services_installation_service_start_install (ProtonPlusServicesInstallationService* self,
                                                              ProtonPlusServicesInstallJob* job,
                                                              gboolean replace_existing,
                                                              gboolean record_change,
                                                              GAsyncReadyCallback _callback_,
                                                              gpointer _user_data_);
static ProtonPlusReturnCode proton_plus_services_installation_service_start_install_finish (ProtonPlusServicesInstallationService* self,
                                                                                     GAsyncResult* _res_);
static void proton_plus_services_installation_service_install_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_);
static void proton_plus_services_installation_service_remove_data_free (gpointer _data);
static gboolean proton_plus_services_installation_service_remove_co (ProtonPlusServicesInstallationServiceRemoveData* _data_);
static ProtonPlusServicesInstallationWorkflow* proton_plus_services_installation_service_select_workflow (ProtonPlusServicesInstallationService* self,
                                                                                                   ProtonPlusServicesInstallJob* job);
static gboolean proton_plus_services_installation_service_has_removable_state (ProtonPlusServicesInstallationService* self,
                                                                        ProtonPlusServicesInstallJob* job);
static ProtonPlusServicesCompatibilityProcessOperationContext* proton_plus_services_installation_service_process_operation_context (ProtonPlusServicesInstallationService* self,
                                                                                                                             ProtonPlusServicesInstallJob* job,
                                                                                                                             ProtonPlusServicesCompatibilityProcessOperationKind operation_kind,
                                                                                                                             gboolean mutates_existing_destination);
static void proton_plus_services_installation_service_remove_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_);
static ProtonPlusReturnCode proton_plus_services_installation_service_process_inspection_return_code (ProtonPlusServicesInstallationService* self,
                                                                                               ProtonPlusServicesCompatibilityProcessInspectionResult* inspection,
                                                                                               ProtonPlusServicesCompatibilityProcessOperationContext* context);
static void proton_plus_services_installation_service_report_process_inspection_result (ProtonPlusServicesInstallationService* self,
                                                                                 ProtonPlusServicesCompatibilityProcessInspectionResult* inspection,
                                                                                 gboolean continuing);
VALA_EXTERN void proton_plus_services_install_job_begin_operation (ProtonPlusServicesInstallJob* self);
VALA_EXTERN void proton_plus_services_install_job_set_state (ProtonPlusServicesInstallJob* self,
                                                 ProtonPlusServicesInstallJobState value);
VALA_EXTERN void proton_plus_services_install_job_finish_operation (ProtonPlusServicesInstallJob* self);
static void proton_plus_services_installation_service_record_successful_change (ProtonPlusServicesInstallationService* self,
                                                                         ProtonPlusServicesInstallJob* job,
                                                                         ProtonPlusModelsSteamChangeKind kind);
static ProtonPlusModelsSteamChangeKind proton_plus_services_installation_service_removal_change_kind (ProtonPlusServicesInstallationService* self,
                                                                                               ProtonPlusServicesInstallJob* job);
static void proton_plus_services_installation_service_update_data_free (gpointer _data);
static gboolean proton_plus_services_installation_service_update_co (ProtonPlusServicesInstallationServiceUpdateData* _data_);
static void proton_plus_services_installation_service_update_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_);
static void proton_plus_services_installation_service_update_specific_runner_data_free (gpointer _data);
static gboolean proton_plus_services_installation_service_update_specific_runner_co (ProtonPlusServicesInstallationServiceUpdateSpecificRunnerData* _data_);
static gboolean proton_plus_services_installation_service_is_legacy_latest_backup (ProtonPlusServicesInstallationService* self,
                                                                            ProtonPlusModelsInstalledToolEntry* entry,
                                                                            ProtonPlusModelsToolsProviderTool* runner);
static gboolean proton_plus_services_installation_service_is_latest_installation (ProtonPlusServicesInstallationService* self,
                                                                           ProtonPlusModelsInstalledToolEntry* entry,
                                                                           ProtonPlusModelsToolsProviderTool* runner);
static void proton_plus_services_installation_service_update_specific_runner_ready (GObject* source_object,
                                                                             GAsyncResult* _res_,
                                                                             gpointer _user_data_);
VALA_EXTERN void proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                  ProtonPlusModelsToolsProviderTool* runner,
                                                                                  GAsyncReadyCallback _callback_,
                                                                                  gpointer _user_data_);
VALA_EXTERN ProtonPlusReturnCode proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_finish (ProtonPlusServicesStandardArchiveWorkflow* self,
                                                                                                         GAsyncResult* _res_);
static void proton_plus_services_installation_service_real_install_for_update_data_free (gpointer _data);
static void proton_plus_services_installation_service_real_install_for_update (ProtonPlusServicesInstallationOperationCoordinator* base,
                                                                        ProtonPlusServicesInstallJob* job,
                                                                        GAsyncReadyCallback _callback_,
                                                                        gpointer _user_data_);
static gboolean proton_plus_services_installation_service_real_install_for_update_co (ProtonPlusServicesInstallationServiceInstallForUpdateData* _data_);
static void proton_plus_services_installation_service_install_for_update_ready (GObject* source_object,
                                                                         GAsyncResult* _res_,
                                                                         gpointer _user_data_);
static void proton_plus_services_installation_service_real_record_completed_update (ProtonPlusServicesInstallationLifecycleRecorder* base,
                                                                             ProtonPlusServicesInstallJob* job);
VALA_EXTERN void proton_plus_services_installation_service_refresh_job_state (ProtonPlusServicesInstallationService* self,
                                                                  ProtonPlusServicesInstallJob* job);
static void proton_plus_services_installation_service_refresh_steam_tinker_launch_release_data_free (gpointer _data);
static gboolean proton_plus_services_installation_service_refresh_steam_tinker_launch_release_co (ProtonPlusServicesInstallationServiceRefreshSteamTinkerLaunchReleaseData* _data_);
static void proton_plus_services_installation_service_refresh_steam_tinker_launch_release_ready (GObject* source_object,
                                                                                          GAsyncResult* _res_,
                                                                                          gpointer _user_data_);
static void proton_plus_services_installation_service_check_for_updates_data_free (gpointer _data);
static gboolean proton_plus_services_installation_service_check_for_updates_co (ProtonPlusServicesInstallationServiceCheckForUpdatesData* _data_);
static void proton_plus_services_installation_service_check_for_updates_ready (GObject* source_object,
                                                                        GAsyncResult* _res_,
                                                                        gpointer _user_data_);
static gboolean proton_plus_services_installation_service_installation_identity_matches_runner (ProtonPlusServicesInstallationService* self,
                                                                                         ProtonPlusModelsInstalledToolEntry* entry,
                                                                                         ProtonPlusModelsToolsProviderTool* runner);
static void proton_plus_services_installation_service_start_install_data_free (gpointer _data);
static gboolean proton_plus_services_installation_service_start_install_co (ProtonPlusServicesInstallationServiceStartInstallData* _data_);
VALA_EXTERN ProtonPlusReturnCode proton_plus_services_installation_service_resolve_provider_install_variant (ProtonPlusServicesInstallationService* self,
                                                                                                 ProtonPlusServicesInstallJob* job,
                                                                                                 gboolean* missing_explicit_selection);
static void proton_plus_services_installation_service_execute_install (ProtonPlusServicesInstallationService* self,
                                                                ProtonPlusServicesInstallJob* job,
                                                                ProtonPlusServicesInstallationWorkflow* workflow,
                                                                gboolean replace_existing,
                                                                gboolean record_change,
                                                                GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_);
static ProtonPlusReturnCode proton_plus_services_installation_service_execute_install_finish (ProtonPlusServicesInstallationService* self,
                                                                                       GAsyncResult* _res_);
static void proton_plus_services_installation_service_start_install_ready (GObject* source_object,
                                                                    GAsyncResult* _res_,
                                                                    gpointer _user_data_);
static gboolean proton_plus_services_installation_service_configured_variant_is_compatible (ProtonPlusServicesInstallationService* self,
                                                                                     ProtonPlusModelsToolsProviderTool* tool,
                                                                                     ProtonPlusModelsVariant* release_variant,
                                                                                     ProtonPlusModelsCpuCapabilities* capabilities);
VALA_EXTERN void proton_plus_services_install_job_apply_selected_release_variant (ProtonPlusServicesInstallJob* self,
                                                                      ProtonPlusModelsVariant* variant);
static void proton_plus_services_installation_service_execute_install_data_free (gpointer _data);
static gboolean proton_plus_services_installation_service_execute_install_co (ProtonPlusServicesInstallationServiceExecuteInstallData* _data_);
static ProtonPlusServicesCompatibilityProcessOperationKind proton_plus_services_installation_service_updating_operation_kind (ProtonPlusServicesInstallationService* self,
                                                                                                                       ProtonPlusServicesInstallJob* job,
                                                                                                                       gboolean replace_existing);
static gboolean proton_plus_services_installation_service_mutates_existing_destination (ProtonPlusServicesInstallationService* self,
                                                                                 ProtonPlusServicesInstallJob* job,
                                                                                 ProtonPlusServicesInstallationWorkflow* workflow,
                                                                                 gboolean replace_existing);
static void proton_plus_services_installation_service_execute_install_ready (GObject* source_object,
                                                                      GAsyncResult* _res_,
                                                                      gpointer _user_data_);
VALA_EXTERN void proton_plus_services_install_job_set_is_finished (ProtonPlusServicesInstallJob* self,
                                                       gboolean value);
VALA_EXTERN void proton_plus_services_install_job_set_install_success (ProtonPlusServicesInstallJob* self,
                                                           gboolean value);
static void proton_plus_services_installation_service_check_final_process_state_data_free (gpointer _data);
VALA_EXTERN void proton_plus_services_installation_service_check_final_process_state (ProtonPlusServicesInstallationService* self,
                                                                          ProtonPlusServicesInstallJob* job,
                                                                          ProtonPlusServicesCompatibilityProcessOperationKind operation_kind,
                                                                          gboolean mutates_existing_destination,
                                                                          GAsyncReadyCallback _callback_,
                                                                          gpointer _user_data_);
VALA_EXTERN ProtonPlusReturnCode proton_plus_services_installation_service_check_final_process_state_finish (ProtonPlusServicesInstallationService* self,
                                                                                                 GAsyncResult* _res_);
static gboolean proton_plus_services_installation_service_check_final_process_state_co (ProtonPlusServicesInstallationServiceCheckFinalProcessStateData* _data_);
static void proton_plus_services_installation_service_check_final_process_state_ready (GObject* source_object,
                                                                                GAsyncResult* _res_,
                                                                                gpointer _user_data_);
VALA_EXTERN const gchar* proton_plus_services_steam_tinker_launch_context_get_base_location (ProtonPlusServicesSteamTinkerLaunchContext* self);
VALA_EXTERN const gchar* proton_plus_services_steam_tinker_launch_context_get_link_location (ProtonPlusServicesSteamTinkerLaunchContext* self);
VALA_EXTERN const gchar* proton_plus_services_steam_tinker_launch_context_get_config_location (ProtonPlusServicesSteamTinkerLaunchContext* self);
VALA_EXTERN const gchar* proton_plus_services_steam_tinker_launch_context_get_manual_remove_location (ProtonPlusServicesSteamTinkerLaunchContext* self);
VALA_EXTERN gboolean proton_plus_services_install_job_mark_steam_change_recorded (ProtonPlusServicesInstallJob* self,
                                                                      ProtonPlusModelsSteamChangeKind kind);
VALA_EXTERN void proton_plus_services_install_job_set_has_steam_restart_record_result (ProtonPlusServicesInstallJob* self,
                                                                           gboolean value);
VALA_EXTERN void proton_plus_services_install_job_set_steam_restart_record_result (ProtonPlusServicesInstallJob* self,
                                                                       ProtonPlusServicesSteamRestartRecordResult value);
VALA_EXTERN void proton_plus_services_install_job_set_steam_restart_warning (ProtonPlusServicesInstallJob* self,
                                                                 const gchar* value);
static void g_cclosure_user_marshal_VOID__OBJECT_STRING (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void proton_plus_services_installation_service_finalize (GObject * obj);
static GType proton_plus_services_installation_service_get_type_once (void);
static void _vala_proton_plus_services_installation_service_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
proton_plus_services_installation_service_get_instance_private (ProtonPlusServicesInstallationService* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusServicesInstallationService_private_offset);
}

static ProtonPlusServicesInstallationService*
proton_plus_services_installation_service_construct (GType object_type)
{
	ProtonPlusServicesInstallationService * self = NULL;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp0_;
	ProtonPlusServicesSteamTinkerLaunchWorkflow* _tmp1_;
	self = (ProtonPlusServicesInstallationService*) g_object_new (object_type, NULL);
	_tmp0_ = proton_plus_services_standard_archive_workflow_new ();
	_g_object_unref0 (self->priv->standard_archive_workflow);
	self->priv->standard_archive_workflow = _tmp0_;
	_tmp1_ = proton_plus_services_steam_tinker_launch_workflow_new ();
	_g_object_unref0 (self->priv->steam_tinker_launch_workflow);
	self->priv->steam_tinker_launch_workflow = _tmp1_;
	return self;
}

static ProtonPlusServicesInstallationService*
proton_plus_services_installation_service_new (void)
{
	return proton_plus_services_installation_service_construct (PROTON_PLUS_SERVICES_TYPE_INSTALLATION_SERVICE);
}

static void
proton_plus_services_installation_service_install_data_free (gpointer _data)
{
	ProtonPlusServicesInstallationServiceInstallData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesInstallationServiceInstallData, _data_);
}

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

void
proton_plus_services_installation_service_install (ProtonPlusServicesInstallationService* self,
                                                   ProtonPlusServicesInstallJob* job,
                                                   gboolean replace_existing,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceInstallData* _data_;
	ProtonPlusServicesInstallationService* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesInstallationServiceInstallData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_installation_service_install_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	_data_->replace_existing = replace_existing;
	proton_plus_services_installation_service_install_co (_data_);
}

ProtonPlusReturnCode
proton_plus_services_installation_service_install_finish (ProtonPlusServicesInstallationService* self,
                                                          GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesInstallationServiceInstallData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_installation_service_install_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceInstallData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_installation_service_install_co (_data_);
}

static gboolean
proton_plus_services_installation_service_install_co (ProtonPlusServicesInstallationServiceInstallData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = proton_plus_utils_download_manager_get_instance ();
	_data_->_tmp1_ = _data_->_tmp0_;
	if (proton_plus_utils_download_manager_is_downloading (_data_->_tmp1_, _data_->job)) {
		_data_->result = PROTON_PLUS_RETURN_CODE_OPERATION_IN_PROGRESS;
		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_->_state_ = 1;
	proton_plus_services_installation_service_start_install (_data_->self, _data_->job, _data_->replace_existing, TRUE, proton_plus_services_installation_service_install_ready, _data_);
	return FALSE;
	_state_1:
	_data_->result = proton_plus_services_installation_service_start_install_finish (_data_->self, _data_->_res_);
	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_services_installation_service_configure_steam_change_recorder (ProtonPlusServicesInstallationService* self,
                                                                           ProtonPlusServicesSteamChangeRecorder* recorder)
{
	ProtonPlusServicesSteamChangeRecorder* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (recorder);
	_g_object_unref0 (self->priv->steam_change_recorder);
	self->priv->steam_change_recorder = _tmp0_;
}

void
proton_plus_services_installation_service_configure_compatibility_process_guard (ProtonPlusServicesInstallationService* self,
                                                                                 ProtonPlusServicesCompatibilityProcessGuard* guard)
{
	ProtonPlusServicesCompatibilityProcessGuard* _tmp0_ = NULL;
	ProtonPlusServicesCompatibilityProcessGuard* _tmp1_;
	ProtonPlusServicesCompatibilityProcessGuard* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp1_ = _g_object_ref0 (guard);
	_tmp0_ = _tmp1_;
	if (_tmp0_ == NULL) {
		ProtonPlusServicesCompatibilityProcessGuard* _tmp2_;
		_tmp2_ = proton_plus_services_compatibility_process_guard_new (NULL);
		_g_object_unref0 (_tmp0_);
		_tmp0_ = _tmp2_;
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	_g_object_unref0 (self->priv->compatibility_process_guard);
	self->priv->compatibility_process_guard = _tmp3_;
	_g_object_unref0 (_tmp0_);
}

void
proton_plus_services_installation_service_reset_lifecycle_configuration (ProtonPlusServicesInstallationService* self)
{
	ProtonPlusServicesCompatibilityProcessGuard* _tmp0_;
	g_return_if_fail (self != NULL);
	_g_object_unref0 (self->priv->steam_change_recorder);
	self->priv->steam_change_recorder = NULL;
	_tmp0_ = proton_plus_services_compatibility_process_guard_new (NULL);
	_g_object_unref0 (self->priv->compatibility_process_guard);
	self->priv->compatibility_process_guard = _tmp0_;
}

void
proton_plus_services_installation_service_reset_lifecycle_configuration_for_tests (void)
{
	ProtonPlusServicesInstallationService* _tmp0_;
	_tmp0_ = proton_plus_services_installation_service__instance;
	if (_tmp0_ != NULL) {
		ProtonPlusServicesInstallationService* _tmp1_;
		_tmp1_ = proton_plus_services_installation_service__instance;
		proton_plus_services_installation_service_reset_lifecycle_configuration (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, PROTON_PLUS_SERVICES_TYPE_INSTALLATION_SERVICE, ProtonPlusServicesInstallationService));
	}
}

static void
proton_plus_services_installation_service_remove_data_free (gpointer _data)
{
	ProtonPlusServicesInstallationServiceRemoveData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesInstallationServiceRemoveData, _data_);
}

void
proton_plus_services_installation_service_remove (ProtonPlusServicesInstallationService* self,
                                                  ProtonPlusServicesInstallJob* job,
                                                  gboolean notify_removal,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceRemoveData* _data_;
	ProtonPlusServicesInstallationService* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesInstallationServiceRemoveData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_installation_service_remove_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	_data_->notify_removal = notify_removal;
	proton_plus_services_installation_service_remove_co (_data_);
}

ProtonPlusReturnCode
proton_plus_services_installation_service_remove_finish (ProtonPlusServicesInstallationService* self,
                                                         GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesInstallationServiceRemoveData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_installation_service_remove_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceRemoveData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_installation_service_remove_co (_data_);
}

static gboolean
proton_plus_services_installation_service_remove_co (ProtonPlusServicesInstallationServiceRemoveData* _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_->_tmp1_ = proton_plus_utils_download_manager_get_instance ();
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = proton_plus_services_install_job_get_install_location (_data_->job);
	_data_->_tmp4_ = _data_->_tmp3_;
	if (proton_plus_utils_download_manager_has_active_installation_at (_data_->_tmp2_, _data_->_tmp4_)) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp5_ = _data_->self->priv->active_removal_locations;
		_data_->_tmp6_ = proton_plus_services_install_job_get_install_location (_data_->job);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp0_ = !gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp5_, _data_->_tmp7_);
	}
	if (_data_->_tmp0_) {
		_data_->result = PROTON_PLUS_RETURN_CODE_OPERATION_IN_PROGRESS;
		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_->_tmp8_ = proton_plus_services_installation_service_select_workflow (_data_->self, _data_->job);
	_data_->workflow = _data_->_tmp8_;
	_data_->had_durable_state = proton_plus_services_installation_service_has_removable_state (_data_->self, _data_->job);
	_data_->_tmp9_ = proton_plus_services_installation_service_process_operation_context (_data_->self, _data_->job, PROTON_PLUS_SERVICES_COMPATIBILITY_PROCESS_OPERATION_KIND_REMOVAL, _data_->had_durable_state);
	_data_->operation_context = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->self->priv->compatibility_process_guard;
	_data_->_tmp11_ = _data_->operation_context;
	_data_->_state_ = 1;
	proton_plus_services_compatibility_process_guard_inspect (_data_->_tmp10_, _data_->_tmp11_, proton_plus_services_installation_service_remove_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp12_ = proton_plus_services_compatibility_process_guard_inspect_finish (_data_->_tmp10_, _data_->_res_);
	_data_->inspection = _data_->_tmp12_;
	_data_->_tmp13_ = _data_->inspection;
	_data_->_tmp14_ = _data_->operation_context;
	_data_->guard_code = proton_plus_services_installation_service_process_inspection_return_code (_data_->self, _data_->_tmp13_, _data_->_tmp14_);
	if (_data_->guard_code != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
		_data_->_tmp15_ = _data_->inspection;
		proton_plus_services_installation_service_report_process_inspection_result (_data_->self, _data_->_tmp15_, FALSE);
		_data_->_tmp16_ = _data_->self->priv->active_removal_locations;
		_data_->_tmp17_ = proton_plus_services_install_job_get_install_location (_data_->job);
		_data_->_tmp18_ = _data_->_tmp17_;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _data_->_tmp16_, _data_->_tmp18_);
		_data_->result = _data_->guard_code;
		_g_object_unref0 (_data_->inspection);
		_g_object_unref0 (_data_->operation_context);
		_g_object_unref0 (_data_->workflow);
		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_->_tmp20_ = proton_plus_services_install_job_get_state (_data_->job);
	_data_->_tmp21_ = _data_->_tmp20_;
	if (_data_->_tmp21_ == PROTON_PLUS_SERVICES_INSTALL_JOB_STATE_BUSY_UPDATING) {
		_data_->_tmp19_ = TRUE;
	} else {
		_data_->_tmp22_ = proton_plus_services_install_job_get_state (_data_->job);
		_data_->_tmp23_ = _data_->_tmp22_;
		_data_->_tmp19_ = _data_->_tmp23_ == PROTON_PLUS_SERVICES_INSTALL_JOB_STATE_BUSY_INSTALLING;
	}
	_data_->busy = _data_->_tmp19_;
	if (!_data_->busy) {
		proton_plus_services_install_job_begin_operation (_data_->job);
		proton_plus_services_install_job_set_state (_data_->job, PROTON_PLUS_SERVICES_INSTALL_JOB_STATE_BUSY_REMOVING);
	}
	_data_->_tmp24_ = _data_->workflow;
	_data_->_state_ = 2;
	proton_plus_services_installation_workflow_remove (_data_->_tmp24_, _data_->job, proton_plus_services_installation_service_remove_ready, _data_);
	return FALSE;
	_state_2:
	_data_->code = proton_plus_services_installation_workflow_remove_finish (_data_->_tmp24_, _data_->_res_);
	_data_->_tmp25_ = proton_plus_services_install_job_get_tool (_data_->job);
	_data_->_tmp26_ = _data_->_tmp25_;
	_data_->_tmp27_ = proton_plus_models_tool_get_group (_data_->_tmp26_);
	_data_->_tmp28_ = _data_->_tmp27_;
	proton_plus_models_group_invalidate_installed_state (_data_->_tmp28_);
	if (!_data_->busy) {
		proton_plus_services_install_job_finish_operation (_data_->job);
	}
	if (_data_->code == PROTON_PLUS_RETURN_CODE_RUNNER_REMOVED) {
		_data_->_tmp29_ = _data_->workflow;
		proton_plus_services_installation_workflow_finalize_removal_success (_data_->_tmp29_, _data_->job);
		if (_data_->notify_removal) {
			_data_->_tmp30_ = proton_plus_utils_download_manager_get_instance ();
			_data_->_tmp31_ = _data_->_tmp30_;
			g_signal_emit_by_name (_data_->_tmp31_, "tool-removed", _data_->job);
		}
		if (_data_->had_durable_state) {
			proton_plus_services_installation_service_record_successful_change (_data_->self, _data_->job, proton_plus_services_installation_service_removal_change_kind (_data_->self, _data_->job));
		}
	}
	_data_->_tmp32_ = _data_->self->priv->active_removal_locations;
	_data_->_tmp33_ = proton_plus_services_install_job_get_install_location (_data_->job);
	_data_->_tmp34_ = _data_->_tmp33_;
	gee_abstract_collection_remove ((GeeAbstractCollection*) _data_->_tmp32_, _data_->_tmp34_);
	_data_->result = _data_->code;
	_g_object_unref0 (_data_->inspection);
	_g_object_unref0 (_data_->operation_context);
	_g_object_unref0 (_data_->workflow);
	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 void
proton_plus_services_installation_service_update_data_free (gpointer _data)
{
	ProtonPlusServicesInstallationServiceUpdateData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesInstallationServiceUpdateData, _data_);
}

void
proton_plus_services_installation_service_update (ProtonPlusServicesInstallationService* self,
                                                  ProtonPlusServicesInstallJob* job,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceUpdateData* _data_;
	ProtonPlusServicesInstallationService* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesInstallationServiceUpdateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_installation_service_update_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	proton_plus_services_installation_service_update_co (_data_);
}

ProtonPlusReturnCode
proton_plus_services_installation_service_update_finish (ProtonPlusServicesInstallationService* self,
                                                         GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesInstallationServiceUpdateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_installation_service_update_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceUpdateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_installation_service_update_co (_data_);
}

static gboolean
proton_plus_services_installation_service_update_co (ProtonPlusServicesInstallationServiceUpdateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = proton_plus_utils_download_manager_get_instance ();
	_data_->_tmp1_ = _data_->_tmp0_;
	if (proton_plus_utils_download_manager_is_downloading (_data_->_tmp1_, _data_->job)) {
		_data_->result = PROTON_PLUS_RETURN_CODE_OPERATION_IN_PROGRESS;
		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_ = proton_plus_services_installation_service_select_workflow (_data_->self, _data_->job);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_state_ = 1;
	proton_plus_services_installation_workflow_update (_data_->_tmp3_, _data_->job, (ProtonPlusServicesInstallationOperationCoordinator*) _data_->self, proton_plus_services_installation_service_update_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp4_ = proton_plus_services_installation_workflow_update_finish (_data_->_tmp3_, _data_->_res_);
	_g_object_unref0 (_data_->_tmp3_);
	_data_->result = _data_->_tmp4_;
	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 void
proton_plus_services_installation_service_update_specific_runner_data_free (gpointer _data)
{
	ProtonPlusServicesInstallationServiceUpdateSpecificRunnerData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->runner);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesInstallationServiceUpdateSpecificRunnerData, _data_);
}

void
proton_plus_services_installation_service_update_specific_runner (ProtonPlusServicesInstallationService* self,
                                                                  ProtonPlusModelsToolsProviderTool* runner,
                                                                  GAsyncReadyCallback _callback_,
                                                                  gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceUpdateSpecificRunnerData* _data_;
	ProtonPlusServicesInstallationService* _tmp0_;
	ProtonPlusModelsToolsProviderTool* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (runner != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesInstallationServiceUpdateSpecificRunnerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_installation_service_update_specific_runner_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (runner);
	_g_object_unref0 (_data_->runner);
	_data_->runner = _tmp1_;
	proton_plus_services_installation_service_update_specific_runner_co (_data_);
}

ProtonPlusReturnCode
proton_plus_services_installation_service_update_specific_runner_finish (ProtonPlusServicesInstallationService* self,
                                                                         GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesInstallationServiceUpdateSpecificRunnerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_installation_service_update_specific_runner_ready (GObject* source_object,
                                                                        GAsyncResult* _res_,
                                                                        gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceUpdateSpecificRunnerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_installation_service_update_specific_runner_co (_data_);
}

static gboolean
proton_plus_services_installation_service_update_specific_runner_co (ProtonPlusServicesInstallationServiceUpdateSpecificRunnerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = proton_plus_models_tool_get_group ((ProtonPlusModelsTool*) _data_->runner);
	_data_->_tmp1_ = _data_->_tmp0_;
	proton_plus_models_group_refresh_installed_state (_data_->_tmp1_);
	_data_->found = FALSE;
	_data_->updated = FALSE;
	_data_->has_legacy_backup = FALSE;
	{
		_data_->_tmp2_ = proton_plus_models_tool_get_group ((ProtonPlusModelsTool*) _data_->runner);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp4_ = proton_plus_models_group_get_installed_tool_snapshot (_data_->_tmp3_);
		_data_->_entry_list = _data_->_tmp4_;
		_data_->_tmp5_ = _data_->_entry_list;
		_data_->_tmp6_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_entry_size = _data_->_tmp7_;
		_data_->_entry_index = -1;
		while (TRUE) {
			_data_->_entry_index = _data_->_entry_index + 1;
			_data_->_tmp8_ = _data_->_entry_index;
			_data_->_tmp9_ = _data_->_entry_size;
			if (!(_data_->_tmp8_ < _data_->_tmp9_)) {
				break;
			}
			_data_->_tmp10_ = _data_->_entry_list;
			_data_->_tmp11_ = gee_list_get (_data_->_tmp10_, _data_->_entry_index);
			_data_->entry = (ProtonPlusModelsInstalledToolEntry*) _data_->_tmp11_;
			_data_->_tmp12_ = _data_->entry;
			if (proton_plus_services_installation_service_is_legacy_latest_backup (_data_->self, _data_->_tmp12_, _data_->runner)) {
				_data_->has_legacy_backup = TRUE;
			}
			_data_->_tmp13_ = _data_->entry;
			if (!proton_plus_services_installation_service_is_latest_installation (_data_->self, _data_->_tmp13_, _data_->runner)) {
				_g_object_unref0 (_data_->entry);
				continue;
			}
			_data_->found = TRUE;
			_data_->_tmp14_ = _data_->self->priv->standard_archive_workflow;
			_data_->_tmp15_ = _data_->entry;
			_data_->_tmp16_ = proton_plus_models_installed_tool_entry_get_path (_data_->_tmp15_);
			_data_->_tmp17_ = _data_->_tmp16_;
			_data_->_state_ = 1;
			proton_plus_services_standard_archive_workflow_update_specific_runner (_data_->_tmp14_, _data_->runner, (ProtonPlusServicesInstallationOperationCoordinator*) _data_->self, _data_->_tmp17_, proton_plus_services_installation_service_update_specific_runner_ready, _data_);
			return FALSE;
			_state_1:
			_data_->code = proton_plus_services_standard_archive_workflow_update_specific_runner_finish (_data_->_tmp14_, _data_->_res_);
			if (_data_->code == PROTON_PLUS_RETURN_CODE_RUNNER_UPDATED) {
				_data_->updated = TRUE;
			} else {
				if (_data_->code != PROTON_PLUS_RETURN_CODE_NOTHING_TO_UPDATE) {
					_data_->_tmp18_ = _data_->code != PROTON_PLUS_RETURN_CODE_INCOMPATIBLE_VARIANT;
				} else {
					_data_->_tmp18_ = FALSE;
				}
				if (_data_->_tmp18_) {
					_data_->result = _data_->code;
					_g_object_unref0 (_data_->entry);
					_g_object_unref0 (_data_->_entry_list);
					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;
				}
			}
			_g_object_unref0 (_data_->entry);
		}
		_g_object_unref0 (_data_->_entry_list);
	}
	if (!_data_->found) {
		_data_->_tmp19_ = _data_->has_legacy_backup;
	} else {
		_data_->_tmp19_ = FALSE;
	}
	if (_data_->_tmp19_) {
		_data_->_tmp20_ = _data_->self->priv->standard_archive_workflow;
		_data_->_state_ = 2;
		proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup (_data_->_tmp20_, _data_->runner, proton_plus_services_installation_service_update_specific_runner_ready, _data_);
		return FALSE;
		_state_2:
		_data_->restore_code = proton_plus_services_standard_archive_workflow_restore_legacy_latest_backup_finish (_data_->_tmp20_, _data_->_res_);
		if (_data_->restore_code != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
			_data_->result = _data_->restore_code;
			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_->_tmp21_ = proton_plus_models_tool_get_group ((ProtonPlusModelsTool*) _data_->runner);
		_data_->_tmp22_ = _data_->_tmp21_;
		proton_plus_models_group_invalidate_installed_state (_data_->_tmp22_);
		_data_->_tmp23_ = _data_->self->priv->standard_archive_workflow;
		_data_->_state_ = 3;
		proton_plus_services_standard_archive_workflow_update_specific_runner (_data_->_tmp23_, _data_->runner, (ProtonPlusServicesInstallationOperationCoordinator*) _data_->self, NULL, proton_plus_services_installation_service_update_specific_runner_ready, _data_);
		return FALSE;
		_state_3:
		_data_->result = proton_plus_services_standard_archive_workflow_update_specific_runner_finish (_data_->_tmp23_, _data_->_res_);
		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;
	}
	if (!_data_->found) {
		_data_->result = PROTON_PLUS_RETURN_CODE_RUNNER_NOT_INSTALLED;
		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;
	}
	if (_data_->updated) {
		_data_->_tmp24_ = PROTON_PLUS_RETURN_CODE_RUNNER_UPDATED;
	} else {
		_data_->_tmp24_ = PROTON_PLUS_RETURN_CODE_NOTHING_TO_UPDATE;
	}
	_data_->result = _data_->_tmp24_;
	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 void
proton_plus_services_installation_service_real_install_for_update_data_free (gpointer _data)
{
	ProtonPlusServicesInstallationServiceInstallForUpdateData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesInstallationServiceInstallForUpdateData, _data_);
}

static void
proton_plus_services_installation_service_real_install_for_update (ProtonPlusServicesInstallationOperationCoordinator* base,
                                                                   ProtonPlusServicesInstallJob* job,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_)
{
	ProtonPlusServicesInstallationService * self;
	ProtonPlusServicesInstallationServiceInstallForUpdateData* _data_;
	ProtonPlusServicesInstallationService* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	g_return_if_fail (job != NULL);
	self = (ProtonPlusServicesInstallationService*) base;
	_data_ = g_slice_new0 (ProtonPlusServicesInstallationServiceInstallForUpdateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_installation_service_real_install_for_update_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	proton_plus_services_installation_service_real_install_for_update_co (_data_);
}

static ProtonPlusReturnCode
proton_plus_services_installation_service_install_for_update_finish (ProtonPlusServicesInstallationOperationCoordinator* base,
                                                                     GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesInstallationServiceInstallForUpdateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_installation_service_install_for_update_ready (GObject* source_object,
                                                                    GAsyncResult* _res_,
                                                                    gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceInstallForUpdateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_installation_service_real_install_for_update_co (_data_);
}

static gboolean
proton_plus_services_installation_service_real_install_for_update_co (ProtonPlusServicesInstallationServiceInstallForUpdateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = proton_plus_utils_download_manager_get_instance ();
	_data_->_tmp1_ = _data_->_tmp0_;
	if (proton_plus_utils_download_manager_is_downloading (_data_->_tmp1_, _data_->job)) {
		_data_->result = PROTON_PLUS_RETURN_CODE_OPERATION_IN_PROGRESS;
		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_->_state_ = 1;
	proton_plus_services_installation_service_start_install (_data_->self, _data_->job, TRUE, FALSE, proton_plus_services_installation_service_install_for_update_ready, _data_);
	return FALSE;
	_state_1:
	_data_->result = proton_plus_services_installation_service_start_install_finish (_data_->self, _data_->_res_);
	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 void
proton_plus_services_installation_service_real_record_completed_update (ProtonPlusServicesInstallationLifecycleRecorder* base,
                                                                        ProtonPlusServicesInstallJob* job)
{
	ProtonPlusServicesInstallationService * self;
	ProtonPlusModelsSteamChangeKind _tmp0_ = 0;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp1_;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp2_;
	self = (ProtonPlusServicesInstallationService*) base;
	g_return_if_fail (job != NULL);
	_tmp1_ = proton_plus_services_install_job_get_steam_tinker_launch_context (job);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		_tmp0_ = PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_STEAMTINKERLAUNCH_CHANGED;
	} else {
		_tmp0_ = PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_COMPATIBILITY_TOOL_UPDATED_OR_REPLACED;
	}
	proton_plus_services_installation_service_record_successful_change (self, job, _tmp0_);
}

void
proton_plus_services_installation_service_refresh_job_state (ProtonPlusServicesInstallationService* self,
                                                             ProtonPlusServicesInstallJob* job)
{
	ProtonPlusServicesInstallationWorkflow* _tmp0_;
	ProtonPlusServicesInstallationWorkflow* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	_tmp0_ = proton_plus_services_installation_service_select_workflow (self, job);
	_tmp1_ = _tmp0_;
	proton_plus_services_installation_workflow_refresh_state (_tmp1_, job);
	_g_object_unref0 (_tmp1_);
}

static void
proton_plus_services_installation_service_refresh_steam_tinker_launch_release_data_free (gpointer _data)
{
	ProtonPlusServicesInstallationServiceRefreshSteamTinkerLaunchReleaseData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesInstallationServiceRefreshSteamTinkerLaunchReleaseData, _data_);
}

void
proton_plus_services_installation_service_refresh_steam_tinker_launch_release (ProtonPlusServicesInstallationService* self,
                                                                               ProtonPlusServicesInstallJob* job,
                                                                               GAsyncReadyCallback _callback_,
                                                                               gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceRefreshSteamTinkerLaunchReleaseData* _data_;
	ProtonPlusServicesInstallationService* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesInstallationServiceRefreshSteamTinkerLaunchReleaseData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_installation_service_refresh_steam_tinker_launch_release_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	proton_plus_services_installation_service_refresh_steam_tinker_launch_release_co (_data_);
}

void
proton_plus_services_installation_service_refresh_steam_tinker_launch_release_finish (ProtonPlusServicesInstallationService* self,
                                                                                      GAsyncResult* _res_)
{
	ProtonPlusServicesInstallationServiceRefreshSteamTinkerLaunchReleaseData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
proton_plus_services_installation_service_refresh_steam_tinker_launch_release_ready (GObject* source_object,
                                                                                     GAsyncResult* _res_,
                                                                                     gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceRefreshSteamTinkerLaunchReleaseData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_installation_service_refresh_steam_tinker_launch_release_co (_data_);
}

static gboolean
proton_plus_services_installation_service_refresh_steam_tinker_launch_release_co (ProtonPlusServicesInstallationServiceRefreshSteamTinkerLaunchReleaseData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = proton_plus_services_installation_service_select_workflow (_data_->self, _data_->job);
	_data_->_tmp1_ = PROTON_PLUS_SERVICES_IS_STEAM_TINKER_LAUNCH_WORKFLOW (_data_->_tmp0_) ? ((ProtonPlusServicesSteamTinkerLaunchWorkflow*) _data_->_tmp0_) : NULL;
	if (_data_->_tmp1_ == NULL) {
		_g_object_unref0 (_data_->_tmp0_);
	}
	_data_->workflow = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->workflow;
	if (_data_->_tmp2_ != NULL) {
		_data_->_tmp3_ = _data_->workflow;
		_data_->_state_ = 1;
		proton_plus_services_steam_tinker_launch_workflow_refresh_latest_release (_data_->_tmp3_, _data_->job, proton_plus_services_installation_service_refresh_steam_tinker_launch_release_ready, _data_);
		return FALSE;
		_state_1:
		proton_plus_services_steam_tinker_launch_workflow_refresh_latest_release_finish (_data_->_tmp3_, _data_->_res_);
	}
	_g_object_unref0 (_data_->workflow);
	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_services_installation_service_detect_steam_tinker_launch_external_installations (ProtonPlusServicesInstallationService* self,
                                                                                             ProtonPlusServicesInstallJob* job)
{
	ProtonPlusServicesSteamTinkerLaunchWorkflow* workflow = NULL;
	ProtonPlusServicesInstallationWorkflow* _tmp0_;
	ProtonPlusServicesSteamTinkerLaunchWorkflow* _tmp1_;
	gboolean _tmp2_ = FALSE;
	ProtonPlusServicesSteamTinkerLaunchWorkflow* _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (job != NULL, FALSE);
	_tmp0_ = proton_plus_services_installation_service_select_workflow (self, job);
	_tmp1_ = PROTON_PLUS_SERVICES_IS_STEAM_TINKER_LAUNCH_WORKFLOW (_tmp0_) ? ((ProtonPlusServicesSteamTinkerLaunchWorkflow*) _tmp0_) : NULL;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (_tmp0_);
	}
	workflow = _tmp1_;
	_tmp3_ = workflow;
	if (_tmp3_ != NULL) {
		ProtonPlusServicesSteamTinkerLaunchWorkflow* _tmp4_;
		_tmp4_ = workflow;
		_tmp2_ = proton_plus_services_steam_tinker_launch_workflow_detect_external_installations (_tmp4_, job);
	} else {
		_tmp2_ = FALSE;
	}
	result = _tmp2_;
	_g_object_unref0 (workflow);
	return result;
}

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

void
proton_plus_services_installation_service_check_for_updates (ProtonPlusServicesInstallationService* self,
                                                             GList* launchers,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceCheckForUpdatesData* _data_;
	ProtonPlusServicesInstallationService* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesInstallationServiceCheckForUpdatesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_installation_service_check_for_updates_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->launchers = launchers;
	proton_plus_services_installation_service_check_for_updates_co (_data_);
}

ProtonPlusReturnCode
proton_plus_services_installation_service_check_for_updates_finish (ProtonPlusServicesInstallationService* self,
                                                                    GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesInstallationServiceCheckForUpdatesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_installation_service_check_for_updates_ready (GObject* source_object,
                                                                   GAsyncResult* _res_,
                                                                   gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceCheckForUpdatesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_installation_service_check_for_updates_co (_data_);
}

static gboolean
proton_plus_services_installation_service_check_for_updates_co (ProtonPlusServicesInstallationServiceCheckForUpdatesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->updated = 0;
	_data_->_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->processed_tool_targets = _data_->_tmp0_;
	{
		_data_->launcher_collection = _data_->launchers;
		for (_data_->launcher_it = _data_->launcher_collection; _data_->launcher_it != NULL; _data_->launcher_it = _data_->launcher_it->next) {
			_data_->_tmp1_ = _g_object_ref0 ((ProtonPlusModelsLauncher*) _data_->launcher_it->data);
			_data_->launcher = _data_->_tmp1_;
			{
				_data_->_tmp2_ = _data_->launcher;
				_data_->_tmp3_ = _data_->_tmp2_->groups;
				_data_->_tmp3__length1 = _data_->_tmp2_->groups_length1;
				{
					_data_->group_collection_length1 = 0;
					_data_->_group_collection_size_ = 0;
					_data_->group_collection = _data_->_tmp3_;
					_data_->group_collection_length1 = _data_->_tmp3__length1;
					for (_data_->group_it = 0; _data_->group_it < _data_->group_collection_length1; _data_->group_it = _data_->group_it + 1) {
						_data_->_tmp4_ = _g_object_ref0 (_data_->group_collection[_data_->group_it]);
						_data_->group = _data_->_tmp4_;
						{
							_data_->_tmp5_ = _data_->group;
							proton_plus_models_group_refresh_installed_state (_data_->_tmp5_);
							_data_->_tmp6_ = _data_->group;
							_data_->_tmp7_ = proton_plus_models_group_get_installed_tool_snapshot (_data_->_tmp6_);
							_data_->entries = _data_->_tmp7_;
							{
								_data_->_tmp8_ = _data_->group;
								_data_->_tmp9_ = proton_plus_models_group_get_tools (_data_->_tmp8_);
								_data_->_tmp10_ = _data_->_tmp9_;
								_data_->_tool_list = _data_->_tmp10_;
								_data_->_tmp11_ = _data_->_tool_list;
								_data_->_tmp12_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp11_);
								_data_->_tmp13_ = _data_->_tmp12_;
								_data_->_tool_size = _data_->_tmp13_;
								_data_->_tool_index = -1;
								while (TRUE) {
									_data_->_tool_index = _data_->_tool_index + 1;
									_data_->_tmp14_ = _data_->_tool_index;
									_data_->_tmp15_ = _data_->_tool_size;
									if (!(_data_->_tmp14_ < _data_->_tmp15_)) {
										break;
									}
									_data_->_tmp16_ = _data_->_tool_list;
									_data_->_tmp17_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp16_, _data_->_tool_index);
									_data_->tool = (ProtonPlusModelsTool*) _data_->_tmp17_;
									_data_->_tmp18_ = _data_->tool;
									_data_->_tmp19_ = _g_object_ref0 (PROTON_PLUS_MODELS_TOOLS_IS_PROVIDER_TOOL (_data_->_tmp18_) ? ((ProtonPlusModelsToolsProviderTool*) _data_->_tmp18_) : NULL);
									_data_->runner = _data_->_tmp19_;
									_data_->_tmp20_ = _data_->runner;
									if (_data_->_tmp20_ == NULL) {
										_g_object_unref0 (_data_->runner);
										_g_object_unref0 (_data_->tool);
										continue;
									}
									_data_->has_latest = FALSE;
									{
										_data_->_tmp21_ = _data_->entries;
										_data_->_entry_list = _data_->_tmp21_;
										_data_->_tmp22_ = _data_->_entry_list;
										_data_->_tmp23_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp22_);
										_data_->_tmp24_ = _data_->_tmp23_;
										_data_->_entry_size = _data_->_tmp24_;
										_data_->_entry_index = -1;
										while (TRUE) {
											_data_->_entry_index = _data_->_entry_index + 1;
											_data_->_tmp25_ = _data_->_entry_index;
											_data_->_tmp26_ = _data_->_entry_size;
											if (!(_data_->_tmp25_ < _data_->_tmp26_)) {
												break;
											}
											_data_->_tmp27_ = _data_->_entry_list;
											_data_->_tmp28_ = gee_list_get (_data_->_tmp27_, _data_->_entry_index);
											_data_->entry = (ProtonPlusModelsInstalledToolEntry*) _data_->_tmp28_;
											_data_->_tmp30_ = _data_->entry;
											_data_->_tmp31_ = _data_->runner;
											if (proton_plus_services_installation_service_is_latest_installation (_data_->self, _data_->_tmp30_, _data_->_tmp31_)) {
												_data_->_tmp29_ = TRUE;
											} else {
												_data_->_tmp32_ = _data_->entry;
												_data_->_tmp33_ = _data_->runner;
												_data_->_tmp29_ = proton_plus_services_installation_service_is_legacy_latest_backup (_data_->self, _data_->_tmp32_, _data_->_tmp33_);
											}
											if (_data_->_tmp29_) {
												_data_->has_latest = TRUE;
												_g_object_unref0 (_data_->entry);
												break;
											}
											_g_object_unref0 (_data_->entry);
										}
									}
									if (!_data_->has_latest) {
										_g_object_unref0 (_data_->runner);
										_g_object_unref0 (_data_->tool);
										continue;
									}
									_data_->_tmp34_ = _data_->processed_tool_targets;
									_data_->_tmp35_ = _data_->runner;
									_data_->_tmp36_ = proton_plus_models_tool_get_id ((ProtonPlusModelsTool*) _data_->_tmp35_);
									_data_->_tmp37_ = _data_->_tmp36_;
									if (!gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp34_, _data_->_tmp37_)) {
										_g_object_unref0 (_data_->runner);
										_g_object_unref0 (_data_->tool);
										continue;
									}
									_data_->_tmp38_ = _data_->runner;
									_data_->_state_ = 1;
									proton_plus_services_installation_service_update_specific_runner (_data_->self, _data_->_tmp38_, proton_plus_services_installation_service_check_for_updates_ready, _data_);
									return FALSE;
									_state_1:
									_data_->code = proton_plus_services_installation_service_update_specific_runner_finish (_data_->self, _data_->_res_);
									if (_data_->code == PROTON_PLUS_RETURN_CODE_RUNNER_UPDATED) {
										_data_->_tmp39_ = _data_->updated;
										_data_->updated = _data_->_tmp39_ + 1;
									} else {
										if (_data_->code != PROTON_PLUS_RETURN_CODE_NOTHING_TO_UPDATE) {
											_data_->_tmp40_ = _data_->code != PROTON_PLUS_RETURN_CODE_INCOMPATIBLE_VARIANT;
										} else {
											_data_->_tmp40_ = FALSE;
										}
										if (_data_->_tmp40_) {
											_data_->result = _data_->code;
											_g_object_unref0 (_data_->runner);
											_g_object_unref0 (_data_->tool);
											_g_object_unref0 (_data_->entries);
											_g_object_unref0 (_data_->group);
											_g_object_unref0 (_data_->launcher);
											_g_object_unref0 (_data_->processed_tool_targets);
											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;
										}
									}
									_g_object_unref0 (_data_->runner);
									_g_object_unref0 (_data_->tool);
								}
							}
							_g_object_unref0 (_data_->entries);
							_g_object_unref0 (_data_->group);
						}
					}
				}
				_g_object_unref0 (_data_->launcher);
			}
		}
	}
	if (_data_->updated > 0) {
		_data_->_tmp41_ = PROTON_PLUS_RETURN_CODE_RUNNERS_UPDATED;
	} else {
		_data_->_tmp41_ = PROTON_PLUS_RETURN_CODE_NOTHING_TO_UPDATE;
	}
	_data_->result = _data_->_tmp41_;
	_g_object_unref0 (_data_->processed_tool_targets);
	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 gboolean
proton_plus_services_installation_service_is_latest_installation (ProtonPlusServicesInstallationService* self,
                                                                  ProtonPlusModelsInstalledToolEntry* entry,
                                                                  ProtonPlusModelsToolsProviderTool* runner)
{
	gchar* latest = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	g_return_val_if_fail (runner != NULL, FALSE);
	_tmp0_ = proton_plus_models_tool_get_title ((ProtonPlusModelsTool*) runner);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup_printf ("%s Latest", _tmp1_);
	latest = _tmp2_;
	_tmp4_ = proton_plus_models_installed_tool_entry_get_directory_name (entry);
	_tmp5_ = _tmp4_;
	_tmp6_ = latest;
	if (g_strcmp0 (_tmp5_, _tmp6_) != 0) {
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp7_ = proton_plus_models_installed_tool_entry_get_directory_name (entry);
		_tmp8_ = _tmp7_;
		_tmp9_ = latest;
		_tmp10_ = g_strdup_printf ("%s-", _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp3_ = !g_str_has_prefix (_tmp8_, _tmp11_);
		_g_free0 (_tmp11_);
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		result = FALSE;
		_g_free0 (latest);
		return result;
	}
	result = proton_plus_services_installation_service_installation_identity_matches_runner (self, entry, runner);
	_g_free0 (latest);
	return result;
}

static gboolean
proton_plus_services_installation_service_is_legacy_latest_backup (ProtonPlusServicesInstallationService* self,
                                                                   ProtonPlusModelsInstalledToolEntry* entry,
                                                                   ProtonPlusModelsToolsProviderTool* runner)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	g_return_val_if_fail (runner != NULL, FALSE);
	_tmp0_ = proton_plus_models_installed_tool_entry_get_directory_name (entry);
	_tmp1_ = _tmp0_;
	_tmp2_ = proton_plus_models_tool_get_title ((ProtonPlusModelsTool*) runner);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup_printf ("%s Latest Backup", _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strcmp0 (_tmp1_, _tmp5_) != 0;
	_g_free0 (_tmp5_);
	if (_tmp6_) {
		result = FALSE;
		return result;
	}
	result = proton_plus_services_installation_service_installation_identity_matches_runner (self, entry, runner);
	return result;
}

static gboolean
proton_plus_services_installation_service_installation_identity_matches_runner (ProtonPlusServicesInstallationService* self,
                                                                                ProtonPlusModelsInstalledToolEntry* entry,
                                                                                ProtonPlusModelsToolsProviderTool* runner)
{
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp7_ = FALSE;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gboolean _tmp14_ = FALSE;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (entry != NULL, FALSE);
	g_return_val_if_fail (runner != NULL, FALSE);
	_tmp1_ = proton_plus_models_installed_tool_entry_get_tool_id (entry);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, "") != 0) {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp3_ = proton_plus_models_installed_tool_entry_get_tool_id (entry);
		_tmp4_ = _tmp3_;
		_tmp5_ = proton_plus_models_tool_get_id ((ProtonPlusModelsTool*) runner);
		_tmp6_ = _tmp5_;
		_tmp0_ = g_strcmp0 (_tmp4_, _tmp6_) != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp8_ = proton_plus_models_installed_tool_entry_get_provider_id (entry);
	_tmp9_ = _tmp8_;
	if (g_strcmp0 (_tmp9_, "") != 0) {
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		_tmp10_ = proton_plus_models_installed_tool_entry_get_provider_id (entry);
		_tmp11_ = _tmp10_;
		_tmp12_ = proton_plus_models_tool_get_provider_id ((ProtonPlusModelsTool*) runner);
		_tmp13_ = _tmp12_;
		_tmp7_ = g_strcmp0 (_tmp11_, _tmp13_) != 0;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		result = FALSE;
		return result;
	}
	_tmp15_ = proton_plus_models_installed_tool_entry_get_launcher_id (entry);
	_tmp16_ = _tmp15_;
	if (g_strcmp0 (_tmp16_, "") == 0) {
		_tmp14_ = TRUE;
	} else {
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		ProtonPlusModelsGroup* _tmp19_;
		ProtonPlusModelsGroup* _tmp20_;
		ProtonPlusModelsLauncher* _tmp21_;
		ProtonPlusModelsLauncher* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		_tmp17_ = proton_plus_models_installed_tool_entry_get_launcher_id (entry);
		_tmp18_ = _tmp17_;
		_tmp19_ = proton_plus_models_tool_get_group ((ProtonPlusModelsTool*) runner);
		_tmp20_ = _tmp19_;
		_tmp21_ = proton_plus_models_group_get_launcher (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = proton_plus_models_launcher_get_tool_target_id (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp14_ = g_strcmp0 (_tmp18_, _tmp24_) == 0;
	}
	result = _tmp14_;
	return result;
}

static void
proton_plus_services_installation_service_start_install_data_free (gpointer _data)
{
	ProtonPlusServicesInstallationServiceStartInstallData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesInstallationServiceStartInstallData, _data_);
}

static void
proton_plus_services_installation_service_start_install (ProtonPlusServicesInstallationService* self,
                                                         ProtonPlusServicesInstallJob* job,
                                                         gboolean replace_existing,
                                                         gboolean record_change,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceStartInstallData* _data_;
	ProtonPlusServicesInstallationService* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesInstallationServiceStartInstallData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_installation_service_start_install_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	_data_->replace_existing = replace_existing;
	_data_->record_change = record_change;
	proton_plus_services_installation_service_start_install_co (_data_);
}

static ProtonPlusReturnCode
proton_plus_services_installation_service_start_install_finish (ProtonPlusServicesInstallationService* self,
                                                                GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesInstallationServiceStartInstallData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_installation_service_start_install_ready (GObject* source_object,
                                                               GAsyncResult* _res_,
                                                               gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceStartInstallData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_installation_service_start_install_co (_data_);
}

static gboolean
proton_plus_services_installation_service_start_install_co (ProtonPlusServicesInstallationServiceStartInstallData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = FALSE;
	_data_->_tmp1_ = proton_plus_services_installation_service_resolve_provider_install_variant (_data_->self, _data_->job, &_data_->_tmp0_);
	_data_->missing_explicit_selection = _data_->_tmp0_;
	_data_->compatibility = _data_->_tmp1_;
	if (_data_->compatibility != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
		_data_->result = _data_->compatibility;
		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_ = proton_plus_services_installation_service_select_workflow (_data_->self, _data_->job);
	_data_->workflow = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->workflow;
	_data_->validation = proton_plus_services_installation_workflow_validate_install (_data_->_tmp3_, _data_->job, _data_->replace_existing);
	if (_data_->validation != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
		_data_->result = _data_->validation;
		_g_object_unref0 (_data_->workflow);
		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_->_tmp4_ = _data_->workflow;
	_data_->_state_ = 1;
	proton_plus_services_installation_service_execute_install (_data_->self, _data_->job, _data_->_tmp4_, _data_->replace_existing, _data_->record_change, proton_plus_services_installation_service_start_install_ready, _data_);
	return FALSE;
	_state_1:
	_data_->result = proton_plus_services_installation_service_execute_install_finish (_data_->self, _data_->_res_);
	_g_object_unref0 (_data_->workflow);
	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;
}

ProtonPlusReturnCode
proton_plus_services_installation_service_resolve_provider_install_variant (ProtonPlusServicesInstallationService* self,
                                                                            ProtonPlusServicesInstallJob* job,
                                                                            gboolean* missing_explicit_selection)
{
	gboolean _vala_missing_explicit_selection = FALSE;
	gboolean _tmp0_ = FALSE;
	ProtonPlusModelsTool* _tmp1_;
	ProtonPlusModelsTool* _tmp2_;
	ProtonPlusModelsInstallationVariantResolution* resolution = NULL;
	ProtonPlusModelsRelease* _tmp5_;
	ProtonPlusModelsRelease* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	ProtonPlusModelsCpuCapabilities* _tmp11_;
	ProtonPlusModelsInstallationVariantResolution* _tmp12_;
	ProtonPlusModelsInstallationVariantResolution* _tmp13_;
	ProtonPlusModelsVariant* _tmp14_;
	ProtonPlusModelsVariant* _tmp15_;
	ProtonPlusModelsToolsProviderTool* provider_tool = NULL;
	ProtonPlusModelsTool* _tmp23_;
	ProtonPlusModelsTool* _tmp24_;
	ProtonPlusModelsToolsProviderTool* _tmp25_;
	ProtonPlusModelsToolsProviderTool* _tmp26_;
	ProtonPlusModelsInstallationVariantResolution* _tmp27_;
	ProtonPlusModelsVariant* _tmp28_;
	ProtonPlusModelsVariant* _tmp29_;
	ProtonPlusModelsCpuCapabilities* _tmp30_;
	ProtonPlusModelsInstallationVariantResolution* _tmp31_;
	ProtonPlusModelsVariant* _tmp32_;
	ProtonPlusModelsVariant* _tmp33_;
	ProtonPlusReturnCode result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (job != NULL, 0);
	_vala_missing_explicit_selection = FALSE;
	_tmp1_ = proton_plus_services_install_job_get_tool (job);
	_tmp2_ = _tmp1_;
	if (!PROTON_PLUS_MODELS_TOOLS_IS_PROVIDER_TOOL (_tmp2_)) {
		_tmp0_ = TRUE;
	} else {
		ProtonPlusServicesSteamTinkerLaunchContext* _tmp3_;
		ProtonPlusServicesSteamTinkerLaunchContext* _tmp4_;
		_tmp3_ = proton_plus_services_install_job_get_steam_tinker_launch_context (job);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ != NULL;
	}
	if (_tmp0_) {
		result = PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED;
		if (missing_explicit_selection) {
			*missing_explicit_selection = _vala_missing_explicit_selection;
		}
		return result;
	}
	_tmp5_ = proton_plus_services_install_job_get_release (job);
	_tmp6_ = _tmp5_;
	_tmp7_ = proton_plus_services_install_job_get_selected_variant_id (job);
	_tmp8_ = _tmp7_;
	_tmp9_ = proton_plus_services_install_job_get_selected_variant_name (job);
	_tmp10_ = _tmp9_;
	_tmp11_ = proton_plus_globals_CPU_CAPABILITIES;
	_tmp12_ = proton_plus_models_variant_selector_resolve_installation_variant (_tmp6_, _tmp8_, _tmp10_, _tmp11_);
	resolution = _tmp12_;
	_tmp13_ = resolution;
	_tmp14_ = proton_plus_models_installation_variant_resolution_get_variant (_tmp13_);
	_tmp15_ = _tmp14_;
	if (_tmp15_ == NULL) {
		gboolean _tmp16_ = FALSE;
		ProtonPlusModelsInstallationVariantResolution* _tmp17_;
		gboolean _tmp18_;
		gboolean _tmp19_;
		_tmp17_ = resolution;
		_tmp18_ = proton_plus_models_installation_variant_resolution_get_has_explicit_selection (_tmp17_);
		_tmp19_ = _tmp18_;
		if (_tmp19_) {
			ProtonPlusModelsInstallationVariantResolution* _tmp20_;
			ProtonPlusModelsVariant* _tmp21_;
			ProtonPlusModelsVariant* _tmp22_;
			_tmp20_ = resolution;
			_tmp21_ = proton_plus_models_installation_variant_resolution_get_matching_variant (_tmp20_);
			_tmp22_ = _tmp21_;
			_tmp16_ = _tmp22_ == NULL;
		} else {
			_tmp16_ = FALSE;
		}
		_vala_missing_explicit_selection = _tmp16_;
		result = PROTON_PLUS_RETURN_CODE_INCOMPATIBLE_VARIANT;
		_g_object_unref0 (resolution);
		if (missing_explicit_selection) {
			*missing_explicit_selection = _vala_missing_explicit_selection;
		}
		return result;
	}
	_tmp23_ = proton_plus_services_install_job_get_tool (job);
	_tmp24_ = _tmp23_;
	_tmp25_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, PROTON_PLUS_MODELS_TOOLS_TYPE_PROVIDER_TOOL, ProtonPlusModelsToolsProviderTool));
	provider_tool = _tmp25_;
	_tmp26_ = provider_tool;
	_tmp27_ = resolution;
	_tmp28_ = proton_plus_models_installation_variant_resolution_get_variant (_tmp27_);
	_tmp29_ = _tmp28_;
	_tmp30_ = proton_plus_globals_CPU_CAPABILITIES;
	if (!proton_plus_services_installation_service_configured_variant_is_compatible (self, _tmp26_, G_TYPE_CHECK_INSTANCE_CAST (_tmp29_, PROTON_PLUS_MODELS_TYPE_VARIANT, ProtonPlusModelsVariant), _tmp30_)) {
		result = PROTON_PLUS_RETURN_CODE_INCOMPATIBLE_VARIANT;
		_g_object_unref0 (provider_tool);
		_g_object_unref0 (resolution);
		if (missing_explicit_selection) {
			*missing_explicit_selection = _vala_missing_explicit_selection;
		}
		return result;
	}
	_tmp31_ = resolution;
	_tmp32_ = proton_plus_models_installation_variant_resolution_get_variant (_tmp31_);
	_tmp33_ = _tmp32_;
	proton_plus_services_install_job_apply_selected_release_variant (job, G_TYPE_CHECK_INSTANCE_CAST (_tmp33_, PROTON_PLUS_MODELS_TYPE_VARIANT, ProtonPlusModelsVariant));
	result = PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED;
	_g_object_unref0 (provider_tool);
	_g_object_unref0 (resolution);
	if (missing_explicit_selection) {
		*missing_explicit_selection = _vala_missing_explicit_selection;
	}
	return result;
}

static gboolean
proton_plus_services_installation_service_configured_variant_is_compatible (ProtonPlusServicesInstallationService* self,
                                                                            ProtonPlusModelsToolsProviderTool* tool,
                                                                            ProtonPlusModelsVariant* release_variant,
                                                                            ProtonPlusModelsCpuCapabilities* capabilities)
{
	ProtonPlusModelsVariant* matching_name = NULL;
	gboolean _tmp24_ = FALSE;
	ProtonPlusModelsVariant* _tmp25_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (tool != NULL, FALSE);
	g_return_val_if_fail (release_variant != NULL, FALSE);
	g_return_val_if_fail (capabilities != NULL, FALSE);
	matching_name = NULL;
	{
		GeeLinkedList* _configured_variant_list = NULL;
		GeeLinkedList* _tmp0_;
		GeeLinkedList* _tmp1_;
		gint _configured_variant_size = 0;
		GeeLinkedList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _configured_variant_index = 0;
		_tmp0_ = proton_plus_models_tools_provider_tool_get_variants (tool);
		_tmp1_ = _tmp0_;
		_configured_variant_list = _tmp1_;
		_tmp2_ = _configured_variant_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_configured_variant_size = _tmp4_;
		_configured_variant_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			ProtonPlusModelsVariant* configured_variant = NULL;
			GeeLinkedList* _tmp7_;
			gpointer _tmp8_;
			ProtonPlusModelsVariant* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			gboolean _tmp15_ = FALSE;
			ProtonPlusModelsVariant* _tmp16_;
			_configured_variant_index = _configured_variant_index + 1;
			_tmp5_ = _configured_variant_index;
			_tmp6_ = _configured_variant_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _configured_variant_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _configured_variant_index);
			configured_variant = (ProtonPlusModelsVariant*) _tmp8_;
			_tmp9_ = configured_variant;
			_tmp10_ = proton_plus_models_variant_get_id (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = proton_plus_models_variant_get_id (release_variant);
			_tmp13_ = _tmp12_;
			if (g_strcmp0 (_tmp11_, _tmp13_) == 0) {
				ProtonPlusModelsVariant* _tmp14_;
				_tmp14_ = configured_variant;
				result = proton_plus_models_variant_is_compatible_with (_tmp14_, capabilities);
				_g_object_unref0 (configured_variant);
				_g_object_unref0 (matching_name);
				return result;
			}
			_tmp16_ = matching_name;
			if (_tmp16_ == NULL) {
				ProtonPlusModelsVariant* _tmp17_;
				const gchar* _tmp18_;
				const gchar* _tmp19_;
				const gchar* _tmp20_;
				const gchar* _tmp21_;
				_tmp17_ = configured_variant;
				_tmp18_ = proton_plus_models_variant_get_name (_tmp17_);
				_tmp19_ = _tmp18_;
				_tmp20_ = proton_plus_models_variant_get_name (release_variant);
				_tmp21_ = _tmp20_;
				_tmp15_ = g_strcmp0 (_tmp19_, _tmp21_) == 0;
			} else {
				_tmp15_ = FALSE;
			}
			if (_tmp15_) {
				ProtonPlusModelsVariant* _tmp22_;
				ProtonPlusModelsVariant* _tmp23_;
				_tmp22_ = configured_variant;
				_tmp23_ = _g_object_ref0 (_tmp22_);
				_g_object_unref0 (matching_name);
				matching_name = _tmp23_;
			}
			_g_object_unref0 (configured_variant);
		}
	}
	_tmp25_ = matching_name;
	if (_tmp25_ == NULL) {
		_tmp24_ = TRUE;
	} else {
		ProtonPlusModelsVariant* _tmp26_;
		_tmp26_ = matching_name;
		_tmp24_ = proton_plus_models_variant_is_compatible_with (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, PROTON_PLUS_MODELS_TYPE_VARIANT, ProtonPlusModelsVariant), capabilities);
	}
	result = _tmp24_;
	_g_object_unref0 (matching_name);
	return result;
}

static void
proton_plus_services_installation_service_execute_install_data_free (gpointer _data)
{
	ProtonPlusServicesInstallationServiceExecuteInstallData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->workflow);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesInstallationServiceExecuteInstallData, _data_);
}

static void
proton_plus_services_installation_service_execute_install (ProtonPlusServicesInstallationService* self,
                                                           ProtonPlusServicesInstallJob* job,
                                                           ProtonPlusServicesInstallationWorkflow* workflow,
                                                           gboolean replace_existing,
                                                           gboolean record_change,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceExecuteInstallData* _data_;
	ProtonPlusServicesInstallationService* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	ProtonPlusServicesInstallationWorkflow* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	g_return_if_fail (workflow != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesInstallationServiceExecuteInstallData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_installation_service_execute_install_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	_tmp2_ = _g_object_ref0 (workflow);
	_g_object_unref0 (_data_->workflow);
	_data_->workflow = _tmp2_;
	_data_->replace_existing = replace_existing;
	_data_->record_change = record_change;
	proton_plus_services_installation_service_execute_install_co (_data_);
}

static ProtonPlusReturnCode
proton_plus_services_installation_service_execute_install_finish (ProtonPlusServicesInstallationService* self,
                                                                  GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesInstallationServiceExecuteInstallData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_installation_service_execute_install_ready (GObject* source_object,
                                                                 GAsyncResult* _res_,
                                                                 gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceExecuteInstallData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_installation_service_execute_install_co (_data_);
}

static gboolean
proton_plus_services_installation_service_execute_install_co (ProtonPlusServicesInstallationServiceExecuteInstallData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->operation_kind = proton_plus_services_installation_service_updating_operation_kind (_data_->self, _data_->job, _data_->replace_existing);
	_data_->_tmp0_ = proton_plus_services_installation_service_process_operation_context (_data_->self, _data_->job, _data_->operation_kind, proton_plus_services_installation_service_mutates_existing_destination (_data_->self, _data_->job, _data_->workflow, _data_->replace_existing));
	_data_->operation_context = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->self->priv->compatibility_process_guard;
	_data_->_tmp2_ = _data_->operation_context;
	_data_->_state_ = 1;
	proton_plus_services_compatibility_process_guard_inspect (_data_->_tmp1_, _data_->_tmp2_, proton_plus_services_installation_service_execute_install_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = proton_plus_services_compatibility_process_guard_inspect_finish (_data_->_tmp1_, _data_->_res_);
	_data_->inspection = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->inspection;
	_data_->_tmp5_ = _data_->operation_context;
	_data_->guard_code = proton_plus_services_installation_service_process_inspection_return_code (_data_->self, _data_->_tmp4_, _data_->_tmp5_);
	if (_data_->guard_code != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
		_data_->_tmp6_ = _data_->inspection;
		proton_plus_services_installation_service_report_process_inspection_result (_data_->self, _data_->_tmp6_, FALSE);
		_data_->result = _data_->guard_code;
		_g_object_unref0 (_data_->inspection);
		_g_object_unref0 (_data_->operation_context);
		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_->_tmp7_ = proton_plus_services_install_job_get_state (_data_->job);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->updating = _data_->_tmp8_ == PROTON_PLUS_SERVICES_INSTALL_JOB_STATE_BUSY_UPDATING;
	proton_plus_services_install_job_begin_operation (_data_->job);
	if (!_data_->updating) {
		proton_plus_services_install_job_set_state (_data_->job, PROTON_PLUS_SERVICES_INSTALL_JOB_STATE_BUSY_INSTALLING);
	}
	_data_->_tmp9_ = proton_plus_utils_download_manager_get_instance ();
	_data_->_tmp10_ = _data_->_tmp9_;
	proton_plus_utils_download_manager_add_download (_data_->_tmp10_, _data_->job);
	_data_->_state_ = 2;
	proton_plus_utils_cache_manager_begin_cache_operation (proton_plus_services_installation_service_execute_install_ready, _data_);
	return FALSE;
	_state_2:
	proton_plus_utils_cache_manager_begin_cache_operation_finish (_data_->_res_);
	_data_->_state_ = 3;
	proton_plus_services_installation_workflow_install (_data_->workflow, _data_->job, _data_->replace_existing, proton_plus_services_installation_service_execute_install_ready, _data_);
	return FALSE;
	_state_3:
	_data_->code = proton_plus_services_installation_workflow_install_finish (_data_->workflow, _data_->_res_);
	proton_plus_utils_cache_manager_end_cache_operation ();
	_data_->_tmp11_ = proton_plus_services_install_job_get_tool (_data_->job);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = proton_plus_models_tool_get_group (_data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	proton_plus_models_group_invalidate_installed_state (_data_->_tmp14_);
	_data_->success = _data_->code == PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED;
	proton_plus_services_install_job_set_is_finished (_data_->job, TRUE);
	proton_plus_services_install_job_set_install_success (_data_->job, _data_->success);
	if (_data_->success) {
		proton_plus_services_installation_workflow_finalize_install_success (_data_->workflow, _data_->job);
	}
	_data_->_tmp15_ = proton_plus_utils_download_manager_get_instance ();
	_data_->_tmp16_ = _data_->_tmp15_;
	proton_plus_utils_download_manager_remove_download (_data_->_tmp16_, _data_->job);
	if (_data_->code != PROTON_PLUS_RETURN_CODE_RUNNERS_IN_USE) {
		_data_->_tmp17_ = _data_->code != PROTON_PLUS_RETURN_CODE_PROCESS_INSPECTION_FAILED;
	} else {
		_data_->_tmp17_ = FALSE;
	}
	if (_data_->_tmp17_) {
		_data_->_tmp18_ = proton_plus_utils_download_manager_get_instance ();
		_data_->_tmp19_ = _data_->_tmp18_;
		proton_plus_utils_download_manager_add_to_history (_data_->_tmp19_, _data_->job, _data_->success);
	}
	if (!_data_->updating) {
		proton_plus_services_install_job_finish_operation (_data_->job);
	}
	if (_data_->success) {
		_data_->_tmp20_ = _data_->record_change;
	} else {
		_data_->_tmp20_ = FALSE;
	}
	if (_data_->_tmp20_) {
		_data_->_tmp22_ = proton_plus_services_install_job_get_steam_tinker_launch_context (_data_->job);
		_data_->_tmp23_ = _data_->_tmp22_;
		if (_data_->_tmp23_ != NULL) {
			_data_->_tmp21_ = PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_STEAMTINKERLAUNCH_CHANGED;
		} else {
			if (_data_->replace_existing) {
				_data_->_tmp24_ = PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_COMPATIBILITY_TOOL_UPDATED_OR_REPLACED;
			} else {
				_data_->_tmp24_ = PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_COMPATIBILITY_TOOL_INSTALLED;
			}
			_data_->_tmp21_ = _data_->_tmp24_;
		}
		proton_plus_services_installation_service_record_successful_change (_data_->self, _data_->job, _data_->_tmp21_);
	}
	_data_->result = _data_->code;
	_g_object_unref0 (_data_->inspection);
	_g_object_unref0 (_data_->operation_context);
	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 void
proton_plus_services_installation_service_check_final_process_state_data_free (gpointer _data)
{
	ProtonPlusServicesInstallationServiceCheckFinalProcessStateData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->job);
	_g_object_unref0 (_data_->self);
	g_slice_free (ProtonPlusServicesInstallationServiceCheckFinalProcessStateData, _data_);
}

void
proton_plus_services_installation_service_check_final_process_state (ProtonPlusServicesInstallationService* self,
                                                                     ProtonPlusServicesInstallJob* job,
                                                                     ProtonPlusServicesCompatibilityProcessOperationKind operation_kind,
                                                                     gboolean mutates_existing_destination,
                                                                     GAsyncReadyCallback _callback_,
                                                                     gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceCheckFinalProcessStateData* _data_;
	ProtonPlusServicesInstallationService* _tmp0_;
	ProtonPlusServicesInstallJob* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	_data_ = g_slice_new0 (ProtonPlusServicesInstallationServiceCheckFinalProcessStateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_services_installation_service_check_final_process_state_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (job);
	_g_object_unref0 (_data_->job);
	_data_->job = _tmp1_;
	_data_->operation_kind = operation_kind;
	_data_->mutates_existing_destination = mutates_existing_destination;
	proton_plus_services_installation_service_check_final_process_state_co (_data_);
}

ProtonPlusReturnCode
proton_plus_services_installation_service_check_final_process_state_finish (ProtonPlusServicesInstallationService* self,
                                                                            GAsyncResult* _res_)
{
	ProtonPlusReturnCode result;
	ProtonPlusServicesInstallationServiceCheckFinalProcessStateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_services_installation_service_check_final_process_state_ready (GObject* source_object,
                                                                           GAsyncResult* _res_,
                                                                           gpointer _user_data_)
{
	ProtonPlusServicesInstallationServiceCheckFinalProcessStateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_services_installation_service_check_final_process_state_co (_data_);
}

static gboolean
proton_plus_services_installation_service_check_final_process_state_co (ProtonPlusServicesInstallationServiceCheckFinalProcessStateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = proton_plus_services_installation_service_process_operation_context (_data_->self, _data_->job, _data_->operation_kind, _data_->mutates_existing_destination);
	_data_->context = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->self->priv->compatibility_process_guard;
	_data_->_tmp2_ = _data_->context;
	_data_->_state_ = 1;
	proton_plus_services_compatibility_process_guard_inspect (_data_->_tmp1_, _data_->_tmp2_, proton_plus_services_installation_service_check_final_process_state_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = proton_plus_services_compatibility_process_guard_inspect_finish (_data_->_tmp1_, _data_->_res_);
	_data_->inspection = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->inspection;
	_data_->_tmp5_ = _data_->context;
	_data_->code = proton_plus_services_installation_service_process_inspection_return_code (_data_->self, _data_->_tmp4_, _data_->_tmp5_);
	if (_data_->code != PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED) {
		_data_->_tmp6_ = _data_->inspection;
		proton_plus_services_installation_service_report_process_inspection_result (_data_->self, _data_->_tmp6_, FALSE);
	}
	_data_->result = _data_->code;
	_g_object_unref0 (_data_->inspection);
	_g_object_unref0 (_data_->context);
	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 ProtonPlusReturnCode
proton_plus_services_installation_service_process_inspection_return_code (ProtonPlusServicesInstallationService* self,
                                                                          ProtonPlusServicesCompatibilityProcessInspectionResult* inspection,
                                                                          ProtonPlusServicesCompatibilityProcessOperationContext* context)
{
	ProtonPlusServicesCompatibilityProcessInspectionStatus _tmp0_;
	ProtonPlusServicesCompatibilityProcessInspectionStatus _tmp1_;
	ProtonPlusReturnCode result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (inspection != NULL, 0);
	g_return_val_if_fail (context != NULL, 0);
	_tmp0_ = proton_plus_services_compatibility_process_inspection_result_get_status (inspection);
	_tmp1_ = _tmp0_;
	switch (_tmp1_) {
		case PROTON_PLUS_SERVICES_COMPATIBILITY_PROCESS_INSPECTION_STATUS_ACTIVE:
		{
			result = PROTON_PLUS_RETURN_CODE_RUNNERS_IN_USE;
			return result;
		}
		case PROTON_PLUS_SERVICES_COMPATIBILITY_PROCESS_INSPECTION_STATUS_UNKNOWN:
		{
			ProtonPlusReturnCode _tmp2_ = 0;
			gboolean _tmp3_;
			gboolean _tmp4_;
			_tmp3_ = proton_plus_services_compatibility_process_operation_context_get_mutates_existing_destination (context);
			_tmp4_ = _tmp3_;
			if (_tmp4_) {
				_tmp2_ = PROTON_PLUS_RETURN_CODE_PROCESS_INSPECTION_FAILED;
			} else {
				_tmp2_ = PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED;
			}
			result = _tmp2_;
			return result;
		}
		default:
		{
			result = PROTON_PLUS_RETURN_CODE_RUNNER_INSTALLED;
			return result;
		}
	}
}

static gboolean
proton_plus_services_installation_service_mutates_existing_destination (ProtonPlusServicesInstallationService* self,
                                                                        ProtonPlusServicesInstallJob* job,
                                                                        ProtonPlusServicesInstallationWorkflow* workflow,
                                                                        gboolean replace_existing)
{
	ProtonPlusServicesStandardArchiveWorkflow* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (job != NULL, FALSE);
	g_return_val_if_fail (workflow != NULL, FALSE);
	_tmp0_ = self->priv->standard_archive_workflow;
	if (workflow != G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, PROTON_PLUS_SERVICES_TYPE_INSTALLATION_WORKFLOW, ProtonPlusServicesInstallationWorkflow)) {
		result = TRUE;
		return result;
	}
	if (replace_existing) {
		gboolean _tmp2_ = FALSE;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		_tmp3_ = proton_plus_services_install_job_get_install_location (job);
		_tmp4_ = _tmp3_;
		if (g_file_test (_tmp4_, G_FILE_TEST_EXISTS)) {
			_tmp2_ = TRUE;
		} else {
			const gchar* _tmp5_;
			const gchar* _tmp6_;
			_tmp5_ = proton_plus_services_install_job_get_install_location (job);
			_tmp6_ = _tmp5_;
			_tmp2_ = g_file_test (_tmp6_, G_FILE_TEST_IS_SYMLINK);
		}
		_tmp1_ = _tmp2_;
	} else {
		_tmp1_ = FALSE;
	}
	result = _tmp1_;
	return result;
}

static ProtonPlusServicesCompatibilityProcessOperationKind
proton_plus_services_installation_service_updating_operation_kind (ProtonPlusServicesInstallationService* self,
                                                                   ProtonPlusServicesInstallJob* job,
                                                                   gboolean replace_existing)
{
	ProtonPlusServicesInstallJobState _tmp0_;
	ProtonPlusServicesInstallJobState _tmp1_;
	ProtonPlusServicesCompatibilityProcessOperationKind _tmp2_ = 0;
	ProtonPlusServicesCompatibilityProcessOperationKind result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (job != NULL, 0);
	_tmp0_ = proton_plus_services_install_job_get_state (job);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == PROTON_PLUS_SERVICES_INSTALL_JOB_STATE_BUSY_UPDATING) {
		result = PROTON_PLUS_SERVICES_COMPATIBILITY_PROCESS_OPERATION_KIND_UPDATE;
		return result;
	}
	if (replace_existing) {
		_tmp2_ = PROTON_PLUS_SERVICES_COMPATIBILITY_PROCESS_OPERATION_KIND_REPLACEMENT;
	} else {
		_tmp2_ = PROTON_PLUS_SERVICES_COMPATIBILITY_PROCESS_OPERATION_KIND_INSTALL;
	}
	result = _tmp2_;
	return result;
}

static ProtonPlusServicesCompatibilityProcessOperationContext*
proton_plus_services_installation_service_process_operation_context (ProtonPlusServicesInstallationService* self,
                                                                     ProtonPlusServicesInstallJob* job,
                                                                     ProtonPlusServicesCompatibilityProcessOperationKind operation_kind,
                                                                     gboolean mutates_existing_destination)
{
	ProtonPlusModelsLauncher* launcher = NULL;
	ProtonPlusModelsTool* _tmp0_;
	ProtonPlusModelsTool* _tmp1_;
	ProtonPlusModelsGroup* _tmp2_;
	ProtonPlusModelsGroup* _tmp3_;
	ProtonPlusModelsLauncher* _tmp4_;
	ProtonPlusModelsLauncher* _tmp5_;
	ProtonPlusModelsLauncher* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	ProtonPlusServicesCompatibilityProcessOperationContext* _tmp17_;
	ProtonPlusServicesCompatibilityProcessOperationContext* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (job != NULL, NULL);
	_tmp0_ = proton_plus_services_install_job_get_tool (job);
	_tmp1_ = _tmp0_;
	_tmp2_ = proton_plus_models_tool_get_group (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = proton_plus_models_group_get_launcher (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	launcher = _tmp6_;
	_tmp7_ = proton_plus_services_install_job_get_install_location (job);
	_tmp8_ = _tmp7_;
	_tmp9_ = proton_plus_models_launcher_get_family_id (launcher);
	_tmp10_ = _tmp9_;
	_tmp11_ = proton_plus_models_launcher_get_instance_id (launcher);
	_tmp12_ = _tmp11_;
	_tmp13_ = proton_plus_models_launcher_get_tool_target_family_id (launcher);
	_tmp14_ = _tmp13_;
	_tmp15_ = proton_plus_models_launcher_get_tool_target_id (launcher);
	_tmp16_ = _tmp15_;
	_tmp17_ = proton_plus_services_compatibility_process_operation_context_new (operation_kind, _tmp8_, _tmp10_, _tmp12_, _tmp14_, _tmp16_, mutates_existing_destination);
	result = _tmp17_;
	_g_object_unref0 (launcher);
	return result;
}

static void
proton_plus_services_installation_service_report_process_inspection_result (ProtonPlusServicesInstallationService* self,
                                                                            ProtonPlusServicesCompatibilityProcessInspectionResult* inspection,
                                                                            gboolean continuing)
{
	gboolean _tmp0_ = FALSE;
	ProtonPlusServicesCompatibilityProcessInspectionStatus _tmp1_;
	ProtonPlusServicesCompatibilityProcessInspectionStatus _tmp2_;
	ProtonPlusServicesCompatibilityProcessInspectionStatus _tmp19_;
	ProtonPlusServicesCompatibilityProcessInspectionStatus _tmp20_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (inspection != NULL);
	_tmp1_ = proton_plus_services_compatibility_process_inspection_result_get_status (inspection);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == PROTON_PLUS_SERVICES_COMPATIBILITY_PROCESS_INSPECTION_STATUS_ACTIVE) {
		ProtonPlusServicesCompatibilityProcessRecord* _tmp3_;
		ProtonPlusServicesCompatibilityProcessRecord* _tmp4_;
		_tmp3_ = proton_plus_services_compatibility_process_inspection_result_get_blocker (inspection);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ProtonPlusServicesCompatibilityProcessRecord* blocker = NULL;
		ProtonPlusServicesCompatibilityProcessRecord* _tmp5_;
		ProtonPlusServicesCompatibilityProcessRecord* _tmp6_;
		ProtonPlusServicesCompatibilityProcessRecord* _tmp7_;
		ProtonPlusServicesCompatibilityProcessRecord* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		ProtonPlusServicesCompatibilityProcessRecord* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		ProtonPlusServicesCompatibilityProcessMatchReason _tmp14_;
		ProtonPlusServicesCompatibilityProcessMatchReason _tmp15_;
		GEnumValue* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		_tmp5_ = proton_plus_services_compatibility_process_inspection_result_get_blocker (inspection);
		_tmp6_ = _tmp5_;
		_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, PROTON_PLUS_SERVICES_TYPE_COMPATIBILITY_PROCESS_RECORD, ProtonPlusServicesCompatibilityProcessRecord));
		blocker = _tmp7_;
		_tmp8_ = blocker;
		_tmp9_ = proton_plus_services_compatibility_process_record_get_pid (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = blocker;
		_tmp12_ = proton_plus_services_compatibility_process_record_get_executable_path (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = proton_plus_services_compatibility_process_inspection_result_get_blocker_reason (inspection);
		_tmp15_ = _tmp14_;
		_tmp16_ = g_enum_get_value (g_type_class_ref (PROTON_PLUS_SERVICES_TYPE_COMPATIBILITY_PROCESS_MATCH_REASON), _tmp15_);
		_tmp17_ = g_strdup_printf ("%s (%s)", _tmp13_, (_tmp16_ != NULL) ? _tmp16_->value_name : NULL);
		_tmp18_ = _tmp17_;
		g_debug ("installation-service.vala:408: Compatibility process %d blocks this op" \
"eration: %s", _tmp10_, _tmp18_);
		_g_free0 (_tmp18_);
		_g_object_unref0 (blocker);
		return;
	}
	_tmp19_ = proton_plus_services_compatibility_process_inspection_result_get_status (inspection);
	_tmp20_ = _tmp19_;
	if (_tmp20_ == PROTON_PLUS_SERVICES_COMPATIBILITY_PROCESS_INSPECTION_STATUS_UNKNOWN) {
		const gchar* _tmp21_ = NULL;
		const gchar* _tmp22_ = NULL;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		if (continuing) {
			_tmp21_ = "Ignoring for a new destination";
		} else {
			_tmp21_ = "Blocking on";
		}
		_tmp23_ = proton_plus_services_compatibility_process_inspection_result_get_inspection_error (inspection);
		_tmp24_ = _tmp23_;
		_tmp22_ = _tmp24_;
		if (_tmp22_ == NULL) {
			_tmp22_ = "unknown error";
		}
		g_debug ("installation-service.vala:418: %s process inspection failure: %s", _tmp21_, _tmp22_);
	}
}

static gboolean
proton_plus_services_installation_service_has_removable_state (ProtonPlusServicesInstallationService* self,
                                                               ProtonPlusServicesInstallJob* job)
{
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp0_;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp1_;
	ProtonPlusServicesSteamTinkerLaunchContext* context = NULL;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp4_;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp5_;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp6_;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (job != NULL, FALSE);
	_tmp0_ = proton_plus_services_install_job_get_steam_tinker_launch_context (job);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		_tmp2_ = proton_plus_services_install_job_get_install_location (job);
		_tmp3_ = _tmp2_;
		result = g_file_test (_tmp3_, G_FILE_TEST_EXISTS);
		return result;
	}
	_tmp4_ = proton_plus_services_install_job_get_steam_tinker_launch_context (job);
	_tmp5_ = _tmp4_;
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, PROTON_PLUS_SERVICES_TYPE_STEAM_TINKER_LAUNCH_CONTEXT, ProtonPlusServicesSteamTinkerLaunchContext));
	context = _tmp6_;
	_tmp10_ = context;
	_tmp11_ = proton_plus_services_steam_tinker_launch_context_get_base_location (_tmp10_);
	_tmp12_ = _tmp11_;
	if (g_file_test (_tmp12_, G_FILE_TEST_EXISTS)) {
		_tmp9_ = TRUE;
	} else {
		ProtonPlusServicesSteamTinkerLaunchContext* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		_tmp13_ = context;
		_tmp14_ = proton_plus_services_steam_tinker_launch_context_get_link_location (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp9_ = g_file_test (_tmp15_, G_FILE_TEST_EXISTS);
	}
	if (_tmp9_) {
		_tmp8_ = TRUE;
	} else {
		ProtonPlusServicesSteamTinkerLaunchContext* _tmp16_;
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		_tmp16_ = context;
		_tmp17_ = proton_plus_services_steam_tinker_launch_context_get_config_location (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp8_ = g_file_test (_tmp18_, G_FILE_TEST_EXISTS);
	}
	if (_tmp8_) {
		_tmp7_ = TRUE;
	} else {
		ProtonPlusServicesSteamTinkerLaunchContext* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		_tmp19_ = context;
		_tmp20_ = proton_plus_services_steam_tinker_launch_context_get_manual_remove_location (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp7_ = g_file_test (_tmp21_, G_FILE_TEST_EXISTS);
	}
	result = _tmp7_;
	_g_object_unref0 (context);
	return result;
}

static ProtonPlusModelsSteamChangeKind
proton_plus_services_installation_service_removal_change_kind (ProtonPlusServicesInstallationService* self,
                                                               ProtonPlusServicesInstallJob* job)
{
	ProtonPlusModelsSteamChangeKind _tmp0_ = 0;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp1_;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp2_;
	ProtonPlusModelsSteamChangeKind result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (job != NULL, 0);
	_tmp1_ = proton_plus_services_install_job_get_steam_tinker_launch_context (job);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NULL) {
		_tmp0_ = PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_STEAMTINKERLAUNCH_CHANGED;
	} else {
		_tmp0_ = PROTON_PLUS_MODELS_STEAM_CHANGE_KIND_COMPATIBILITY_TOOL_REMOVED;
	}
	result = _tmp0_;
	return result;
}

static void
proton_plus_services_installation_service_record_successful_change (ProtonPlusServicesInstallationService* self,
                                                                    ProtonPlusServicesInstallJob* job,
                                                                    ProtonPlusModelsSteamChangeKind kind)
{
	ProtonPlusServicesSteamChangeRecorder* recorder = NULL;
	ProtonPlusServicesSteamChangeRecorder* _tmp0_;
	ProtonPlusServicesSteamChangeRecorder* _tmp1_;
	ProtonPlusModelsSteamRestartTarget* target = NULL;
	ProtonPlusModelsTool* _tmp2_;
	ProtonPlusModelsTool* _tmp3_;
	ProtonPlusModelsGroup* _tmp4_;
	ProtonPlusModelsGroup* _tmp5_;
	ProtonPlusModelsLauncher* _tmp6_;
	ProtonPlusModelsLauncher* _tmp7_;
	ProtonPlusModelsSteamRestartTarget* _tmp8_;
	gboolean _tmp9_ = FALSE;
	gboolean _tmp10_ = FALSE;
	ProtonPlusServicesSteamChangeRecorder* _tmp11_;
	gchar* resource_key = NULL;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	ProtonPlusModelsSteamChangeReceipt* receipt = NULL;
	ProtonPlusModelsSteamRestartTarget* _tmp16_;
	const gchar* _tmp17_;
	ProtonPlusModelsTool* _tmp18_;
	ProtonPlusModelsTool* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	ProtonPlusModelsSteamChangeReceipt* _tmp25_;
	ProtonPlusModelsSteamChangeReceipt* _tmp26_;
	ProtonPlusServicesSteamRestartRecordResult _result_ = 0;
	ProtonPlusServicesSteamChangeRecorder* _tmp27_;
	ProtonPlusModelsSteamChangeReceipt* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	_tmp0_ = self->priv->steam_change_recorder;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	recorder = _tmp1_;
	_tmp2_ = proton_plus_services_install_job_get_tool (job);
	_tmp3_ = _tmp2_;
	_tmp4_ = proton_plus_models_tool_get_group (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = proton_plus_models_group_get_launcher (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = proton_plus_models_launcher_get_steam_restart_target (_tmp7_);
	target = _tmp8_;
	_tmp11_ = recorder;
	if (_tmp11_ == NULL) {
		_tmp10_ = TRUE;
	} else {
		ProtonPlusModelsSteamRestartTarget* _tmp12_;
		_tmp12_ = target;
		_tmp10_ = _tmp12_ == NULL;
	}
	if (_tmp10_) {
		_tmp9_ = TRUE;
	} else {
		_tmp9_ = !proton_plus_services_install_job_mark_steam_change_recorded (job, kind);
	}
	if (_tmp9_) {
		_g_object_unref0 (target);
		_g_object_unref0 (recorder);
		return;
	}
	_tmp13_ = proton_plus_services_install_job_get_install_location (job);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_canonicalize_filename (_tmp14_, NULL);
	resource_key = _tmp15_;
	_tmp16_ = target;
	_tmp17_ = resource_key;
	_tmp18_ = proton_plus_services_install_job_get_tool (job);
	_tmp19_ = _tmp18_;
	_tmp20_ = proton_plus_models_tool_get_id (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = proton_plus_services_install_job_get_displayed_title (job);
	_tmp23_ = _tmp22_;
	_tmp24_ = _tmp23_;
	_tmp25_ = proton_plus_models_steam_change_receipt_new (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, PROTON_PLUS_MODELS_TYPE_STEAM_RESTART_TARGET, ProtonPlusModelsSteamRestartTarget), kind, proton_plus_models_steam_change_receipt_default_requirement_for_kind (kind), _tmp17_, _tmp21_, _tmp24_, NULL, NULL);
	_tmp26_ = _tmp25_;
	_g_free0 (_tmp24_);
	receipt = _tmp26_;
	_tmp27_ = recorder;
	_tmp28_ = receipt;
	_result_ = proton_plus_services_steam_change_recorder_record (_tmp27_, _tmp28_);
	proton_plus_services_install_job_set_has_steam_restart_record_result (job, TRUE);
	proton_plus_services_install_job_set_steam_restart_record_result (job, _result_);
	if (_result_ != PROTON_PLUS_SERVICES_STEAM_RESTART_RECORD_RESULT_PERSISTENCE_FAILED) {
		_g_object_unref0 (receipt);
		_g_free0 (resource_key);
		_g_object_unref0 (target);
		_g_object_unref0 (recorder);
		return;
	}
	proton_plus_services_install_job_set_steam_restart_warning (job, _ ("The compatibility tool changed, but the Steam restart reminder could n" \
"ot be saved."));
	_tmp29_ = proton_plus_services_install_job_get_steam_restart_warning (job);
	_tmp30_ = _tmp29_;
	g_signal_emit (self, proton_plus_services_installation_service_signals[PROTON_PLUS_SERVICES_INSTALLATION_SERVICE_STEAM_RESTART_RECORDING_FAILED_SIGNAL], 0, job, (const gchar*) _tmp30_);
	_g_object_unref0 (receipt);
	_g_free0 (resource_key);
	_g_object_unref0 (target);
	_g_object_unref0 (recorder);
}

static ProtonPlusServicesInstallationWorkflow*
proton_plus_services_installation_service_select_workflow (ProtonPlusServicesInstallationService* self,
                                                           ProtonPlusServicesInstallJob* job)
{
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp0_;
	ProtonPlusServicesSteamTinkerLaunchContext* _tmp1_;
	ProtonPlusServicesStandardArchiveWorkflow* _tmp4_;
	ProtonPlusServicesInstallationWorkflow* _tmp5_;
	ProtonPlusServicesInstallationWorkflow* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (job != NULL, NULL);
	_tmp0_ = proton_plus_services_install_job_get_steam_tinker_launch_context (job);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != NULL) {
		ProtonPlusServicesSteamTinkerLaunchWorkflow* _tmp2_;
		ProtonPlusServicesInstallationWorkflow* _tmp3_;
		_tmp2_ = self->priv->steam_tinker_launch_workflow;
		_tmp3_ = _g_object_ref0 ((ProtonPlusServicesInstallationWorkflow*) _tmp2_);
		result = _tmp3_;
		return result;
	}
	_tmp4_ = self->priv->standard_archive_workflow;
	_tmp5_ = _g_object_ref0 ((ProtonPlusServicesInstallationWorkflow*) _tmp4_);
	result = _tmp5_;
	return result;
}

ProtonPlusServicesInstallationService*
proton_plus_services_installation_service_get_instance (void)
{
	ProtonPlusServicesInstallationService* result;
	ProtonPlusServicesInstallationService* _tmp0_;
	ProtonPlusServicesInstallationService* _tmp2_;
	_tmp0_ = proton_plus_services_installation_service__instance;
	if (_tmp0_ == NULL) {
		ProtonPlusServicesInstallationService* _tmp1_;
		_tmp1_ = proton_plus_services_installation_service_new ();
		_g_object_unref0 (proton_plus_services_installation_service__instance);
		proton_plus_services_installation_service__instance = _tmp1_;
	}
	_tmp2_ = proton_plus_services_installation_service__instance;
	result = _tmp2_;
	return result;
}

static void
g_cclosure_user_marshal_VOID__OBJECT_STRING (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_STRING) (gpointer data1, gpointer arg_1, const char* arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_string (param_values + 2), data2);
}

static void
proton_plus_services_installation_service_class_init (ProtonPlusServicesInstallationServiceClass * klass,
                                                      gpointer klass_data)
{
	proton_plus_services_installation_service_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusServicesInstallationService_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_services_installation_service_get_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_services_installation_service_finalize;
	proton_plus_services_installation_service_signals[PROTON_PLUS_SERVICES_INSTALLATION_SERVICE_STEAM_RESTART_RECORDING_FAILED_SIGNAL] = g_signal_new ("steam-restart-recording-failed", PROTON_PLUS_SERVICES_TYPE_INSTALLATION_SERVICE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2, PROTON_PLUS_SERVICES_TYPE_INSTALL_JOB, G_TYPE_STRING);
}

static void
proton_plus_services_installation_service_proton_plus_services_installation_operation_coordinator_interface_init (ProtonPlusServicesInstallationOperationCoordinatorIface * iface,
                                                                                                                  gpointer iface_data)
{
	proton_plus_services_installation_service_proton_plus_services_installation_operation_coordinator_parent_iface = g_type_interface_peek_parent (iface);
	iface->install_for_update = (void (*) (ProtonPlusServicesInstallationOperationCoordinator*, ProtonPlusServicesInstallJob*, GAsyncReadyCallback, gpointer)) proton_plus_services_installation_service_real_install_for_update;
	iface->install_for_update_finish = (ProtonPlusReturnCode (*) (ProtonPlusServicesInstallationOperationCoordinator*, GAsyncResult*)) proton_plus_services_installation_service_install_for_update_finish;
}

static void
proton_plus_services_installation_service_proton_plus_services_installation_lifecycle_recorder_interface_init (ProtonPlusServicesInstallationLifecycleRecorderIface * iface,
                                                                                                               gpointer iface_data)
{
	proton_plus_services_installation_service_proton_plus_services_installation_lifecycle_recorder_parent_iface = g_type_interface_peek_parent (iface);
	iface->record_completed_update = (void (*) (ProtonPlusServicesInstallationLifecycleRecorder*, ProtonPlusServicesInstallJob*)) proton_plus_services_installation_service_real_record_completed_update;
}

static void
proton_plus_services_installation_service_instance_init (ProtonPlusServicesInstallationService * self,
                                                         gpointer klass)
{
	GeeHashSet* _tmp0_;
	ProtonPlusServicesCompatibilityProcessGuard* _tmp1_;
	self->priv = proton_plus_services_installation_service_get_instance_private (self);
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->active_removal_locations = _tmp0_;
	_tmp1_ = proton_plus_services_compatibility_process_guard_new (NULL);
	self->priv->compatibility_process_guard = _tmp1_;
	self->priv->steam_change_recorder = NULL;
}

static void
proton_plus_services_installation_service_finalize (GObject * obj)
{
	ProtonPlusServicesInstallationService * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_SERVICES_TYPE_INSTALLATION_SERVICE, ProtonPlusServicesInstallationService);
	_g_object_unref0 (self->priv->standard_archive_workflow);
	_g_object_unref0 (self->priv->steam_tinker_launch_workflow);
	_g_object_unref0 (self->priv->active_removal_locations);
	_g_object_unref0 (self->priv->compatibility_process_guard);
	_g_object_unref0 (self->priv->steam_change_recorder);
	G_OBJECT_CLASS (proton_plus_services_installation_service_parent_class)->finalize (obj);
}

static GType
proton_plus_services_installation_service_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusServicesInstallationServiceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_services_installation_service_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusServicesInstallationService), 0, (GInstanceInitFunc) proton_plus_services_installation_service_instance_init, NULL };
	static const GInterfaceInfo proton_plus_services_installation_operation_coordinator_info = { (GInterfaceInitFunc) proton_plus_services_installation_service_proton_plus_services_installation_operation_coordinator_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo proton_plus_services_installation_lifecycle_recorder_info = { (GInterfaceInitFunc) proton_plus_services_installation_service_proton_plus_services_installation_lifecycle_recorder_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType proton_plus_services_installation_service_type_id;
	proton_plus_services_installation_service_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusServicesInstallationService", &g_define_type_info, 0);
	g_type_add_interface_static (proton_plus_services_installation_service_type_id, PROTON_PLUS_SERVICES_TYPE_INSTALLATION_OPERATION_COORDINATOR, &proton_plus_services_installation_operation_coordinator_info);
	g_type_add_interface_static (proton_plus_services_installation_service_type_id, PROTON_PLUS_SERVICES_TYPE_INSTALLATION_LIFECYCLE_RECORDER, &proton_plus_services_installation_lifecycle_recorder_info);
	ProtonPlusServicesInstallationService_private_offset = g_type_add_instance_private (proton_plus_services_installation_service_type_id, sizeof (ProtonPlusServicesInstallationServicePrivate));
	return proton_plus_services_installation_service_type_id;
}

GType
proton_plus_services_installation_service_get_type (void)
{
	static volatile gsize proton_plus_services_installation_service_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_services_installation_service_type_id__once)) {
		GType proton_plus_services_installation_service_type_id;
		proton_plus_services_installation_service_type_id = proton_plus_services_installation_service_get_type_once ();
		g_once_init_leave (&proton_plus_services_installation_service_type_id__once, proton_plus_services_installation_service_type_id);
	}
	return proton_plus_services_installation_service_type_id__once;
}

static void
_vala_proton_plus_services_installation_service_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec)
{
	ProtonPlusServicesInstallationService * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_SERVICES_TYPE_INSTALLATION_SERVICE, ProtonPlusServicesInstallationService);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

