Hacker voice: *i'm in* (to the emmc)
This commit is contained in:
58
source/storage/mountmanager.c
Normal file
58
source/storage/mountmanager.c
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "mountmanager.h"
|
||||
#include "emummc.h"
|
||||
#include "../tegraexplorer/tconf.h"
|
||||
#include "nx_emmc.h"
|
||||
#include "../keys/keys.h"
|
||||
#include <sec/se.h>
|
||||
#include <libs/fatfs/ff.h>
|
||||
#include "nx_emmc_bis.h"
|
||||
|
||||
void SetKeySlots(){
|
||||
if (TConf.keysDumped){
|
||||
se_aes_key_set(0, dumpedKeys.bis_key[0], AES_128_KEY_SIZE);
|
||||
se_aes_key_set(1, dumpedKeys.bis_key[0] + AES_128_KEY_SIZE, AES_128_KEY_SIZE);
|
||||
se_aes_key_set(2, dumpedKeys.bis_key[1], AES_128_KEY_SIZE);
|
||||
se_aes_key_set(3, dumpedKeys.bis_key[1] + AES_128_KEY_SIZE, AES_128_KEY_SIZE);
|
||||
se_aes_key_set(4, dumpedKeys.bis_key[2], AES_128_KEY_SIZE);
|
||||
se_aes_key_set(5, dumpedKeys.bis_key[2] + AES_128_KEY_SIZE, AES_128_KEY_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void disconnectMMC(){
|
||||
if (TConf.connectedMMCMounted)
|
||||
f_unmount("bis:");
|
||||
TConf.connectedMMCMounted = 0;
|
||||
emummc_storage_end(&emmc_storage);
|
||||
}
|
||||
|
||||
int connectMMC(u8 mmcType){
|
||||
if (mmcType == TConf.currentMMCConnected)
|
||||
return 0;
|
||||
|
||||
//disconnectMMC();
|
||||
emu_cfg.enabled = (mmcType == MMC_CONN_EMMC) ? 0 : 1;
|
||||
int res = emummc_storage_init_mmc(&emmc_storage, &emmc_sdmmc);
|
||||
if (!res)
|
||||
TConf.currentMMCConnected = mmcType;
|
||||
|
||||
return res; // deal with the errors later lol
|
||||
}
|
||||
|
||||
ErrCode_t mountMMCPart(const char *partition){
|
||||
emummc_storage_set_mmc_partition(&emmc_storage, 0);
|
||||
LIST_INIT(curGpt);
|
||||
nx_emmc_gpt_parse(&curGpt, &emmc_storage);
|
||||
emmc_part_t *system_part = nx_emmc_part_find(&curGpt, partition);
|
||||
if (!system_part)
|
||||
return newErrCode(TE_ERR_PARTITION_NOT_FOUND);
|
||||
|
||||
nx_emmc_bis_init(system_part);
|
||||
|
||||
int res = 0;
|
||||
if ((res = f_mount(&emmc_fs, "bis:", 1)))
|
||||
return newErrCode(res);
|
||||
|
||||
nx_emmc_gpt_free(&curGpt);
|
||||
TConf.connectedMMCMounted = 1;
|
||||
return newErrCode(0);
|
||||
}
|
||||
13
source/storage/mountmanager.h
Normal file
13
source/storage/mountmanager.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include <utils/types.h>
|
||||
#include "../err.h"
|
||||
|
||||
enum {
|
||||
MMC_CONN_None = 0,
|
||||
MMC_CONN_EMMC,
|
||||
MMC_CONN_EMUMMC
|
||||
};
|
||||
|
||||
int connectMMC(u8 mmcType);
|
||||
ErrCode_t mountMMCPart(const char *partition);
|
||||
void SetKeySlots();
|
||||
Reference in New Issue
Block a user