+#include <stdio.h>
+#include <string.h>
+#include <glib-object.h>
+
+#include "exportable.h"
+#include "uobject.h"
+#include "texture.h"
+#include "upkg.h"
+
+#define TEXTURE_GET_PRIV(o) \
+ G_TYPE_INSTANCE_GET_PRIVATE(o, ENGINE_TEXTURE_TYPE, struct texture_priv)
+
+struct texture_priv {
+ unsigned type;
+
+ struct upkg_file *f;
+ size_t base, len;
+
+ unsigned char buf[2048];
+ unsigned long nbuf;
+};
+
+void exportable_init(UObjectExportable *e)
+{
+}
+
+G_DEFINE_DYNAMIC_TYPE(EngineTexture, engine_texture, U_OBJECT_TYPE);
+
+static int deserialize(UObject *o, struct upkg_file *f)
+{
+ struct texture_priv *priv = TEXTURE_GET_PRIV(o);
+ EngineTexture *t = ENGINE_TEXTURE(o);
+ const GValue *val;
+
+ U_OBJECT_CLASS(engine_texture_parent_class)->deserialize(o, f);
+
+ val = u_object_get_property(o, "USize");
+ if (!(val && G_VALUE_HOLDS(val, G_TYPE_ULONG)))
+ return -1;
+ t->usize = g_value_get_ulong(val);
+
+ val = u_object_get_property(o, "USize");
+ if (!(val && G_VALUE_HOLDS(val, G_TYPE_ULONG)))
+ return -1;
+ t->vsize = g_value_get_ulong(val);
+
+ printf("Texture size: %lux%lu\n", t->usize, t->vsize);
+
+ return 0;
+}
+
+void texture_register(GTypeModule *m)
+{
+ engine_texture_register_type(m);
+}
+
+static void engine_texture_init(EngineTexture *m)
+{
+}
+
+static void engine_texture_class_init(EngineTextureClass *class)
+{
+ UObjectClass *uo = U_OBJECT_CLASS(class);
+
+ g_type_class_add_private(class, sizeof (struct texture_priv));
+
+ uo->deserialize = deserialize;
+}
+
+static void engine_texture_class_finalize(EngineTextureClass *class)
+{
+}