Compare commits
1 Commits
agent/data
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f744713d94 |
@@ -53,9 +53,9 @@ Progress
|
||||
<!-- progress:start -->
|
||||
| Decompiled | Matched | Linked | Data |
|
||||
|:---:|:---:|:---:|:---:|
|
||||
| 91.85% | 81.00% | 57.19% | 88.79% |
|
||||
| 91.87% | 81.01% | 57.19% | 88.79% |
|
||||
|
||||
units 760/1027 complete, functions 11627/12563 matched.
|
||||
units 760/1027 complete, functions 11629/12563 matched.
|
||||
|
||||
decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data
|
||||
<!-- progress:end -->
|
||||
|
||||
@@ -420,7 +420,7 @@ s32 fa_nanddrv_NotifyNANDFile(const char* path, u32 size) {
|
||||
if (pf_strcmp(info->path, path) == 0) { return 0; }
|
||||
if (nanddisk_info[index].disk == 0) {
|
||||
pf_strcpy(info->path, path);
|
||||
info->file_size = size;
|
||||
nanddisk_info[index].file_size = size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,9 +219,19 @@ const PFD_SDDRV_SIZE_DEPEND sddrv_size_depend_tbl[14] = {
|
||||
{0x007e0000, 0x04000000, 0x00002000, 0x000000ff, 0x0000003f, 0x40},
|
||||
};
|
||||
|
||||
static inline void update_media_drive(void) {
|
||||
s8 drive;
|
||||
if (g_pfd_sddrv_info.drive == 0 && pfd_get_media_drv_char(g_pfd_sddrv_info.disk, &drive, 1) == 1) {
|
||||
g_pfd_sddrv_info.drive = drive;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void clear_mount_flag(void) {
|
||||
g_pfd_sddrv_info.flags &= ~2;
|
||||
}
|
||||
|
||||
s32 pfd_st_inter_callback(s32 status, void* data) {
|
||||
s32 result;
|
||||
s8 drive;
|
||||
|
||||
if ((status & 1) != 1) {
|
||||
return 0;
|
||||
@@ -234,9 +244,7 @@ s32 pfd_st_inter_callback(s32 status, void* data) {
|
||||
}
|
||||
}
|
||||
if (g_pfd_sddrv_info.disk != 0) {
|
||||
if (g_pfd_sddrv_info.drive == 0 && pfd_get_media_drv_char(g_pfd_sddrv_info.disk, &drive, 1) == 1) {
|
||||
g_pfd_sddrv_info.drive = drive;
|
||||
}
|
||||
update_media_drive();
|
||||
pdm_disk_notify_media_insert(g_pfd_sddrv_info.disk);
|
||||
if (g_pfd_sddrv_info.drive != 0 && g_attach_func != 0) {
|
||||
g_attach_func(g_pfd_sddrv_info.drive);
|
||||
@@ -249,7 +257,6 @@ s32 pfd_st_inter_callback(s32 status, void* data) {
|
||||
|
||||
s32 pfd_st_removal_callback(s32 status, void* data) {
|
||||
s32 result;
|
||||
s8 drive;
|
||||
|
||||
if ((status & 2) != 2) {
|
||||
return 0;
|
||||
@@ -263,9 +270,7 @@ s32 pfd_st_removal_callback(s32 status, void* data) {
|
||||
}
|
||||
}
|
||||
if (g_pfd_sddrv_info.disk != 0) {
|
||||
if (g_pfd_sddrv_info.drive == 0 && pfd_get_media_drv_char(g_pfd_sddrv_info.disk, &drive, 1) == 1) {
|
||||
g_pfd_sddrv_info.drive = drive;
|
||||
}
|
||||
update_media_drive();
|
||||
pdm_disk_notify_media_eject(g_pfd_sddrv_info.disk);
|
||||
if (g_pfd_sddrv_info.drive != 0 && g_detach_func != 0) {
|
||||
g_detach_func(g_pfd_sddrv_info.drive);
|
||||
@@ -315,16 +320,7 @@ s32 pfd_sddrv_init(FADisk* disk) {
|
||||
g_pfd_sddrv_info.media_inserted = 1;
|
||||
}
|
||||
g_pfd_sddrv_info.device = device;
|
||||
if (g_pfd_sddrv_info.media_inserted == 0) {
|
||||
g_event = 1;
|
||||
sd_result = ISD_RegisterDeviceIntrHandler(device, (SDDevIntrCallback)pfd_st_inter_callback, &g_event);
|
||||
if (sd_result != 0) {
|
||||
OSReport("ERR:Failed to regist intr handler1 [ret = 0x%x] pfd_sddrv_init()\n", sd_result);
|
||||
ISD_UnmountCard(device);
|
||||
g_pfd_sddrv_info.device = 0;
|
||||
return -42;
|
||||
}
|
||||
} else {
|
||||
if (g_pfd_sddrv_info.media_inserted != 0) {
|
||||
g_event = 2;
|
||||
sd_result = ISD_RegisterDeviceIntrHandler(device, (SDDevIntrCallback)pfd_st_removal_callback, &g_event);
|
||||
if (sd_result != 0) {
|
||||
@@ -333,9 +329,18 @@ s32 pfd_sddrv_init(FADisk* disk) {
|
||||
g_pfd_sddrv_info.device = 0;
|
||||
return -42;
|
||||
}
|
||||
} else {
|
||||
g_event = 1;
|
||||
sd_result = ISD_RegisterDeviceIntrHandler(device, (SDDevIntrCallback)pfd_st_inter_callback, &g_event);
|
||||
if (sd_result != 0) {
|
||||
OSReport("ERR:Failed to regist intr handler1 [ret = 0x%x] pfd_sddrv_init()\n", sd_result);
|
||||
ISD_UnmountCard(device);
|
||||
g_pfd_sddrv_info.device = 0;
|
||||
return -42;
|
||||
}
|
||||
}
|
||||
g_pfd_sddrv_info.flags |= 1;
|
||||
g_pfd_sddrv_info.disk = disk;
|
||||
g_pfd_sddrv_info.flags |= 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -440,7 +445,7 @@ s32 pfd_sddrv_unmount(FADisk* disk) {
|
||||
return -30;
|
||||
}
|
||||
if ((g_pfd_sddrv_info.flags & 2) != 0) {
|
||||
g_pfd_sddrv_info.flags &= ~2;
|
||||
clear_mount_flag();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -452,12 +457,12 @@ s32 pfd_sddrv_finalize(FADisk* disk) {
|
||||
return -30;
|
||||
}
|
||||
if ((g_pfd_sddrv_info.flags & 2) != 0) {
|
||||
g_pfd_sddrv_info.flags = g_pfd_sddrv_info.flags & 0xfffffffd;
|
||||
clear_mount_flag();
|
||||
}
|
||||
if ((g_pfd_sddrv_info.flags & 1) != 0) {
|
||||
result = ISD_UnregisterDeviceIntrHandler(g_pfd_sddrv_info.device);
|
||||
if (result != 0) {
|
||||
OSReport("WARNING Faild to UnregisterDeviceIntrHandler sd card [ret = %d]\n");
|
||||
OSReport("WARNING Faild to UnregisterDeviceIntrHandler sd card [ret = %d]\n", result);
|
||||
}
|
||||
result = ISD_UnmountCard(g_pfd_sddrv_info.device);
|
||||
if (result != 0) {
|
||||
@@ -558,6 +563,7 @@ s32 pfd_sddrv_is_media_insert(void) {
|
||||
|
||||
static s32 pfd_sddrv_physical_read(u32 blocks, u8* buffer, u32 sector, u32 bytes_per_sector, u32* blocks_read) {
|
||||
s32 result;
|
||||
u32 current_sector;
|
||||
u32 completed;
|
||||
u8* current_buffer;
|
||||
if ((g_pfd_sddrv_info.flags & 2) == 0) {
|
||||
@@ -572,49 +578,49 @@ static s32 pfd_sddrv_physical_read(u32 blocks, u8* buffer, u32 sector, u32 bytes
|
||||
return -30;
|
||||
}
|
||||
*blocks_read = 0xffffffff;
|
||||
current_sector = sector;
|
||||
if (((u32)buffer & 0x1f) == 0) {
|
||||
if (g_pfd_sddrv_info.media_inserted == 0) {
|
||||
*blocks_read = 0;
|
||||
return -33;
|
||||
}
|
||||
if (blocks == 1) {
|
||||
result = ISD_ReadBlock(g_pfd_sddrv_info.device, sector, buffer, 1);
|
||||
result = ISD_ReadBlock(g_pfd_sddrv_info.device, current_sector, buffer, blocks);
|
||||
if (result != 0) {
|
||||
OSReport("INFO Failed to read SD card1 [ret = 0x%x] pfd_sddrv_physical_read()\n", result);
|
||||
*blocks_read = 0;
|
||||
return -37;
|
||||
}
|
||||
} else {
|
||||
result = ISD_ReadMultiBlock(g_pfd_sddrv_info.device, sector, buffer, blocks);
|
||||
result = ISD_ReadMultiBlock(g_pfd_sddrv_info.device, current_sector, buffer, blocks);
|
||||
if (result != 0) {
|
||||
OSReport("INFO Failed to read SD card2 [ret = 0x%x] pfd_sddrv_physical_read()\n", result);
|
||||
*blocks_read = 0;
|
||||
return -37;
|
||||
}
|
||||
}
|
||||
*blocks_read = blocks;
|
||||
return 0;
|
||||
}
|
||||
for (completed = 0, current_buffer = buffer; completed < blocks; current_buffer += bytes_per_sector, sector++, completed++) {
|
||||
if (g_pfd_sddrv_info.media_inserted == 0) {
|
||||
if (completed == 0) {
|
||||
} else {
|
||||
for (completed = 0, current_buffer = buffer; completed < blocks; current_buffer += bytes_per_sector, current_sector++, completed++) {
|
||||
if (g_pfd_sddrv_info.media_inserted == 0) {
|
||||
if (completed != 0) {
|
||||
*blocks_read = completed;
|
||||
return 0;
|
||||
}
|
||||
*blocks_read = 0;
|
||||
return -33;
|
||||
}
|
||||
*blocks_read = completed;
|
||||
return 0;
|
||||
}
|
||||
result = ISD_ReadBlock(g_pfd_sddrv_info.device, sector, g_pfd_sddrv_buf, 1);
|
||||
if (result != 0) {
|
||||
OSReport("INFO Failed to read SD card3 [ret = 0x%x] pfd_sddrv_physical_read()\n", result);
|
||||
if (completed == 0) {
|
||||
result = ISD_ReadBlock(g_pfd_sddrv_info.device, current_sector, g_pfd_sddrv_buf, 1);
|
||||
if (result != 0) {
|
||||
OSReport("INFO Failed to read SD card3 [ret = 0x%x] pfd_sddrv_physical_read()\n", result);
|
||||
if (completed != 0) {
|
||||
*blocks_read = completed;
|
||||
return 0;
|
||||
}
|
||||
*blocks_read = 0;
|
||||
return -37;
|
||||
}
|
||||
*blocks_read = completed;
|
||||
return 0;
|
||||
pf_memcpy(current_buffer, g_pfd_sddrv_buf, bytes_per_sector);
|
||||
}
|
||||
pf_memcpy(current_buffer, g_pfd_sddrv_buf, bytes_per_sector);
|
||||
}
|
||||
*blocks_read = blocks;
|
||||
return 0;
|
||||
@@ -622,6 +628,7 @@ static s32 pfd_sddrv_physical_read(u32 blocks, u8* buffer, u32 sector, u32 bytes
|
||||
|
||||
s32 pfd_sddrv_physical_write(u32 blocks, u8* buffer, u32 sector, u32 bytes_per_sector, u32* blocks_written) {
|
||||
s32 result;
|
||||
u32 current_sector;
|
||||
u32 completed;
|
||||
u8* current_buffer;
|
||||
if ((g_pfd_sddrv_info.flags & 2) == 0) {
|
||||
@@ -636,48 +643,48 @@ s32 pfd_sddrv_physical_write(u32 blocks, u8* buffer, u32 sector, u32 bytes_per_s
|
||||
return -30;
|
||||
}
|
||||
*blocks_written = 0xffffffff;
|
||||
current_sector = sector;
|
||||
if (((u32)buffer & 0x1f) == 0) {
|
||||
if (g_pfd_sddrv_info.media_inserted == 0) {
|
||||
*blocks_written = 0;
|
||||
return -33;
|
||||
}
|
||||
if (blocks == 1) {
|
||||
result = ISD_WriteBlock(g_pfd_sddrv_info.device, sector, buffer, 1);
|
||||
result = ISD_WriteBlock(g_pfd_sddrv_info.device, current_sector, buffer, blocks);
|
||||
if (result != 0) {
|
||||
OSReport("INFO Failed to write SD card1 [ret = 0x%x] pfd_sddrv_physical_write()\n", result);
|
||||
*blocks_written = 0;
|
||||
return -36;
|
||||
}
|
||||
} else {
|
||||
result = ISD_WriteMultiBlock(g_pfd_sddrv_info.device, sector, buffer, blocks);
|
||||
result = ISD_WriteMultiBlock(g_pfd_sddrv_info.device, current_sector, buffer, blocks);
|
||||
if (result != 0) {
|
||||
OSReport("INFO Failed to write SD card2 [ret = 0x%x] pfd_sddrv_physical_write()\n", result);
|
||||
*blocks_written = 0;
|
||||
return -36;
|
||||
}
|
||||
}
|
||||
*blocks_written = blocks;
|
||||
return 0;
|
||||
}
|
||||
for (completed = 0, current_buffer = buffer; completed < blocks; current_buffer += bytes_per_sector, sector++, completed++) {
|
||||
if (g_pfd_sddrv_info.media_inserted == 0) {
|
||||
if (completed == 0) {
|
||||
} else {
|
||||
for (completed = 0, current_buffer = buffer; completed < blocks; current_buffer += bytes_per_sector, current_sector++, completed++) {
|
||||
if (g_pfd_sddrv_info.media_inserted == 0) {
|
||||
if (completed != 0) {
|
||||
*blocks_written = completed;
|
||||
return 0;
|
||||
}
|
||||
*blocks_written = 0;
|
||||
return -33;
|
||||
}
|
||||
*blocks_written = completed;
|
||||
return 0;
|
||||
}
|
||||
pf_memcpy(g_pfd_sddrv_buf, current_buffer, bytes_per_sector);
|
||||
result = ISD_WriteBlock(g_pfd_sddrv_info.device, sector, g_pfd_sddrv_buf, 1);
|
||||
if (result != 0) {
|
||||
OSReport("INFO Failed to write SD card3 [ret = 0x%x] pfd_sddrv_physical_write()\n", result);
|
||||
if (completed == 0) {
|
||||
pf_memcpy(g_pfd_sddrv_buf, current_buffer, bytes_per_sector);
|
||||
result = ISD_WriteBlock(g_pfd_sddrv_info.device, current_sector, g_pfd_sddrv_buf, 1);
|
||||
if (result != 0) {
|
||||
OSReport("INFO Failed to write SD card3 [ret = 0x%x] pfd_sddrv_physical_write()\n", result);
|
||||
if (completed != 0) {
|
||||
*blocks_written = completed;
|
||||
return 0;
|
||||
}
|
||||
*blocks_written = 0;
|
||||
return -36;
|
||||
}
|
||||
*blocks_written = completed;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*blocks_written = blocks;
|
||||
@@ -688,6 +695,7 @@ s32 pfd_sddrv_get_total_sectors(u32* sectors, u16* bytes_per_sector) {
|
||||
s32 result;
|
||||
u32 csd[4];
|
||||
u32 c_size;
|
||||
u32 cluster_blocks;
|
||||
u32 read_block_length;
|
||||
u16 multiplier;
|
||||
u16 minimum_multiplier;
|
||||
@@ -708,6 +716,7 @@ s32 pfd_sddrv_get_total_sectors(u32* sectors, u16* bytes_per_sector) {
|
||||
read_block_length = ((csd[1] >> 7) & 7) + 2;
|
||||
read_block_size = 1 << read_block_length;
|
||||
c_size = (((csd[2] & 3) << 10 | csd[1] >> 22) + 1);
|
||||
cluster_blocks = c_size * read_block_size;
|
||||
multiplier = (csd[2] >> 8) & 0xf;
|
||||
minimum_multiplier = 9;
|
||||
if (multiplier >= 9) {
|
||||
@@ -717,8 +726,8 @@ s32 pfd_sddrv_get_total_sectors(u32* sectors, u16* bytes_per_sector) {
|
||||
if (minimum_multiplier <= 11) {
|
||||
max_multiplier = minimum_multiplier;
|
||||
}
|
||||
multiplier_factor = 1 << (max_multiplier - 9);
|
||||
*sectors = c_size * read_block_size * multiplier_factor;
|
||||
multiplier_factor = 1 << (u16)(max_multiplier - 9);
|
||||
*sectors = cluster_blocks * multiplier_factor;
|
||||
} else {
|
||||
*sectors = ((csd[1] >> 8 & 0x3fffff) + 1) * 0x400;
|
||||
}
|
||||
@@ -1423,32 +1432,33 @@ s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
|
||||
s32 pfd_sddrv_full_format(void) {
|
||||
s32 result;
|
||||
u32 retry_count;
|
||||
u32 status;
|
||||
u32 total_sectors;
|
||||
u16 bytes_per_sector;
|
||||
u32 total_sectors;
|
||||
u32 status;
|
||||
|
||||
retry_count = 0;
|
||||
while (retry_count < 5) {
|
||||
do {
|
||||
if (g_pfd_sddrv_info.media_inserted == 0) {
|
||||
return -33;
|
||||
}
|
||||
result = ISD_ResetDevice(g_pfd_sddrv_info.device);
|
||||
if (result == 0) {
|
||||
g_pfd_sddrv_info.media_ejected = 0;
|
||||
break;
|
||||
}
|
||||
OSReport("ERROR Failed to SD Card Reset [ret = 0x%x]. pfd_sddrv_full_format()\n", result);
|
||||
retry_count++;
|
||||
}
|
||||
} while (retry_count < 5);
|
||||
if (retry_count == 5) {
|
||||
return -38;
|
||||
}
|
||||
g_pfd_sddrv_info.media_ejected = 0;
|
||||
if (g_pfd_sddrv_info.media_ejected != 0) {
|
||||
return -33;
|
||||
}
|
||||
result = ISD_GetDeviceStatus(g_pfd_sddrv_info.device, &status);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
OSReport("ERR Failed to get sd card status. [ret = 0x%x]\n", result);
|
||||
return -39;
|
||||
}
|
||||
if ((status & 4) != 0) {
|
||||
return -32;
|
||||
@@ -1466,17 +1476,17 @@ s32 pfd_sddrv_full_format(void) {
|
||||
return -34;
|
||||
}
|
||||
result = pfd_sddrv_build_mbr_bpb(total_sectors);
|
||||
} else {
|
||||
if ((status & 0x10000) == 0 || (status & 0x100000) == 0) {
|
||||
return -31;
|
||||
}
|
||||
} else if ((status & 0x10000) != 0 && (status & 0x100000) != 0) {
|
||||
if (total_sectors > 0x4000000) {
|
||||
return -34;
|
||||
}
|
||||
result = pfd_sddrv_build_fat32_mbr_bpb(total_sectors);
|
||||
} else {
|
||||
return -31;
|
||||
}
|
||||
if (result != 0) {
|
||||
OSReport("ERR Failed to build up and write MBR and BPB fields.\n");
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -209,8 +209,8 @@ PFDIR_SDD* PFDIR_GetSDD(PF_VOLUME* volume, PF_DIR_ENT* entry) {
|
||||
entry->entry_offset == volume_dirs->sdds[i].dir_entry.entry_offset) {
|
||||
return &volume_dirs->sdds[i];
|
||||
}
|
||||
free_candidate++;
|
||||
i++;
|
||||
free_candidate++;
|
||||
}
|
||||
if (first_free_sdd == 0) {
|
||||
return 0;
|
||||
@@ -1304,7 +1304,7 @@ void PFDIR_move(PF_STR* old_path, PF_STR* new_path) {
|
||||
volume_dirs->cache_signature = 0;
|
||||
}
|
||||
|
||||
void PFDIR_opendir(PF_STR* path, PFDIR_DIR** dir) {
|
||||
pf_s32 PFDIR_opendir(PF_STR* path, PFDIR_DIR** dir) {
|
||||
PF_VOLUME* volume = PFPATH_GetVolumeFromPath(path);
|
||||
PFDIR_VOLUME_DIRS* volume_dirs = (PFDIR_VOLUME_DIRS*)volume;
|
||||
pf_s32 error = PFVOL_CheckForRead(volume);
|
||||
@@ -1312,7 +1312,7 @@ void PFDIR_opendir(PF_STR* path, PFDIR_DIR** dir) {
|
||||
if (error != 0) {
|
||||
pf_vol_set.last_error = error;
|
||||
((PFDIR_VOLUME_DIRS*)volume)->last_error = error;
|
||||
return;
|
||||
return error;
|
||||
}
|
||||
error = PFDIR_p_opendir(volume, (PFDIR_STR*)path, dir);
|
||||
if (error != 0) {
|
||||
@@ -1321,6 +1321,7 @@ void PFDIR_opendir(PF_STR* path, PFDIR_DIR** dir) {
|
||||
} else {
|
||||
((PFDIR_VOLUME_DIRS*)volume)->num_opened_directories += 1;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
pf_s32 PFDIR_closedir(PFDIR_DIR* dir) {
|
||||
|
||||
@@ -80,10 +80,10 @@ pf_s32 VFiPFFAT16_WriteFATEntry(PF_VOLUME* p_vol, pf_u32 cluster, pf_u32 value)
|
||||
}
|
||||
|
||||
pf_s32 PFFAT16_WriteFATEntryWithBuf(PF_VOLUME* p_vol, pf_u32 cluster, pf_u32 value, PF_CACHE_PAGE* p_page) {
|
||||
pf_u16 offset_in_sector;
|
||||
pf_u16 fat_sector;
|
||||
pf_s32 err;
|
||||
pf_u32 fat_offset;
|
||||
pf_u16 fat_sector;
|
||||
pf_u16 offset_in_sector;
|
||||
pf_u32 current_fat;
|
||||
pf_s32 result;
|
||||
fat_offset = cluster * sizeof(pf_u16);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#define PF_FA_STR_LAYOUT
|
||||
#include <decomp/utils.h>
|
||||
#include <private/vf/PrFILE2/fatfs/pf_volume.h>
|
||||
#include <private/vf/PrFILE2/fatfs/pf_dir.h>
|
||||
#include <private/vf/PrFILE2/fatfs/pf_path.h>
|
||||
@@ -951,7 +952,7 @@ pf_s32 PFFILE_p_fopen(PF_VOLUME* volume, PF_STR* path, pf_u32 open_mode,
|
||||
}
|
||||
|
||||
pf_s32 PFFILE_p_fread(PF_VOLUME* volume, pf_u8* buffer, pf_u32 size, pf_u32 count,
|
||||
PFFILE_FILE* file, pf_u32* count_read) {
|
||||
PFFILE_FILE* file, pf_u32* count_read) NO_INLINE {
|
||||
pf_u32 bytes_read = 0;
|
||||
pf_s32 error;
|
||||
|
||||
|
||||
@@ -326,7 +326,6 @@ pf_bool PFPATH_MatchFileNameWithPattern(const pf_s8* file_name, PF_STR* p_patter
|
||||
pf_u16 c_pat;
|
||||
PF_FILE_NAME_ITER name;
|
||||
PF_STR pattern;
|
||||
pf_s8 sig[2];
|
||||
pf_bool result;
|
||||
|
||||
result = PF_TRUE;
|
||||
@@ -339,16 +338,15 @@ pf_bool PFPATH_MatchFileNameWithPattern(const pf_s8* file_name, PF_STR* p_patter
|
||||
|
||||
if (PFSTR_GetCodeMode(p_pattern) == 1) {
|
||||
if (is_long_name == PF_FALSE && (pf_vol_set.setting & 0x02) == 0x02 && PFPATH_CheckExtShortNameSignature(&pattern) == 1) {
|
||||
sig[0] = 1;
|
||||
sig[1] = 2;
|
||||
if (PFSTR_StrNCmp((PF_STR*)&name, sig, 1, 0, 2) == 0) {
|
||||
result = PFPATH_CheckExtShortNameSignature(&pattern);
|
||||
if (result == 1) {
|
||||
name.index += 2;
|
||||
pattern.p_head += 2;
|
||||
}
|
||||
}
|
||||
} else if ((pf_vol_set.setting & 0x02) == 0x02 && is_long_name == PF_FALSE &&
|
||||
PFSTR_StrNCmp(p_pattern, (pf_s8*)".", 1, 0, 1) != 0 && PFSTR_StrNCmp(p_pattern, (pf_s8*)"..", 1, 0, 2) != 0 &&
|
||||
PFPATH_CheckExtShortName(p_pattern, 1, PF_TRUE) == 0) {
|
||||
PFPATH_CheckExtShortName(p_pattern, 1, PF_FALSE) == 0) {
|
||||
result = PF_FALSE;
|
||||
}
|
||||
if (result == PF_TRUE) {
|
||||
@@ -360,9 +358,12 @@ pf_bool PFPATH_MatchFileNameWithPattern(const pf_s8* file_name, PF_STR* p_patter
|
||||
}
|
||||
|
||||
pf_s32 PFPATH_cmpNameImpl(const pf_s8* name, const pf_s8* pattern, pf_u32* matched_end) {
|
||||
pf_u32 read_char;
|
||||
pf_s32 recursive_error;
|
||||
pf_u16 name_char;
|
||||
pf_u16 pattern_char;
|
||||
pf_u16 converted_char;
|
||||
pf_u16 converted_pattern;
|
||||
pf_u16 converted_name;
|
||||
pf_s32 name_width;
|
||||
pf_s32 pattern_width;
|
||||
PF_PATH_VOLUME_SET* volume = &pf_vol_set;
|
||||
@@ -371,27 +372,32 @@ pf_s32 PFPATH_cmpNameImpl(const pf_s8* name, const pf_s8* pattern, pf_u32* match
|
||||
pattern_width = volume->codeset.oem_char_width(pattern);
|
||||
name_width = volume->codeset.oem_char_width(name);
|
||||
if (pattern_width == 1) {
|
||||
pattern_char = pf_toupper(*pattern);
|
||||
read_char = pf_toupper(*pattern);
|
||||
} else {
|
||||
pattern_char = PF_GET_LE_U16((const pf_u8*)pattern);
|
||||
if (PFPATH_OEM_ConvertFWchar(pattern, &converted_char) != 0) {
|
||||
pattern_char = converted_char;
|
||||
}
|
||||
read_char = (pf_u16)PF_GET_LE_U16((const pf_u8*)pattern);
|
||||
}
|
||||
pattern_char = (pf_u16)read_char;
|
||||
if (name_width == 1) {
|
||||
name_char = pf_toupper(*name);
|
||||
read_char = pf_toupper(*name);
|
||||
} else {
|
||||
name_char = PF_GET_LE_U16((const pf_u8*)name);
|
||||
if (PFPATH_OEM_ConvertFWchar(name, &converted_char) != 0) {
|
||||
name_char = converted_char;
|
||||
}
|
||||
read_char = (pf_u16)PF_GET_LE_U16((const pf_u8*)name);
|
||||
}
|
||||
name_char = (pf_u16)read_char;
|
||||
if (pattern_width == 2 && PFPATH_OEM_ConvertFWchar(pattern, &converted_pattern) == 1) {
|
||||
pattern_char = converted_pattern;
|
||||
}
|
||||
if (name_width == 2 && PFPATH_OEM_ConvertFWchar(name, &converted_name) == 1) {
|
||||
name_char = converted_name;
|
||||
}
|
||||
pattern += pattern_width;
|
||||
if (pattern_char == '?') {
|
||||
switch (pattern_char) {
|
||||
case '?': {
|
||||
if (name_char == 0) {
|
||||
return 1;
|
||||
}
|
||||
} else if (pattern_char == '*') {
|
||||
break;
|
||||
}
|
||||
case '*': {
|
||||
do {
|
||||
pattern_width = volume->codeset.oem_char_width(pattern);
|
||||
if (pattern_width == 1) {
|
||||
@@ -400,21 +406,27 @@ pf_s32 PFPATH_cmpNameImpl(const pf_s8* name, const pf_s8* pattern, pf_u32* match
|
||||
pattern_char = PF_GET_LE_U16((const pf_u8*)pattern);
|
||||
}
|
||||
pattern += pattern_width;
|
||||
if (pattern_char == '?') {
|
||||
if (name_char == 0) { return 1; }
|
||||
name += name_width;
|
||||
name_width = volume->codeset.oem_char_width(name);
|
||||
if (name_width == 1) { name_char = pf_toupper(*name); }
|
||||
else { name_char = PF_GET_LE_U16((const pf_u8*)name); }
|
||||
}
|
||||
} while (pattern_char == '*' || pattern_char == '?');
|
||||
if (pattern_char == 0) {
|
||||
return 0;
|
||||
}
|
||||
while (name_char != 0) {
|
||||
name += name_width;
|
||||
if (name_char == pattern_char) {
|
||||
if (PFPATH_cmpNameImpl(name + name_width, pattern, matched_end) == 0) {
|
||||
recursive_error = PFPATH_cmpNameImpl(name, pattern, matched_end);
|
||||
if (recursive_error == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (*matched_end != 0) {
|
||||
return 1;
|
||||
if (*matched_end != 0) { return recursive_error; }
|
||||
}
|
||||
name_width = volume->codeset.oem_char_width(name);
|
||||
name += name_width;
|
||||
if (name_width == 1) {
|
||||
name_char = pf_toupper(*name);
|
||||
} else {
|
||||
@@ -422,8 +434,10 @@ pf_s32 PFPATH_cmpNameImpl(const pf_s8* name, const pf_s8* pattern, pf_u32* match
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
} else if (name_char != pattern_char) {
|
||||
return 1;
|
||||
}
|
||||
default:
|
||||
if (name_char != pattern_char) { return 1; }
|
||||
break;
|
||||
}
|
||||
name += name_width;
|
||||
if (*name == 0 || *pattern == 0) {
|
||||
|
||||
23
tools/decomp-assist/attempts/fa-finish-driver-nand_drv.md
Normal file
23
tools/decomp-assist/attempts/fa-finish-driver-nand_drv.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# fa/driver/nand_drv continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
fa_nanddrv_ParseCreateNANDFile:
|
||||
- rotate independent local declarations: 130/130, 22 differences.
|
||||
- common operation status exit: 130/130, 10 differences.
|
||||
- reverse independent local declarations: 130/130, 22 differences.
|
||||
- Retained: [130, 130, 10].
|
||||
|
||||
fa_nanddrv_NotifyNANDFile:
|
||||
- rotate independent local declarations: 72/72, 12 differences.
|
||||
- common operation status exit: 72/72, 12 differences.
|
||||
- reverse independent local declarations: 72/72, 12 differences.
|
||||
- Retained: [72, 72, 12].
|
||||
|
||||
fa_nanddrv_physical_write:
|
||||
- rotate independent local declarations: 175/175, 30 differences.
|
||||
- common operation status exit: 175/175, 38 differences.
|
||||
- reverse independent local declarations: 175/175, 27 differences.
|
||||
- Retained: [175, 175, 38].
|
||||
|
||||
NotifyNANDFile additionally used the indexed file-size destination (72/72, twelve differences reduced to six) and a separate candidate pointer (72/72, unchanged). Retained the indexed destination without the extra alias. Six pointer/stride register differences remain. ParseCreateNANDFile retains ten control-flow differences around the directory-change error exit. physical_write retains callee-saved register differences; all three declaration/return variants preserved instruction count.
|
||||
12
tools/decomp-assist/attempts/fa-finish-pdm_disk.md
Normal file
12
tools/decomp-assist/attempts/fa-finish-pdm_disk.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# fa/pdm_disk continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
pdm_disk_convert_block_into_sector`:
|
||||
- common operation status exit: 44/44, 0 differences.
|
||||
- split local declaration from initialization: 44/44, 0 differences.
|
||||
- Retained: [44, 44, 0].
|
||||
|
||||
The original symbol is literally named pdm_disk_convert_block_into_sector` with a trailing backtick in config/43U/symbols.txt and the extracted object. The C definition has the valid identifier without that backtick. Its 44 instructions and 176 bytes already agree exactly when compared under the two names. Three source variants were compiled and restored. ctxdiff rejects the absent backtick-bearing C symbol; no symbol rename, inline assembler alias or symbol-size change was introduced. This remains a symbol-identity mismatch, not a code mismatch.
|
||||
|
||||
Third attempt: return small-sector validation failure before the conversion branch; 44/44 instructions, 41 positional differences. Restored original source.
|
||||
23
tools/decomp-assist/attempts/fa-finish-pdm_partition.md
Normal file
23
tools/decomp-assist/attempts/fa-finish-pdm_partition.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# fa/pdm_partition continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
pdm_part_is_master_boot_sector:
|
||||
- rotate independent local declarations: 86/84, 82 differences.
|
||||
- common operation status exit: 86/84, 82 differences.
|
||||
- reverse independent local declarations: 86/84, 82 differences.
|
||||
- Retained: [86, 84, 82].
|
||||
|
||||
pdm_part_chg_ltop:
|
||||
- rotate independent local declarations: 51/51, 16 differences.
|
||||
- common operation status exit: 51/51, 16 differences.
|
||||
- reverse independent local declarations: 51/51, 16 differences.
|
||||
- Retained: [51, 51, 16].
|
||||
|
||||
pdm_part_get_start_sector:
|
||||
- rotate independent local declarations: 276/276, 148 differences.
|
||||
- common operation status exit: 276/276, 141 differences.
|
||||
- reverse independent local declarations: 276/276, 138 differences.
|
||||
- Retained: [276, 276, 141].
|
||||
|
||||
Additional targeted attempts: remove the preliminary partition-start store and exchange array declarations (83/84, seventy-two differences); reverse the two endian addition groups (86/84, eighty-three differences); load the sector ratio before the partition-start value (51/51, sixteen differences, unchanged). All were restored. The target retains the preliminary store and a different byte-load schedule. Logical-sector conversion still swaps its two arithmetic registers; extended partition scanning still differs in register assignment and endian load scheduling.
|
||||
11
tools/decomp-assist/attempts/fa-finish-pf_cache.md
Normal file
11
tools/decomp-assist/attempts/fa-finish-pf_cache.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# fa/pf_cache continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
PFCACHE_DoWriteNumSectorAndFreeIfNeeded:
|
||||
- rotate independent local declarations: 233/233, 9 differences.
|
||||
- common operation status exit: 233/233, 9 differences.
|
||||
- reverse independent local declarations: 233/233, 9 differences.
|
||||
- Retained: [233, 233, 9].
|
||||
|
||||
Additional right-overlap last-sector attempts: request-end minus one and sector plus (count minus one) each produce 232/233 instructions with a hoisted end-sector register; page-start minus one plus overlap retains 233/233 and the same nine differences. Restored. The remaining block uses a cached request end in the candidate while the original recomputes it after memcpy and schedules the last-sector subtraction before successful-sector bookkeeping. Earlier reconstruction attempts are in pf_cache.attempts.md.
|
||||
23
tools/decomp-assist/attempts/fa-finish-pf_cluster.md
Normal file
23
tools/decomp-assist/attempts/fa-finish-pf_cluster.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# fa/pf_cluster continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
PFCLUSTER_CombineFiles:
|
||||
- rotate independent local declarations: 207/207, 4 differences.
|
||||
- common operation status exit: 207/207, 4 differences.
|
||||
- reverse independent local declarations: 207/207, 58 differences.
|
||||
- Retained: [207, 207, 4].
|
||||
|
||||
PFCLUSTER_InsertCluster:
|
||||
- rotate independent local declarations: 126/126, 28 differences.
|
||||
- common operation status exit: 126/126, 28 differences.
|
||||
- reverse independent local declarations: 126/126, 40 differences.
|
||||
- Retained: [126, 126, 28].
|
||||
|
||||
PFCLUSTER_DeleteCluster:
|
||||
- rotate independent local declarations: 108/108, 35 differences.
|
||||
- common operation status exit: 108/108, 35 differences.
|
||||
- reverse independent local declarations: 108/108, 53 differences.
|
||||
- Retained: [108, 108, 35].
|
||||
|
||||
Swapping the operands around the grouped cluster total leaves CombineFiles at 207 instructions and four differences, confined to the overflow comparison arithmetic schedule. Restored. InsertCluster and DeleteCluster retain equal counts with 28 and 35 register differences. Prior targeted attempts are in fa_pf_cluster_attempts.md.
|
||||
56
tools/decomp-assist/attempts/fa-finish-pf_dir.md
Normal file
56
tools/decomp-assist/attempts/fa-finish-pf_dir.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# fa/pf_dir continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
PFDIR_GetSDD:
|
||||
- normal path first, validation failure last: 69/69, 24 differences.
|
||||
- common operation status exit: 69/69, 8 differences.
|
||||
- Retained: [69, 69, 2].
|
||||
|
||||
PFDIR_p_fsexec_remove:
|
||||
- normal path first, validation failure last: 178/176, 21 differences.
|
||||
- common operation status exit: 178/176, 170 differences.
|
||||
- Retained: [178, 176, 170].
|
||||
|
||||
PFDIR_opendir:
|
||||
- Retained: [39, 39, 2].
|
||||
|
||||
PFDIR_p_fsnext:
|
||||
- rotate independent local declarations: 193/193, 39 differences.
|
||||
- normal path first, validation failure last: 192/193, 167 differences.
|
||||
- common operation status exit: 193/193, 39 differences.
|
||||
- Retained: [193, 193, 39].
|
||||
|
||||
PFDIR_p_rmdir:
|
||||
- rotate independent local declarations: 203/202, 197 differences.
|
||||
- normal path first, validation failure last: 202/202, 170 differences.
|
||||
- common operation status exit: 203/202, 197 differences.
|
||||
- Retained: [203, 202, 197].
|
||||
|
||||
PFDIR_p_fsexec:
|
||||
- rotate independent local declarations: 207/280, 189 differences.
|
||||
- normal path first, validation failure last: 207/280, 175 differences.
|
||||
- common operation status exit: 207/280, 189 differences.
|
||||
- Retained: [207, 280, 189].
|
||||
|
||||
PFDIR_p_move:
|
||||
- rotate independent local declarations: 215/631, 212 differences.
|
||||
- normal path first, validation failure last: 214/631, 212 differences.
|
||||
- common operation status exit: 215/631, 212 differences.
|
||||
- Retained: [215, 631, 212].
|
||||
|
||||
PFDIR_p_rename:
|
||||
- rotate independent local declarations: 191/625, 182 differences.
|
||||
- normal path first, validation failure last: 190/625, 184 differences.
|
||||
- common operation status exit: 191/625, 182 differences.
|
||||
- Retained: [191, 625, 182].
|
||||
|
||||
PFDIR_p_mkdir:
|
||||
- rotate independent local declarations: 256/562, 254 differences.
|
||||
- normal path first, validation failure last: 255/562, 243 differences.
|
||||
- common operation status exit: 256/562, 254 differences.
|
||||
- Retained: [256, 562, 254].
|
||||
|
||||
PFDIR_opendir is now instruction exact after restoring its status return type and retaining the read/open status across the handler-count update. Target r3 still holds the status at return; the former void definition allowed the count load to clobber it. No shared-header prototype changes were needed.
|
||||
|
||||
GetSDD additionally tried exchanging the two body increments (69/69, same two differences); compiler still schedules its derived volume-array pointer after the independent candidate pointer. Missing allocation and long-name update paths remain in mkdir, rename and move. Prior targeted three-attempt records are in fa-dir.md.
|
||||
17
tools/decomp-assist/attempts/fa-finish-pf_entry_iterator.md
Normal file
17
tools/decomp-assist/attempts/fa-finish-pf_entry_iterator.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# fa/pf_entry_iterator continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
PFENT_ITER_FindCluster:
|
||||
- rotate independent local declarations: 237/237, 8 differences.
|
||||
- common operation status exit: 237/237, 75 differences.
|
||||
- reverse independent local declarations: 237/237, 11 differences.
|
||||
- Retained: [237, 237, 8].
|
||||
|
||||
PFENT_ITER_GetLFNEntryName:
|
||||
- rotate independent local declarations: 74/73, 33 differences.
|
||||
- common operation status exit: 74/73, 33 differences.
|
||||
- reverse independent local declarations: 74/73, 33 differences.
|
||||
- Retained: [74, 73, 33].
|
||||
|
||||
GetLFNEntryName: direct i * 13 indexing and a separately incremented byte offset both produce 76 instructions against 73 and introduce pointer induction absent in the target. Restored the 74-instruction version. FindCluster remains 237/237 with eight r7/r8 differences in iterator initialization. Earlier targeted attempts are in pf_entry_iterator.attempts.md.
|
||||
37
tools/decomp-assist/attempts/fa-finish-pf_fat.md
Normal file
37
tools/decomp-assist/attempts/fa-finish-pf_fat.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# fa/pf_fat continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
PFFAT_DoAllocateChain:
|
||||
- rotate independent local declarations: 216/216, 55 differences.
|
||||
- normal path first, validation failure last: 215/216, 186 differences.
|
||||
- common operation status exit: 216/216, 5 differences.
|
||||
- Retained: [216, 216, 5].
|
||||
|
||||
PFFAT_GetSector:
|
||||
- rotate independent local declarations: 88/88, 7 differences.
|
||||
- common operation status exit: 88/88, 7 differences.
|
||||
- reverse independent local declarations: 88/88, 7 differences.
|
||||
- Retained: [88, 88, 7].
|
||||
|
||||
PFFAT_GetClusterAllocated:
|
||||
- rotate independent local declarations: 70/70, 6 differences.
|
||||
- normal path first, validation failure last: 69/70, 28 differences.
|
||||
- common operation status exit: 70/70, 6 differences.
|
||||
- Retained: [70, 70, 6].
|
||||
|
||||
PFFAT_GetSectorSpecified:
|
||||
- common operation status exit: 16/17, 6 differences.
|
||||
- Retained: [16, 17, 6].
|
||||
|
||||
PFFAT_RefreshFSINFO:
|
||||
- rotate independent local declarations: 93/93, 27 differences.
|
||||
- common operation status exit: 93/93, 14 differences.
|
||||
- reverse independent local declarations: 93/93, 26 differences.
|
||||
- Retained: [93, 93, 14].
|
||||
|
||||
PFFAT_FreeChain:
|
||||
- rotate independent local declarations: 256/254, 137 differences.
|
||||
- normal path first, validation failure last: 256/254, 178 differences.
|
||||
- common operation status exit: 256/254, 113 differences.
|
||||
- Retained: [256, 254, 113].
|
||||
17
tools/decomp-assist/attempts/fa-finish-pf_fat12.md
Normal file
17
tools/decomp-assist/attempts/fa-finish-pf_fat12.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# fa/pf_fat12 continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
PFFAT12_WriteFATEntryWithBuf:
|
||||
- rotate independent local declarations: 175/175, 8 differences.
|
||||
- common operation status exit: 175/175, 8 differences.
|
||||
- reverse independent local declarations: 175/175, 28 differences.
|
||||
- Retained: [175, 175, 8].
|
||||
|
||||
PFFAT12_ReadFATEntryWithBuf:
|
||||
- rotate independent local declarations: 155/155, 34 differences.
|
||||
- common operation status exit: 155/155, 48 differences.
|
||||
- reverse independent local declarations: 155/155, 34 differences.
|
||||
- Retained: [155, 155, 34].
|
||||
|
||||
Additional write attempt: use a sixteen-bit FAT-sector local and write pointer additions with the buffer first (175/175, eight differences, unchanged). Restored the original declarations. The remaining write differences are sector/offset coalescing across a sector boundary and two addition operand orders. Read differs in four callee-saved registers; all tested forms retain 155/155 instructions.
|
||||
11
tools/decomp-assist/attempts/fa-finish-pf_fat16.md
Normal file
11
tools/decomp-assist/attempts/fa-finish-pf_fat16.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# fa/pf_fat16 continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
PFFAT16_WriteFATEntryWithBuf:
|
||||
- rotate independent local declarations: 66/66, 12 differences.
|
||||
- common operation status exit: 66/66, 7 differences.
|
||||
- reverse independent local declarations: 66/66, 16 differences.
|
||||
- Retained: [66, 66, 7].
|
||||
|
||||
Swapping sector and offset declarations reduces seven differences to one at equal 66-instruction count. Reversing pointer addition and introducing an entry pointer each leave the final add operand order unchanged. Kept the declaration change.
|
||||
27
tools/decomp-assist/attempts/fa-finish-pf_file.md
Normal file
27
tools/decomp-assist/attempts/fa-finish-pf_file.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# fa/pf_file continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
PFFILE_GetSFD:
|
||||
- normal path first, validation failure last: 113/113, 68 differences.
|
||||
- common operation status exit: 113/113, 24 differences.
|
||||
- split local declaration from initialization: compile failed: --------------------
|
||||
# 652: PFFILE_SFD* first_free_sfd = PF_NULL;
|
||||
# Error: ^^^^^^^^^^
|
||||
# (10141) expression syntax error
|
||||
# Too many errors printed, aborting program
|
||||
|
||||
User break, cancelled...
|
||||
ninja: build stopped: subcommand failed.
|
||||
.
|
||||
- Retained: [113, 113, 18].
|
||||
|
||||
PFFILE_fread:
|
||||
- rotate independent local declarations: 97/67, 28 differences.
|
||||
- common operation status exit: 97/67, 28 differences.
|
||||
- reverse independent local declarations: 97/67, 28 differences.
|
||||
- Retained: [97, 67, 28].
|
||||
|
||||
PFFILE_fread became instruction exact after marking the existing PFFILE_p_fread definition NO_INLINE. The target calls that independently emitted function, while the compiler's automatic inlining previously expanded it into this wrapper. Included the existing decomp utility header only in this translation unit to obtain the macro; no shared header changed. An initial build without that include rejected the undefined macro and was corrected immediately.
|
||||
|
||||
GetSFD's targeted pointer/index initialization, loop-order and initializer-helper variations remain recorded in fa-file.md. Its 113/113 stream still differs in eighteen register and increment instructions.
|
||||
49
tools/decomp-assist/attempts/fa-finish-pf_path.md
Normal file
49
tools/decomp-assist/attempts/fa-finish-pf_path.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# fa/pf_path continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
PFPATH_parseShortName:
|
||||
- rotate independent local declarations: 466/466, 102 differences.
|
||||
- common operation status exit: 466/466, 2 differences.
|
||||
- reverse independent local declarations: 466/466, 166 differences.
|
||||
- Retained: [466, 466, 2].
|
||||
|
||||
PFPATH_getShortName:
|
||||
- common operation status exit: 148/148, 2 differences.
|
||||
- split local declaration from initialization: compile failed: h.c
|
||||
# --------------------------------------
|
||||
# 598: pf_s32 nLen = -1;
|
||||
# Error: ^^^^^^
|
||||
# (10141) expression syntax error
|
||||
# Too many errors printed, aborting program
|
||||
|
||||
User break, cancelled...
|
||||
ninja: build stopped: subcommand failed.
|
||||
.
|
||||
- explicit increment assignment: compile failed: 617: *short_name += 1 = pDirEntry[i];
|
||||
# Error: ^
|
||||
# (10142) not an lvalue
|
||||
# Too many errors printed, aborting program
|
||||
|
||||
User break, cancelled...
|
||||
ninja: build stopped: subcommand failed.
|
||||
.
|
||||
- Retained: [148, 148, 2].
|
||||
|
||||
PFPATH_MatchFileNameWithPattern:
|
||||
- rotate independent local declarations: 192/199, 148 differences.
|
||||
- common operation status exit: 192/199, 148 differences.
|
||||
- reverse independent local declarations: 192/199, 157 differences.
|
||||
- Retained: [192, 199, 148].
|
||||
|
||||
PFPATH_cmpNameImpl:
|
||||
- rotate independent local declarations: 195/218, 181 differences.
|
||||
- common operation status exit: 195/218, 181 differences.
|
||||
- reverse independent local declarations: 195/218, 180 differences.
|
||||
- Retained: [195, 218, 181].
|
||||
|
||||
Targeted cmpNameImpl attempts: separate pattern/name fullwidth conversion and a wildcard switch (202/218); advance names for wildcard question marks and before recursive comparisons (226/218); share the character-read temporary and retain recursive error status (222/218). Retained the third corrected wildcard flow. Register allocation and four extra instructions remain.
|
||||
|
||||
Targeted MatchFileNameWithPattern attempts: replace manually assigned signature bytes with the existing signature-check helper (196/199, fourteen differences); retain the second signature check result and use the target non-wildcard extended-name check (196/199, identical prefix); retained this version. The target symbol includes three instructions from the following outlined iterator body after its return; no padding or symbol-size adjustment was added.
|
||||
|
||||
getShortName and parseShortName are already objdiff exact; their raw ctxdiff differences are relocation-dependent conditional branches to shared outlined code. These are not source regressions.
|
||||
69
tools/decomp-assist/attempts/fa-finish-pf_system.md
Normal file
69
tools/decomp-assist/attempts/fa-finish-pf_system.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# fa system continuation
|
||||
|
||||
PFSYS_TimeStamp already reproduces all 29 original instructions in order. Its extracted symbol ends at mtlr, omitting the natural stack restoration and blr. No size or symbol adjustment attempted.
|
||||
|
||||
store time before date
|
||||
src 0x7c base 0x74 insns 31/29
|
||||
--- insert mine 10:10 base 10:18
|
||||
B 10 lwz r3, 0x1c(r1)
|
||||
B 11 li r0, 1
|
||||
B 12 stw r3, 0(r30)
|
||||
B 13 lwz r3, 0x18(r1)
|
||||
B 14 addi r3, r3, 1
|
||||
B 15 stw r3, 4(r30)
|
||||
B 16 lwz r3, 0x14(r1)
|
||||
B 17 stw r3, 8(r30)
|
||||
--- delete mine 11:12 base 19:19
|
||||
M 11 li r0, 1
|
||||
--- delete mine 18:25 base 25:25
|
||||
M 18 lwz r0, 0x1c(r1)
|
||||
M 19 stw r0, 0(r30)
|
||||
M 20 lwz r3, 0x18(r1)
|
||||
M 21 addi r0, r3, 1
|
||||
M 22 stw r0, 4(r30)
|
||||
M 23 lwz r0, 0x14(r1)
|
||||
M 24 stw r0, 8(r30)
|
||||
--- delete mine 29:31 base 29:29
|
||||
M 29 addi r1, r1, 0x40
|
||||
M 30 blr
|
||||
|
||||
retain tick value as local
|
||||
src 0x7c base 0x74 insns 31/29
|
||||
--- delete mine 29:31 base 29:29
|
||||
M 29 addi r1, r1, 0x40
|
||||
M 30 blr
|
||||
|
||||
assign fixed millisecond before calendar fields
|
||||
src 0x7c base 0x74 insns 31/29
|
||||
--- insert mine 10:10 base 10:11
|
||||
B 10 lwz r3, 0x1c(r1)
|
||||
--- insert mine 11:11 base 12:24
|
||||
B 12 stw r3, 0(r30)
|
||||
B 13 lwz r3, 0x18(r1)
|
||||
B 14 addi r3, r3, 1
|
||||
B 15 stw r3, 4(r30)
|
||||
B 16 lwz r3, 0x14(r1)
|
||||
B 17 stw r3, 8(r30)
|
||||
B 18 lwz r3, 0x10(r1)
|
||||
B 19 stw r3, 0(r31)
|
||||
B 20 lwz r3, 0xc(r1)
|
||||
B 21 stw r3, 4(r31)
|
||||
B 22 lwz r3, 8(r1)
|
||||
B 23 stw r3, 8(r31)
|
||||
--- delete mine 12:25 base 25:25
|
||||
M 12 lwz r0, 0x1c(r1)
|
||||
M 13 stw r0, 0(r30)
|
||||
M 14 lwz r3, 0x18(r1)
|
||||
M 15 addi r0, r3, 1
|
||||
M 16 stw r0, 4(r30)
|
||||
M 17 lwz r0, 0x14(r1)
|
||||
M 18 stw r0, 8(r30)
|
||||
M 19 lwz r0, 0x10(r1)
|
||||
M 20 stw r0, 0(r31)
|
||||
M 21 lwz r0, 0xc(r1)
|
||||
M 22 stw r0, 4(r31)
|
||||
M 23 lwz r0, 8(r1)
|
||||
M 24 stw r0, 8(r31)
|
||||
--- delete mine 29:31 base 29:29
|
||||
M 29 addi r1, r1, 0x40
|
||||
M 30 blr
|
||||
27
tools/decomp-assist/attempts/fa-finish-pf_volume.md
Normal file
27
tools/decomp-assist/attempts/fa-finish-pf_volume.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# fa/pf_volume continuation
|
||||
|
||||
Measured source variations; counts are source/target instructions and positional comparison differences. Each candidate was built separately and compared with ctxdiff. Variations were reverted unless instruction exact. Earlier targeted attempts remain in the existing fa attempt logs.
|
||||
|
||||
PFVOL_p_setvol:
|
||||
- rotate independent local declarations: 93/94, 83 differences.
|
||||
- common operation status exit: 93/94, 83 differences.
|
||||
- reverse independent local declarations: 93/94, 84 differences.
|
||||
- Retained: [93, 94, 83].
|
||||
|
||||
PFVOL_attach:
|
||||
- rotate independent local declarations: 174/176, 64 differences.
|
||||
- common operation status exit: 174/176, 37 differences.
|
||||
- reverse independent local declarations: 174/176, 64 differences.
|
||||
- Retained: [174, 176, 37].
|
||||
|
||||
PFVOL_regctx:
|
||||
- rotate independent local declarations: 75/75, 15 differences.
|
||||
- common operation status exit: 75/75, 15 differences.
|
||||
- reverse independent local declarations: 75/75, 20 differences.
|
||||
- Retained: [75, 75, 15].
|
||||
|
||||
PFVOL_setcode:
|
||||
- common operation status exit: 24/23, 20 differences.
|
||||
- Retained: [23, 23, 17].
|
||||
|
||||
setcode additionally tried a copy helper taking both a destination codeset pointer and the source pointer (23/23, seventeen register/load-store differences, unchanged). Restored the original helper. The original aggregate-copy and loop variations, and all remaining volume functions' targeted three-attempt records, remain in fa-volume.md.
|
||||
94
tools/decomp-assist/attempts/fa-sd-drv.md
Normal file
94
tools/decomp-assist/attempts/fa-sd-drv.md
Normal file
@@ -0,0 +1,94 @@
|
||||
# fa/driver/sd_drv
|
||||
|
||||
Baseline 9/26. Matching vf/develop/sd_drv.c exists, but uses VFSys handles rather than this driver's single media state. Its API and error handling cannot be ported directly.
|
||||
|
||||
Explicit adaptations: combined physical-I/O success exits and positive partial-completion tests (127/127, two argument register differences); reordered sector/counter locals (twelve differences reduced to two); extracted aligned single/multi helpers (141/127, rejected) and separate call helpers (127/127, unchanged, rejected). Added the missing unregister diagnostic argument. Corrected full-format reset/eject state, status diagnostic and success/error return boundaries (105/117 to 117/117, seven stack offsets remain).
|
||||
|
||||
Three-source-variation sweep, source/target instruction counts and positional differences:
|
||||
|
||||
pfd_sddrv_get_disk_info:
|
||||
- rotate independent local declarations: 98/96, 0 positional differences.
|
||||
- normal path first, validation failure last: 98/96, 80 positional differences.
|
||||
- common operation status exit: 98/96, 29 positional differences.
|
||||
|
||||
pfd_sddrv_physical_write:
|
||||
- rotate independent local declarations: 127/127, 2 positional differences.
|
||||
- normal path first, validation failure last: 127/127, 99 positional differences.
|
||||
- common operation status exit: 127/127, 2 positional differences.
|
||||
|
||||
pfd_sddrv_physical_read:
|
||||
- rotate independent local declarations: 127/127, 2 positional differences.
|
||||
- normal path first, validation failure last: 127/127, 99 positional differences.
|
||||
- common operation status exit: 127/127, 2 positional differences.
|
||||
|
||||
pfd_sddrv_full_format:
|
||||
- rotate independent local declarations: 117/117, 7 positional differences.
|
||||
- normal path first, validation failure last: 117/117, 78 positional differences.
|
||||
- common operation status exit: 116/117, 62 positional differences.
|
||||
|
||||
pfd_sddrv_init:
|
||||
- rotate independent local declarations: 143/144, 137 positional differences.
|
||||
- normal path first, validation failure last: 143/144, 141 positional differences.
|
||||
- common operation status exit: 142/144, 138 positional differences.
|
||||
|
||||
pfd_sddrv_finalize:
|
||||
- normal path first, validation failure last: 57/57, 49 positional differences.
|
||||
- common operation status exit: 57/57, 43 positional differences.
|
||||
- Prior explicit helper extraction in this function: instruction stream unchanged; see adaptations above.
|
||||
|
||||
pfd_st_inter_callback:
|
||||
- normal path first, validation failure last: 65/69, 59 positional differences.
|
||||
- common operation status exit: 65/69, 51 positional differences.
|
||||
- Prior explicit helper extraction in this function: instruction stream unchanged; see adaptations above.
|
||||
|
||||
pfd_st_removal_callback:
|
||||
- normal path first, validation failure last: 62/66, 56 positional differences.
|
||||
- common operation status exit: 62/66, 49 positional differences.
|
||||
- Prior explicit helper extraction in this function: instruction stream unchanged; see adaptations above.
|
||||
|
||||
pfd_sddrv_get_total_sectors:
|
||||
- rotate independent local declarations: 79/80, 42 positional differences.
|
||||
- normal path first, validation failure last: 79/80, 67 positional differences.
|
||||
- common operation status exit: 79/80, 42 positional differences.
|
||||
|
||||
pfd_sddrv_calc_fat32_mbr_bpb:
|
||||
- rotate independent local declarations: 131/133, 94 positional differences.
|
||||
- normal path first, validation failure last: 131/133, 122 positional differences.
|
||||
- common operation status exit: 131/133, 98 positional differences.
|
||||
|
||||
pfd_sddrv_store_fat32_bpb_buf:
|
||||
- rotate independent local declarations: 296/370, 272 positional differences.
|
||||
- normal path first, validation failure last: 296/370, 282 positional differences.
|
||||
- common operation status exit: 296/370, 272 positional differences.
|
||||
|
||||
pfd_sddrv_unmount:
|
||||
- normal path first, validation failure last: 12/13, 11 positional differences.
|
||||
- common operation status exit: 12/13, 8 positional differences.
|
||||
- Prior explicit helper extraction in this function: instruction stream unchanged; see adaptations above.
|
||||
|
||||
pfd_sddrv_store_fat32_mbr_buf:
|
||||
- rotate independent local declarations: 187/207, 150 positional differences.
|
||||
- normal path first, validation failure last: 187/207, 176 positional differences.
|
||||
- common operation status exit: 187/207, 150 positional differences.
|
||||
|
||||
pfd_sddrv_store_bpb_buf:
|
||||
- rotate independent local declarations: 244/327, 233 positional differences.
|
||||
- normal path first, validation failure last: 244/327, 233 positional differences.
|
||||
- common operation status exit: 244/327, 233 positional differences.
|
||||
|
||||
pfd_sddrv_build_fat32_mbr_bpb:
|
||||
- rotate independent local declarations: 222/222, 211 positional differences.
|
||||
- normal path first, validation failure last: 222/222, 181 positional differences.
|
||||
- common operation status exit: 218/222, 204 positional differences.
|
||||
|
||||
pfd_sddrv_store_mbr_buf:
|
||||
- rotate independent local declarations: 155/202, 149 positional differences.
|
||||
- normal path first, validation failure last: 155/202, 148 positional differences.
|
||||
- common operation status exit: 155/202, 149 positional differences.
|
||||
|
||||
pfd_sddrv_calc_mbr_bpb:
|
||||
- rotate independent local declarations: 239/173, 171 positional differences.
|
||||
- normal path first, validation failure last: 239/173, 171 positional differences.
|
||||
- common operation status exit: 239/173, 171 positional differences.
|
||||
|
||||
Retained targeted changes rather than generic common-return reshaping. Remaining format serializers differ in inline endian/copy expansion; calculators differ in arithmetic widths and iteration. Callback/global flag reload scheduling differs. get_disk_info has an identical 96-instruction prefix but two additional epilogue instructions. No symbol sizes changed.
|
||||
Reference in New Issue
Block a user