Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff9671c481 | ||
|
|
da1bb77d8e | ||
|
|
14c50ed7f8 | ||
|
|
61401d733e |
2
Makefile
2
Makefile
@@ -10,7 +10,7 @@ IPL_LOAD_ADDR := 0x40008000
|
||||
IPL_MAGIC := 0x43544349 #"ICTC"
|
||||
BLVERSION_MAJOR := 4
|
||||
BLVERSION_MINOR := 9
|
||||
BLVERSION_HOTFX := 0
|
||||
BLVERSION_HOTFX := 1
|
||||
|
||||
BL_RESERVED := 0
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ There are four possible type of entries. "**[ ]**": Boot entry, "**{ }**": Capti
|
||||
| fullsvcperm=1 | Disables SVC verification (full services permission) |
|
||||
| debugmode=1 | Enables Debug mode. Obsolete when used with exosphere as secmon. |
|
||||
| atmosphere=1 | Enables Atmosphère patching |
|
||||
| stock=1 | Disables unneeded kernel patching when running stock or semi-stock. |
|
||||
| payload={SD path} | Payload launching. Tools, Linux, CFW bootloaders, etc. |
|
||||
|
||||
**Note1**: When using the wildcard (`/*`) with `kip1` you can still use the normal `kip1` after that to load extra signle kips.
|
||||
|
||||
@@ -87,7 +87,7 @@ static int _dump_emmc_verify(sdmmc_storage_t *storage, u32 lba_curr, char *outFi
|
||||
f_close(&fp);
|
||||
return 1;
|
||||
}
|
||||
f_lseek(&fp, sdFileSector);
|
||||
f_lseek(&fp, (u64)sdFileSector << (u64)9);
|
||||
if (f_read(&fp, bufSd, num << 9, NULL))
|
||||
{
|
||||
gfx_con.fntsz = 16;
|
||||
@@ -112,7 +112,7 @@ static int _dump_emmc_verify(sdmmc_storage_t *storage, u32 lba_curr, char *outFi
|
||||
}
|
||||
|
||||
sparseShouldVerify++;
|
||||
sdFileSector += NUM_SECTORS_PER_ITER << 9;
|
||||
sdFileSector += NUM_SECTORS_PER_ITER;
|
||||
|
||||
pct = (u64)((u64)(lba_curr - part->lba_start) * 100u) / (u64)(part->lba_end - part->lba_start);
|
||||
if (pct != prevPct)
|
||||
@@ -129,7 +129,7 @@ static int _dump_emmc_verify(sdmmc_storage_t *storage, u32 lba_curr, char *outFi
|
||||
{
|
||||
gfx_con.fntsz = 16;
|
||||
WPRINTF("\n\nVerification was cancelled!");
|
||||
EPRINTF("\nPress any key...\n");
|
||||
gfx_con.fntsz = 8;
|
||||
msleep(1000);
|
||||
|
||||
f_close(&fp);
|
||||
@@ -612,7 +612,8 @@ static int _restore_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part
|
||||
|
||||
FIL fp;
|
||||
FILINFO fno;
|
||||
gfx_printf(&gfx_con, "\nFilename: %s\n", outFilename);
|
||||
|
||||
gfx_con_getpos(&gfx_con, &gfx_con.savedx, &gfx_con.savedy);
|
||||
|
||||
bool use_multipart = false;
|
||||
|
||||
@@ -622,10 +623,7 @@ static int _restore_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part
|
||||
if (f_stat(outFilename, &fno))
|
||||
{
|
||||
// If not, check if there are partial files and the total size matches.
|
||||
gfx_printf(&gfx_con, "\nFile not found, checking for part files.\n");
|
||||
|
||||
// Store console pos, so we dont take too much room.
|
||||
gfx_con_getpos(&gfx_con, &gfx_con.savedx, &gfx_con.savedy);
|
||||
gfx_printf(&gfx_con, "No single file, checking for part files...\n");
|
||||
|
||||
outFilename[sdPathLen++] = '.';
|
||||
|
||||
@@ -665,9 +663,9 @@ static int _restore_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part
|
||||
}
|
||||
}
|
||||
|
||||
gfx_con_setpos(&gfx_con, gfx_con.savedx, gfx_con.savedy);
|
||||
|
||||
res = f_open(&fp, outFilename, FA_READ);
|
||||
gfx_con_setpos(&gfx_con, gfx_con.savedx, gfx_con.savedy);
|
||||
gfx_printf(&gfx_con, "\nFilename: %s\n", outFilename);
|
||||
if (res)
|
||||
{
|
||||
if (res != FR_NO_FILE)
|
||||
@@ -690,7 +688,7 @@ static int _restore_emmc_part(char *sd_path, sdmmc_storage_t *storage, emmc_part
|
||||
{
|
||||
fileSize = (u64)f_size(&fp);
|
||||
gfx_printf(&gfx_con, "\nTotal restore size: %d MiB.\n\n",
|
||||
((u32)((use_multipart ? ((u64)totalCheckFileSize >> (u64)9) : fileSize) >> (u64)9)) >> SECTORS_TO_MIB_COEFF);
|
||||
(u32)((use_multipart ? (u64)totalCheckFileSize : fileSize) >> (u64)9) >> SECTORS_TO_MIB_COEFF);
|
||||
}
|
||||
|
||||
const u32 NUM_SECTORS_PER_ITER = 8192; // 4MB Cache.
|
||||
|
||||
@@ -60,9 +60,24 @@ typedef struct _fss_content_t
|
||||
int parse_fss(launch_ctxt_t *ctxt, const char *value)
|
||||
{
|
||||
FIL fp;
|
||||
|
||||
bool stock = false;
|
||||
|
||||
LIST_FOREACH_ENTRY(ini_kv_t, kv, &ctxt->cfg->kvs, link)
|
||||
{
|
||||
if (!strcmp("stock", kv->key))
|
||||
if (kv->val[0] == '1')
|
||||
stock = true;
|
||||
}
|
||||
|
||||
if (stock && ctxt->pkg1_id->kb <= KB_FIRMWARE_VERSION_620)
|
||||
return 1;
|
||||
|
||||
if (f_open(&fp, value, FA_READ) != FR_OK)
|
||||
return 0;
|
||||
|
||||
ctxt->atmosphere = true;
|
||||
|
||||
void *fss = malloc(f_size(&fp));
|
||||
// Read header.
|
||||
f_read(&fp, fss, 0x400, NULL);
|
||||
@@ -89,7 +104,9 @@ int parse_fss(launch_ctxt_t *ctxt, const char *value)
|
||||
// Load content to launch context.
|
||||
switch (curr_fss_cnt[i].type)
|
||||
{
|
||||
case CNT_TYPE_KIP:;
|
||||
case CNT_TYPE_KIP:
|
||||
if (stock)
|
||||
continue;
|
||||
merge_kip_t *mkip1 = (merge_kip_t *)malloc(sizeof(merge_kip_t));
|
||||
mkip1->kip1 = content;
|
||||
list_append(&ctxt->kip1_list, &mkip1->link);
|
||||
|
||||
@@ -369,6 +369,7 @@ out:;
|
||||
|
||||
static void _free_launch_components(launch_ctxt_t *ctxt)
|
||||
{
|
||||
ini_free_section(ctxt->cfg);
|
||||
free(ctxt->keyblob);
|
||||
free(ctxt->pkg1);
|
||||
free(ctxt->pkg2);
|
||||
@@ -388,20 +389,25 @@ int hos_launch(ini_sec_t *cfg)
|
||||
memset(&tsec_ctxt, 0, sizeof(tsec_ctxt_t));
|
||||
list_init(&ctxt.kip1_list);
|
||||
|
||||
ctxt.cfg = cfg;
|
||||
|
||||
if (!gfx_con.mute)
|
||||
gfx_clear_grey(&gfx_ctxt, 0x1B);
|
||||
gfx_con_setpos(&gfx_con, 0, 0);
|
||||
|
||||
// Try to parse config if present.
|
||||
if (cfg && !parse_boot_config(&ctxt, cfg))
|
||||
return 0;
|
||||
|
||||
gfx_printf(&gfx_con, "Initializing...\n\n");
|
||||
|
||||
// Read package1 and the correct keyblob.
|
||||
if (!_read_emmc_pkg1(&ctxt))
|
||||
return 0;
|
||||
|
||||
// Try to parse config if present.
|
||||
if (ctxt.cfg && !parse_boot_config(&ctxt))
|
||||
{
|
||||
EPRINTF("Wrong ini cfg or missing files!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check if fuses lower than 4.0.0 and if yes apply NO Gamecard patch.
|
||||
if (h_cfg.autonogc && !(fuse_read_odm(7) & ~0xF) && ctxt.pkg1_id->kb >= KB_FIRMWARE_VERSION_400)
|
||||
config_kip1patch(&ctxt, "nogc");
|
||||
@@ -507,7 +513,7 @@ int hos_launch(ini_sec_t *cfg)
|
||||
ctxt.kernel = pkg2_hdr->data;
|
||||
ctxt.kernel_size = pkg2_hdr->sec_size[PKG2_SEC_KERNEL];
|
||||
|
||||
if (ctxt.svcperm || ctxt.debugmode || ctxt.atmosphere)
|
||||
if (!ctxt.stock && (ctxt.svcperm || ctxt.debugmode || ctxt.atmosphere))
|
||||
{
|
||||
u32 kernel_crc32 = crc32c(ctxt.kernel, ctxt.kernel_size);
|
||||
ctxt.pkg2_kernel_id = pkg2_identify(kernel_crc32);
|
||||
@@ -610,7 +616,7 @@ int hos_launch(ini_sec_t *cfg)
|
||||
|
||||
// Config Exosphère if booting full Atmosphère.
|
||||
if (ctxt.atmosphere && ctxt.secmon)
|
||||
config_exosphere(ctxt.pkg1_id->id, ctxt.pkg1_id->kb, (void *)ctxt.pkg1_id->warmboot_base, ctxt.pkg1);
|
||||
config_exosphere(ctxt.pkg1_id->id, ctxt.pkg1_id->kb, (void *)ctxt.pkg1_id->warmboot_base, ctxt.pkg1, ctxt.stock);
|
||||
|
||||
// Unmount SD card.
|
||||
sd_unmount();
|
||||
@@ -640,7 +646,6 @@ int hos_launch(ini_sec_t *cfg)
|
||||
secmon_mb->out = 0;
|
||||
|
||||
// Free allocated memory.
|
||||
ini_free_section(cfg);
|
||||
_free_launch_components(&ctxt);
|
||||
|
||||
// Disable display. This must be executed before secmon to provide support for all fw versions.
|
||||
|
||||
@@ -58,7 +58,10 @@ typedef struct _launch_ctxt_t
|
||||
|
||||
bool svcperm;
|
||||
bool debugmode;
|
||||
bool stock;
|
||||
bool atmosphere;
|
||||
|
||||
ini_sec_t *cfg;
|
||||
} launch_ctxt_t;
|
||||
|
||||
typedef struct _merge_kip_t
|
||||
|
||||
@@ -176,6 +176,16 @@ static int _config_debugmode(launch_ctxt_t *ctxt, const char *value)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _config_stock(launch_ctxt_t *ctxt, const char *value)
|
||||
{
|
||||
if (*value == '1')
|
||||
{
|
||||
DPRINTF("Disabled all patching\n");
|
||||
ctxt->stock = true;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _config_atmosphere(launch_ctxt_t *ctxt, const char *value)
|
||||
{
|
||||
if (*value == '1')
|
||||
@@ -205,14 +215,15 @@ static const cfg_handler_t _config_handlers[] = {
|
||||
{ "kip1patch", config_kip1patch },
|
||||
{ "fullsvcperm", _config_svcperm },
|
||||
{ "debugmode", _config_debugmode },
|
||||
{ "stock", _config_stock },
|
||||
{ "atmosphere", _config_atmosphere },
|
||||
{ "fss0", _config_fss },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
int parse_boot_config(launch_ctxt_t *ctxt, ini_sec_t *cfg)
|
||||
int parse_boot_config(launch_ctxt_t *ctxt)
|
||||
{
|
||||
LIST_FOREACH_ENTRY(ini_kv_t, kv, &cfg->kvs, link)
|
||||
LIST_FOREACH_ENTRY(ini_kv_t, kv, &ctxt->cfg->kvs, link)
|
||||
{
|
||||
for(u32 i = 0; _config_handlers[i].key; i++)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "hos.h"
|
||||
|
||||
int parse_boot_config(launch_ctxt_t *ctxt, ini_sec_t *cfg);
|
||||
int parse_boot_config(launch_ctxt_t *ctxt);
|
||||
int config_kip1patch(launch_ctxt_t *ctxt, const char *value);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,7 @@ typedef struct _atm_meta_t
|
||||
#define EXO_FLAG_DBG_PRIV (1 << 1)
|
||||
#define EXO_FLAG_DBG_USER (1 << 2)
|
||||
|
||||
void config_exosphere(const char *id, u32 kb, void *warmboot, void *pkg1)
|
||||
void config_exosphere(const char *id, u32 kb, void *warmboot, void *pkg1, bool stock)
|
||||
{
|
||||
u32 exoFwNo = 0;
|
||||
u32 exoFlags = 0;
|
||||
@@ -75,8 +75,9 @@ void config_exosphere(const char *id, u32 kb, void *warmboot, void *pkg1)
|
||||
if (kb == KB_FIRMWARE_VERSION_620)
|
||||
exoFlags |= EXO_FLAG_620_KGN;
|
||||
|
||||
// To avoid problems, make private debug mode always on.
|
||||
exoFlags |= EXO_FLAG_DBG_PRIV;
|
||||
// To avoid problems, make private debug mode always on if not semi-stock.
|
||||
if (!stock)
|
||||
exoFlags |= EXO_FLAG_DBG_PRIV;
|
||||
|
||||
// Set mailbox values.
|
||||
exo_cfg_depr->magic = EXO_MAGIC_VAL;
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
#include "../utils/types.h"
|
||||
|
||||
void config_exosphere(const char *id, u32 kb, void *warmboot, void *pkg1);
|
||||
void config_exosphere(const char *id, u32 kb, void *warmboot, void *pkg1, bool stock);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1119,7 +1119,7 @@ ment_t ment_top[] = {
|
||||
};
|
||||
menu_t menu_top = {
|
||||
ment_top,
|
||||
"hekate - CTCaer mod v4.9", 0, 0
|
||||
"hekate - CTCaer mod v4.9.1", 0, 0
|
||||
};
|
||||
|
||||
#define IPL_STACK_TOP 0x90010000
|
||||
|
||||
@@ -1,46 +1,59 @@
|
||||
[config]
|
||||
autoboot=5
|
||||
autoboot=4
|
||||
autoboot_list=0
|
||||
bootwait=3
|
||||
customlogo=1
|
||||
verification=2
|
||||
verification=1
|
||||
backlight=100
|
||||
autohosoff=0
|
||||
autonogc=1
|
||||
|
||||
{-------- Stock -------}
|
||||
[Stock]
|
||||
[Stock 6.2.0 and lower]
|
||||
stock=1
|
||||
|
||||
[Stock (SVC perms)]
|
||||
fullsvcperm=1
|
||||
debugmode=1
|
||||
|
||||
[Stock (Prevent GC access)]
|
||||
kip1patch=nogc
|
||||
|
||||
[Stock (Allow unsigned NCA)]
|
||||
kip1patch=nosigchk
|
||||
[Stock All FW]
|
||||
fss0=atmosphere/fusee-secondary.bin
|
||||
stock=1
|
||||
{ }
|
||||
# Both above disable kernel patching
|
||||
# Stock All FW, includes exosphere and warmboot, ONLY when >= 7.0.0.
|
||||
|
||||
{-- Custom Firmwares --}
|
||||
[AtmoHB]
|
||||
kip1=cfw/loader.kip1
|
||||
kip1=cfw/sm.kip1
|
||||
[Atmo FSS0 Vanilla]
|
||||
fss0=atmosphere/fusee-secondary.bin
|
||||
logopath=cfw/atmo.bmp
|
||||
|
||||
[AtmoHB (SVC Perms)]
|
||||
kip1=cfw/loader.kip1
|
||||
kip1=cfw/sm.kip1
|
||||
fullsvcperm=1
|
||||
[CFW FSS0 extra kips]
|
||||
fss0=atmosphere/fusee-secondary.bin
|
||||
kip1=cfw/mods/mods_extra/*
|
||||
kip1=cfw/mods/mods_extra/single/extra.kip
|
||||
logopath=cfw/cfw.bmp
|
||||
# Both options for kip1 can be used. Wildcard and single.
|
||||
|
||||
[Atmosphere Full]
|
||||
secmon=cfw/atmo/exosphere.bin
|
||||
kip1=cfw/atmo/loader.kip
|
||||
kip1=cfw/atmo/sm.kip
|
||||
kip1=cfw/atmo/fs_mitm.kip
|
||||
logopath=cfw/atmo/atmo.bmp
|
||||
[Atmo Vanilla]
|
||||
secmon=cfw/mods/exosphere.bin
|
||||
warmboot=cfw/mods/lp0fw.bin
|
||||
kip1=cfw/mods/loader.kip
|
||||
kip1=cfw/mods/sm.kip
|
||||
kip1=cfw/mods/pm.kip
|
||||
kip1=cfw/mods/ams_mitm.kip
|
||||
logopath=cfw/atmo.bmp
|
||||
atmosphere=1
|
||||
# kip1=cfw/atmo/pm.kip
|
||||
# All kips defined.
|
||||
|
||||
[CFW Extra kips]
|
||||
secmon=cfw/mods/exosphere.bin
|
||||
warmboot=cfw/mods/lp0fw.bin
|
||||
kip1=cfw/mods/*
|
||||
kip1=cfw/mods/extra/extra.kip
|
||||
logopath=cfw/cfw.bmp
|
||||
atmosphere=1
|
||||
# All kips parsed from a directory and extra added.
|
||||
{ }
|
||||
|
||||
{------- Tools -------}
|
||||
[Clear Error Logs]
|
||||
kip1=cfw/nx-dreport.kip
|
||||
[memloader]
|
||||
payload=bootloader/payloads/memloader.bin
|
||||
|
||||
|
||||
# hekate - CTCaer mod v3.0 .ini template
|
||||
# hekate - CTCaer mod v4.9.1 .ini template
|
||||
|
||||
Reference in New Issue
Block a user