Fix ZXERep ASM disassemble with DocLock/DocUnlock, show progress using progress bars

This commit is contained in:
GutPuncher 2023-10-13 04:46:49 -04:00
parent de8482ced7
commit 8c3f160283
No known key found for this signature in database
GPG key ID: 38CE0A7B6841D1C7

View file

@ -32,8 +32,7 @@ public Bool ZXERep(U8 *filename)
Bool res = FALSE; Bool res = FALSE;
CZXE *zxe; CZXE *zxe;
CHashExport *saved_hash_ptr = NULL; CHashExport *saved_hash_ptr = NULL;
Bool unlock_doc = DocLock(Fs->put_doc);
"%c", 20;
fbuf = ExtDefault(filename, "ZXE"); fbuf = ExtDefault(filename, "ZXE");
@ -60,12 +59,19 @@ public Bool ZXERep(U8 *filename)
" MODULE_ALIGN:%X\n", 1 << zxe->module_align_bits; " MODULE_ALIGN:%X\n", 1 << zxe->module_align_bits;
ptr = zxe(U8 *) + zxe->patch_table_offset; ptr = zxe(U8 *) + zxe->patch_table_offset;
progress1_max = size - zxe->patch_table_offset;
progress1 = 0;
while (etype = *ptr++) while (etype = *ptr++)
{ {
progress1++;
saved_hash_ptr = NULL; saved_hash_ptr = NULL;
i = *ptr(U32 *)++; i = *ptr(U32 *)++;
progress1 += 4;
sptr = ptr; sptr = ptr;
ptr += StrLen(sptr) + 1; ptr += StrLen(sptr) + 1;
progress1 += StrLen(sptr) + 1;
"$$LTCYAN$$%16Z:$$GREEN$$%s$$FG$$:%X ", etype, "ST_ZXE_FILE_TYPES", sptr, i; "$$LTCYAN$$%16Z:$$GREEN$$%s$$FG$$:%X ", etype, "ST_ZXE_FILE_TYPES", sptr, i;
switch (etype) switch (etype)
{ {
@ -104,6 +110,7 @@ public Bool ZXERep(U8 *filename)
'\n'; '\n';
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
"%X ", *ptr(U32 *)++; "%X ", *ptr(U32 *)++;
progress1 += j * 4;
break; break;
case IET_CODE_HEAP: case IET_CODE_HEAP:
@ -111,6 +118,7 @@ public Bool ZXERep(U8 *filename)
"Size:%X\n", *ptr(U32 *)++; "Size:%X\n", *ptr(U32 *)++;
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
"%X ", *ptr(U32 *)++; "%X ", *ptr(U32 *)++;
progress1 += 4 + j * 4;
break; break;
case IET_DATA_HEAP: case IET_DATA_HEAP:
@ -118,6 +126,7 @@ public Bool ZXERep(U8 *filename)
"Size:%X\n", *ptr(I64 *)++; "Size:%X\n", *ptr(I64 *)++;
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
"%X ", *ptr(U32 *)++; "%X ", *ptr(U32 *)++;
progress1 += 8 + j * 4;
break; break;
default: default:
@ -133,7 +142,10 @@ br_done2:
br_done1: br_done1:
Free(fbuf); Free(fbuf);
"%c", 20; if (unlock_doc)
DocUnlock(Fs->put_doc);
progress1_max = 0;
return res; return res;
} }