summaryrefslogtreecommitdiff
path: root/bxgen.c
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-07-09 00:45:02 +0200
committerMitya Selivanov <automainint@guattari.tech>2024-07-09 00:45:02 +0200
commitfdfdcd49bb4fa32572ec9708779dab2a20cebd90 (patch)
tree7d662c385b05d882cf19635d0b8030aee8849642 /bxgen.c
parent8bc7b2f0318db2cc0f00a90e52604169086ed66f (diff)
downloadbxgen-fdfdcd49bb4fa32572ec9708779dab2a20cebd90.zip
Decoding string table
Diffstat (limited to 'bxgen.c')
-rwxr-xr-xbxgen.c25
1 files 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("<EMPTY>");
+ } else
+ printf("%c", c);
+ has_line = 1;
+ }
+ }
} else {
if (strstr(id, "/") != NULL)
*strstr(id, "/") = '\0';