diff --git a/kofu.c b/kofu.c index 2d6e4bb..dbf9fa7 100644 --- a/kofu.c +++ b/kofu.c @@ -135,7 +135,7 @@ int main(int argc, char **argv) { int fd = open(argv[1], O_RDONLY); struct stat st; fstat(fd, &st); - if (!kos_fuse_init(fd, st.st_size / 512)) { + if (!kos_fuse_init(fd, st.st_size / 512, 512)) { exit(1); } diff --git a/kofuse.c b/kofuse.c index a8a685d..247d713 100644 --- a/kofuse.c +++ b/kofuse.c @@ -102,6 +102,6 @@ int main(int argc, char *argv[]) { int fd = open(argv[2], O_RDONLY); struct stat st; fstat(fd, &st); - kos_fuse_init(fd, st.st_size / 512); + kos_fuse_init(fd, st.st_size / 512, 512); return fuse_main(argc-1, argv, &kofuse_oper, NULL); } diff --git a/kolibri.asm b/kolibri.asm index d7ce77b..bbd1eba 100644 --- a/kolibri.asm +++ b/kolibri.asm @@ -38,7 +38,7 @@ kos_time_to_epoch: ret -;void *kos_fuse_init(int fd, uint32_t sect_cnt); +;void *kos_fuse_init(int fd, uint32_t sect_cnt, uint32_t sect_sz); public kos_fuse_init kos_fuse_init: push ebx esi edi ebp @@ -49,7 +49,8 @@ kos_fuse_init: mov [file_disk.fd], eax mov eax, [esp + 0x18] mov [file_disk.Sectors], eax - mov [file_disk.Logical], 512 + mov eax, [esp + 0x1c] + mov [file_disk.Logical], eax stdcall disk_add, disk_functions, disk_name, file_disk, DISK_NO_INSERT_NOTIFICATION push eax stdcall disk_media_changed, eax, 1 @@ -75,8 +76,10 @@ proc disk_read stdcall, userdata, buffer, startsector:qword, numsectors pushad mov eax, dword[startsector + 0] ; sector lo mov edx, dword[startsector + 4] ; sector hi - xor ecx, ecx - imul edx, eax, 512 + mov edx, [userdata] + mul [edx + FILE_DISK.Logical] + mov ecx, edx + mov edx, eax ;DEBUGF 1, "lseek to: %x\n", edx mov eax, [userdata] mov ebx, [eax + FILE_DISK.fd] @@ -110,8 +113,10 @@ proc disk_write stdcall, userdata, buffer, startsector:qword, numsectors pushad mov eax, dword[startsector + 0] ; sector lo mov edx, dword[startsector + 4] ; sector hi - xor ecx, ecx - imul edx, eax, 512 + mov edx, [userdata] + mul [edx + FILE_DISK.Logical] + mov ecx, edx + mov edx, eax ;DEBUGF 1, "lseek to: %x\n", ecx mov eax, [userdata] mov ebx, [eax + FILE_DISK.fd] diff --git a/kolibri.h b/kolibri.h index a873dc8..cf9427d 100644 --- a/kolibri.h +++ b/kolibri.h @@ -84,7 +84,7 @@ struct f70s5arg { #define KF_FOLDER 0x10 uint32_t kos_time_to_epoch(uint32_t *time); -void *kos_fuse_init(int fd, uint32_t sect_cnt); +void *kos_fuse_init(int fd, uint32_t sect_cnt, uint32_t sect_sz); int kos_fuse_lfn(void *f70arg); #endif