From 0527704c28e7e44f3a13349e45dfd91f7753921a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Israelson?= <57065102+israpps@users.noreply.github.com> Date: Wed, 18 Dec 2024 08:26:51 -0300 Subject: [PATCH] arcade header (#11) Co-authored-by: AKuHAK <621640+AKuHAK@users.noreply.github.com> --- src/kelf.cpp | 4 ++++ src/kelf.h | 1 + src/kelftool.cpp | 22 +++++++++++++++++----- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/kelf.cpp b/src/kelf.cpp index 0efa230..43f99b5 100644 --- a/src/kelf.cpp +++ b/src/kelf.cpp @@ -387,6 +387,10 @@ int Kelf::SaveKelf(const std::string &filename, int headerid) USER_HEADER = USER_HEADER_DNASLOAD; break; + case HEADER::ARCADE_BOOTFILE: + USER_HEADER = USER_HEADER_NAMCO_SECURITY_DONGLE_BOOTFILE; + break; + default: USER_HEADER = USER_HEADER_FHDB; break; diff --git a/src/kelf.h b/src/kelf.h index 31eb0ee..c3b2b3c 100644 --- a/src/kelf.h +++ b/src/kelf.h @@ -36,6 +36,7 @@ enum HEADER { FHDB, MBR, DNASLOAD, + ARCADE_BOOTFILE, }; static uint8_t USER_HEADER_FMCB[16] = {0x01, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x4A, 0x00, 0x01, 0x02, 0x19, 0x00, 0x00, 0x00, 0x56}; diff --git a/src/kelftool.cpp b/src/kelftool.cpp index 1032feb..f73e7ed 100644 --- a/src/kelftool.cpp +++ b/src/kelftool.cpp @@ -42,7 +42,9 @@ int decrypt(int argc, char **argv) std::string KeyStoreEntry = "default"; if (argc < 3) { - printf("%s decrypt <input> <output>\n", argv[0]); + printf("%s decrypt <input> <output> [Flags]\n", argv[0]); + printf("\tFlags:\n"); + printf("\t\t--keys Specify keys to be used\n"); return -1; } @@ -85,8 +87,14 @@ int encrypt(int argc, char **argv) int headerid = -1; if (argc < 4) { - printf("%s encrypt <headerid> <input> <output>\n", argv[0]); - printf("<headerid>: fmcb, fhdb, mbr\n"); + printf("%s encrypt <headerid> <input> <output> [Flags]\n", argv[0]); + printf("<headerid>: fmcb, fhdb, mbr dnasload dongle\n"); + printf("\tFlags:\n"); + printf("\t\t--keys Specify keys to be used\n"); + printf("\t\t--mgzone Specify custom region whitelist\n"); + printf("\t\t--apptype Specify application type \n"); + printf("\t\t--kflags Specify custom flags for KELF Header\n"); + printf("\t\t--systemtype Specify sys type (PS2 or PSX)\n"); return -1; } @@ -145,6 +153,9 @@ int encrypt(int argc, char **argv) if (strcmp("dnasload", argv[1]) == 0) headerid = HEADER::DNASLOAD; + if (strcmp("dongle", argv[1]) == 0) + headerid = HEADER::ARCADE_BOOTFILE; + if (headerid == HEADER::INVALID) { printf("Invalid header: %s\n", argv[1]); @@ -184,9 +195,10 @@ int main(int argc, char **argv) printf("usage: %s <submodule> <args>\n", argv[0]); printf("Available submodules:\n"); printf("\tdecrypt - decrypt and check signature of kelf files\n"); - printf("\tencrypt <headerid> - encrypt and sign kelf files <headerid>: fmcb, fhdb, mbr\n"); + printf("\tencrypt <headerid> - encrypt and sign kelf files <headerid>: fmcb, fhdb, mbr, dnasload, dongle\n"); printf("\t\tfmcb - for retail PS2 memory cards\n"); - printf("\t\tdnasload - for retail PS2 memory cards (PSX bypass)\n"); + printf("\t\tdnasload - for retail PS2 memory cardsfor retail PS2 memory cards (PSX bypass)\n"); + printf("\t\tdongle - for arcade PS2 Security Dongle\n"); printf("\t\tfhdb - for retail PS2 HDD (HDD OSD / BB Navigator)\n"); printf("\t\tmbr - for retail PS2 HDD (mbr injection).\n"); printf("\t\t Note: for mbr elf should load from 0x100000 and should be without headers:\n");