X-Git-Url: https://git.saurik.com/ldid.git/blobdiff_plain/20c5f1e8cda3d7c5249f5d09090ba93e561396c5..ea6a0421ff3e7d09ca273664b987a83af8e7a8fd:/ldid.cpp diff --git a/ldid.cpp b/ldid.cpp index 4b28403..b581988 100644 --- a/ldid.cpp +++ b/ldid.cpp @@ -316,7 +316,13 @@ int main(int argc, const char *argv[]) { std::vector files; - _assert(argc != 0); + if (argc == 1) { + fprintf(stderr, "usage: %s -S[entitlements.xml] \n", argv[0]); + fprintf(stderr, " %s -S cat\n", argv[0]); + fprintf(stderr, " %s -Stfp.xml gdb\n", argv[0]); + exit(0); + } + for (int argi(1); argi != argc; ++argi) if (argv[argi][0] != '-') files.push_back(argv[argi]); @@ -492,7 +498,7 @@ int main(int argc, const char *argv[]) { for (size_t i = 0; i != pages - 1; ++i) sha1(hashes[i], top + 0x1000 * i, 0x1000); if (pages != 0) - sha1(hashes[pages - 1], top + 0x1000 * (pages - 1), data % 0x1000); + sha1(hashes[pages - 1], top + 0x1000 * (pages - 1), ((data - 1) % 0x1000) + 1); } } @@ -547,7 +553,7 @@ int main(int argc, const char *argv[]) { for (size_t i = 0; i != pages - 1; ++i) sha1(hashes[i], top + 0x1000 * i, 0x1000); if (pages != 0) - sha1(hashes[pages - 1], top + 0x1000 * (pages - 1), data % 0x1000); + sha1(hashes[pages - 1], top + 0x1000 * (pages - 1), ((data - 1) % 0x1000) + 1); directory->hashOffset = Swap(offset - begin); offset += sizeof(*hashes) * pages;