/* * 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 #define UPKG_FLAG_ALLOW_DOWNLOAD 0x0001 #define UPKG_FLAG_CLIENT_OPTIONAL 0x0002 #define UPKG_FLAG_SERVER_ONLY 0x0004 #define UPKG_FLAG_BROKEN_LINKS 0x0008 #define UPKG_FLAG_INSECURE 0x0010 #define UPKG_FLAG_REQUIRED 0x8000 #define UPKG_OBJ_FLAG_TRANSACTIONAL 0x00000001 #define UPKG_OBJ_FLAG_UNREACHABLE 0x00000002 #define UPKG_OBJ_FLAG_PUBLIC 0x00000004 #define UPKG_OBJ_FLAG_TAG_IMPORT 0x00000008 #define UPKG_OBJ_FLAG_TAG_EXPORT 0x00000010 #define UPKG_OBJ_FLAG_SOURCE_MODIFIED 0x00000020 #define UPKG_OBJ_FLAG_TAG_GARBAGE 0x00000040 #define UPKG_OBJ_FLAG_NEED_LOAD 0x00000200 #define UPKG_OBJ_FLAG_HIGHLIGHT_NAME 0x00000400 #define UPKG_HDR_MAGIC 0x9e2a83c1 #define UPKG_HDR_SIZE 36 struct upkg { unsigned version, license; unsigned char guid[16]; unsigned long flags; unsigned long name_count, export_count, import_count; 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, const char **group); 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