From b898389f1d1a77dea76e0da3c536407c01c0df93 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Sun, 6 Jul 2025 14:31:51 +0300 Subject: [PATCH 1/4] pfs2tar: fix unexpected end of file warning --- src/pfs2tar.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pfs2tar.c b/src/pfs2tar.c index 4c35450..21a0fb3 100644 --- a/src/pfs2tar.c +++ b/src/pfs2tar.c @@ -688,6 +688,9 @@ int main(int argc, char *argv[]) if (backup_mode) { printf("Backing up from %s to %s\n", hdd_path, tar_filename); tar_part(partition_name); + char zero_block[512] = {0}; + fwrite(zero_block, 1, 512, tarfile_handle); + fwrite(zero_block, 1, 512, tarfile_handle); } else { printf("Restoring from %s to %s\n", tar_filename, hdd_path); part_tar(partition_name); @@ -701,7 +704,7 @@ int main(int argc, char *argv[]) fseek(check_file, 0, SEEK_END); long size = ftell(check_file); fclose(check_file); - if (size == 0) { + if (size <= 1024) { // If the file is less than 1KB, consider it empty remove(tar_filename); printf("Tar file empty, tar file removed: %s\n", tar_filename); } From 4714ad776ba7b6bacebfaa096d3d8a993a041265 Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Wed, 9 Jul 2025 01:04:36 +0300 Subject: [PATCH 2/4] pfs2tar: make compression more verbose --- src/pfs2tar.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pfs2tar.c b/src/pfs2tar.c index 21a0fb3..fc9ab72 100644 --- a/src/pfs2tar.c +++ b/src/pfs2tar.c @@ -57,11 +57,14 @@ static int do_wrapped_ftw(path_info_t *pi, char *path, wrapped_ftw_callback fn) } path[j] = '/'; strcpy(path + j + 1, de.name); + printf("\r\033[K %s", path); + fflush(stdout); if ((r = do_wrapped_ftw(pi, path, fn))) { iomanX_close(d); return r; } } + printf("\r\033[K"); iomanX_close(d); } else { return -1; @@ -348,7 +351,7 @@ static int tar_part(const char *arg) iox_dirent_t de; while ((result = iomanX_dread(dh, &de)) && result != -1) { if (de.stat.mode == 0x0100 && de.stat.attr != 1) { - printf("(%s) %s\n", "hdd0:", de.name); + printf("%s%s\n", "hdd0:", de.name); if (arg == NULL || !strcmp(de.name, arg)) { char mount_point[256]; char prefix_path[256]; @@ -366,6 +369,7 @@ static int tar_part(const char *arg) iomanX_umount(IOMANX_MOUNT_POINT); } + printf("\n"); } } From f2d99fd7698ed557e1cb7a147a51e376589b70fe Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Wed, 9 Jul 2025 01:13:37 +0300 Subject: [PATCH 3/4] pfs2tar: print edge cases --- src/pfs2tar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pfs2tar.c b/src/pfs2tar.c index fc9ab72..319e64d 100644 --- a/src/pfs2tar.c +++ b/src/pfs2tar.c @@ -266,6 +266,7 @@ static int tar_c_file(path_info_t *pi, const char *in_path, const iox_stat_t *st if ((FIO_S_ISREG(st->mode)) && (st->hisize != 0)) { /* The file is over 4GB, which we don't support (currently) */ + printf("(!) %s: too large file. Skipping.\n", in_path); // Print message for large file return 0; } @@ -286,6 +287,7 @@ static int tar_c_file(path_info_t *pi, const char *in_path, const iox_stat_t *st if (path_separate == NULL) { /* Path is too long */ + printf("(!) %s: path is too long. Skipping.\n", in_path); // Print message for long path return 0; } From ba45d38ea97baf4c098eeee60589434ca6fccb5d Mon Sep 17 00:00:00 2001 From: AKuHAK <621640+AKuHAK@users.noreply.github.com> Date: Wed, 9 Jul 2025 01:30:35 +0300 Subject: [PATCH 4/4] pfs2tar: include pfs2tar in archive input for Windows build --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index ed29dcc..d50618a 100644 --- a/meson.build +++ b/meson.build @@ -183,7 +183,7 @@ if host_system == 'windows' and cc.get_id() != 'msvc' and cc.get_id() != 'clang- archive = custom_target( 'archive', output: meson.project_name() + '-' + meson.project_version() + '-win32.7z', - input: [pfsshell, libps2hdd, 'README.md', 'COPYING', 'COPYING.AFLv2'], + input: [pfsshell, libps2hdd, pfs2tar, 'README.md', 'COPYING', 'COPYING.AFLv2'], build_by_default: true, command: [find_program('7z'), 'a', '@OUTPUT@', '@INPUT@'] )