#include <stdio.h>
#include <stdlib.h>
+#include <glib-object.h>
+
#include "upkg.h"
+#include "serializable.h"
+#include "exportable.h"
+#include "music.h"
void print_upkg_flags(const char *prefix, unsigned long flags)
{
{
struct upkg *pkg;
+ g_type_init();
+
if (argc < 2) {
fprintf(stderr, "usage: upkg file\n");
return EXIT_FAILURE;
printf("Exports: %lu\n", pkg->export_count);
printf("Imports: %lu\n", pkg->import_count);
+ GObject *music = u_music_new();
+ struct upkg_file *f = upkg_export_open(pkg, 0);
+ upkg_deserialize(music, f);
+
+ char name[256];
+ upkg_export_name(music, name, sizeof name);
+ FILE *fp = fopen(name, "wb");
+ if (!fp) return EXIT_FAILURE;
+ upkg_export(music, fp);
+ fclose(fp);
+ printf("Wrote %s\n", name);
+
upkg_close(pkg);
return 0;
}