Skip to content

Commit 271f9be

Browse files
committed
fixes wrong head.bin when it is larger than 64KB
1 parent 0a7c295 commit 271f9be

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg2zip.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static const char* get_region(const char* id)
128128

129129
int main(int argc, char* argv[])
130130
{
131-
printf("pkg2zip v1.0\n");
131+
printf("pkg2zip v1.1\n");
132132
if (argc < 2 || argc > 3)
133133
{
134134
fatal("Usage: %s file.pkg [NoNpDrmKey]\n", argv[0]);
@@ -301,13 +301,15 @@ int main(int argc, char* argv[])
301301
snprintf(path, sizeof(path), "app/%.9s/sce_sys/package/head.bin", id);
302302

303303
zip_begin_file(&z, path);
304+
size_t head_offset = 0;
304305
while (head_size != 0)
305306
{
306307
uint8_t buffer[1 << 16];
307308
uint32_t size = (uint32_t)min64(head_size, sizeof(buffer));
308-
sys_read(pkg, 0, buffer, size);
309+
sys_read(pkg, head_offset, buffer, size);
309310
zip_write_file(&z, buffer, size);
310311
head_size -= size;
312+
head_offset += size;
311313
}
312314
zip_end_file(&z);
313315

0 commit comments

Comments
 (0)