]> git.draconx.ca Git - upkg.git/blobdiff - src/engine/palette.c
engine: Start using GOB2 to generate GObject classes.
[upkg.git] / src / engine / palette.c
diff --git a/src/engine/palette.c b/src/engine/palette.c
deleted file mode 100644 (file)
index 29725ec..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  upkg: tool for manipulating Unreal Tournament packages.
- *  Copyright © 2011 Nick Bowler
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <engine/palette.h>
-#include "upkg.h"
-
-G_DEFINE_DYNAMIC_TYPE(EnginePalette, engine_palette, U_TYPE_OBJECT);
-
-static int deserialize(UObject *uo)
-{
-       EnginePalette *p = ENGINE_PALETTE(uo);
-       struct upkg_file *f = uo->pkg_file;
-       unsigned char buf[16];
-       size_t rc, buflen;
-       long entries;
-
-       U_OBJECT_CLASS(engine_palette_parent_class)->deserialize(uo);
-
-       buflen = upkg_export_read(f, buf, sizeof buf);
-       rc = upkg_decode_index(&entries, buf, buflen);
-       if (rc == 0 || entries < 0)
-               return -1;
-
-       upkg_export_seek(f, rc, SEEK_SET);
-
-       p->entries = entries;
-       p->rgba = malloc(entries * sizeof p->rgba[0]);
-       if (!p->rgba)
-               return -1;
-
-       rc = upkg_export_read(f, p->rgba, entries * sizeof p->rgba[0]);
-       if (rc != entries * sizeof p->rgba[0]) {
-               free(p->rgba);
-               return -1;
-       }
-
-       return 0;
-}
-
-void palette_register(GTypeModule *m)
-{
-       engine_palette_register_type(m);
-}
-
-static void engine_palette_init(EnginePalette *p)
-{
-       p->entries = 0;
-}
-
-static void engine_palette_class_init(EnginePaletteClass *class)
-{
-       UObjectClass *uo = U_OBJECT_CLASS(class);
-
-       uo->deserialize = deserialize;
-}
-
-static void engine_palette_class_finalize(EnginePaletteClass *class)
-{
-}