mirror of
https://github.com/ApacheThunder/NTR_Launcher.git
synced 2025-06-18 19:15:40 -04:00

* Added DSOnei kernel to included nds files for Stage2 menu. * Added N-Card rom dump to included nds files for Stage2 menu. * Added CycloDS, and DSTWo bootloader dumps to included nds files for Stage2 menu. * DSTwo now boots correctly from cart launcher. * R4 SDHC Gold and other similar DEMON time bomb DSTTi clones now boot correctly from cart launcher. * Added back option for enabling/disabling TWL ram. * Added fixes to allow DS only carts to run with TWL ram enabled. * Initial modcrypt code added for TWL carts. Currently works in emulation however TWL carts will fail to boot on hardware (when twl mode, ram, etc is enabled). * If TWL mode and ram is enabled, cart loader will now load the DSi extended binaries into ram. Currently however they will only boot in emulation. Have not resolved why it's not working on hardware yet. * Stage2 menu now allowed to load dsi extended binaries of SRLs if TWL mode and TWL ram is enabled. Booting rom dumps as a method of booting into TWL carts is confirmed working. At least for System Flaw it does. :D * Despite the improvents Acekard 2i still appears to require using the stage2 menu to boot into. * Fixes that allowed Demon timebomb carts to boot from cart launcher/autoboot may allow other non working carts to work. Further testing needed.
71 lines
1.7 KiB
C
71 lines
1.7 KiB
C
#pragma once
|
|
|
|
#include <nds.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/************************ Constants / Defines *********************************/
|
|
|
|
#define AES_BLOCK_SIZE 16
|
|
#define SHA1_LEN 20
|
|
|
|
#define KEYSEED_DSI_NAND_0 0x24ee6906
|
|
#define KEYSEED_DSI_NAND_1 0xe65b601d
|
|
|
|
#define KEYSEED_3DS_NAND_0 0xb358a6af
|
|
#define KEYSEED_3DS_NAND_1 0x544e494e
|
|
#define KEYSEED_3DS_NAND_2 0x4f444e45
|
|
#define KEYSEED_3DS_NAND_3 0x08c267b7
|
|
|
|
#define KEYSEED_ES_0 0x4e00004a
|
|
#define KEYSEED_ES_1 0x4a00004e
|
|
#define KEYSEED_ES_2 0xc80c4b72
|
|
|
|
#define GET_UINT32_BE(n, b, i) \
|
|
((uint8_t*)&(n))[0] = (b)[i + 3]; \
|
|
((uint8_t*)&(n))[1] = (b)[i + 2]; \
|
|
((uint8_t*)&(n))[2] = (b)[i + 1]; \
|
|
((uint8_t*)&(n))[3] = (b)[i + 0]
|
|
|
|
#define PUT_UINT32_BE(n, b, i) \
|
|
(b)[i + 0] = ((uint8_t*)&(n))[3]; \
|
|
(b)[i + 1] = ((uint8_t*)&(n))[2]; \
|
|
(b)[i + 2] = ((uint8_t*)&(n))[1]; \
|
|
(b)[i + 3] = ((uint8_t*)&(n))[0]
|
|
|
|
|
|
typedef enum {
|
|
ENCRYPT,
|
|
DECRYPT
|
|
} crypt_mode_t;
|
|
|
|
typedef enum {
|
|
NAND,
|
|
NAND_3DS,
|
|
ES
|
|
} key_mode_t;
|
|
|
|
|
|
// don't want to include nds.h just for this
|
|
void swiSHA1Calc(void *digest, const void *buf, size_t len);
|
|
|
|
int dsi_sha1_verify(const void *digest_verify, const void *data, unsigned len);
|
|
|
|
void dsi_crypt_init(const uint8_t *console_id_be, const uint8_t *emmc_cid, int is3DS);
|
|
|
|
void dsi_nand_crypt_1(uint8_t *out, const uint8_t* in, u32 offset);
|
|
|
|
void dsi_nand_crypt(uint8_t *out, const uint8_t* in, u32 offset, unsigned count);
|
|
|
|
int dsi_es_block_crypt(uint8_t *buf, unsigned buf_len, crypt_mode_t mode);
|
|
|
|
void dsi_boot2_crypt_set_ctr(uint32_t size_r);
|
|
|
|
void dsi_boot2_crypt(uint8_t* out, const uint8_t* in, unsigned count);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|