1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-23 04:12:04 +00:00

Do partition alignment, bump version to v1.1.1

This commit is contained in:
Such Meme, Many Skill 2019-12-26 23:07:18 +01:00
parent 6518f37b1c
commit 697fc3a086
4 changed files with 15 additions and 10 deletions

View file

@ -6105,10 +6105,10 @@ FRESULT f_fdisk (
void* work /* Pointer to the working buffer (null: use heap memory) */ void* work /* Pointer to the working buffer (null: use heap memory) */
) )
{ {
UINT i, n, sz_cyl, tot_cyl, b_cyl, e_cyl, p_cyl; UINT i, n, sz_cyl, tot_cyl, e_cyl;
BYTE s_hd, e_hd, *p, *buf = (BYTE*)work; BYTE s_hd, e_hd, *p, *buf = (BYTE*)work;
DSTATUS stat; DSTATUS stat;
DWORD sz_disk, sz_part, s_part; DWORD sz_disk, sz_part, s_part, p_cyl, b_cyl;
FRESULT res; FRESULT res;
@ -6134,17 +6134,17 @@ FRESULT f_fdisk (
mem_set(buf, 0, FF_MAX_SS); mem_set(buf, 0, FF_MAX_SS);
p = buf + MBR_Table; b_cyl = 0; p = buf + MBR_Table; b_cyl = 0;
for (i = 0; i < 4; i++, p += SZ_PTE) { for (i = 0; i < 4; i++, p += SZ_PTE) {
p_cyl = (szt[i] <= 100U) ? (DWORD)tot_cyl * (szt[i] / 100) : szt[i] / sz_cyl; /* Number of cylinders */ p_cyl = (szt[i] <= 100U) ? (DWORD)tot_cyl * (szt[i] / 100) : szt[i]; // sz_cyl; /* Number of cylinders */
if (p_cyl == 0) continue; if (p_cyl == 0) continue;
s_part = (DWORD)sz_cyl * b_cyl; s_part = /*(DWORD)sz_cyl * */ b_cyl;
sz_part = (DWORD)sz_cyl * p_cyl; sz_part = /* (DWORD)sz_cyl * */ p_cyl;
if (i == 0) { /* Exclude first track of cylinder 0 */ if (i == 0) { /* Exclude first track of cylinder 0 */
s_hd = 1; s_hd = 1;
s_part += 32768; sz_part -= 32768; s_part += 32768; sz_part -= 32768;
} else { } else {
s_hd = 0; s_hd = 0;
} }
e_cyl = b_cyl + p_cyl - 1; /* End cylinder */ e_cyl = (b_cyl + p_cyl - 1) / sz_cyl; /* End cylinder */
if (e_cyl >= tot_cyl) LEAVE_MKFS(FR_INVALID_PARAMETER); if (e_cyl >= tot_cyl) LEAVE_MKFS(FR_INVALID_PARAMETER);

View file

@ -77,6 +77,7 @@ short returnpkg1ver(){
} }
void disconnect_emmc(){ void disconnect_emmc(){
f_unmount("emmc:");
sdmmc_storage_end(&storage); sdmmc_storage_end(&storage);
} }

View file

@ -26,7 +26,7 @@ void clearscreen(){
gfx_clear_grey(0x1B); gfx_clear_grey(0x1B);
gfx_box(0, 0, 719, 15, COLOR_WHITE); gfx_box(0, 0, 719, 15, COLOR_WHITE);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
gfx_printf("%k%KTegraexplorer v1.1.0%k%K\n", COLOR_DEFAULT, COLOR_WHITE, COLOR_WHITE, COLOR_DEFAULT); gfx_printf("%k%KTegraexplorer v1.1.1%k%K\n", COLOR_DEFAULT, COLOR_WHITE, COLOR_WHITE, COLOR_DEFAULT);
} }
int message(char* message, u32 color){ int message(char* message, u32 color){

View file

@ -145,7 +145,7 @@ int format(int mode){
int res; int res;
bool fatalerror = false; bool fatalerror = false;
DWORD plist[] = {666, 61145088}; DWORD plist[] = {666, 61145088};
u32 timer, totalsectors; u32 timer, totalsectors, alignedsectors, extrasectors;
BYTE work[FF_MAX_SS]; BYTE work[FF_MAX_SS];
DWORD clustsize = 32768; DWORD clustsize = 32768;
BYTE formatoptions = 0; BYTE formatoptions = 0;
@ -163,8 +163,12 @@ int format(int mode){
fatalerror = true; fatalerror = true;
} }
else { else {
plist[0] = totalsectors - 61145088; totalsectors -= plist[1];
gfx_printf("\nStarting SD partitioning:\nTotalSectors: %d\nPartition1 (SD): %d\nPartition2 (EMUMMC): %d\n", totalsectors, plist[0], plist[1]); alignedsectors = (totalsectors / 2048) * 2048;
extrasectors = totalsectors - alignedsectors;
plist[0] = alignedsectors;
plist[1] += extrasectors;
gfx_printf("\nStarting SD partitioning:\nTotalSectors: %d\nPartition1 (SD): %d\nPartition2 (EMUMMC): %d\n", plist[0] + plist[1], plist[0], plist[1]);
} }
} }
else { else {