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

/* This file is part of retro-gtk. License: GPLv3*/

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gmodule.h>


#define RETRO_TYPE_SYSTEM_INFO (retro_system_info_get_type ())
typedef struct _RetroSystemInfo RetroSystemInfo;
#define _g_module_close0(var) ((var == NULL) ? NULL : (var = (g_module_close (var), NULL)))

#define RETRO_TYPE_CORE (retro_core_get_type ())
#define RETRO_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RETRO_TYPE_CORE, RetroCore))
#define RETRO_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RETRO_TYPE_CORE, RetroCoreClass))
#define RETRO_IS_CORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RETRO_TYPE_CORE))
#define RETRO_IS_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RETRO_TYPE_CORE))
#define RETRO_CORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RETRO_TYPE_CORE, RetroCoreClass))

typedef struct _RetroCore RetroCore;
typedef struct _RetroCoreClass RetroCoreClass;

/**
 * Error type thrown by interfaces when accessing one of their Core's
 * callback.
 */
typedef enum  {
	RETRO_CB_ERROR_NO_CORE,
	RETRO_CB_ERROR_NO_CALLBACK
} RetroCbError;
#define RETRO_CB_ERROR retro_cb_error_quark ()
struct _RetroSystemInfo {
	gchar* library_name;
	gchar* library_version;
	gchar* valid_extensions;
	gboolean need_fullpath;
	gboolean block_extract;
};

typedef void (*RetroGetSystemInfo) (RetroSystemInfo* info);


#define RETRO_API_VERSION ((guint) 1)
#define RETRO_ENV_PLUGIN_PATH "RETRO_PLUGIN_PATH_1_0"
GQuark retro_cb_error_quark (void);
GType retro_system_info_get_type (void) G_GNUC_CONST;
RetroSystemInfo* retro_system_info_dup (const RetroSystemInfo* self);
void retro_system_info_free (RetroSystemInfo* self);
void retro_system_info_copy (const RetroSystemInfo* self, RetroSystemInfo* dest);
void retro_system_info_destroy (RetroSystemInfo* self);
RetroSystemInfo* retro_get_system_info (const gchar* module_name);
GType retro_core_get_type (void) G_GNUC_CONST;
void retro_g_log (RetroCore* core, const gchar* log_domain, GLogLevelFlags log_level, const gchar* message);


GQuark retro_cb_error_quark (void) {
	return g_quark_from_static_string ("retro_cb_error-quark");
}


/**
 * Gets a module's system informations in a simple and light way.
 *
 * @param module_name the file name of the module to get the system
 * informations
 * @return the system infos of the module or //null//
 */
static gpointer _retro_system_info_dup0 (gpointer self) {
	return self ? retro_system_info_dup (self) : NULL;
}


RetroSystemInfo* retro_get_system_info (const gchar* module_name) {
	RetroSystemInfo* result = NULL;
	GModule* module = NULL;
	const gchar* _tmp0_;
	GModule* _tmp1_;
	void* function = NULL;
	GModule* _tmp2_;
	void* _tmp3_ = NULL;
	void* _tmp4_;
	RetroSystemInfo info = {0};
	void* _tmp5_;
	RetroSystemInfo _tmp6_ = {0};
	RetroSystemInfo _tmp7_;
	RetroSystemInfo _tmp8_;
	RetroSystemInfo* _tmp9_;
	g_return_val_if_fail (module_name != NULL, NULL);
	_tmp0_ = module_name;
	_tmp1_ = g_module_open (_tmp0_, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
	module = _tmp1_;
	_tmp2_ = module;
	g_module_symbol (_tmp2_, "retro_get_system_info", &_tmp3_);
	function = _tmp3_;
	_tmp4_ = function;
	if (_tmp4_ == NULL) {
		result = NULL;
		_g_module_close0 (module);
		return result;
	}
	_tmp5_ = function;
	((RetroGetSystemInfo) _tmp5_) (&_tmp6_);
	info = _tmp6_;
	_tmp7_ = info;
	_tmp8_ = _tmp7_;
	_tmp9_ = _retro_system_info_dup0 (&_tmp8_);
	result = _tmp9_;
	_g_module_close0 (module);
	return result;
}



