From fdfdcd49bb4fa32572ec9708779dab2a20cebd90 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Tue, 9 Jul 2024 00:45:02 +0200 Subject: Decoding string table --- bxgen.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/bxgen.c b/bxgen.c index 855a59c..6f8909d 100755 --- a/bxgen.c +++ b/bxgen.c @@ -858,12 +858,33 @@ void unit_write(Pool *pool, i64 unit, u16 target, i64 io_out, void *io_user_data // Skip file // + printf("String table\n\n"); + i64 byte_count = atoi(size); if ((byte_count & 1) == 1) ++byte_count; // align - n = io_seek(f, byte_count, IO_SEEK_CURSOR, io_user_data); if (n == 0) break; - current_offset += n; + b8 has_line = 0; + + while (byte_count > 0) { + c8 c; + n = io_read(f, 1, &c, io_user_data); if (n == 0) break; + current_offset += n; + byte_count -= n; + if (c == '\0') { + if (has_line) { + printf("\n"); + has_line = 0; + } + } else { + if (c == '/') { + if (!has_line) + printf(""); + } else + printf("%c", c); + has_line = 1; + } + } } else { if (strstr(id, "/") != NULL) *strstr(id, "/") = '\0'; -- cgit v1.2.3