/* nintendo-64-snapshot.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from nintendo-64-snapshot.vala, do not modify */

/* This file is part of GNOME Games. License: GPL-3.0+.*/

#include "games-nintendo-64-plugin.h"
#include "gnome-games.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.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  {
	GAMES_NINTENDO64_SNAPSHOT_0_PROPERTY,
	GAMES_NINTENDO64_SNAPSHOT_PAK1_PROPERTY,
	GAMES_NINTENDO64_SNAPSHOT_PAK2_PROPERTY,
	GAMES_NINTENDO64_SNAPSHOT_PAK3_PROPERTY,
	GAMES_NINTENDO64_SNAPSHOT_PAK4_PROPERTY,
	GAMES_NINTENDO64_SNAPSHOT_NUM_PROPERTIES
};
static GParamSpec* games_nintendo64_snapshot_properties[GAMES_NINTENDO64_SNAPSHOT_NUM_PROPERTIES];
#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))

struct _GamesNintendo64SnapshotPrivate {
	GamesNintendo64Pak _pak1;
	GamesNintendo64Pak _pak2;
	GamesNintendo64Pak _pak3;
	GamesNintendo64Pak _pak4;
};

static gint GamesNintendo64Snapshot_private_offset;
static gpointer games_nintendo64_snapshot_parent_class = NULL;
static GType games_nintendo64_snapshot_type_id = 0;

static void games_nintendo64_snapshot_real_load_metadata (GamesSnapshot* base,
                                                   GKeyFile* keyfile,
                                                   GError** error);
static void games_nintendo64_snapshot_real_save_metadata (GamesSnapshot* base,
                                                   GKeyFile* keyfile);
static void games_nintendo64_snapshot_finalize (GObject * obj);
static void _vala_games_nintendo64_snapshot_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec);
static void _vala_games_nintendo64_snapshot_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec);

static inline gpointer
games_nintendo64_snapshot_get_instance_private (GamesNintendo64Snapshot* self)
{
	return G_STRUCT_MEMBER_P (self, GamesNintendo64Snapshot_private_offset);
}

