emuSD & other fixes
This commit is contained in:
@@ -66,6 +66,8 @@ static bool _boot_storage_initialize(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void _boot_storage_end(bool deinit){
|
static void _boot_storage_end(bool deinit){
|
||||||
|
BYTE prev_drive = drive_cur;
|
||||||
|
|
||||||
if(boot_storage_get_mounted()){
|
if(boot_storage_get_mounted()){
|
||||||
switch(drive_cur){
|
switch(drive_cur){
|
||||||
case DRIVE_SD:
|
case DRIVE_SD:
|
||||||
@@ -82,7 +84,7 @@ static void _boot_storage_end(bool deinit){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(deinit){
|
if(deinit){
|
||||||
switch(drive_cur){
|
switch(prev_drive){
|
||||||
case DRIVE_SD:
|
case DRIVE_SD:
|
||||||
sd_end();
|
sd_end();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void emusd_load_cfg()
|
|||||||
}
|
}
|
||||||
|
|
||||||
LIST_INIT(ini_sections);
|
LIST_INIT(ini_sections);
|
||||||
if(ini_parse(&ini_sections, "emuSD/emusd.ini", false))
|
if(!ini_parse(&ini_sections, "emuSD/emusd.ini", false))
|
||||||
{
|
{
|
||||||
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
|
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
|
||||||
{
|
{
|
||||||
@@ -77,6 +77,7 @@ bool emusd_mount() {
|
|||||||
EPRINTFARGS("emusd mount fail %d", res);
|
EPRINTFARGS("emusd mount fail %d", res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
emusd_mounted = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,16 +90,15 @@ bool emusd_unmount() {
|
|||||||
bool emusd_set_path(char *path) {
|
bool emusd_set_path(char *path) {
|
||||||
FIL fp;
|
FIL fp;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
// TODO: use emu_sd.file_path instead
|
strcpy(emu_sd_cfg.emummc_file_based_path, "");
|
||||||
strcat(emu_sd_cfg.emummc_file_based_path, "");
|
|
||||||
strcpy(emu_sd_cfg.emummc_file_based_path, path);
|
strcpy(emu_sd_cfg.emummc_file_based_path, path);
|
||||||
strcat(emu_sd_cfg.emummc_file_based_path, "/raw_emmc_based");
|
strcat(emu_sd_cfg.emummc_file_based_path, "/raw_based");
|
||||||
if(!f_open(&fp, emu_sd_cfg.emummc_file_based_path, FA_READ))
|
if(!f_open(&fp, emu_sd_cfg.emummc_file_based_path, FA_READ))
|
||||||
{
|
{
|
||||||
if(!f_read(&fp, &emu_sd_cfg.sector, 4, NULL)){
|
if(!f_read(&fp, &emu_sd_cfg.sector, 4, NULL)){
|
||||||
if(emu_sd_cfg.sector){
|
if(emu_sd_cfg.sector){
|
||||||
found = true;
|
found = true;
|
||||||
emu_sd_cfg.enabled = 4;
|
emu_sd_cfg.enabled = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,11 +266,15 @@ void *emusd_file_read(const char *path, u32 *fsize) {
|
|||||||
strcpy(path1, "emusd:");
|
strcpy(path1, "emusd:");
|
||||||
strcat(path1, path);
|
strcat(path1, path);
|
||||||
FIL fp;
|
FIL fp;
|
||||||
if (!emusd_get_mounted())
|
if (!emusd_get_mounted()) {
|
||||||
|
free(path1);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (f_open(&fp, path, FA_READ) != FR_OK)
|
if (f_open(&fp, path1, FA_READ) != FR_OK) {
|
||||||
|
free(path1);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
u32 size = f_size(&fp);
|
u32 size = f_size(&fp);
|
||||||
if (fsize)
|
if (fsize)
|
||||||
@@ -282,11 +286,12 @@ void *emusd_file_read(const char *path, u32 *fsize) {
|
|||||||
{
|
{
|
||||||
free(buf);
|
free(buf);
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
|
free(path1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
|
free(path1);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1040,12 +1040,17 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 r
|
|||||||
|
|
||||||
sdmmc_storage_t *emu_storage = drive == DRIVE_SD ? &sd_storage : &emmc_storage;
|
sdmmc_storage_t *emu_storage = drive == DRIVE_SD ? &sd_storage : &emmc_storage;
|
||||||
|
|
||||||
boot_storage_mount();
|
if (drive == DRIVE_SD)
|
||||||
|
|
||||||
if (drive == DRIVE_SD && !sd_initialize(false))
|
|
||||||
{
|
{
|
||||||
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init SD!#");
|
if (!sd_mount())
|
||||||
goto out;
|
{
|
||||||
|
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init SD!#");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boot_storage_mount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!emmc_initialize(false))
|
if (!emmc_initialize(false))
|
||||||
@@ -1168,6 +1173,9 @@ out_failed:
|
|||||||
out:
|
out:
|
||||||
free(txt_buf);
|
free(txt_buf);
|
||||||
free(gui->base_path);
|
free(gui->base_path);
|
||||||
boot_storage_unmount();
|
if (drive == DRIVE_SD)
|
||||||
|
sd_unmount();
|
||||||
|
else
|
||||||
|
boot_storage_unmount();
|
||||||
emmc_end();
|
emmc_end();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ void load_emusd_cfg(emusd_cfg_t *emu_info){
|
|||||||
|
|
||||||
// Parse emuMMC configuration.
|
// Parse emuMMC configuration.
|
||||||
LIST_INIT(ini_sections);
|
LIST_INIT(ini_sections);
|
||||||
if (!ini_parse(&ini_sections, "emuSD/emusd.ini", false))
|
if (ini_parse(&ini_sections, "emuSD/emusd.ini", false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
|
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
|
||||||
@@ -264,7 +264,7 @@ int create_emusd(int part_idx, u32 sector_mbr, u32 sector_start, u32 sector_size
|
|||||||
f_mkdir(path);
|
f_mkdir(path);
|
||||||
s_printf(path + strlen(path), "/RAW_%s%d", drive == DRIVE_SD ? "SD" : "EMMC", part_idx);
|
s_printf(path + strlen(path), "/RAW_%s%d", drive == DRIVE_SD ? "SD" : "EMMC", part_idx);
|
||||||
f_mkdir(path);
|
f_mkdir(path);
|
||||||
strcat(path, "/raw_emmc_based");
|
strcat(path, drive == DRIVE_SD ? "/raw_based" : "/raw_emmc_based");
|
||||||
|
|
||||||
f_open(&f, path, FA_CREATE_ALWAYS | FA_WRITE);
|
f_open(&f, path, FA_CREATE_ALWAYS | FA_WRITE);
|
||||||
f_write(&f, §or_mbr, 4, NULL);
|
f_write(&f, §or_mbr, 4, NULL);
|
||||||
|
|||||||
@@ -1281,6 +1281,7 @@ static void _create_tab_about(lv_theme_t * th, lv_obj_t * parent)
|
|||||||
" (c) 2018-2026, #C7EA46 CTCaer#\n"
|
" (c) 2018-2026, #C7EA46 CTCaer#\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#C7EA46 Nyx# (c) 2019-2026, #C7EA46 CTCaer#\n"
|
"#C7EA46 Nyx# (c) 2019-2026, #C7EA46 CTCaer#\n"
|
||||||
|
"#C7EA46 Pro# (c) 2025-2026, #C7EA46 Nautilus#, #C7EA46 naga#\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Thanks to: #00CCFF derrek, nedwill, plutoo, #\n"
|
"Thanks to: #00CCFF derrek, nedwill, plutoo, #\n"
|
||||||
" #00CCFF shuffle2, smea, thexyz, yellows8 #\n"
|
" #00CCFF shuffle2, smea, thexyz, yellows8 #\n"
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ static void _create_mbox_emummc_emmc_raw()
|
|||||||
// TODO: should check for emummc guid instead
|
// TODO: should check for emummc guid instead
|
||||||
// TODO: currently hard limited to 3 entries
|
// TODO: currently hard limited to 3 entries
|
||||||
s32 gpt_idx = gpt_get_part_by_name(gpt, "emummc", -1);
|
s32 gpt_idx = gpt_get_part_by_name(gpt, "emummc", -1);
|
||||||
while(gpt_idx != -1){
|
while(gpt_idx != -1 && gpt_ctx.emmc_part_cnt < 3){
|
||||||
u32 offset = gpt->entries[gpt_idx].lba_start;
|
u32 offset = gpt->entries[gpt_idx].lba_start;
|
||||||
u32 size = gpt->entries[gpt_idx].lba_end - gpt->entries[gpt_idx].lba_start + 1;
|
u32 size = gpt->entries[gpt_idx].lba_end - gpt->entries[gpt_idx].lba_start + 1;
|
||||||
|
|
||||||
|
|||||||
@@ -4381,15 +4381,12 @@ lv_res_t create_window_partition_manager(lv_obj_t *btn, u8 drive)
|
|||||||
lv_obj_set_hidden(lbl_hos_os, !has_hos_os);
|
lv_obj_set_hidden(lbl_hos_os, !has_hos_os);
|
||||||
|
|
||||||
lv_coord_t spacing;
|
lv_coord_t spacing;
|
||||||
if(drive == DRIVE_EMMC){
|
if(has_hos_os){
|
||||||
if(has_hos_os){
|
// adjust spacing when we have 6 sliders
|
||||||
// adjust spacing when we have 5 sliders
|
spacing = (LV_DPI / 3) - (lv_obj_get_height(lbl_hos_os) + LV_DPI / 3) / 3;
|
||||||
spacing = (LV_DPI / 3) - (lv_obj_get_height(lbl_hos_os) + LV_DPI / 3) / 3;
|
|
||||||
}else{
|
|
||||||
spacing = (LV_DPI / 3) - (lv_obj_get_height(lbl_hos_os) + LV_DPI / 3) / 4;
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
spacing = LV_DPI / 3;
|
// 5 sliders
|
||||||
|
spacing = (LV_DPI / 3) - (lv_obj_get_height(lbl_hos_os) + LV_DPI / 3) / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_t *lbl_hos = lv_label_create(h1, NULL);
|
lv_obj_t *lbl_hos = lv_label_create(h1, NULL);
|
||||||
@@ -4404,11 +4401,11 @@ lv_res_t create_window_partition_manager(lv_obj_t *btn, u8 drive)
|
|||||||
lv_obj_t *lbl_emu_sd = lv_label_create( h1, lbl_hos);
|
lv_obj_t *lbl_emu_sd = lv_label_create( h1, lbl_hos);
|
||||||
lv_label_set_static_text(lbl_emu_sd, "#FF00D6 " SYMBOL_DOT " emuSD:#");
|
lv_label_set_static_text(lbl_emu_sd, "#FF00D6 " SYMBOL_DOT " emuSD:#");
|
||||||
lv_obj_align(lbl_emu_sd, lbl_emu, LV_ALIGN_OUT_BOTTOM_LEFT, 0, spacing);
|
lv_obj_align(lbl_emu_sd, lbl_emu, LV_ALIGN_OUT_BOTTOM_LEFT, 0, spacing);
|
||||||
lv_obj_set_hidden(lbl_emu_sd, drive == DRIVE_SD);
|
lv_obj_set_hidden(lbl_emu_sd, false);
|
||||||
|
|
||||||
lv_obj_t *lbl_l4t = lv_label_create(h1, lbl_hos);
|
lv_obj_t *lbl_l4t = lv_label_create(h1, lbl_hos);
|
||||||
lv_label_set_static_text(lbl_l4t, "#00DDFF "SYMBOL_DOT" Linux (EXT4):#");
|
lv_label_set_static_text(lbl_l4t, "#00DDFF "SYMBOL_DOT" Linux (EXT4):#");
|
||||||
lv_obj_align(lbl_l4t, drive == DRIVE_SD ? lbl_emu : lbl_emu_sd, LV_ALIGN_OUT_BOTTOM_LEFT, 0, spacing);
|
lv_obj_align(lbl_l4t, lbl_emu_sd, LV_ALIGN_OUT_BOTTOM_LEFT, 0, spacing);
|
||||||
|
|
||||||
lv_obj_t *lbl_and = lv_label_create(h1, lbl_hos);
|
lv_obj_t *lbl_and = lv_label_create(h1, lbl_hos);
|
||||||
lv_label_set_static_text(lbl_and, "#FF8000 "SYMBOL_DOT" Android (USER):#");
|
lv_label_set_static_text(lbl_and, "#FF8000 "SYMBOL_DOT" Android (USER):#");
|
||||||
@@ -4495,7 +4492,7 @@ lv_res_t create_window_partition_manager(lv_obj_t *btn, u8 drive)
|
|||||||
lv_slider_set_style(slider_emu_sd, LV_SLIDER_STYLE_KNOB, &bar_emu_sd_btn);
|
lv_slider_set_style(slider_emu_sd, LV_SLIDER_STYLE_KNOB, &bar_emu_sd_btn);
|
||||||
lv_obj_align(slider_emu_sd, lbl_emu_sd, LV_ALIGN_IN_LEFT_MID, LV_DPI * 3, 0);
|
lv_obj_align(slider_emu_sd, lbl_emu_sd, LV_ALIGN_IN_LEFT_MID, LV_DPI * 3, 0);
|
||||||
lv_slider_set_action(slider_emu_sd, _action_slider_emu_sd);
|
lv_slider_set_action(slider_emu_sd, _action_slider_emu_sd);
|
||||||
lv_obj_set_hidden(slider_emu_sd, drive == DRIVE_SD);
|
lv_obj_set_hidden(slider_emu_sd, false);
|
||||||
part_info.slider_emu_sd = slider_emu_sd;
|
part_info.slider_emu_sd = slider_emu_sd;
|
||||||
|
|
||||||
// Create HOS OS size lable
|
// Create HOS OS size lable
|
||||||
@@ -4541,7 +4538,7 @@ lv_res_t create_window_partition_manager(lv_obj_t *btn, u8 drive)
|
|||||||
lv_obj_t *lbl_sl_emu_sd = lv_label_create(h1, lbl_sl_hos);
|
lv_obj_t *lbl_sl_emu_sd = lv_label_create(h1, lbl_sl_hos);
|
||||||
lv_label_set_text(lbl_sl_emu_sd, "#FF00D6 0 GiB#");
|
lv_label_set_text(lbl_sl_emu_sd, "#FF00D6 0 GiB#");
|
||||||
lv_obj_align(lbl_sl_emu_sd, slider_emu_sd, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 4 / 7, 0);
|
lv_obj_align(lbl_sl_emu_sd, slider_emu_sd, LV_ALIGN_OUT_RIGHT_MID, LV_DPI * 4 / 7, 0);
|
||||||
lv_obj_set_hidden(lbl_sl_emu_sd, drive == DRIVE_SD);
|
lv_obj_set_hidden(lbl_sl_emu_sd, false);
|
||||||
part_info.lbl_emu_sd = lbl_sl_emu_sd;
|
part_info.lbl_emu_sd = lbl_sl_emu_sd;
|
||||||
|
|
||||||
// Set partition manager notes.
|
// Set partition manager notes.
|
||||||
|
|||||||
Reference in New Issue
Block a user