diff --git a/configure.py b/configure.py index b264fdec..9313a927 100644 --- a/configure.py +++ b/configure.py @@ -1698,7 +1698,7 @@ config.libs = [ Object(NonMatching, "fa/pf_entry_iterator.c"), Object(NonMatching, "fa/pf_fat.c"), Object(NonMatching, "fa/pf_fat12.c"), - Object(NonMatching, "fa/pf_fat16.c"), + Object(Matching, "fa/pf_fat16.c"), Object(Matching, "fa/pf_fat32.c"), Object(Matching, "fa/pf_fatfs.c"), Object(NonMatching, "fa/pf_file.c"), @@ -1706,7 +1706,7 @@ config.libs = [ Object(Matching, "fa/pf_sector.c"), Object(NonMatching, "fa/pf_volume.c"), Object(Matching, "fa/pf_volume_apiadd.c"), - Object(NonMatching, "fa/pf_cp932.c"), + Object(Matching, "fa/pf_cp932.c"), Object(Matching, "fa/pf_api_util.c"), Object(Matching, "fa/pf_attach.c"), Object(Matching, "fa/pf_buffering.c"), @@ -1800,7 +1800,7 @@ config.libs = [ Object(Matching, "fa/pf_w_rmdir.c"), Object(Matching, "fa/pf_w_xdivide.c"), Object(Matching, "fa/pf_filelock.c"), - Object(NonMatching, "fa/pf_stub.c"), + Object(Matching, "fa/pf_stub.c"), Object(Matching, "fa/pf_system.c"), Object(Matching, "fa/pf_stub_standard.c"), Object(Matching, "fa/pfs_attach.c"), @@ -1851,11 +1851,11 @@ config.libs = [ Object(Matching, "fa/api/FASetThreadPriority.c"), Object(Matching, "fa/api/FAUnmount.c"), - Object(NonMatching, "fa/kernel/pfk_api.c"), + Object(Matching, "fa/kernel/pfk_api.c"), Object(NonMatching, "fa/driver/nand_drv.c"), Object(NonMatching, "fa/driver/sd_drv.c"), - Object(NonMatching, "fa/driver/pfd_cmn.c"), + Object(Matching, "fa/driver/pfd_cmn.c"), Object(NonMatching, "fa/driver/msc_drv.c"), Object(NonMatching, "fa/msc/puh_msc.c"), diff --git a/libs/RVL_SDK/src/fa/driver/sd_drv.c b/libs/RVL_SDK/src/fa/driver/sd_drv.c index f217d23d..22c74da1 100644 --- a/libs/RVL_SDK/src/fa/driver/sd_drv.c +++ b/libs/RVL_SDK/src/fa/driver/sd_drv.c @@ -554,7 +554,7 @@ s32 pfd_sddrv_get_disk_info(FADisk* disk, FADiskInfo* disk_info) { disk_info->heads = 0; disk_info->sectorsPerTrack = 0; disk_info->formatParam = 0; - return 0; + return result; } s32 pfd_sddrv_init_drv_tbl(FADiskTbl* disk_table, u32 extended) { diff --git a/libs/RVL_SDK/src/fa/pdm_partition.c b/libs/RVL_SDK/src/fa/pdm_partition.c index f4670e2b..fba3b7ed 100644 --- a/libs/RVL_SDK/src/fa/pdm_partition.c +++ b/libs/RVL_SDK/src/fa/pdm_partition.c @@ -10,24 +10,34 @@ pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mb pf_s16 index; pf_u32 start[4]; pf_u32 count[4]; + pf_u32* p_start; + pf_u32* p_count; *p_is_mbr = 0; if (buf[510] != 0x55 || buf[511] != 0xAA) { return 2; } + p_start = start; + p_count = count; for (index = 0; index < 4; index++) { - start[index] = 0; - start[index] = (((pf_u32)buf[456] << 16) + buf[454]) + (((pf_u32)buf[457] << 24) + ((pf_u32)buf[455] << 8)); - count[index] = (((pf_u32)buf[460] << 16) + buf[458]) + (((pf_u32)buf[461] << 24) + ((pf_u32)buf[459] << 8)); - if (start[index] != 0 && count[index] != 0) { + *p_start = 0; + *p_start = (((pf_u32)buf[456] << 16) + buf[454]) + (((pf_u32)buf[457] << 24) + ((pf_u32)buf[455] << 8)); + *p_count = (((pf_u32)buf[460] << 16) + buf[458]) + (((pf_u32)buf[461] << 24) + ((pf_u32)buf[459] << 8)); + if (*p_start != 0 && *p_count != 0) { if (index == 0) { *p_is_mbr = 1; } } else { if (index == 0) { return 2; } } + p_start++; + p_count++; buf += 16; } + p_start = start; + p_count = count; for (index = 0; index < 4; index++) { - if (start[index] + count[index] > total) { + if (*p_start + *p_count > total) { if (index == 0) { *p_is_mbr = 0; } return 2; } + p_start++; + p_count++; } return 0; } diff --git a/libs/RVL_SDK/src/fa/pf_cp932.c b/libs/RVL_SDK/src/fa/pf_cp932.c index a1c08bdb..66289d7f 100644 --- a/libs/RVL_SDK/src/fa/pf_cp932.c +++ b/libs/RVL_SDK/src/fa/pf_cp932.c @@ -1,4 +1,3 @@ -#define PF_FA_CP932_TABLE #define VFiPFCODE_CP932_OEM2Unicode PFCODE_CP932_OEM2Unicode #define VFiPFCODE_CP932_OEMCharWidth PFCODE_CP932_OEMCharWidth #define VFiPFCODE_CP932_Unicode2OEM PFCODE_CP932_Unicode2OEM diff --git a/libs/RVL_SDK/src/fa/pf_dir.c b/libs/RVL_SDK/src/fa/pf_dir.c index b452470a..f48f7f14 100644 --- a/libs/RVL_SDK/src/fa/pf_dir.c +++ b/libs/RVL_SDK/src/fa/pf_dir.c @@ -468,7 +468,7 @@ extern pf_s32 PFPATH_cmpName(const pf_s8* short_name, PFDIR_STR* pattern, pf_u32 extern pf_s32 PFPATH_cmpNameUni(const pf_u16* name, PFDIR_STR* pattern); pf_s32 PFDIR_p_mkdir(PF_VOLUME* volume, PF_STR* path, pf_u32 option, PF_DTA* data) { PF_DIR_ENT parent_entry; - pf_u32 index; + PF_DIR_ENT entry; pf_s8 normalized_name[512]; PF_ENT_ITER iter; PFDIR_FFD ffd; @@ -488,8 +488,8 @@ pf_s32 PFDIR_p_mkdir(PF_VOLUME* volume, PF_STR* path, pf_u32 option, PF_DTA* dat pf_u16 filename_length; pf_u16 original_offset; pf_u8 checksum; - PF_DIR_ENT entry; pf_u32 cluster; + pf_u32 index; pf_u32 lfn_index; pf_u32* next_sector; pf_s32 error; @@ -1070,7 +1070,7 @@ pf_s32 PFDIR_p_move(PF_VOLUME* volume, PF_STR* old_path, PF_STR* new_path) { error = PFENT_ITER_GetEntryOfPath(&source_iter, &source_entry, volume, (PFDIR_STR*)old_path, 0); if (error != 0) { return error; } - if (PFPATH_GetVolumeFromPath(new_path) != volume) { return 0x1F; } + if (volume != PFPATH_GetVolumeFromPath(new_path)) { return 0x1F; } error = PFPATH_SplitPath((PFDIR_STR*)new_path, &directory, &destination_name); if (error != 0) { return error; } if (PFSTR_GetCodeMode(&destination_name) == 2) { diff --git a/libs/RVL_SDK/src/fa/pf_entry_iterator.c b/libs/RVL_SDK/src/fa/pf_entry_iterator.c index cdd22745..97a16b9b 100644 --- a/libs/RVL_SDK/src/fa/pf_entry_iterator.c +++ b/libs/RVL_SDK/src/fa/pf_entry_iterator.c @@ -728,20 +728,23 @@ pf_s32 PFENT_ITER_GetEntryOfIter(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent) { pf_s32 PFENT_ITER_GetLFNEntryName(PFITER_ENT_ITER* p_iter, PF_DIR_ENT* p_ent) { pf_u32 i; + pf_u32 index; pf_s32 err; if (p_ent->num_entry_LFNs != 0 && !(p_ent->small_letter_flag & 0x18)) { + index = 0; for (i = 0; i < p_ent->num_entry_LFNs; ++i) { pf_u16* destination; err = PFENT_ITER_Retreat(p_iter, 0); if (err != 0) return err; err = PFENT_ITER_LoadEntry(p_iter); if (err != 0) return err; - destination = &p_ent->long_name[(i * 26U) / 2U]; + destination = &p_ent->long_name[index]; pf_memcpy(destination, &p_iter->buf[1], 10); pf_memcpy(destination + 5, &p_iter->buf[14], 12); pf_memcpy(destination + 11, &p_iter->buf[28], 4); + index += 13; } - p_ent->long_name[(p_ent->num_entry_LFNs * 26U) / 2U] = 0; + p_ent->long_name[index] = 0; } return 0; } diff --git a/libs/RVL_SDK/src/fa/pf_fat12.c b/libs/RVL_SDK/src/fa/pf_fat12.c index 182c6b12..52b844f0 100644 --- a/libs/RVL_SDK/src/fa/pf_fat12.c +++ b/libs/RVL_SDK/src/fa/pf_fat12.c @@ -126,6 +126,7 @@ pf_s32 PFFAT12_WriteFATEntryWithBuf(PF_VOLUME* p_vol, pf_s16 cluster, pf_u16 val pf_s32 fat_offset; pf_u32 fat_sector; pf_s32 result; + pf_u32 next_sector; fat_offset = (pf_u16)(cluster + (cluster >> 1)); fat_sector = (pf_u16)(p_vol->bpb.active_FAT_sector + (fat_offset >> p_vol->bpb.log2_bytes_per_sector)); offset_in_sector = fat_offset & (p_vol->bpb.bytes_per_sector - 1); @@ -146,10 +147,10 @@ pf_s32 PFFAT12_WriteFATEntryWithBuf(PF_VOLUME* p_vol, pf_s16 cluster, pf_u16 val p_page->p_buf[(pf_u16)offset_in_sector] = (p_page->p_buf[(pf_u16)offset_in_sector] & 0xF) | ((value << 4) & 0xF0); if ((pf_u16)offset_in_sector == (pf_u32)(p_vol->bpb.bytes_per_sector - 1)) { FLUSH_FAT_BUFFER(); - offset_in_sector = fat_sector + 1; - err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, offset_in_sector, 0, p_vol->bpb.bytes_per_sector); + next_sector = fat_sector + 1; + err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, next_sector, 0, p_vol->bpb.bytes_per_sector); if (err != 0) { return err; } - p_page->sector = offset_in_sector; + p_page->sector = next_sector; p_page->p_buf[0] = value >> 4; } else { ((pf_u16)offset_in_sector + p_page->p_buf)[1] = value >> 4; @@ -158,10 +159,10 @@ pf_s32 PFFAT12_WriteFATEntryWithBuf(PF_VOLUME* p_vol, pf_s16 cluster, pf_u16 val p_page->p_buf[(pf_u16)offset_in_sector] = value; if ((pf_u16)offset_in_sector == (pf_u32)(p_vol->bpb.bytes_per_sector - 1)) { FLUSH_FAT_BUFFER(); - offset_in_sector = fat_sector + 1; - err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, offset_in_sector, 0, p_vol->bpb.bytes_per_sector); + next_sector = fat_sector + 1; + err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, next_sector, 0, p_vol->bpb.bytes_per_sector); if (err != 0) { return err; } - p_page->sector = offset_in_sector; + p_page->sector = next_sector; p_page->p_buf[0] = (p_page->p_buf[0] & 0xF0) | ((pf_u8)(value >> 8)); } else { ((pf_u16)offset_in_sector + p_page->p_buf)[1] = (((pf_u16)offset_in_sector + p_page->p_buf)[1] & 0xF0) | ((pf_u8)(value >> 8)); diff --git a/libs/RVL_SDK/src/fa/pf_fat16.c b/libs/RVL_SDK/src/fa/pf_fat16.c index be63b1a0..38d11812 100644 --- a/libs/RVL_SDK/src/fa/pf_fat16.c +++ b/libs/RVL_SDK/src/fa/pf_fat16.c @@ -102,7 +102,7 @@ pf_s32 PFFAT16_WriteFATEntryWithBuf(PF_VOLUME* p_vol, pf_u32 cluster, pf_u32 val err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, fat_sector, 0, p_vol->bpb.bytes_per_sector); } p_page->p_buf[offset_in_sector] = value; - (offset_in_sector + p_page->p_buf)[1] = value >> 8; + p_page->p_buf[offset_in_sector + 1] = value >> 8; if (err != 0) { result = err; } diff --git a/libs/RVL_SDK/src/fa/pf_stub.c b/libs/RVL_SDK/src/fa/pf_stub.c index a9b4e558..ee61864f 100644 --- a/libs/RVL_SDK/src/fa/pf_stub.c +++ b/libs/RVL_SDK/src/fa/pf_stub.c @@ -58,7 +58,7 @@ void* pfstub_entry(void* argument) { pf_vol_set.context_id = message->task_id; if (message->operation >= 0 && message->operation < 100) { pfstub_call_function_standard(message); - } else if (received->operation >= 100 && received->operation < 200) { + } else if (((s32*)received)[1] >= 100 && ((s32*)received)[1] < 200) { pfstub_call_function_unicode(message); } else { message->result.status = -1;