static void win_get_nex_vol(int offset) { m_volume_index += offset; ASSERT(storage_get_volume_count()) if((UINT32)m_volume_index >= storage_get_volume_count()) m_volume_index = 0; if(m_volume_index < 0) m_volume_index = storage_get_volume_count()-1; }
void win_tms_enter_key(POBJECT_HEAD pObj,UINT8 id) { #if (defined(MULTI_PARTITION_SUPPORT) && !defined(DISK_MANAGER_SUPPORT)) if (id == 4) { OSD_RECT rect; COM_POP_LIST_PARAM_T param; rect.uLeft = CON_L + TXTS_L_OF - 100; rect.uWidth = TXTS_W+80; rect.uHeight = 300; param.selecttype = POP_LIST_SINGLESELECT; if(storage_get_volume_count()<=1) return; rect.uTop = CON_T + (CON_H + CON_GAP) * (id - 1); param.cur = m_volume_index; m_volume_index = win_com_open_sub_list(POP_LIST_TYPE_VOLUMELIST,&rect,¶m); win_set_vol_string(&tms_item_txtset4); OSD_TrackObject(pObj, C_UPDATE_ALL); } #endif }
void win_tms_right_key(POBJECT_HEAD pObj,UINT8 id) { if(id == 1) { sys_data_set_tms(!sys_data_get_tms()); win_tms_set_string(sys_data_get_tms(),&tms_item_txtset1); tms_set_tms2rec_item_active(TRUE); } else if (id == 2) { sys_data_set_tms2rec(!sys_data_get_tms2rec()); win_tms_set_string(sys_data_get_tms2rec(),&tms_item_txtset2); } else if (id == 3) { sys_data_set_rec_type(!sys_data_get_rec_type()); win_set_rec_type_string(sys_data_get_rec_type(),&tms_item_txtset3); } #if (defined(MULTI_PARTITION_SUPPORT) && !defined(DISK_MANAGER_SUPPORT)) else if (id == 4) { if(storage_get_volume_count()<=1) return; win_get_nex_vol(1); win_set_vol_string(&tms_item_txtset4); } #endif OSD_TrackObject(pObj,C_UPDATE_ALL); }
void win_pvr_vol_invalid_msg() { UINT8 back_saved; win_popup_choice_t choice; if(storage_get_volume_count() == 0) return; if(m_pvr_vol_error < -1) { char hint[128]; char name_old[64]; char name_new[64]; UINT8 device_type = sys_data_get_storage_type(); UINT8 device_sub = sys_data_get_storage_sub_dev(); UINT8 device_part = sys_data_get_storage_partition(); storage_type2osd_string2(device_type, device_sub, device_part,name_old); storage_type2osd_string2(m_sto_device_type, m_sto_device_sub, m_sto_device_part,name_new); if(m_pvr_vol_error == -2) sprintf(hint, "Cann't find last PVR %s, auto select to %s!",name_old, name_new); else if(m_pvr_vol_error == -3) sprintf(hint, "Cann't find any PVR partition!"); else ASSERT(0); win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(hint, NULL, 0); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved); if(choice == WIN_POP_CHOICE_YES) { sys_data_set_storage(m_sto_device_type, m_sto_device_sub, m_sto_device_part); } } }
void win_pvr_vol_save() { char new_volume[32]; UINT8 back_saved; win_popup_choice_t choice; PVR_VOL_INFO volume; if(m_volume_index < 0 || storage_get_volume_count()== 0) return; if(storage_get_pvr_volume(m_volume_index, &volume)<0) return; if( volume.type == m_sto_device_type && volume.sub_type == m_sto_device_sub && volume.partition_idx == m_sto_device_part) { return; } win_compopup_init(WIN_POPUP_TYPE_OKNO); win_compopup_set_msg(NULL, NULL, RS_ARE_YOU_SURE_TO_CHANGE_PVR_PARTION); win_compopup_set_default_choice(WIN_POP_CHOICE_NO); choice = win_compopup_open_ext(&back_saved); if (choice == WIN_POP_CHOICE_YES) { if(storage_change_pvr_volume(volume.type,volume.sub_type,volume.partition_idx)>=0) sys_data_set_storage(volume.type,volume.sub_type,volume.partition_idx); } }
static PRESULT hddfmt_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT16 title_id; POBJECT_HEAD nextObj; switch(event) { case EVN_PRE_OPEN: if(hddfmt_window_active) { hddfmt_window_active= TRUE; title_id = RS_STORAGE_FORMAT; OSD_SetContainerNextObj(&g_win_hddformat, (POBJECT_HEAD)&hddfmt_item_con1); } else { title_id = RS_HDD_NFORMATION; hddfmt_window_active = FALSE; OSD_SetContainerNextObj(&g_win_hddformat, NULL); } hddfmt_vol_init(); hddfmt_set_vol_string(&hddfmt_item_txtset1); wincom_open_title(pObj,title_id,0); break; case EVN_POST_OPEN: break; case EVN_PRE_CLOSE: /* Make OSD not flickering */ *((UINT32*)param2) &= ~C_CLOSE_CLRBACK_FLG; break; case EVN_POST_CLOSE: break; case EVN_POST_DRAW: win_hddfmt_draw_disk_infor(); break; case EVN_MSG_GOT: if(param1 == CTRL_MSG_SUBTYPE_CMD_STO && param2 == USB_STATUS_OVER) { storage_dev_mount_hint(1); hddfmt_vol_init(); if(storage_get_volume_count() == 0) { ret = PROC_LEAVE; } else if(hddfmt_window_active) { hddfmt_set_vol_string(&hddfmt_item_txtset1); OSD_TrackObject((POBJECT_HEAD)&g_win_hddformat, C_UPDATE_ALL); win_hddfmt_draw_disk_infor(); } } break; } return ret; }
static BOOL hddfmt_get_next_vol(int offset) { int max_volume = storage_get_volume_count(); if(max_volume == 0) return FALSE; hddfmt_cur_volume += offset; if(hddfmt_cur_volume >= max_volume) hddfmt_cur_volume = 0; if(hddfmt_cur_volume < 0) hddfmt_cur_volume = max_volume-1; return TRUE; }
static void hddfmt_vol_init() { UINT8 type; UINT8 sub_type; UINT8 partition; int max_volume; storage_get_device_info(STORAGE_TYPE_ALL); max_volume = storage_get_volume_count(); storage_get_cur_pvr_sto_info(&type, &sub_type, &partition); hddfmt_cur_volume = storage_find_volume(type, sub_type, partition); if(max_volume >= 1 && hddfmt_cur_volume < 0) { // cann't fint pvr partition, get the first partition hddfmt_cur_volume = 0; } }
static BOOL win_pvr_vol_init() { m_volume_index = -1; m_pvr_vol_error = 0; storage_get_device_info(STORAGE_TYPE_SD); if(storage_get_volume_count() == 0) { set_container_active(&tms_item_con4, FALSE); m_pvr_vol_error = -1; return FALSE; } m_sto_device_type = sys_data_get_storage_type(); m_sto_device_sub = sys_data_get_storage_sub_dev(); m_sto_device_part = sys_data_get_storage_partition(); // check the system data setting valid. m_volume_index = storage_find_volume(m_sto_device_type,m_sto_device_sub,m_sto_device_part); if(m_volume_index < 0) { m_pvr_vol_error = -2; libc_printf("cann't find the origial PVR partition(%d:%d:%d)\n",m_sto_device_type,m_sto_device_sub,m_sto_device_part); // invalid config, load current pvr setting. storage_get_cur_pvr_sto_info(&m_sto_device_type , &m_sto_device_sub, &m_sto_device_part); // check it again. m_volume_index = storage_find_volume(m_sto_device_type,m_sto_device_sub,m_sto_device_part); if(m_volume_index < 0) { ASSERT(0); m_sto_device_type = 0; m_sto_device_sub = 0; m_sto_device_part = 0; m_pvr_vol_error = -3; libc_printf("cann't find the new PVR partition(%d:%d:%d)\n",m_sto_device_type,m_sto_device_sub,m_sto_device_part); return FALSE; } libc_printf("find the new PVR partition(%d:%d:%d)\n",m_sto_device_type,m_sto_device_sub,m_sto_device_part); } return TRUE; }
void hddfmt_vol_enter_key(POBJECT_HEAD pObj,UINT8 id) { OSD_RECT rect; COM_POP_LIST_PARAM_T param; rect.uLeft = CON_L + TXTS_L_OF - 100; rect.uWidth = TXTS_W+80; rect.uHeight = 300; param.selecttype = POP_LIST_SINGLESELECT; if(storage_get_volume_count()<=1 || hddfmt_cur_volume < 0) return; rect.uTop = CON_T + (CON_H + CON_GAP) * 2; param.cur = hddfmt_cur_volume; hddfmt_cur_volume = win_com_open_sub_list(POP_LIST_TYPE_VOLUMELIST,&rect,¶m); hddfmt_set_vol_string(&hddfmt_item_txtset1); OSD_TrackObject(pObj, C_UPDATE_ALL); win_hddfmt_draw_disk_infor(); }