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); } } }
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; }