?? htxexhead.cc
字號(hào):
/* * HT Editor * htxexhead.cc * * Copyright (C) 2006 Sebastian Biallas (sb@biallas.net) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. */#include <cstring>#include "formats.h"#include "htapp.h"#include "atom.h"#include "htcoff.h"#include "htctrl.h"#include "endianess.h"#include "hthex.h"#include "htiobox.h"#include "htnewexe.h"#include "htxex.h"#include "htxexhead.h"#include "httag.h"#include "strtools.h"#include "snprintf.h"#include "xexstruct.h"static ht_tag_flags_s xbe_init_flags[] ={ {-1, "XBE - initialisation flags"}, {0, "[00] Mount Utility Drive"}, {1, "[01] Format Utility Drive"}, {2, "[02] Limit to 64MB"}, {3, "[03] Dont setup harddisk"}, {0, 0}};static ht_mask_ptable xeximageheader[] = { {"magic", STATICTAG_EDIT_CHAR("00000000")STATICTAG_EDIT_CHAR("00000001")STATICTAG_EDIT_CHAR("00000002")STATICTAG_EDIT_CHAR("00000003")}, {"version", STATICTAG_EDIT_DWORD_BE("00000004")}, {"size of header", STATICTAG_EDIT_DWORD_BE("00000008")}, {"res", STATICTAG_EDIT_DWORD_BE("0000000c")}, {"offset of file header", STATICTAG_EDIT_DWORD_BE("00000010")" "STATICTAG_REF("0000000100000000", "03", "raw")}, {"info table entries", STATICTAG_EDIT_DWORD_BE("00000014")}, {0, 0}};/*#define XEX_MEDIA_HD 0x00000001#define XEX_MEDIA_DVD_X2 0x00000002#define XEX_MEDIA_DVD_CD 0x00000004#define XEX_MEDIA_DVD_5 0x00000008#define XEX_MEDIA_DVD_9 0x00000010#define XEX_MEDIA_FLASH 0x00000020#define XEX_MEDIA_MEMORY_UNIT 0x00000080#define XEX_MEDIA_MASS_STORAGE 0x00000100#define XEX_MEDIA_SMB 0x00000200#define XEX_MEDIA_RAM 0x00000400#define XEX_MEDIA_INSECURE 0x01000000#define XEX_MEDIA_SAVE_GAME 0x02000000#define XEX_MEDIA_LOCAL 0x04000000#define XEX_MEDIA_LIVE 0x08000000#define XEX_MEDIA_XBOX 0x10000000M { 0x00000001, "hard disk" }, { 0x00000002, "DVD-X2" }, { 0x00000004, "DVD/CD" }, { 0x00000008, "DVD-5" }, { 0x00000010, "DVD-9" }, { 0x00000020, "system flash" }, { 0x00000080, "memory unit" }, { 0x00000100, "mass storage device" }, { 0x00000200, "SMB filesystem" }, { 0x00000400, "direct-from-RAM" }, { 0x01000000, "insecure package" }, { 0x02000000, "save game package" }, { 0x04000000, "locally signed package" }, { 0x08000000, "Live-signed package" }, { 0x10000000, "Xbox platform package" }*/static ht_tag_flags_s xex_media_flags[] ={ {-1, "XEX - media type mask"}, { 24, "[00] hard disk" }, { 25, "[01] DVD-X2" }, { 26, "[02] DVD/CD" }, { 27, "[03] DVD-5" }, { 28, "[04] DVD-9" }, { 29, "[05] system flash" }, { 30, "[06] memory unit" }, { 31, "[07] mass storage device" }, { 16, "[08] SMB filesystem" }, { 17, "[09] direct-from-RAM" }, { 0, "[24] insecure package" }, { 1, "[25] save game package" }, { 2, "[26] locally signed package" }, { 3, "[27] Live-signed package" }, { 4, "[28] Xbox platform package" }};#define ATOM_XEX_INFO_CLASS_MAGICS 0x58455801#define ATOM_XEX_INFO_CLASS_MAGICS_STR "58455801"#define ATOM_XEX_MEDIA_FLAGS 0x58455802#define ATOM_XEX_MEDIA_FLAGS_STR "58455802"static ht_mask_sub *prep_sub(File *file, const char *desc, uint32 type, int i, ht_collapsable_sub **cs){ char title[100]; ht_snprintf(title, sizeof title, "%-22s [0x%08x]", desc, type); ht_mask_sub *s = new ht_mask_sub(); s->init(file, i+4); *cs = new ht_collapsable_sub(); (*cs)->init(file, s, true, title, true); return s;}static ht_sub *add_resmap(File *file, const char *desc, ht_xex_shared_data &xex_shared, int i, FileOfs ofs){ ht_collapsable_sub *cs; ht_mask_sub *s = prep_sub(file, desc, xex_shared.info_table_cooked[i].type, i, &cs); char b[200]; char b2[200]; ht_snprintf(b2, sizeof b2, STATICTAG_REF("00000000%08x", "08", "show raw"), i); ht_snprintf(b, sizeof b, "type "STATICTAG_EDIT_BYTE("00000000")STATICTAG_EDIT_BYTE("00000001")STATICTAG_EDIT_BYTE("00000002")STATICTAG_EDIT_BYTE("00000003") " %s", xex_shared.info_table_cooked[i].start ? b2 : ""); s->add_staticmask(b, ofs, true); s->add_staticmask("value "STATICTAG_EDIT_DWORD_BE("00000004")" ", ofs, true); return cs;}static ht_sub *add_loaderinfo(File *file, const char *desc, ht_xex_shared_data &xex_shared, int i, FileOfs ofs){ ht_collapsable_sub *cs; ht_mask_sub *s = prep_sub(file, desc, xex_shared.info_table_cooked[i].type, i, &cs); ofs = xex_shared.info_table_cooked[i].start; if (xex_shared.info_table_cooked[i].size >= 4) { s->add_staticmask("crypted? "STATICTAG_EDIT_WORD_BE("00000000"), ofs, true); s->add_staticmask("type of loader "STATICTAG_EDIT_WORD_BE("00000002"), ofs, true); s->add_staticmask(" ---", ofs, true); switch (xex_shared.loader_info.type) { case XEX_LOADER_RAW: { int entries = (xex_shared.info_table_cooked[i].size-4)/8; ofs += 4; for (int i = 0; i < entries; i++) { s->add_staticmask("raw bytes "STATICTAG_EDIT_DWORD_BE("00000000"), ofs, true); s->add_staticmask("pad "STATICTAG_EDIT_DWORD_BE("00000004"), ofs, true); ofs += 8; } break; } case XEX_LOADER_COMPRESSED: { s->add_staticmask("compression window "STATICTAG_EDIT_DWORD_BE("00000004"), ofs, true); s->add_staticmask("size of loader "STATICTAG_EDIT_DWORD_BE("00000008"), ofs, true); if (xex_shared.info_table_cooked[i].size >= 32) { String str("SHA1 hash loader "); for (int j=0; j < 20; j++) { String str2; str2.assignFormat(STATICTAG_EDIT_BYTE("%08x"), 12+j); str.append(str2); } s->add_staticmask(str.contentChar(), ofs, true); } break; } } // FIXME: compressed vs. raw } return cs;}static ht_sub *add_filename(File *file, const char *desc, ht_xex_shared_data &xex_shared, int i, FileOfs ofs){ return add_resmap(file, desc, xex_shared, i, ofs);}static ht_sub *add_single(File *file, const char *desc, ht_xex_shared_data &xex_shared, int i, FileOfs ofs){ return add_resmap(file, desc, xex_shared, i, ofs);}static ht_sub *add_import(File *file, const char *desc, ht_xex_shared_data &xex_shared, int i, FileOfs ofs){ return add_resmap(file, desc, xex_shared, i, ofs);}static ht_sub *add_ids(File *file, const char *desc, ht_xex_shared_data &xex_shared, int i, FileOfs ofs){ ht_collapsable_sub *cs; ht_mask_sub *s = prep_sub(file, desc, xex_shared.info_table_cooked[i].type, i, &cs); ofs = xex_shared.info_table_cooked[i].start; s->add_staticmask("image checksum "STATICTAG_EDIT_DWORD_BE("00000000"), ofs, true); s->add_staticmask("timestamp "STATICTAG_EDIT_TIME_BE("00000004"), ofs, true); return cs;}static ht_sub *add_fileinfo(File *file, const char *desc, ht_xex_shared_data &xex_shared, int i, FileOfs ofs){ ht_collapsable_sub *cs; ht_mask_sub *s = prep_sub(file, desc, xex_shared.info_table_cooked[i].type, i, &cs); ofs = xex_shared.info_table_cooked[i].start; s->add_staticmask("media ID "STATICTAG_EDIT_DWORD_BE("00000000"), ofs, true); s->add_staticmask("xbox min version "STATICTAG_EDIT_DWORD_BE("00000004"), ofs, true); s->add_staticmask("xbox max? version "STATICTAG_EDIT_DWORD_BE("00000008"), ofs, true); s->add_staticmask("title ID "STATICTAG_EDIT_DWORD_BE("0000000c"), ofs, true); s->add_staticmask("platform "STATICTAG_EDIT_BYTE("00000010"), ofs, true); s->add_staticmask("executable type "STATICTAG_EDIT_BYTE("00000011"), ofs, true);
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -