From 900275bffd40c3315b7e1b77094b00c7104671c1 Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Mon, 3 Aug 2020 21:56:48 +0800 Subject: [PATCH] Dump certs.db This is used to build CIAs. Currently only retail certs are supported --- dist/threeSDumper.gm9 | 9 ++++++++- src/common/common_paths.h | 1 + src/core/importer.cpp | 1 + src/core/importer.h | 4 +++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dist/threeSDumper.gm9 b/dist/threeSDumper.gm9 index 81609ea..2850779 100644 --- a/dist/threeSDumper.gm9 +++ b/dist/threeSDumper.gm9 @@ -29,6 +29,13 @@ else goto Exit end +# === certs.db +if chk $[RDTYPE] "devkit" + echo "WARNING: \nDev kit detected. \nCIA building will not be usable." +else + cp -w -n "1:/dbs/certs.db" $[OUT]/certs.db +end + # === Safe mode firm if not find $[OUT]/firm NULL mkdir $[OUT]/firm @@ -159,7 +166,7 @@ else end # === Write version -dumptxt $[OUT]/version.txt 1 +dumptxt $[OUT]/version.txt 2 set PREVIEW_MODE "threeSD Dumper\nby zhaowenlan1779\n \nSuccess!" echo "Successfully dumped necessary\nfiles for threeSD." diff --git a/src/common/common_paths.h b/src/common/common_paths.h index 7bc7711..0e1d38e 100644 --- a/src/common/common_paths.h +++ b/src/common/common_paths.h @@ -39,3 +39,4 @@ #define MOVABLE_SED "movable.sed" #define SEED_DB "seeddb.bin" #define AES_KEYS "aes_keys.txt" +#define CERTS_DB "certs.db" diff --git a/src/core/importer.cpp b/src/core/importer.cpp index 173b525..065444e 100644 --- a/src/core/importer.cpp +++ b/src/core/importer.cpp @@ -901,6 +901,7 @@ std::vector LoadPresetConfig(std::string mount_point) { LOAD_DATA(movable_sed_path, MOVABLE_SED); LOAD_DATA(bootrom_path, BOOTROM9); + LOAD_DATA(certs_db_path, CERTS_DB); LOAD_DATA(safe_mode_firm_path, "firm/"); LOAD_DATA(seed_db_path, SEED_DB); LOAD_DATA(secret_sector_path, SECRET_SECTOR); diff --git a/src/core/importer.h b/src/core/importer.h index 5900eda..28f5f2c 100644 --- a/src/core/importer.h +++ b/src/core/importer.h @@ -68,6 +68,8 @@ struct Config { std::string movable_sed_path; ///< Path to movable.sed std::string bootrom_path; ///< Path to bootrom (boot9.bin) (Sysdata 0) + std::string certs_db_path; ///< Path to certs.db. Used while building CIA. + // The following system files are optional for importing and are only copied so that Citra // will be able to decrypt imported encrypted ROMs. @@ -84,7 +86,7 @@ struct Config { }; // Version of the current dumper. -constexpr int CurrentDumperVersion = 1; +constexpr int CurrentDumperVersion = 2; class SDMCFile; class NCCHContainer;