]> git.draconx.ca Git - upkg.git/blobdiff - src/upkg.h
libupkg: Add signed integer unpacking to fix incorrect signedness issue.
[upkg.git] / src / upkg.h
index 514e1220f53b61e5789192b8cebcf8ec6dcdf45a..775f918c8087e8b128562b78aeec95991a2c9316 100644 (file)
@@ -1,6 +1,27 @@
+/*
+ *  upkg: tool for manipulating Unreal Tournament packages.
+ *  Copyright (C) 2009 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 2 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, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
 #ifndef UPKG_H_
 #define UPKG_H_
 
+#include <stddef.h>
+
 #define UPKG_FLAG_ALLOW_DOWNLOAD  0x0001
 #define UPKG_FLAG_CLIENT_OPTIONAL 0x0002
 #define UPKG_FLAG_SERVER_ONLY     0x0004
@@ -23,6 +44,7 @@
 
 struct upkg {
        unsigned version, license;
+       unsigned char guid[16];
        unsigned long flags;
 
        unsigned long name_count, export_count, import_count;
@@ -30,8 +52,31 @@ struct upkg {
        struct upkg_private *priv;
 };
 
+struct upkg_file {
+       const char *name;
+
+       int eof;
+
+       struct upkg *pkg;
+       unsigned long base, offset, len;
+};
+
 struct upkg *upkg_fopen(const char *path);
 int upkg_close(struct upkg *pkg);
+
 const char *upkg_get_name(struct upkg *pkg, unsigned long idx);
 
+long   upkg_export_find(struct upkg *pkg, const char *name);
+const char *upkg_export_name(struct upkg *pkg, unsigned long idx);
+const char *upkg_export_class(struct upkg *pkg, unsigned long idx,
+                              const char **package);
+
+struct upkg_file *upkg_export_open(struct upkg *pkg, unsigned long idx);
+size_t upkg_export_read(struct upkg_file *f, void *buf, size_t n);
+int    upkg_export_seek(struct upkg_file *f, long offset, int whence);
+long   upkg_export_tell(struct upkg_file *f);
+void   upkg_export_close(struct upkg_file *f);
+
+size_t upkg_decode_index(long *val, unsigned char *bytes, size_t n);
+
 #endif