static void
games_nintendo64_snapshot_real_load_metadata (GamesSnapshot* base,
                                              GKeyFile* keyfile,
                                              GError** error)
{
	GamesNintendo64Snapshot * self;
	gchar* value = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	GamesNintendo64Pak* _tmp2_;
	GamesNintendo64Pak* _tmp3_;
	gchar* _tmp4_ = NULL;
	gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	GamesNintendo64Pak* _tmp8_;
	GamesNintendo64Pak* _tmp9_;
	gchar* _tmp10_ = NULL;
	gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	GamesNintendo64Pak* _tmp14_;
	GamesNintendo64Pak* _tmp15_;
	gchar* _tmp16_ = NULL;
	gchar* _tmp17_;
	gchar* _tmp18_;
	const gchar* _tmp19_;
	GamesNintendo64Pak* _tmp20_;
	GamesNintendo64Pak* _tmp21_;
	GError* _inner_error0_ = NULL;
	self = (GamesNintendo64Snapshot*) base;
	g_return_if_fail (keyfile != NULL);
	GAMES_SNAPSHOT_CLASS (games_nintendo64_snapshot_parent_class)->load_metadata (G_TYPE_CHECK_INSTANCE_CAST (self, GAMES_TYPE_SNAPSHOT, GamesSnapshot), keyfile, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_KEY_FILE_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp0_ = g_key_file_get_string (keyfile, "Nintendo 64", "Pak 1", &_inner_error0_);
	value = _tmp0_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_KEY_FILE_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp1_ = value;
	_tmp2_ = games_nintendo64_pak_from_value (_tmp1_);
	_tmp3_ = _tmp2_;
	games_nintendo64_snapshot_set_pak1 (self, *_tmp3_);
	_g_free0 (_tmp3_);
	_tmp5_ = g_key_file_get_string (keyfile, "Nintendo 64", "Pak 2", &_inner_error0_);
	_tmp4_ = _tmp5_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_KEY_FILE_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (value);
			return;
		} else {
			_g_free0 (value);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp6_ = _tmp4_;
	_tmp4_ = NULL;
	_g_free0 (value);
	value = _tmp6_;
	_tmp7_ = value;
	_tmp8_ = games_nintendo64_pak_from_value (_tmp7_);
	_tmp9_ = _tmp8_;
	games_nintendo64_snapshot_set_pak2 (self, *_tmp9_);
	_g_free0 (_tmp9_);
	_tmp11_ = g_key_file_get_string (keyfile, "Nintendo 64", "Pak 3", &_inner_error0_);
	_tmp10_ = _tmp11_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_KEY_FILE_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (_tmp4_);
			_g_free0 (value);
			return;
		} else {
			_g_free0 (_tmp4_);
			_g_free0 (value);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp12_ = _tmp10_;
	_tmp10_ = NULL;
	_g_free0 (value);
	value = _tmp12_;
	_tmp13_ = value;
	_tmp14_ = games_nintendo64_pak_from_value (_tmp13_);
	_tmp15_ = _tmp14_;
	games_nintendo64_snapshot_set_pak3 (self, *_tmp15_);
	_g_free0 (_tmp15_);
	_tmp17_ = g_key_file_get_string (keyfile, "Nintendo 64", "Pak 4", &_inner_error0_);
	_tmp16_ = _tmp17_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_KEY_FILE_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (_tmp10_);
			_g_free0 (_tmp4_);
			_g_free0 (value);
			return;
		} else {
			_g_free0 (_tmp10_);
			_g_free0 (_tmp4_);
			_g_free0 (value);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp18_ = _tmp16_;
	_tmp16_ = NULL;
	_g_free0 (value);
	value = _tmp18_;
	_tmp19_ = value;
	_tmp20_ = games_nintendo64_pak_from_value (_tmp19_);
	_tmp21_ = _tmp20_;
	games_nintendo64_snapshot_set_pak4 (self, *_tmp21_);
	_g_free0 (_tmp21_);
	_g_free0 (_tmp16_);
	_g_free0 (_tmp10_);
	_g_free0 (_tmp4_);
	_g_free0 (value);
}

static void
games_nintendo64_snapshot_real_save_metadata (GamesSnapshot* base,
                                              GKeyFile* keyfile)
{
	GamesNintendo64Snapshot * self;
	GamesNintendo64Pak _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GamesNintendo64Pak _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GamesNintendo64Pak _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GamesNintendo64Pak _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	self = (GamesNintendo64Snapshot*) base;
	g_return_if_fail (keyfile != NULL);
	GAMES_SNAPSHOT_CLASS (games_nintendo64_snapshot_parent_class)->save_metadata (G_TYPE_CHECK_INSTANCE_CAST (self, GAMES_TYPE_SNAPSHOT, GamesSnapshot), keyfile);
	_tmp0_ = self->priv->_pak1;
	_tmp1_ = games_nintendo64_pak_get_value (_tmp0_);
	_tmp2_ = _tmp1_;
	g_key_file_set_string (keyfile, "Nintendo 64", "Pak 1", _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = self->priv->_pak2;
	_tmp4_ = games_nintendo64_pak_get_value (_tmp3_);
	_tmp5_ = _tmp4_;
	g_key_file_set_string (keyfile, "Nintendo 64", "Pak 2", _tmp5_);
	_g_free0 (_tmp5_);
	_tmp6_ = self->priv->_pak3;
	_tmp7_ = games_nintendo64_pak_get_value (_tmp6_);
	_tmp8_ = _tmp7_;
	g_key_file_set_string (keyfile, "Nintendo 64", "Pak 3", _tmp8_);
	_g_free0 (_tmp8_);
	_tmp9_ = self->priv->_pak4;
	_tmp10_ = games_nintendo64_pak_get_value (_tmp9_);
	_tmp11_ = _tmp10_;
	g_key_file_set_string (keyfile, "Nintendo 64", "Pak 4", _tmp11_);
	_g_free0 (_tmp11_);
}

GamesNintendo64Snapshot*
games_nintendo64_snapshot_construct (GType object_type)
{
	GamesNintendo64Snapshot * self = NULL;
	self = (GamesNintendo64Snapshot*) games_snapshot_construct (object_type);
	return self;
}

GamesNintendo64Snapshot*
games_nintendo64_snapshot_new (void)
{
	return games_nintendo64_snapshot_construct (GAMES_TYPE_NINTENDO64_SNAPSHOT);
}

GamesNintendo64Pak
games_nintendo64_snapshot_get_pak1 (GamesNintendo64Snapshot* self)
{
	GamesNintendo64Pak result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_pak1;
	return result;
}

void
games_nintendo64_snapshot_set_pak1 (GamesNintendo64Snapshot* self,
                                    GamesNintendo64Pak value)
{
	GamesNintendo64Pak old_value;
	g_return_if_fail (self != NULL);
	old_value = games_nintendo64_snapshot_get_pak1 (self);
	if (old_value != value) {
		self->priv->_pak1 = value;
		g_object_notify_by_pspec ((GObject *) self, games_nintendo64_snapshot_properties[GAMES_NINTENDO64_SNAPSHOT_PAK1_PROPERTY]);
	}
}

GamesNintendo64Pak
games_nintendo64_snapshot_get_pak2 (GamesNintendo64Snapshot* self)
{
	GamesNintendo64Pak result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_pak2;
	return result;
}

void
games_nintendo64_snapshot_set_pak2 (GamesNintendo64Snapshot* self,
                                    GamesNintendo64Pak value)
{
	GamesNintendo64Pak old_value;
	g_return_if_fail (self != NULL);
	old_value = games_nintendo64_snapshot_get_pak2 (self);
	if (old_value != value) {
		self->priv->_pak2 = value;
		g_object_notify_by_pspec ((GObject *) self, games_nintendo64_snapshot_properties[GAMES_NINTENDO64_SNAPSHOT_PAK2_PROPERTY]);
	}
}

GamesNintendo64Pak
games_nintendo64_snapshot_get_pak3 (GamesNintendo64Snapshot* self)
{
	GamesNintendo64Pak result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_pak3;
	return result;
}

void
games_nintendo64_snapshot_set_pak3 (GamesNintendo64Snapshot* self,
                                    GamesNintendo64Pak value)
{
	GamesNintendo64Pak old_value;
	g_return_if_fail (self != NULL);
	old_value = games_nintendo64_snapshot_get_pak3 (self);
	if (old_value != value) {
		self->priv->_pak3 = value;
		g_object_notify_by_pspec ((GObject *) self, games_nintendo64_snapshot_properties[GAMES_NINTENDO64_SNAPSHOT_PAK3_PROPERTY]);
	}
}

GamesNintendo64Pak
games_nintendo64_snapshot_get_pak4 (GamesNintendo64Snapshot* self)
{
	GamesNintendo64Pak result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_pak4;
	return result;
}

void
games_nintendo64_snapshot_set_pak4 (GamesNintendo64Snapshot* self,
                                    GamesNintendo64Pak value)
{
	GamesNintendo64Pak old_value;
	g_return_if_fail (self != NULL);
	old_value = games_nintendo64_snapshot_get_pak4 (self);
	if (old_value != value) {
		self->priv->_pak4 = value;
		g_object_notify_by_pspec ((GObject *) self, games_nintendo64_snapshot_properties[GAMES_NINTENDO64_SNAPSHOT_PAK4_PROPERTY]);
	}
}

static void
games_nintendo64_snapshot_class_init (GamesNintendo64SnapshotClass * klass,
                                      gpointer klass_data)
{
	games_nintendo64_snapshot_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesNintendo64Snapshot_private_offset);
	((GamesSnapshotClass *) klass)->load_metadata = (void (*) (GamesSnapshot*, GKeyFile*, GError**)) games_nintendo64_snapshot_real_load_metadata;
	((GamesSnapshotClass *) klass)->save_metadata = (void (*) (GamesSnapshot*, GKeyFile*)) games_nintendo64_snapshot_real_save_metadata;
	G_OBJECT_CLASS (klass)->get_property = _vala_games_nintendo64_snapshot_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_nintendo64_snapshot_set_property;
	G_OBJECT_CLASS (klass)->finalize = games_nintendo64_snapshot_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_NINTENDO64_SNAPSHOT_PAK1_PROPERTY, games_nintendo64_snapshot_properties[GAMES_NINTENDO64_SNAPSHOT_PAK1_PROPERTY] = g_param_spec_enum ("pak1", "pak1", "pak1", GAMES_TYPE_NINTENDO64_PAK, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_NINTENDO64_SNAPSHOT_PAK2_PROPERTY, games_nintendo64_snapshot_properties[GAMES_NINTENDO64_SNAPSHOT_PAK2_PROPERTY] = g_param_spec_enum ("pak2", "pak2", "pak2", GAMES_TYPE_NINTENDO64_PAK, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_NINTENDO64_SNAPSHOT_PAK3_PROPERTY, games_nintendo64_snapshot_properties[GAMES_NINTENDO64_SNAPSHOT_PAK3_PROPERTY] = g_param_spec_enum ("pak3", "pak3", "pak3", GAMES_TYPE_NINTENDO64_PAK, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_NINTENDO64_SNAPSHOT_PAK4_PROPERTY, games_nintendo64_snapshot_properties[GAMES_NINTENDO64_SNAPSHOT_PAK4_PROPERTY] = g_param_spec_enum ("pak4", "pak4", "pak4", GAMES_TYPE_NINTENDO64_PAK, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
games_nintendo64_snapshot_instance_init (GamesNintendo64Snapshot * self,
                                         gpointer klass)
{
	self->priv = games_nintendo64_snapshot_get_instance_private (self);
}

static void
games_nintendo64_snapshot_finalize (GObject * obj)
{
	GamesNintendo64Snapshot * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_NINTENDO64_SNAPSHOT, GamesNintendo64Snapshot);
	G_OBJECT_CLASS (games_nintendo64_snapshot_parent_class)->finalize (obj);
}

GType
games_nintendo64_snapshot_get_type (void)
{
	return games_nintendo64_snapshot_type_id;
}

GType
games_nintendo64_snapshot_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesNintendo64SnapshotClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_nintendo64_snapshot_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesNintendo64Snapshot), 0, (GInstanceInitFunc) games_nintendo64_snapshot_instance_init, NULL };
	games_nintendo64_snapshot_type_id = g_type_module_register_type (module, GAMES_TYPE_SNAPSHOT, "GamesNintendo64Snapshot", &g_define_type_info, 0);
	GamesNintendo64Snapshot_private_offset = sizeof (GamesNintendo64SnapshotPrivate);
	return games_nintendo64_snapshot_type_id;
}

static void
_vala_games_nintendo64_snapshot_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec)
{
	GamesNintendo64Snapshot * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_NINTENDO64_SNAPSHOT, GamesNintendo64Snapshot);
	switch (property_id) {
		case GAMES_NINTENDO64_SNAPSHOT_PAK1_PROPERTY:
		g_value_set_enum (value, games_nintendo64_snapshot_get_pak1 (self));
		break;
		case GAMES_NINTENDO64_SNAPSHOT_PAK2_PROPERTY:
		g_value_set_enum (value, games_nintendo64_snapshot_get_pak2 (self));
		break;
		case GAMES_NINTENDO64_SNAPSHOT_PAK3_PROPERTY:
		g_value_set_enum (value, games_nintendo64_snapshot_get_pak3 (self));
		break;
		case GAMES_NINTENDO64_SNAPSHOT_PAK4_PROPERTY:
		g_value_set_enum (value, games_nintendo64_snapshot_get_pak4 (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_nintendo64_snapshot_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec)
{
	GamesNintendo64Snapshot * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_NINTENDO64_SNAPSHOT, GamesNintendo64Snapshot);
	switch (property_id) {
		case GAMES_NINTENDO64_SNAPSHOT_PAK1_PROPERTY:
		games_nintendo64_snapshot_set_pak1 (self, g_value_get_enum (value));
		break;
		case GAMES_NINTENDO64_SNAPSHOT_PAK2_PROPERTY:
		games_nintendo64_snapshot_set_pak2 (self, g_value_get_enum (value));
		break;
		case GAMES_NINTENDO64_SNAPSHOT_PAK3_PROPERTY:
		games_nintendo64_snapshot_set_pak3 (self, g_value_get_enum (value));
		break;
		case GAMES_NINTENDO64_SNAPSHOT_PAK4_PROPERTY:
		games_nintendo64_snapshot_set_pak4 (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

